Hey,

With BOOKKEEPER-643
(https://github.com/apache/bookkeeper/commit/694568b0ff0d048c284c8d5db0c9455d30dfa3ce)
feature, 'entryLogFilePreallocationEnabled' is introduced. But by the
way it is handled,  it looks like it can never be used.

In EntryLoggerAllocator.createNewLog, even if
entryLogPreAllocationEnabled is configured to true, else block is
unreachable because ‘preallocation’ will always be null and it would
end up with ‘if’ block. So effectively
‘entryLogFilePreallocationEnabled’ logic is broken.

        synchronized BufferedLogChannel createNewLog() throws IOException {
            BufferedLogChannel bc;
            if (!entryLogPreAllocationEnabled || null == preallocation) {
                // initialization time to create a new log
                bc = allocateNewLog();
            } else {
                // has a preallocated entry log
                ......

                ......
                preallocation = allocatorExecutor.submit(new
Callable<BufferedLogChannel>() {   <-------- this is the only place
where 'preallocation' is set and it is not possible to get into the
else block in this method  ------------>

                    @Override
                    public BufferedLogChannel call() throws IOException {
                        return allocateNewLog();
                    }
                });
            }
            LOG.info("Created new entry logger {}.", bc.getLogId());
            return bc;
        }


Thanks,
Charan

Reply via email to