Skip to content

Conversation

@3pacccccc
Copy link
Contributor

Motivation

Currently, when adding a message to a ledger, ManagedLedgerImpl.ADD_OP_COUNT_UPDATER is incremented twice:

  1. First increment occurs in createOpAddEntryNoRetainBuffer() when creating the OpAddEntry
  2. Second increment occurs in OpAddEntry.initiate()

This double increment leads to incorrect operation counting and potential metric inaccuracies.
here's the example I've tested on my local.
1752159904760

Modifications

  • Changed the second occurrence in OpAddEntry.initiate() from incrementAndGet() to get() to prevent duplicate counting
  • Added a test case testAddOpCountWithMessageAdd() to verify the correct increment behavior

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

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

If the box was checked, please highlight the changes

  • 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

Documentation

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

Matching PR in forked repository

PR in forked repository: 3pacccccc#11

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 11, 2025
@3pacccccc
Copy link
Contributor Author

since I got some problems when rebase to master in #24502, so I close that PR and open a new one, please take a look again. thank you
@dao-jun @nodece @Technoboy-

@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.33%. Comparing base (bbc6224) to head (6f73b96).
⚠️ Report is 1556 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24506      +/-   ##
============================================
+ Coverage     73.57%   74.33%   +0.76%     
- Complexity    32624    32936     +312     
============================================
  Files          1877     1874       -3     
  Lines        139502   146230    +6728     
  Branches      15299    16772    +1473     
============================================
+ Hits         102638   108703    +6065     
+ Misses        28908    28875      -33     
- Partials       7956     8652     +696     
Flag Coverage Δ
inttests 26.92% <ø> (+2.34%) ⬆️
systests 23.32% <ø> (-1.01%) ⬇️
unittests 73.82% <ø> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...org/apache/bookkeeper/mledger/impl/OpAddEntry.java 75.62% <ø> (+2.80%) ⬆️

... and 1111 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.

@crossoverJie crossoverJie merged commit 39ac65a into apache:master Jul 23, 2025
51 checks passed
lhotari pushed a commit that referenced this pull request Jul 23, 2025
…dEntry (#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
lhotari pushed a commit that referenced this pull request Jul 23, 2025
…dEntry (#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
lhotari pushed a commit that referenced this pull request Jul 23, 2025
…dEntry (#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
(cherry picked from commit ffc2495)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
(cherry picked from commit ffc2495)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
(cherry picked from commit c1c1b21)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
(cherry picked from commit ffc2495)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
(cherry picked from commit c1c1b21)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 28, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 28, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
(cherry picked from commit 39ac65a)
@3pacccccc 3pacccccc deleted the removeRepeatAdd branch August 7, 2025 11:19
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
…dEntry (apache#24506)

Co-authored-by: crossoverJie <crossoverJie@gmail.com>
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.

6 participants