-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix lost message issue due to ledger rollover. #14664
Fix lost message issue due to ledger rollover. #14664
Conversation
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.
good catch and great work
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.
Nice Catch.
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.
Great Catch!
(cherry picked from commit ad2cc2d)
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Show resolved
Hide resolved
…dger (#1176) Fixes #1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in #894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`.
…dger (#1176) Fixes #1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in #894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`. (cherry picked from commit bb37893)
(cherry picked from commit ad2cc2d)
(cherry picked from commit ad2cc2d)
…dger (streamnative#1176) Fixes streamnative#1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`. (cherry picked from commit bb37893)
…dger (#1179) Fixes #1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in #894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`. (cherry picked from commit bb37893) * Bump pulsar to 2.9.2.8 Co-authored-by: Yunze Xu <[email protected]>
…dger (streamnative#1176) Fixes streamnative#1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`.
…dger (streamnative#1176) Fixes streamnative#1175 ### Motivation The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. ### Modifications - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`.
…dger (#1176) Fixes #1175 The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative/kop#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`. (cherry picked from commit bb37893)
…dger (#1176) Fixes #1175 The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative/kop#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP. - Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664 - Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`. (cherry picked from commit bb37893) (cherry picked from commit 47e332b)
Squash merge branch 'lost-data' into '2.8.1' 修复Broker 丢数据问题(apache#14664) TAPD: --bug=097504477
Motivation
pre-require : User config
managedLedgerMaxLedgerRolloverTimeMinutes > 0
.Then, if ManagedLedger creates a ledger in the below case :
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 778 to 785 in 7998c44
The ManagedLedger state now is
CreatingLedger
. At this moment, rollover is triggered, it will set the state toClosingLedger
(line-1674)pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 1671 to 1692 in 7998c44
And invoke
createLedgerAfterClosed -> isNeededCreateNewLedgerAfterCloseLedger
is passing,because
isNeededCreateNewLedgerAfterCloseLedger
checksCreatingLedger
andLedgerOpened
state, but the current state isClosingLedger
:pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 1648 to 1667 in 7998c44
So it will also create a new ledger. And result in the message being lost. It's the same result with #12221
Detail log:
Modification
LedgerOpened
state.Documentation
no-need-doc