You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Michael Semb Wever (Jira)" <ji...@apache.org> on 2026/09/06 12:54:00 UTC

[jira] [Created] (CASSANDRA-21658) A read on a replica that does not know the index yet fails with a NullPointerException

Michael Semb Wever created CASSANDRA-21658:
----------------------------------------------

             Summary: A read on a replica that does not know the index yet fails with a NullPointerException
                 Key: CASSANDRA-21658
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21658
             Project: Apache Cassandra
          Issue Type: Bug
          Components: Feature/2i Index
            Reporter: Michael Semb Wever


{{ReadCommand.Serializer.deserializeIndexMetadata}} returns null when the index the coordinator names is unknown to this replica, and says so:

{code:java}
logger.info("Couldn't find a defined index on {}.{} with the id {}. " +
            "If an index was just created, this is likely due to the schema not " +
            "being fully propagated. Local read will proceed without using the " +
            "index. ...");
return null;
{code}

The caller passes that null straight on:

{code:java}
IndexMetadata index = deserializeIndexMetadata(in, version, metadata);
Index.Group indexGroup =  Keyspace.openAndGetStore(metadata).indexManager.getIndexGroup(index);
{code}

{{SecondaryIndexManager.getIndexGroup}} calls {{getIndex}}, which reads {{metadata.name}}, so the local read does not proceed at all: deserialization throws a NullPointerException, the message is dropped, and the coordinator waits for the read to time out. The window is the schema propagation of a new index, so a client sees read timeouts for a short time after {{CREATE INDEX}}.

The patch tests the index metadata for null, so the read proceeds without the index as the log line states, and marks {{deserializeIndexMetadata}} {{Nullable}} together with the two {{SecondaryIndexManager}} methods that require an index.

Patch: [mck/upstream/read-command-unknown-index/5.0|https://github.com/thelastpickle/cassandra/tree/mck/upstream/read-command-unknown-index/5.0]
Provenance: [69d5b5a300|https://github.com/datastax/cassandra/commit/69d5b5a300d2c82a83713191b4a8ed29c2dd5e04] by Piotr Kołaczkowski, [~cassandra-te]. That commit is the same change; this patch adds the regression test it lacks.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org