cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <>
Subject questions about SSTableExport/Import
Date Wed, 17 Nov 2010 11:19:26 GMT
I was trying to help this guy
who seemed to have troubles loading a json file. And I started taking a look at SSTableExport
and SSTableImport.

SSTableExport does not encode any information about the Column sub type (ExpiringColumn or
DeletedColumn). It records isMarkedForDelete(), the timestamp and the localDeletionTime as
the col value if its a DeletedColumn. SSTableImport then calls either cf.addColumn() or cf.addTombstone()
based on the deleted flag. 

First question is is the code in SSTableImport.addToStandardCF() correct to call cf.addColumn()
if when the column was serialised it was isMarkedForDelete() ?

Next is it OK to lose the fact that a column is an ExpiringColumn (and its ttl) when it's
exported to json? 

On my local machine I modified the unit test for SSTableExport as below and the assertion
that the col was not returned failed.


diff --git a/test/unit/org/apache/cassandra/tools/ b/test/unit/org/apache/cassandra/tools/
index 6f79f62..53d2a9c 100644
--- a/test/unit/org/apache/cassandra/tools/
+++ b/test/unit/org/apache/cassandra/tools/
@@ -179,6 +179,7 @@ public class SSTableExportTest extends SchemaLoader
         // Add rowA
         cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")),
ByteBufferUtil.bytes("val"), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("ttl")),
ByteBufferUtil.bytes("val"), 1, 1);
         writer.append("rowA"), cfamily);
@@ -187,6 +188,15 @@ public class SSTableExportTest extends SchemaLoader
         writer.append("rowExclude"), cfamily);
+        //make sure the ttl col has expired
+        try
+        {
+            Thread.sleep(1500);
+        }
+        catch (InterruptedException e)
+        {
+            throw new AssertionError(e);
+        }
         SSTableReader reader = writer.closeAndOpenReader();
         // Export to JSON and verify
@@ -203,6 +213,11 @@ public class SSTableExportTest extends SchemaLoader
         assertTrue(cf != null);
+        qf = QueryFilter.getNamesFilter("rowA"), new QueryPath("Standard1", null,
null), ByteBufferUtil.bytes("ttl"));
+        cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
+        assertTrue(cf != null);
+        assertTrue(cf.getColumn(ByteBufferUtil.bytes("ttl")) == null);

View raw message