Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-16241

ArrayClustering does not properly handle null clustering key elements left over from tables created WITH COMPACT STORAGE

    XMLWordPrintableJSON

Details

    • Degradation - Resource Management
    • Critical
    • Normal
    • User Report
    • All
    • None
    • Hide

      There is a new test here that reproduces the problem in a way that's basically identical to the way it occurred on an actual cluster.

      Show
      There is a new test here that reproduces the problem in a way that's basically identical to the way it occurred on an actual cluster.

    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.

      Attachments

        Activity

          People

            maedhroz Caleb Rackliffe
            maedhroz Caleb Rackliffe
            Caleb Rackliffe
            Jordan West, Yifan Cai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m