smiklosovic commented on code in PR #4300: URL: https://github.com/apache/cassandra/pull/4300#discussion_r2276019920
########## src/java/org/apache/cassandra/db/compaction/CompactionTask.java: ########## @@ -171,7 +177,45 @@ public boolean apply(SSTableReader sstable) long inputSizeBytes; long timeSpentWritingKeys; + List<Index> indexesReceptiveToFullyExpiredSSTables = cfs.indexManager.listIndexes() + .stream() + .filter(Index::includeFullyExpiredTablesInCompaction) + .collect(Collectors.toList()); + + if (!indexesReceptiveToFullyExpiredSSTables.isEmpty() && !fullyExpiredSSTables.isEmpty()) + { + try (WriteContext ctx = cfs.keyspace.getWriteHandler().createContextForIndexing()) + { + for (SSTableReader expiredSSTable : fullyExpiredSSTables) + { + expiredSSTable.getScanner() + .forEachRemaining(partition -> + partition.forEachRemaining(unfiltered -> { + if (unfiltered instanceof Row) + { + for (Index index : indexesReceptiveToFullyExpiredSSTables) Review Comment: Actually, I think that `versions` should be just ... 1? If you look into what `IndexGCTransaction` is doing: ```` public void start() { if (versions > 0) rows = new Row[versions]; } ```` So rows will not be null only in case versions is > than 0, sure. And then on `commit` ```` public void commit() { if (rows == null) return; ```` This is not be null so it will proceed and then this will just go over one row for all indexers. ```` try (WriteContext ctx = keyspace.getWriteHandler().createContextForIndexing()) { for (Index index : indexes) { Index.Indexer indexer = index.indexerFor(key, columns, nowInSec, ctx, Type.COMPACTION); if (indexer == null) continue; indexer.begin(); for (Row row : rows) if (row != null) indexer.removeRow(row); indexer.finish(); } } ```` -- 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