Skip to content

Commit 32154ee

Browse files
committed
Optionally force IndexStatusManager to use the optimized index status format
patch by Caleb Rackliffe; reviewed by Jon Meredith for CASSANDRA-21132
1 parent 60c7f05 commit 32154ee

6 files changed

Lines changed: 37 additions & 0 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
5.0.7
2+
* Optionally force IndexStatusManager to use the optimized index status format (CASSANDRA-21132)
23
* No need to evict already prepared statements, as it creates a race condition between multiple threads (CASSANDRA-17401)
34
* Upgrade logback version to 1.5.18 and slf4j dependencies to 2.0.17 (CASSANDRA-21137)
45
* Automatically disable zero-copy streaming for legacy sstables with old bloom filter format (CASSANDRA-21092)

src/java/org/apache/cassandra/config/Config.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,13 @@ public static void setClientMode(boolean clientMode)
883883
public volatile boolean drop_keyspace_enabled = true;
884884
public volatile boolean secondary_indexes_enabled = true;
885885

886+
/**
887+
* If we encounter a Gossip bug where {@link org.apache.cassandra.gms.Gossiper#getMinVersion} is
888+
* unable to accurately report a minimum version for the cluster, optionally force the optimized
889+
* index status format added in CASSANDRA-20058.
890+
*/
891+
public volatile boolean force_optimized_index_status_format = false;
892+
886893
public volatile String default_secondary_index = CassandraIndex.NAME;
887894
public volatile boolean default_secondary_index_enabled = true;
888895

src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5264,6 +5264,16 @@ public static void setPrioritizeSAIOverLegacyIndex(boolean value)
52645264
conf.sai_options.prioritize_over_legacy_index = value;
52655265
}
52665266

5267+
public static boolean getForceOptimizedIndexStatusFormat()
5268+
{
5269+
return conf.force_optimized_index_status_format;
5270+
}
5271+
5272+
public static void setForceOptimizedIndexStatusFormat(boolean value)
5273+
{
5274+
conf.force_optimized_index_status_format = value;
5275+
}
5276+
52675277
public static RepairRetrySpec getRepairRetrySpec()
52685278
{
52695279
return conf == null ? new RepairRetrySpec() : conf.repair.retries;

src/java/org/apache/cassandra/index/IndexStatusManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.slf4j.LoggerFactory;
3535

3636
import org.apache.cassandra.concurrent.ExecutorPlus;
37+
import org.apache.cassandra.config.DatabaseDescriptor;
3738
import org.apache.cassandra.db.ConsistencyLevel;
3839
import org.apache.cassandra.db.Keyspace;
3940
import org.apache.cassandra.exceptions.ReadFailureException;
@@ -249,6 +250,9 @@ public synchronized void propagateLocalIndexStatus(String keyspace, String index
249250

250251
private static boolean shouldWriteLegacyStatusFormat(CassandraVersion minVersion)
251252
{
253+
if (DatabaseDescriptor.getForceOptimizedIndexStatusFormat())
254+
return false;
255+
252256
return minVersion == null || (minVersion.major == 5 && minVersion.minor == 0 && minVersion.patch < 3);
253257
}
254258

src/java/org/apache/cassandra/service/StorageService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7675,6 +7675,18 @@ public void setPrioritizeSAIOverLegacyIndex(boolean value)
76757675
DatabaseDescriptor.setPrioritizeSAIOverLegacyIndex(value);
76767676
}
76777677

7678+
@Override
7679+
public boolean getForceOptimizedIndexStatusFormat()
7680+
{
7681+
return DatabaseDescriptor.getForceOptimizedIndexStatusFormat();
7682+
}
7683+
7684+
@Override
7685+
public void setForceOptimizedIndexStatusFormat(boolean value)
7686+
{
7687+
DatabaseDescriptor.setForceOptimizedIndexStatusFormat(value);
7688+
}
7689+
76787690
@Override
76797691
public void setPaxosRepairRaceWait(boolean paxosRepairRaceWait)
76807692
{

src/java/org/apache/cassandra/service/StorageServiceMBean.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,9 @@ public void enableAuditLog(String loggerName, String includedKeyspaces, String e
13221322
boolean getPrioritizeSAIOverLegacyIndex();
13231323
void setPrioritizeSAIOverLegacyIndex(boolean value);
13241324

1325+
boolean getForceOptimizedIndexStatusFormat();
1326+
void setForceOptimizedIndexStatusFormat(boolean value);
1327+
13251328
void setPaxosRepairRaceWait(boolean paxosRepairCoordinatorWait);
13261329

13271330
boolean getPaxosRepairRaceWait();

0 commit comments

Comments
 (0)