[
https://issues.apache.org/jira/browse/CASSANDRA-21658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Semb Wever updated CASSANDRA-21658:
-------------------------------------------
Bug Category: Parent values: Availability(12983)
Complexity: Low Hanging Fruit
Discovered By: Code Inspection
Fix Version/s: 6.0.x
5.0.x
7.x
Severity: Normal
Status: Open (was: Triage Needed)
> 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
> Priority: Normal
> Fix For: 6.0.x, 5.0.x, 7.x
>
>
> {{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: [email protected]
For additional commands, e-mail: [email protected]