Skip to content

[fix][broker] Avoid false WARN log when replicator is already terminated#21

Open
Denovo1998 wants to merge 1 commit intomasterfrom
replicator_terminated_log_warn
Open

[fix][broker] Avoid false WARN log when replicator is already terminated#21
Denovo1998 wants to merge 1 commit intomasterfrom
replicator_terminated_log_warn

Conversation

@Denovo1998
Copy link
Owner

Fixes #xyz

Main Issue: #xyz

PIP: #xyz

Motivation

AbstractReplicator.closeProducerAsync can race with termination. In the post-close callback, the state check mixed two different state snapshots, so a normal transition to Terminated could be misclassified and logged as an unexpected WARN. This creates noisy logs and makes concurrent shutdown behavior harder to reason about.

Modifications

  • Fixed the terminated-state branch condition in AbstractReplicator to consistently use setDisconnectedRes when evaluating Terminating/Terminated.
  • Kept the close/termination state machine behavior unchanged, and only corrected the condition used for log-path selection.
  • Added testCloseProducerAsyncNoWarnWhenAlreadyTerminated to cover the race where another thread sets the replicator state to Terminated while producer.closeAsync() is still in progress.
  • Asserted that no unexpected WARN log is emitted and that the expected INFO log path is used.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: apache#25259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant