Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
Degradation - Resource Management
-
Critical
-
Normal
-
User Report
-
All
-
None
-
Description
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, you should be able to observe an exception that looks roughly like this:
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)
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.