jt2594838 commented on code in PR #16425:
URL: https://github.com/apache/iotdb/pull/16425#discussion_r2357807274
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema/dualkeycache/impl/FIFOCacheEntryManager.java:
##########
@@ -171,28 +186,40 @@ public int hashCode() {
private static class FIFOLinkedList<SK, V> {
// head.next is the newest
- private final FIFOCacheEntry head;
- private final FIFOCacheEntry tail;
+ private final FIFOCacheEntry<SK, V> head;
+ private final FIFOCacheEntry<SK, V> tail;
public FIFOLinkedList() {
- head = new FIFOCacheEntry(null, null, null);
- tail = new FIFOCacheEntry(null, null, null);
+ head = new FIFOCacheEntry<>(null, null, null);
+ tail = new FIFOCacheEntry<>(null, null, null);
head.next = tail;
tail.pre = head;
}
- synchronized void add(FIFOCacheEntry cacheEntry) {
- cacheEntry.next = head.next;
+ synchronized void add(final FIFOCacheEntry<SK, V> cacheEntry) {
+ FIFOCacheEntry<SK, V> nextEntry;
+
+ do {
+ nextEntry = head.next;
+ } while (nextEntry.isInvalidated.get());
Review Comment:
So, if `nextEntry.isInvalidated` is set to true, there must be another
thread that will modify head.next?
--
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]