merlimat commented on a change in pull request #10480:
URL: https://github.com/apache/pulsar/pull/10480#discussion_r625793222
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryImpl.java
##########
@@ -166,7 +170,16 @@ protected void deallocate() {
timestamp = -1;
ledgerId = -1;
entryId = -1;
+ invalidated.set(false);
recyclerHandle.recycle(this);
}
+ @Override
+ public boolean invalidate() {
+ if (invalidated.compareAndSet(false, true)) {
+ release();
+ return true;
+ }
+ return false;
Review comment:
I don't think this is the correct approach. If the issue is that we're
using an already released buffer, we should fix that instead.
This will avoid decrementing the ref-count more than once, but it will not
prevent the 2nd thread from accessing an entry whose ref-count was already to
0.
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java
##########
@@ -113,7 +113,7 @@ public Value get(Key key) {
try {
value.retain();
values.add(value);
- } catch (Throwable t) {
+ } catch (IllegalReferenceCountException e) {
Review comment:
It's expected to happen and it's fine when it happens. It just indicates
the entry is being evicted when we're trying to access it. If the retain
succeeds, the operation was successful, otherwise the entry is already gone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]