Caleb Rackliffe created CASSANDRA-16241:
-------------------------------------------
Summary: ArrayClustering does not properly handle null clustering
key elements left over from tables created WITH COMPACT STORAGE
Key: CASSANDRA-16241
URL: https://issues.apache.org/jira/browse/CASSANDRA-16241
Project: Cassandra
Issue Type: Bug
Components: Local/Compaction
Reporter: Caleb Rackliffe
Assignee: Caleb Rackliffe
The only way we can produce null clustering key elements is leaving them empty
on insert while a table is still compact. If we subsequently DROP COMPACT
STORAGE, those null elements linger, and {{ArrayClustering}} does not handle
them appropriately on compaction.
If you run the test
[here|https://github.com/maedhroz/cassandra/commit/e247b7868cae383168153bbe8bbbaa47a660f76b],
you should be able to observe an exception that looks roughly like this:
{noformat}
java.lang.NullPointerException
at java.base/java.nio.ByteBuffer.wrap(ByteBuffer.java:422)
at
org.apache.cassandra.db.AbstractArrayClusteringPrefix.getBufferArray(AbstractArrayClusteringPrefix.java:45)
at
org.apache.cassandra.io.sstable.metadata.MetadataCollector.finalizeMetadata(MetadataCollector.java:246)
at
org.apache.cassandra.io.sstable.format.SSTableWriter.finalizeMetadata(SSTableWriter.java:315)
at
org.apache.cassandra.io.sstable.format.big.BigTableWriter.access$200(BigTableWriter.java:52)
at
org.apache.cassandra.io.sstable.format.big.BigTableWriter$TransactionalProxy.doPrepare(BigTableWriter.java:415)
at
org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:168)
at
org.apache.cassandra.io.sstable.format.SSTableWriter.prepareToCommit(SSTableWriter.java:283)
at
org.apache.cassandra.io.sstable.SSTableRewriter.doPrepare(SSTableRewriter.java:380)
at
org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:168)
at
org.apache.cassandra.db.compaction.writers.CompactionAwareWriter.doPrepare(CompactionAwareWriter.java:118)
at
org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:168)
at
org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.finish(Transactional.java:179)
at
org.apache.cassandra.db.compaction.writers.CompactionAwareWriter.finish(CompactionAwareWriter.java:128)
at
org.apache.cassandra.db.compaction.CompactionTask.runMayThrow(CompactionTask.java:225)
at
org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
{noformat}
There are already numerous places where we respect the fact that clustering
elements may be null, so this should be pretty straightforward to fix, and the
tests that accompany it will probably be more complex than the fix itself.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]