Skip to content

[fix][managed-ledger] fix calculation in getNumberOfEntriesInStorage #15627

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

Merged
merged 1 commit into from
May 28, 2022

Conversation

HQebupt
Copy link
Contributor

@HQebupt HQebupt commented May 17, 2022

Motivation

The number of entries in storage is between markDeletePosition and lastConfirmedEntry, which the markDeletePosition is excluded, and the lastConfirmedEntry in included.
The current algorithm yields 1 more because ledger.getLastPosition().getNext() is included.

Modifications

The right way is to make the algorithm not include ledger.getLastPosition().getNext().

Verifying this change

  • Make sure that the change passes the CI checks.

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

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

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • no-need-doc

Sorry, something went wrong.

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 17, 2022
@HQebupt
Copy link
Contributor Author

HQebupt commented May 17, 2022

/pulsarbot run-failure-checks

@gaozhangmin gaozhangmin requested review from eolivelli, nicoloboschi and mattisonchao and removed request for eolivelli, nicoloboschi and mattisonchao May 17, 2022 06:35
@HQebupt
Copy link
Contributor Author

HQebupt commented May 17, 2022

/pulsarbot run-failure-checks

@gaozhangmin gaozhangmin modified the milestone: 2.11.0 May 20, 2022
@gaozhangmin
Copy link
Contributor

/pulsarbot run-failure-checks

@gaozhangmin
Copy link
Contributor

/pulsarbot rerun-failure-checks

1 similar comment
@HQebupt
Copy link
Contributor Author

HQebupt commented May 22, 2022

/pulsarbot rerun-failure-checks

Copy link
Contributor

@Jason918 Jason918 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.

hangc0276 pushed a commit that referenced this pull request Jun 7, 2022
@hangc0276 hangc0276 added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jun 7, 2022
codelipenghui pushed a commit to codelipenghui/incubator-pulsar that referenced this pull request Jun 7, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 7, 2022
(cherry picked from commit a439811)
(cherry picked from commit 155d60c)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 7, 2022
(cherry picked from commit a439811)
(cherry picked from commit fa862e3)
@nicoloboschi
Copy link
Contributor

The new test is failing in the release branches because, in order to pass, it needs also #14672

Caused by: java.lang.AssertionError: expected [2] but found [3]
	at org.testng.Assert.fail(Assert.java:99)
	at org.testng.Assert.failNotEquals(Assert.java:1037)
	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
	at org.testng.Assert.assertEquals(Assert.java:122)
	at org.testng.Assert.assertEquals(Assert.java:907)
	at org.testng.Assert.assertEquals(Assert.java:917)
	at org.apache.bookkeeper.mledger.impl.ManagedLedgerTest.lambda$testGetNumberOfEntriesInStorage$34(ManagedLedgerTest.java:2296)
	at org.awaitility.core.AssertionCondition.lambda$new$0(AssertionCondition.java:53)
	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:222)
	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:209)
	... 4 more

I believe that we should NOT port #14672 to release branches since it's a behaviour change (even if internal). We can just modify the failing test

@HQebupt could you do it?

codelipenghui added a commit that referenced this pull request Jun 10, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fixes: #16000

After cherry-picked #15627, the test `org.apache.bookkeeper.mledger.impl.ManagedLedgerTest`
will fail for branch-2.10. Details to see #15627 (comment)

Not 100% sure what's going on for now, but looks like It's related to the concurrency issue in the class initialization. Just found some related information. 

https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#parallel-test-execution

testcontainers/testcontainers-java#2939 (comment)
codelipenghui pushed a commit that referenced this pull request Jun 10, 2022
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Jun 10, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 13, 2022
Fixes: apache#16000

After cherry-picked apache#15627, the test `org.apache.bookkeeper.mledger.impl.ManagedLedgerTest`
will fail for branch-2.10. Details to see apache#15627 (comment)

Not 100% sure what's going on for now, but looks like It's related to the concurrency issue in the class initialization. Just found some related information.

https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#parallel-test-execution

testcontainers/testcontainers-java#2939 (comment)
(cherry picked from commit 0b7bacc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants