title: Why is data corruption happen in Cassandra 1.2?
body: <p>I dropped a column in Cassandra 1.2 couple days ago by:
  1. drop the whole table,
  2. recreate the table, without the column,
  3. insert insert statement (without the column).</p>
  
  <p>The reason why I did that way is because Cassandra 1.2 doesn't support "drop column" operation.</p>
  
  <p>Today I was notified by Ops team because of the data corruption issue. 
  My questions: </p>
  
  <ol>
  <li>What is the root cause? </li>
  <li><p>How to fix it?</p>
  
  <p>ERROR [ReadStage:79] 2014-11-04 11:29:55,021 CassandraDaemon.java (line 191) Exception in thread Thread[ReadStage:79,5,main]
  org.apache.cassandra.io.sstable.CorruptSSTableException: org.apache.cassandra.db.ColumnSerializer$CorruptColumnException: invalid column name length 0 (/data/cassandra/data/xxx/yyy/zzz-Data.db, 1799885 bytes remaining)
      at org.apache.cassandra.db.columniterator.SimpleSliceReader.computeNext(SimpleSliceReader.java:110)
      at org.apache.cassandra.db.columniterator.SimpleSliceReader.computeNext(SimpleSliceReader.java:40)
      at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      at org.apache.cassandra.db.columniterator.SSTableSliceIterator.hasNext(SSTableSliceIterator.java:90)
      at org.apache.cassandra.db.filter.QueryFilter$2.getNext(QueryFilter.java:171)
      at org.apache.cassandra.db.filter.QueryFilter$2.hasNext(QueryFilter.java:154)
      at org.apache.cassandra.utils.MergeIterator$OneToOne.computeNext(MergeIterator.java:199)
      at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      at org.apache.cassandra.db.filter.SliceQueryFilter.collectReducedColumns(SliceQueryFilter.java:160)
      at org.apache.cassandra.db.filter.QueryFilter.collateColumns(QueryFilter.java:136)
      at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:84)
      at org.apache.cassandra.db.CollationController.collectAllData(CollationController.java:291)
      at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:65)
      at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1398)
      at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1214)
      at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1130)
      at org.apache.cassandra.db.Table.getRow(Table.java:344)
      at org.apache.cassandra.db.SliceFromReadCommand.getRow(SliceFromReadCommand.java:70)
      at org.apache.cassandra.db.ReadVerbHandler.doVerb(ReadVerbHandler.java:44)
      at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:56)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: org.apache.cassandra.db.ColumnSerializer$CorruptColumnException: invalid column name length 0 (/data/cassandra/data/xxx/yyy/zzz-Data.db, 1799885 bytes remaining)
      at org.apache.cassandra.db.ColumnSerializer$CorruptColumnException.create(ColumnSerializer.java:148)
      at org.apache.cassandra.db.OnDiskAtom$Serializer.deserializeFromSSTable(OnDiskAtom.java:86)
      at org.apache.cassandra.db.OnDiskAtom$Serializer.deserializeFromSSTable(OnDiskAtom.java:73)
      at org.apache.cassandra.db.columniterator.SimpleSliceReader.computeNext(SimpleSliceReader.java:106)
      ... 24 more
  ERROR [ReadStage:89] 2014-11-04 11:29:58,076 CassandraDaemon.java (line 191) Exception in thread Thread[ReadStage:89,5,main]
  java.lang.OutOfMemoryError: Java heap space
      at org.apache.cassandra.io.util.RandomAccessReader.readBytes(RandomAccessReader.java:376)
      at org.apache.cassandra.utils.ByteBufferUtil.read(ByteBufferUtil.java:392)
      at org.apache.cassandra.utils.ByteBufferUtil.readWithLength(ByteBufferUtil.java:355)
      at org.apache.cassandra.db.ColumnSerializer.deserializeColumnBody(ColumnSerializer.java:108)
      at org.apache.cassandra.db.OnDiskAtom$Serializer.deserializeFromSSTable(OnDiskAtom.java:92)
      at org.apache.cassandra.db.OnDiskAtom$Serializer.deserializeFromSSTable(OnDiskAtom.java:73)
      at org.apache.cassandra.db.columniterator.SimpleSliceReader.computeNext(SimpleSliceReader.java:106)
      at org.apache.cassandra.db.columniterator.SimpleSliceReader.computeNext(SimpleSliceReader.java:40)
      at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      at org.apache.cassandra.db.columniterator.SSTableSliceIterator.hasNext(SSTableSliceIterator.java:90)
      at org.apache.cassandra.db.filter.QueryFilter$2.getNext(QueryFilter.java:171)
      at org.apache.cassandra.db.filter.QueryFilter$2.hasNext(QueryFilter.java:154)
      at org.apache.cassandra.utils.MergeIterator$OneToOne.computeNext(MergeIterator.java:199)</p></li>
  </ol>