belliottsmith commented on code in PR #2144:
URL: https://github.com/apache/cassandra/pull/2144#discussion_r1127620874
##########
src/java/org/apache/cassandra/service/accord/AccordStateCache.java:
##########
@@ -247,96 +260,115 @@ private void maybeEvict()
Node<?, ?> evict = current;
current = current.prev;
- // if there are any dangling write only groups, apply them and
- // move their futures into write futures so we don't evict
- applyAndRemoveWriteOnlyGroup(evict.value);
- if (!canEvict(evict.key()))
+ if (!canEvict(evict))
continue;
- logger.trace("Evicting {} {}",
evict.value.getClass().getSimpleName(), evict.key());
- unlink(evict);
- cache.remove(evict.key());
- bytesCached -= evict.estimatedSizeOnHeap();
+ evict(evict, true);
}
}
- private static <K, F extends Future<?>> F getFuture(NamedMap<Object, F>
futuresMap, K key)
+ private void evict(Node<?, ?> evict, boolean unlink)
{
- F r = futuresMap.get(key);
+ logger.trace("Evicting {} {} - {}", evict.state(), evict.key(),
evict.isLoaded() ? evict.value() : null);
+ if (unlink) unlink(evict);
Review Comment:
Might it be neater to just have `unlink` no-op if it's not in the queue?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]