Skip to content

[fix] [txn] Get previous position by managed ledger.#22024

Merged
dao-jun merged 2 commits intoapache:masterfrom
thetumbled:Fix_MaxReadPosition
Feb 22, 2024
Merged

[fix] [txn] Get previous position by managed ledger.#22024
dao-jun merged 2 commits intoapache:masterfrom
thetumbled:Fix_MaxReadPosition

Conversation

@thetumbled
Copy link
Copy Markdown
Member

@thetumbled thetumbled commented Feb 5, 2024

Motivation

Max read position is before the first ongoing txn's position. But the entry id of the first message may be 0, calculate the max read position by entry id - 1 is unsafe.

Modifications

Calculate the max read position by method managedLedger.getPreviousPosition.

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.

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: thetumbled#42

Copy link
Copy Markdown
Contributor

@congbobo184 congbobo184 left a comment

Choose a reason for hiding this comment

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

please add a test for this change

@dao-jun
Copy link
Copy Markdown
Member

dao-jun commented Feb 18, 2024

please add a test for this change

I think existing tests could cover the case.

@thetumbled
Copy link
Copy Markdown
Member Author

PTAL, thanks. @dao-jun @congbobo184 @liangyepianzhou

@thetumbled
Copy link
Copy Markdown
Member Author

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 21, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.62%. Comparing base (825e997) to head (44ccec3).
⚠️ Report is 1785 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22024      +/-   ##
============================================
+ Coverage     73.57%   73.62%   +0.05%     
- Complexity    32575    32582       +7     
============================================
  Files          1874     1874              
  Lines        139252   139252              
  Branches      15260    15260              
============================================
+ Hits         102454   102528      +74     
+ Misses        28880    28816      -64     
+ Partials       7918     7908      -10     
Flag Coverage Δ
inttests 24.63% <100.00%> (-0.15%) ⬇️
systests 24.37% <0.00%> (+0.02%) ⬆️
unittests 72.89% <100.00%> (+0.05%) ⬆️

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

Files with missing lines Coverage Δ
...ransaction/buffer/impl/TopicTransactionBuffer.java 87.74% <100.00%> (ø)

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

Copy link
Copy Markdown
Contributor

@liangyepianzhou liangyepianzhou 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. Please help supplement the testing.

@thetumbled
Copy link
Copy Markdown
Member Author

Hi, I have add a test to produce a exception, and it is necessary to fix this problem.
PTAL, thanks. @dao-jun @congbobo184 @liangyepianzhou

@dao-jun dao-jun merged commit 1f72817 into apache:master Feb 22, 2024
@Technoboy- Technoboy- added this to the 3.3.0 milestone Feb 22, 2024
@Technoboy-
Copy link
Copy Markdown
Contributor

@dao-jun It's better to check which branches we need to release before merging.
@liangyepianzhou please help label the branches

@heesung-sohn
Copy link
Copy Markdown
Contributor

This fails the build in branch-3.0 now. Please help to fix this issue.

@Technoboy- @thetumbled

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project pulsar-broker: Compilation failure
[ERROR] /Users/hsohn/Workspace/pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:[286,33] cannot find symbol
[ERROR]   symbol:   class ManagedLedgerImpl
[ERROR]   location: class org.apache.pulsar.broker.transaction.buffer.impl.TopicTransactionBuffer

@lhotari
Copy link
Copy Markdown
Member

lhotari commented Feb 26, 2024

This fails the build in branch-3.0 now. Please help to fix this issue.

@Technoboy- @thetumbled

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project pulsar-broker: Compilation failure
[ERROR] /Users/hsohn/Workspace/pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:[286,33] cannot find symbol
[ERROR]   symbol:   class ManagedLedgerImpl
[ERROR]   location: class org.apache.pulsar.broker.transaction.buffer.impl.TopicTransactionBuffer

@Technoboy- can this be reverted from branch-3.0 ?

@thetumbled
Copy link
Copy Markdown
Member Author

This fails the build in branch-3.0 now. Please help to fix this issue.
@Technoboy- @thetumbled

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project pulsar-broker: Compilation failure
[ERROR] /Users/hsohn/Workspace/pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:[286,33] cannot find symbol
[ERROR]   symbol:   class ManagedLedgerImpl
[ERROR]   location: class org.apache.pulsar.broker.transaction.buffer.impl.TopicTransactionBuffer

@Technoboy- can this be reverted from branch-3.0 ?

It seems that the problem has been fixed by @Technoboy.

@lhotari
Copy link
Copy Markdown
Member

lhotari commented Feb 27, 2024

It seems that the problem has been fixed by @Technoboy.

@thetumbled How was it fixed? we need the fix to branch-3.0 .

@thetumbled
Copy link
Copy Markdown
Member Author

It seems that the problem has been fixed by @Technoboy.

@thetumbled How was it fixed? we need the fix to branch-3.0 .

commit: 5578873
image

@lhotari
Copy link
Copy Markdown
Member

lhotari commented Feb 27, 2024

@thetumbled Thanks. There's a test failure in branch-3.0 too, to reproduce:

mvn -Pcore-modules,-main -T 1C clean -DskipTests -Dspotbugs.skip=true
mvn -DredirectTestOutputToFile=false -DtestRetryCount=0 test -pl pulsar-broker -Dtest=TopicTransactionBufferTest

@thetumbled
Copy link
Copy Markdown
Member Author

@thetumbled Thanks. There's a test failure in branch-3.0 too, to reproduce:

mvn -Pcore-modules,-main -T 1C clean -DskipTests -Dspotbugs.skip=true
mvn -DredirectTestOutputToFile=false -DtestRetryCount=0 test -pl pulsar-broker -Dtest=TopicTransactionBufferTest

Let me take a look at this issue.

@Technoboy-
Copy link
Copy Markdown
Contributor

TopicTransactionBufferTest.testGetLastMessageIdsWithOngoingTransactions

Revert this pr and the test still failed

@thetumbled
Copy link
Copy Markdown
Member Author

@thetumbled Thanks. There's a test failure in branch-3.0 too, to reproduce:

mvn -Pcore-modules,-main -T 1C clean -DskipTests -Dspotbugs.skip=true
mvn -DredirectTestOutputToFile=false -DtestRetryCount=0 test -pl pulsar-broker -Dtest=TopicTransactionBufferTest

The problem is fixed by pr: #22130

mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 1, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 6, 2024
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
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.

8 participants