Skip to content
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][txn] Fix append txn message is lower than lowWaterMark decrease PendingWriteOps #16266

Conversation

congbobo184
Copy link
Contributor

@congbobo184 congbobo184 commented Jun 28, 2022

Motivation

when send txn message is lower than low watermark, tb will throwNotAllowedException, but now we don't decrease PendingWriteOps, if PendingWriteOps != 0 and managed ledger in WriteFailed state, we can't roll over the ledger and create a new ledger.

private void decrementPendingWriteOpsAndCheck() {
long pending = pendingWriteOps.decrementAndGet();
if (pending == 0 && isFenced && !isClosingOrDeleting) {
synchronized (this) {
if (isFenced && !isClosingOrDeleting) {
messageDeduplication.resetHighestSequenceIdPushed();
log.info("[{}] Un-fencing topic...", topic);
// signal to managed ledger that we are ready to resume by creating a new ledger
ledger.readyToCreateNewLedger();
unfence();
}
}
}
}

Modifications

when tb throw NotAllowedException, we should do decrementPendingWriteOpsAndCheck

Verifying this change

add the check for pendingWriteOps

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • Does this pull request introduces a new feature? (yes)

  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

  • If a feature is not applicable for documentation, explain why?

  • If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation

  • doc-not-needed

@congbobo184 congbobo184 added type/bug The PR fixed a bug or issue reported a bug area/transaction doc-not-needed Your PR changes do not impact docs release/2.10.2 release/2.9.4 labels Jun 28, 2022
@congbobo184 congbobo184 added this to the 2.11.0 milestone Jun 28, 2022
@congbobo184 congbobo184 self-assigned this Jun 28, 2022
Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@codelipenghui codelipenghui merged commit af7990d into apache:master Jun 28, 2022
mattisonchao pushed a commit that referenced this pull request Jul 2, 2022
@mattisonchao mattisonchao added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Jul 2, 2022
codelipenghui pushed a commit that referenced this pull request Jul 10, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jul 11, 2022
… pendingWriteOps (apache#16266)

(cherry picked from commit af7990d)
(cherry picked from commit c95c98c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/transaction cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 doc-not-needed Your PR changes do not impact docs release/2.9.4 release/2.10.2 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants