-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LogBufferUnblocker::unblock activeTermCount/expectedTermCount #424
Comments
You are talking about the Java code and not the C++ code, correct... the use of "::" had me confused. If I follow your logic, there are some tests for this case. Specifically, doesn't If I don't understand the test case, it should be straight forward to construct it in |
I think this is an issue in the Java code. I've been testing and about to push a fix. It has been a typo when I realised a missing case and my solution is not right. |
…ious term or on the boundary. Issue #424.
It would be good to review if what I pushed makes sense. |
That last push has an issue. I'm fixing. |
Let me know when you are happy and I will review and reflect on the C side. |
The reported issue is applicable to Java and C. For the unblock section of the code I think we should use expectedTermCount. For the rotateLog sections, I think we should still use the activTermCount though. |
Sorry I replied too rapidly I will review the latest changes later and post my feedback |
@goglusid I'm jetlagged badly, so it takes very little to confuse me. ;) |
The latest changes resolved the issue. ;) Thanks |
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);
...
}
The text was updated successfully, but these errors were encountered: