Charan Reddy Guttapalem created BOOKKEEPER-1082:
---------------------------------------------------

             Summary: Issue with 'preallocation' feature in EntryLogger
                 Key: BOOKKEEPER-1082
                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-1082
             Project: Bookkeeper
          Issue Type: Bug
            Reporter: Charan Reddy Guttapalem
            Assignee: Charan Reddy Guttapalem
            Priority: Minor


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;
        }




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to