Skip to content

Conversation

@Denovo1998
Copy link
Contributor

@Denovo1998 Denovo1998 commented Oct 17, 2025

Fixes #24844

Main Issue: #xyz

PIP: #xyz

Motivation

log: https://gist.github.com/Denovo1998/1e10695405a3b283c7f2f6c6004c4d68

  • The test testSeekWillNotEncounteredFencedError intermittently failed because it counted "Subscription is fenced" errors that happened before the seek was triggered.
  • The test performs frequent topic unloads, which cause the consumer to auto-reconnect and occasionally hit a fenced subscription during subscription re-creation. This is expected during unload/reload and is unrelated to the seek operation itself.
  • The assertion intended to verify that no "Subscription is fenced" errors occur as a result of seek(), but it was also including errors emitted before seek(), leading to false negatives.

Modifications

  • Introduced an AtomicBoolean gate (countAfterSeek) to record "Subscription is fenced" errors only after seek() starts.
    • Default false; set to true immediately before calling consumer.seek(msgId1).
    • Updated the ClientCnx.handleError() override in the test to increment the counter only when:
      • error.getMessage() contains "Subscription is fenced", and
      • countAfterSeek.get() is true.
  • Kept the final assertion unchanged, now effectively validating that the seek operation itself does not surface "Subscription is fenced" to the client.
  • No changes to production code; this is a test-only fix to eliminate flakiness while keeping the original intent of the test.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

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

Matching PR in forked repository

PR in forked repository: Denovo1998#14

@Denovo1998 Denovo1998 changed the title [fix][test] Fix flaky SubscriptionSeekTest by counting subscription is fenced only after seek [fix][test] Fix flaky SubscriptionSeekTest.testSeekWillNotEncounteredFencedError by counting subscription is fenced only after seek Oct 17, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Oct 17, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.27%. Comparing base (ee33c99) to head (8aaf04b).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24865      +/-   ##
============================================
- Coverage     74.45%   74.27%   -0.18%     
- Complexity    33531    33848     +317     
============================================
  Files          1913     1913              
  Lines        149280   149315      +35     
  Branches      17324    17331       +7     
============================================
- Hits         111140   110910     -230     
- Misses        29341    29564     +223     
- Partials       8799     8841      +42     
Flag Coverage Δ
inttests 26.41% <ø> (-0.52%) ⬇️
systests 22.81% <ø> (-0.08%) ⬇️
unittests 73.79% <ø> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 107 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lhotari lhotari merged commit 678db6b into apache:master Oct 17, 2025
54 of 55 checks passed
@lhotari lhotari added this to the 4.2.0 milestone Oct 17, 2025
Technoboy- pushed a commit that referenced this pull request Oct 23, 2025
…FencedError by counting subscription is fenced only after seek (#24865)
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Oct 23, 2025
…FencedError by counting subscription is fenced only after seek (apache#24865)

(cherry picked from commit 7140420)
Technoboy- pushed a commit that referenced this pull request Oct 27, 2025
…FencedError by counting subscription is fenced only after seek (#24865)
lhotari pushed a commit that referenced this pull request Oct 28, 2025
…FencedError by counting subscription is fenced only after seek (#24865)

(cherry picked from commit 678db6b)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Oct 29, 2025
…FencedError by counting subscription is fenced only after seek (apache#24865)

(cherry picked from commit 678db6b)
(cherry picked from commit 37c024c)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Oct 30, 2025
…FencedError by counting subscription is fenced only after seek (apache#24865)

(cherry picked from commit 678db6b)
(cherry picked from commit 37c024c)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Oct 30, 2025
…FencedError by counting subscription is fenced only after seek (apache#24865)

(cherry picked from commit 678db6b)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Nov 6, 2025
…FencedError by counting subscription is fenced only after seek (apache#24865)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: SubscriptionSeekTest.testSeekWillNotEncounteredFencedError

4 participants