[improve][broker] Enhanced process logic of PersistentReplicator.cancellationPendingReadTasks#25501
[improve][broker] Enhanced process logic of PersistentReplicator.cancellationPendingReadTasks#25501gosonzhang wants to merge 1 commit intoapache:masterfrom
PersistentReplicator.cancellationPendingReadTasks#25501Conversation
…cellationPendingReadTasks`
|
/pulsarbot rerun-failure-checks |
Can you provide a detailed explanation of this scenario and add a unit test to cover it? |
@liangyepianzhou Improvement to the existing implementation: if multiple tasks with In reality, |
@liangyepianzhou The relevant tests for pr(#24189) have covered the modified parts. |
Motivation
While normally
inFlightTaskscontains at most one pending read task (guaranteed byhasPendingRead()inacquirePermitsIfNotFetchingSchema()), in exceptional scenarios, multiple tasks withentries == nullmay occur.The original implementation only set
entriesfor the last pending task iterated over; theentriesof the preceding pending tasks remained null. IfcanceledPendingRead= true (i.e., the cursor's read has been canceled, and the callback will not occur again), these unset tasks will remain in a pending state indefinitely, causing:hasPendingRead()to always return true,acquirePermitsIfNotFetchingSchema()to always return null, and copying to be permanently stuck.The improved implementation sets
entries = emptyList()for all pending tasks whencanceledPendingRead= true. This ensures that all canceled tasks complete correctly, and no task will remain in a pending state indefinitely.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
gosonzhang#4