[fix][broker] Fix geo-replication backlog stuck after backlog quota rejection#26002
Open
void-ptr974 wants to merge 1 commit into
Open
[fix][broker] Fix geo-replication backlog stuck after backlog quota rejection#26002void-ptr974 wants to merge 1 commit into
void-ptr974 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
When a persistent replicator publish fails because the remote producer is rejected, for example by backlog quota,
PersistentReplicatorrewinds the cursor so the failed entry can be read and retried later.However, the failed send was not marked as completed in the corresponding in-flight task. As a result, the in-flight task could keep consuming a read permit even though the cursor had already been rewound. After the producer reconnects, the replicator might not read the failed entry again, leaving the replication backlog stuck.
This can cause geo-replication to stop making progress after a transient remote publish failure. It also caused
ReplicatorTest.testResumptionAfterBacklogRelaxedto fail intermittently because the backlog remained at1instead of returning to0.Reference CI failure from #25995:
The same test report shows the failure happened after the remote backlog quota rejected the replicator producer:
Modifications
Mark the failed publish as completed in the current
InFlightTaskafter rewinding the cursor inPersistentReplicator.ProducerSendCallback.The cursor rewind makes the failed entry readable again, so the in-flight task should release its permit. This allows the replicator to resume reading entries after the remote producer becomes available again.
Added a unit test covering the failed publish path to verify that:
ProducerBlockedQuotaExceededExceptionVerifying this change
This change added tests and can be verified as follows:
PersistentReplicatorInflightTaskTest.testFailedPublishCompletesInFlightTask./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.service.persistent.PersistentReplicatorInflightTaskTest.testFailedPublishCompletesInFlightTask./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.service.ReplicatorTest.testResumptionAfterBacklogRelaxedDoes this pull request potentially affect one of the following parts: