title: sstableloader corrupt input data using snapshot generated sstables
body: <p>Is what I'm doing a legitimate use of sstableloader?</p>
  
  <p>I'm migrating a table from one Cassandra cluster S to another T.  I have one other machine (L) with Cassandra installed for the purpose of running sstableloader.  All Cassandras are from Datastax Enterprise v 4.0.3-1.  The schemas for the table on both the source and target have been checked manually using cqlsh and match exactly.</p>
  
  <p>The data and index sstables on the source machines (S) were prepared using nodetool snapshot commands and copied to the machine with sstableloader (L).  The cassandra.yaml file from one of the target nodes (cluster T) was copied to the machine with sstableloader (L) and the directory that holds it was placed in CLASSPATH so that sstableloader could find the configuration.</p>
  
  <pre><code>% export CLASSPATH=${HOME}:${HOME}/cassandra.yaml
  % sstableloader -d 192.168.4.79,192.168.4.80,192.168.4.81 -v xs/url_table
  </code></pre>
  
  <p>The response starts off with</p>
  
  <pre><code>Established connection to initial hosts
  Opening sstables and calculating sections to stream
  </code></pre>
  
  <p>Then sstableloader picks up the data files, reports a streaming session id, and then aborts.  The trace from sstableloader, on L, says</p>
  
  <pre><code>java.lang.IllegalArgumentException: unable to seek to position 2129 in /home/ajacobs/xs/url_table/xs-url_table-jb-4704-Data.db (1557 bytes) in read-only mode
  at org.apache.cassandra.io.util.RandomAccessReader.seek(RandomAccessReader.java:274)
  at org.apache.cassandra.streaming.StreamWriter.write(StreamWriter.java:91)
  at org.apache.cassandra.streaming.messages.OutgoingFileMessage$1.serialize(OutgoingFileMessage.java:59)
  at org.apache.cassandra.streaming.messages.OutgoingFileMessage$1.serialize(OutgoingFileMessage.java:42)
  at org.apache.cassandra.streaming.messages.StreamMessage.serialize(StreamMessage.java:45)
  at org.apache.cassandra.streaming.ConnectionHandler$OutgoingMessageHandler.sendMessage(ConnectionHandler.java:383)
  at org.apache.cassandra.streaming.ConnectionHandler$OutgoingMessageHandler.run(ConnectionHandler.java:355)
  at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>On the Cassandra side, the system.log file from one of the T nodes, reports</p>
  
  <pre><code>WARN [STREAM-IN-/192.168.4.75] 2014-07-17 23:00:41,939 StreamSession.java (line 540) [Stream #2c22d370-0e06-11e4-ab07-410b0105b818] Retrying for following error
  java.io.IOException: Corrupt input data, block did not start with 2 byte signature ('ZV') followed by type byte, 2-byte length)
  at com.ning.compress.lzf.LZFDecoder.decompressChunk(LZFDecoder.java:182)
  at com.ning.compress.lzf.LZFInputStream.readyBuffer(LZFInputStream.java:254)
  at com.ning.compress.lzf.LZFInputStream.read(LZFInputStream.java:111)
  at com.ning.compress.lzf.LZFInputStream.skip(LZFInputStream.java:189)
  at java.io.FilterInputStream.skip(FilterInputStream.java:151)
  at org.apache.cassandra.streaming.StreamReader.drain(StreamReader.java:117)
  at org.apache.cassandra.streaming.StreamReader.read(StreamReader.java:96)
  at org.apache.cassandra.streaming.messages.IncomingFileMessage$1.deserialize(IncomingFileMessage.java:47)
  at org.apache.cassandra.streaming.messages.IncomingFileMessage$1.deserialize(IncomingFileMessage.java:37)
  at org.apache.cassandra.streaming.messages.StreamMessage.deserialize(StreamMessage.java:55)
  at org.apache.cassandra.streaming.ConnectionHandler$IncomingMessageHandler.run(ConnectionHandler.java:283)
  at java.lang.Thread.run(Thread.java:744)
  ERROR [STREAM-IN-/192.168.4.75] 2014-07-17 23:00:41,940 StreamSession.java (line 420) [Stream #2c22d370-0e06-11e4-ab07-410b0105b818] Streaming error occurred
  java.lang.IllegalArgumentException: Unknown type 72
  at org.apache.cassandra.streaming.messages.StreamMessage$Type.get(StreamMessage.java:89)
  at org.apache.cassandra.streaming.messages.StreamMessage.deserialize(StreamMessage.java:54)
  at org.apache.cassandra.streaming.ConnectionHandler$IncomingMessageHandler.run(ConnectionHandler.java:283)
  at java.lang.Thread.run(Thread.java:744)
  </code></pre>