aweisberg commented on code in PR #3575:
URL: https://github.com/apache/cassandra/pull/3575#discussion_r1800169776


##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -168,6 +167,22 @@ public UnfilteredRowIterator queryStorage(PrimaryKey key, 
ReadExecutionControlle
         return partition.queryMemtableAndDisk(cfs, executionController);
     }
 
+    private static Runnable getIndexReleaser(Set<SSTableIndex> 
referencedIndexes)
+    {
+        return new Runnable()
+        {
+            boolean closed;
+            @Override
+            public void run()
+            {
+                if (closed)
+                    return;
+                closed = true;
+                referencedIndexes.forEach(SSTableIndex::releaseQuietly);
+            }
+        };
+    }

Review Comment:
   Close is on iterators is supposed to be idempotent. It's not in this case 
and you can end up double freeing the sstable index breaking reads. The code in 
`TxnNamedRead` was closing the inner and wrapping iterator so close ended up 
being called twice revealing the problem.



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to