8000 LogBufferUnblocker::unblock activeTermCount/expectedTermCount · Issue #424 · aeron-io/aeron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
LogBufferUnblocker::unblock activeTermCount/expectedTermCount  #424
Closed
@goglusid

Description

@goglusid

For the following function, if the following situation happens then the blockedoffset is used with the wrong term id.

IF

blockedPosition is within TermId = 0 (the second half because otherwise the pub=lmt doesn't cross two terms)
activeTermCount is now at 1

Then

index = 1
termId = 1

However given that blockedOffset refers to term 0, working with termBuffers[index] doesn't make sense.

It seems like we should use the expectedTermCount to compute the index instead.

LogBufferUnblocker::unblock()
{
final int termLength = termBuffers[0].capacity();
final int positionBitsToShift = Integer.numberOfTrailingZeros(termLength);
final int activeTermCount = activeTermCount(logMetaDataBuffer);
final int expectedTermCount = (int)(blockedPosition >> positionBitsToShift);
final int index = indexByTermCount(activeTermCount);
final long rawTail = rawTailVolatile(logMetaDataBuffer, index);
final int termId = termId(rawTail);

...

    final int tailOffset = termOffset(rawTail, termLength);
    final int blockedOffset = computeTermOffsetFromPosition(blockedPosition, positionBitsToShift);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Footer

      © 2025 GitHub, Inc.
      0