-
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 issues 12221 #12223
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.
Lgtm
} | ||
} | ||
|
||
synchronized boolean isNeededCreateNewLedgerAfterCloseLedger() { |
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.
It seems that there is no need to add synchronized
here
The following methods have synchronized
, isNeededCreateNewLedgerAfterCloseLedger()
is called inside them:
createLedgerAfterClosed()
ledgerClosed(final LedgerHandle lh)
internalAsyncAddEntry(OpAddEntry addOperation)
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.
yes, now it is not neccessary to add synchronized before isNeededCreateNewLedgerAfterCloseLedger method. and add synchronized now avoid it is used by others.
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.
We don't know the logic of subsequent calls to this method, whether the same lock (ML object) is used.
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.
ok, i change it later.
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Show resolved
Hide resolved
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.
LGTM
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 job!
Fixes #12221 *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: #12221 ### Motivation There are three way to create new ledger when one ledger is full. first: after add last entry for full ledger, it will handle create ledger processing. second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing. third: check ledger is or not full, when ledger is full, it will handle create ledger processing. So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time. (cherry picked from commit eb9d9d4)
Fixes apache#12221 *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: apache#12221 ### Motivation There are three way to create new ledger when one ledger is full. first: after add last entry for full ledger, it will handle create ledger processing. second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing. third: check ledger is or not full, when ledger is full, it will handle create ledger processing. So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time. (cherry picked from commit eb9d9d4) (cherry picked from commit e3c8386)
|
cc @baomingyu @315157973 PTAL |
Fixes apache#12221 *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: apache#12221 ### Motivation There are three way to create new ledger when one ledger is full. first: after add last entry for full ledger, it will handle create ledger processing. second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing. third: check ledger is or not full, when ledger is full, it will handle create ledger processing. So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time.
Fixes apache#12221 *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: apache#12221 ### Motivation There are three way to create new ledger when one ledger is full. first: after add last entry for full ledger, it will handle create ledger processing. second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing. third: check ledger is or not full, when ledger is full, it will handle create ledger processing. So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time.
Squash merge branch 'inlong-2.8.1.1-fix-lost-message' into 'inlong-2.8.1.1' cherry pick : Fix lost message issues 12221 (apache#12223)
Fixes apache#12221 *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: apache#12221 ### Motivation There are three way to create new ledger when one ledger is full. first: after add last entry for full ledger, it will handle create ledger processing. second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing. third: check ledger is or not full, when ledger is full, it will handle create ledger processing. So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time.
Fixes #12221
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>
to link to the master issue.)Master Issue: #12221
Motivation
There are three way to create new ledger when one ledger is full.
first: after add last entry for full ledger, it will handle create ledger processing.
second: check ledger is or not full, when ledger is full and appendingAddEntries is not empty, it will handle create ledger processing.
third: check ledger is or not full, when ledger is full, it will handle create ledger processing.
So we need check it is or not creating or has created when concurrent create new ledger. avoid to create three new ledgers one time.