diff --git a/CHANGES.txt b/CHANGES.txt index 09f3d96c06..671be30550 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 5.0-beta1 + * SAI indexes are marked queryable during truncation (CASSANDRA-19032) * Enable Direct-IO feature for CommitLog files using Java native API's. (CASSANDRA-18464) * SAI fixes for composite partitions, and static and non-static rows intersections (CASSANDRA-19034) * Improve SAI IndexContext handling of indexed and non-indexed columns in queries (CASSANDRA-18166) diff --git a/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java b/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java index 4304a3edfe..49d93bd643 100644 --- a/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java +++ b/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java @@ -390,10 +390,15 @@ public class StorageAttachedIndex implements Index public Callable getTruncateTask(long truncatedAt) { /* - * index files will be removed as part of base sstable lifecycle in - * {@link LogTransaction#delete(java.io.File)} asynchronously. + * index files will be removed as part of base sstable lifecycle in {@link LogTransaction#delete(java.io.File)} + * asynchronously, but we need to mark the index queryable because if the truncation is during the initial + * build of the index it won't get marked queryable by the build. */ - return null; + return () -> { + logger.info(indexIdentifier.logMessage("Making index queryable during table truncation")); + baseCfs.indexManager.makeIndexQueryable(this, Status.BUILD_SUCCEEDED); + return null; + }; } @Override