should not waitBackOff when replicating open fragment #4593
+61
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Descriptions of the changes in this PR:
When replicating a ledger with open fragment, ReplicationWorker.rereplicate(long ledgerIdToReplicate) method returns false.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
Lines 495 to 499 in 25326dc
This will cause the replication worker to wait for rwRereplicateBackoffMs ms and be unable to replicate other ledgers. This seriously affects the efficiency of the replication worker.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
Lines 247 to 252 in 25326dc
Motivation
When replicating a ledger in the open state, ReplicationWorker will choose to wait for a while before releasing the lock.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
Lines 496 to 497 in 25326dc
Therefore, ReplicationWorker does not need to waitBackOffTime any more after skipping replicating an open ledger.
Changes
When replicating an open ledger, it no longer waitBackOffTime but immediately continues to replicate the next ledger.