apache/cassandra · error · ConfigurationException

The support for the OldNetworkTopologyStrategy has been remo

Error message

The support for the OldNetworkTopologyStrategy has been removed in C* version 4.0. The keyspace strategy should be switch to NetworkTopologyStrategy

What it means

getClass rejects the OldNetworkTopologyStrategy class name (removed in Cassandra 4.0 per CASSANDRA-16301) and throws ConfigurationException telling the user to switch to NetworkTopologyStrategy. The legacy RackUnawareStrategy/old topology behavior is no longer available at all.

Source

Thrown at src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java:341

                                                   Map<String, String> strategyOptions,
                                                   ClientState state) throws ConfigurationException
    {
        AbstractReplicationStrategy strategy = createInternal(keyspaceName, strategyClass, strategyOptions);
        strategy.validateExpectedOptions(metadata);
        strategy.validateOptions();
        strategy.maybeWarnOnOptions(state);
        if (strategy.hasTransientReplicas() && !DatabaseDescriptor.isTransientReplicationEnabled())
        {
            throw new ConfigurationException("Transient replication is disabled. Enable in cassandra.yaml to use.");
        }
    }

    public static Class<AbstractReplicationStrategy> getClass(String cls) throws ConfigurationException
    {
        String className = cls.contains(".") ? cls : "org.apache.cassandra.locator." + cls;

        if ("org.apache.cassandra.locator.OldNetworkTopologyStrategy".equals(className)) // see CASSANDRA-16301 
            throw new ConfigurationException("The support for the OldNetworkTopologyStrategy has been removed in C* version 4.0. The keyspace strategy should be switch to NetworkTopologyStrategy");

        @SuppressWarnings("unchecked")
        Class<AbstractReplicationStrategy> strategyClass =
            (Class<AbstractReplicationStrategy>) FBUtilities.classForNameWithoutInitialization(className,
                                                                                             "replication strategy",
                                                                                             AbstractReplicationStrategy.class);
        return strategyClass;
    }

    public boolean hasSameSettings(AbstractReplicationStrategy other)
    {
        return getClass().equals(other.getClass()) && getReplicationFactor().equals(other.getReplicationFactor());
    }

    protected void validateReplicationFactor(String s) throws ConfigurationException
    {
        try
        {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Replace OldNetworkTopologyStrategy with NetworkTopologyStrategy in the replication map
  2. Define per-datacenter replication factors explicitly, e.g. {'class':'NetworkTopologyStrategy','dc1':'3'}
  3. Rebuild keyspaces on the new strategy and run a full repair/rebuild of replicas
  4. Update automation/schema migration scripts that reference the old class

Example fix

// before
CREATE KEYSPACE ks WITH replication = {'class':'OldNetworkTopologyStrategy','replication_factor':'3'};
// after
CREATE KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'};
Defensive patterns

Strategy: validation

Validate before calling

// Reject legacy strategy names before applying schema
String cls = (String) replication.get("class");
if (cls != null && cls.replace("org.apache.cassandra.locator.", "").equals("OldNetworkTopologyStrategy"))
    throw new IllegalArgumentException("Use NetworkTopologyStrategy instead");

Try / catch

try {
    session.execute(ddl);
} catch (ConfigurationException e) {
    if (e.getMessage().contains("OldNetworkTopologyStrategy"))
        logger.error("Legacy strategy in schema; migrate to NetworkTopologyStrategy");
}

Prevention

When it happens

Trigger: Running CREATE/ALTER KEYSPACE with replication = {'class':'OldNetworkTopologyStrategy'} or restoring a schema from a pre-3.x-era cluster that referenced it (fully-qualified or short name resolves to org.apache.cassandra.locator.OldNetworkTopologyStrategy).

Common situations: Migrating a very old cluster (pre-Cassandra 2.0 schema dumps) to 4.0+; scripts generated years ago still naming OldNetworkTopologyStrategy; restoring snapshots with legacy schema files.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/b596a9aceba94f1e. Report an issue: GitHub.