maedhroz commented on code in PR #3575: URL: https://github.com/apache/cassandra/pull/3575#discussion_r1800293237
########## 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: The iterator `executeLocally()` produces is closed twice? i.e. The SAI internal code still closes things at the proper level, but `TxnNamedRead` is closing both? If so, making the actual site of the closure logic in `QueryController` enforce idempotence makes sense. EDIT: ...or you could also enforce idempotent closure in `KeyRangeIterator#close()` if you feel like that's easier. -- 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