Optionally force IndexStatusManager to use the optimized index status format

patch by Caleb Rackliffe; reviewed by Jon Meredith for CASSANDRA-21132
This commit is contained in:
Caleb Rackliffe 2026-02-16 17:39:37 -06:00
parent 60c7f05138
commit 32154eebcd
6 changed files with 37 additions and 0 deletions

View File

@ -1,4 +1,5 @@
5.0.7
* Optionally force IndexStatusManager to use the optimized index status format (CASSANDRA-21132)
* No need to evict already prepared statements, as it creates a race condition between multiple threads (CASSANDRA-17401)
* Upgrade logback version to 1.5.18 and slf4j dependencies to 2.0.17 (CASSANDRA-21137)
* Automatically disable zero-copy streaming for legacy sstables with old bloom filter format (CASSANDRA-21092)

View File

@ -883,6 +883,13 @@ public class Config
public volatile boolean drop_keyspace_enabled = true;
public volatile boolean secondary_indexes_enabled = true;
/**
* If we encounter a Gossip bug where {@link org.apache.cassandra.gms.Gossiper#getMinVersion} is
* unable to accurately report a minimum version for the cluster, optionally force the optimized
* index status format added in CASSANDRA-20058.
*/
public volatile boolean force_optimized_index_status_format = false;
public volatile String default_secondary_index = CassandraIndex.NAME;
public volatile boolean default_secondary_index_enabled = true;

View File

@ -5264,6 +5264,16 @@ public class DatabaseDescriptor
conf.sai_options.prioritize_over_legacy_index = value;
}
public static boolean getForceOptimizedIndexStatusFormat()
{
return conf.force_optimized_index_status_format;
}
public static void setForceOptimizedIndexStatusFormat(boolean value)
{
conf.force_optimized_index_status_format = value;
}
public static RepairRetrySpec getRepairRetrySpec()
{
return conf == null ? new RepairRetrySpec() : conf.repair.retries;

View File

@ -34,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.concurrent.ExecutorPlus;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.ConsistencyLevel;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.exceptions.ReadFailureException;
@ -249,6 +250,9 @@ public class IndexStatusManager
private static boolean shouldWriteLegacyStatusFormat(CassandraVersion minVersion)
{
if (DatabaseDescriptor.getForceOptimizedIndexStatusFormat())
return false;
return minVersion == null || (minVersion.major == 5 && minVersion.minor == 0 && minVersion.patch < 3);
}

View File

@ -7675,6 +7675,18 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
DatabaseDescriptor.setPrioritizeSAIOverLegacyIndex(value);
}
@Override
public boolean getForceOptimizedIndexStatusFormat()
{
return DatabaseDescriptor.getForceOptimizedIndexStatusFormat();
}
@Override
public void setForceOptimizedIndexStatusFormat(boolean value)
{
DatabaseDescriptor.setForceOptimizedIndexStatusFormat(value);
}
@Override
public void setPaxosRepairRaceWait(boolean paxosRepairRaceWait)
{

View File

@ -1322,6 +1322,9 @@ public interface StorageServiceMBean extends NotificationEmitter
boolean getPrioritizeSAIOverLegacyIndex();
void setPrioritizeSAIOverLegacyIndex(boolean value);
boolean getForceOptimizedIndexStatusFormat();
void setForceOptimizedIndexStatusFormat(boolean value);
void setPaxosRepairRaceWait(boolean paxosRepairCoordinatorWait);
boolean getPaxosRepairRaceWait();