GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][txn] Retry failed transaction buffer snapshots on idle topics by codelipenghui · Pull Request #27221 · apache/pulsar

Conversation

@codelipenghui

@codelipenghui codelipenghui commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

Snapshot submission clears the dirty counter before persistence completes. If the last snapshot fails, an idle topic remains at zero and subsequent timer ticks never retry, leaving its transaction-buffer state without an updated snapshot.

Modifications

  • Share count- and timer-triggered snapshot submission.
  • Restore a dirty floor of one on exceptional completion while preserving increments from newer read-position changes.
  • Cover failure, cancellation and concurrent publication.

This retries failures propagated by the snapshot processor, including segmented index-write failures. It leaves the Single snapshot processor error-handling behavior unchanged.

Verifying this change

  • Make sure that the change passes the CI checks.

Base: Apache master 8b827b7953aa62f51913b29377b760aec59db0d0. The tested source hashes are unchanged after rebasing onto the CI-only master update.

  • Scoped Gradle tests: TopicTransactionBufferRecoveryTest, SnapshotSegmentAbortedTxnProcessorCloseTest, TopicTransactionBufferCloseTest, TopicTransactionBufferPublishOrderTest, SnapshotSegmentAbortedTxnProcessorWorkerTest, TopicTransactionBufferSnapshotRetryTest. 27 passed, zero failures/errors/skips, retries disabled.
  • ./gradlew quickCheck --max-workers=2: passed.
  • git diff --check: passed.

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

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codelipenghui
[fix][txn] Retry failed transaction buffer snapshots on idle topics
eeec776
Keep a timed retry pending after a failed snapshot without discarding newer read-position changes. Restore a dirty floor so a busy segmented worker does not trigger another request on every commit.

Assisted-by: OpenAI Codex
@codelipenghui codelipenghui self-assigned this Oct 31, 2026
@codelipenghui codelipenghui added this to the 5.1.0 milestone Oct 31, 2026
@codelipenghui codelipenghui added type/bug The PR fixed a bug or issue reported a bug ready-to-test release/4.2.6 release/4.0.15 release/5.0.2 labels Oct 31, 2026
@codelipenghui
codelipenghui marked this pull request as ready for review October 31, 2026 00:27
lhotari
lhotari approved these changes Nov 4, 2026
View reviewed changes

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. Thanks for tracking down this idle-topic snapshot stall and covering it with a deterministic test.

I checked the change against the code and by running it. Reverting takeSnapshot() to the old fire-and-forget form makes both testRetriesFailedFinalSnapshotWithoutNewPublication cases fail ([7:1] instead of [7:1, 7:1]), and they pass with the change. The max(changes, 1) floor is atomic, so increments from updateMaxReadPosition that land while a snapshot is in flight are kept. Retries are driven by the timer or the count threshold, not by the failure callback, so a busy cancellation cannot spin. run() only fires while the buffer is Ready, so a closed buffer does not keep retrying.

Non-blocking, and already noted in the description: transactionBufferSegmentedSnapshotEnabled defaults to false, and SingleSnapshotAbortedTxnProcessorImpl.takeAbortedTxnsSnapshot turns a failed write into a successful completion, so the default configuration still does not retry. A follow-up that lets that failure propagate would give the same protection there.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codelipenghui
codelipenghui merged commit 05b8148 into apache:master Nov 5, 2026
53 of 56 checks passed

Uh oh!

There was an error while loading. Please reload this page.

codelipenghui added a commit that referenced this pull request Nov 5, 2026
@codelipenghui
[fix][txn] Retry failed transaction buffer snapshots on idle topics (#…
044504f
…27221)

(cherry picked from commit 05b8148)
@codelipenghui codelipenghui added the cherry-picked/branch-4.0 label Nov 5, 2026
codelipenghui added a commit that referenced this pull request Nov 5, 2026
@codelipenghui
[fix][txn] Retry failed transaction buffer snapshots on idle topics (#…
309f05c
…27221)

(cherry picked from commit 05b8148)
@codelipenghui codelipenghui added the cherry-picked/branch-4.2 label Nov 5, 2026
codelipenghui added a commit that referenced this pull request Nov 5, 2026
@codelipenghui
[fix][test][branch-4.0] Stub transaction buffer snapshots in TopicTra…
2ec27e3
…nsactionBufferCloseTest

#27221 completes snapshot attempts through the future returned by AbortedTxnProcessor#takeAbortedTxnsSnapshot.
Mockito 5.19 on branch-4.0 returns null for unstubbed CompletableFuture methods, unlike the newer Mockito on
master, so stub the snapshot to complete.
codelipenghui added a commit that referenced this pull request Nov 5, 2026
@codelipenghui
[fix][test][branch-4.2] Stub transaction buffer snapshots in TopicTra…
f07664f
…nsactionBufferCloseTest

#27221 completes snapshot attempts through the future returned by AbortedTxnProcessor#takeAbortedTxnsSnapshot.
Mockito 5.19 on branch-4.2 returns null for unstubbed CompletableFuture methods, unlike the newer Mockito on
master, so stub the snapshot to complete.
@nodece nodece mentioned this pull request Nov 5, 2026
[fix][ml][broker][client] Sync branch-as-4.0 with apache branch-4.0 (2026-09 to 2026-11, 159 commits) ascentstream/pulsar#109
Merged
4 of 5 tasks
lhotari pushed a commit that referenced this pull request Nov 6, 2026
@codelipenghui @lhotari
[fix][txn] Retry failed transaction buffer snapshots on idle topics (#…
e817233
…27221)

(cherry picked from commit 05b8148)
@lhotari lhotari added the cherry-picked/branch-5.0 label Nov 6, 2026
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@codelipenghui @nodece
[fix][txn] Retry failed transaction buffer snapshots on idle topics (a…
0e1790e
…pache#27221)

(cherry picked from commit 05b8148)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lhotari lhotari lhotari approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@codelipenghui codelipenghui

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 ready-to-test release/4.0.15 release/4.2.6 release/5.0.2 type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@codelipenghui @lhotari
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.