-
Notifications
You must be signed in to change notification settings - Fork 902
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
Fix NoSuchElementException when rereplicate empty ledgers #4039
Fix NoSuchElementException when rereplicate empty ledgers #4039
Conversation
@hangc0276 @zymap PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. @chenhongSZ Would you please add a test to cover this change? thanks.
done, PTAL |
long numberOfEntriesToReplicate = firstEntryId == INVALID_ENTRY_ID && lastEntryId == INVALID_ENTRY_ID ? 0 : | ||
(lastEntryId - firstEntryId) + 1; | ||
long splitsWithFullEntries = numberOfEntriesToReplicate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share the configuration of replicationEntryBatchSize
in the bookie server?
If I understand correctly, this problem will only occur when replicationEntryBatchSize=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your understanding is correct. Our configuration is rereplicationEntryBatchSize=1
@@ -293,7 +293,8 @@ static Set<LedgerFragment> splitIntoSubFragments(LedgerHandle lh, | |||
assert false; | |||
} | |||
|
|||
long numberOfEntriesToReplicate = (lastEntryId - firstEntryId) + 1; | |||
long numberOfEntriesToReplicate = firstEntryId == INVALID_ENTRY_ID && lastEntryId == INVALID_ENTRY_ID ? 0 : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify the condition to long numberOfEntriesToReplicate = firstEntryId == INVALID_ENTRY_ID ? 0 : (lastEntryId - firstEntryId) + 1;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### Motivation Master issue: apache#4036 ### Changes Set the `numberOfEntriesToReplicate` to 0 when ledger is empty (cherry picked from commit 95320f4)
### Motivation Master issue: apache#4036 ### Changes Set the `numberOfEntriesToReplicate` to 0 when ledger is empty
Motivation
Master issue: #4036
Changes
Set the
numberOfEntriesToReplicate
to 0 when ledger is empty