Skip to content

Issue with 'preallocation' feature in EntryLogger #568

@ivankelly

Description

@ivankelly

JIRA: https://issues.apache.org/jira/browse/BOOKKEEPER-1082

Reporter: Charan Reddy Guttapalem @reddycharan

With BOOKKEEPER-643 (694568b) 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;
    }

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions