Repository navigation
[fix][broker]Cache invalidation due to concurrent access - #18076
Merged
Merged
Conversation
|
|
||
| entry = entries.pollFirstEntry(); | ||
| if (entry == null) { | ||
| Value value = entries.remove(entry.getKey()); |
Contributor
There was a problem hiding this comment.
Suggested change
| Value value = entries.remove(entry.getKey()); | |
| Value value = entries.remove(entry.getKey(), entry.getValue()); |
eolivelli
approved these changes
Oct 18, 2022
eolivelli
left a comment
Contributor
There was a problem hiding this comment.
LGTM
is there anyway to add a unit test ?
Codecov Report
@@ Coverage Diff @@
## master #18076 +/- ##
=============================================
+ Coverage 34.91% 50.81% +15.90%
- Complexity 5707 8697 +2990
=============================================
Files 607 607
Lines 53396 53398 +2
Branches 5712 5714 +2
=============================================
+ Hits 18644 27136 +8492
+ Misses 32119 23242 -8877
- Partials 2633 3020 +387
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Technoboy-
approved these changes
Oct 19, 2022
Technoboy-
pushed a commit
that referenced
this pull request
Oct 19, 2022
1 of 4 tasks
Contributor
Author
|
Hi @eolivelli Sorry, I have been too busy these two days to add a test. I created a new pr to make up for it. |
lhotari
pushed a commit
to datastax/pulsar
that referenced
this pull request
Oct 20, 2022
(cherry picked from commit 7e5cad7)
congbobo184
pushed a commit
that referenced
this pull request
Nov 14, 2022
(cherry picked from commit 7e5cad7)
aloyszhang
pushed a commit
to aloyszhang/pulsar
that referenced
this pull request
Nov 30, 2022
…t !155) (merge request !156) Squash merge branch 'release-2.8.1.4-fix-invalid-cache' into 'release-2.8.1.4' Fixes #<xyz> ### Motivation --bug=104424941 Pulsar Broker cache失效问题修复(apache#18076) (merge request !155) TAPD: --bug=104424941
congbobo184
pushed a commit
that referenced
this pull request
Dec 7, 2022
(cherry picked from commit 7e5cad7)
liangyepianzhou
pushed a commit
that referenced
this pull request
Dec 12, 2022
(cherry picked from commit 7e5cad7)
aloyszhang
pushed a commit
to aloyszhang/pulsar
that referenced
this pull request
Jan 9, 2023
…t !155) (merge request !156) Squash merge branch 'release-2.8.1.4-fix-invalid-cache' into 'release-2.8.1.4' Fixes #<xyz> ### Motivation --bug=104424941 Pulsar Broker cache失效问题修复(apache#18076) (merge request !155) TAPD: --bug=104424941
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17908
Motivation
ManagedCursorImpl.setReadPosition()will trigger cleaning of caches smaller than the earliestreadPositionManagedLedgerFactoryImpl, there is a scheduled task that deletes inactive cache data every second<strong(High light)>When the
cursorupdates thereadPositionand clears the outdated ledger cache concurrency, an entry's cache is incorrectly deleted.E.g.
ManagedCursorImpl.setReadPositionManagedLedgerFactory.doCacheEvictionentryin the Cache1:11:1fromEntryCacheentryand setentry.timestampto-1entry.timestamp>maxTimestampEntryCache: expecting1:1, but really1:2So entry
1:2is incorrectly deleted.pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java
Lines 195 to 208 in 0c7a0d1
You can reproduce the problem by running
ManagedLedgerBkTest.verifyConcurrentUsage200~1000 timesModifications
Use the instruction
remove(key)instead ofpopFirst()to delete the target EntryDocumentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: