cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1174367 - in /cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra: db/ColumnFamilyStore.java db/compaction/ParallelCompactionIterable.java db/compaction/PrecompactedRow.java io/sstable/SSTableIdentityIterator.java
Date Thu, 22 Sep 2011 20:14:14 GMT
Author: jbellis
Date: Thu Sep 22 20:14:14 2011
New Revision: 1174367

URL: http://svn.apache.org/viewvc?rev=1174367&view=rev
Log:
use Array backed columns in compaction
patch by jbellis; reviewed by slebresne and tested by brandonwilliams for CASSANDRA-3234

Modified:
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1174367&r1=1174366&r2=1174367&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Thu Sep 22 20:14:14 2011
@@ -812,8 +812,10 @@ public class ColumnFamilyStore implement
 
     private static void removeDeletedStandard(ColumnFamily cf, int gcBefore)
     {
-        for (IColumn c : cf)
+        Iterator<IColumn> iter = cf.iterator();
+        while (iter.hasNext())
         {
+            IColumn c = iter.next();
             ByteBuffer cname = c.name();
             // remove columns if
             // (a) the column itself is tombstoned or
@@ -821,7 +823,7 @@ public class ColumnFamilyStore implement
             if ((c.isMarkedForDelete() && c.getLocalDeletionTime() <= gcBefore)
                 || c.timestamp() <= cf.getMarkedForDeleteAt())
             {
-                cf.remove(cname);
+                iter.remove();
             }
         }
     }
@@ -836,15 +838,17 @@ public class ColumnFamilyStore implement
         {
             SuperColumn c = (SuperColumn)iter.next();
             long minTimestamp = Math.max(c.getMarkedForDeleteAt(), cf.getMarkedForDeleteAt());
-            for (IColumn subColumn : c.getSubColumns())
+            Iterator<IColumn> subIter = c.getSubColumns().iterator();
+            while (subIter.hasNext())
             {
+                IColumn subColumn = subIter.next();
                 // remove subcolumns if
                 // (a) the subcolumn itself is tombstoned or
                 // (b) the supercolumn is tombstoned and the subcolumn is not newer than
it
                 if (subColumn.timestamp() <= minTimestamp
                     || (subColumn.isMarkedForDelete() && subColumn.getLocalDeletionTime()
<= gcBefore))
                 {
-                    c.remove(subColumn.name());
+                    subIter.remove();
                 }
             }
             if (c.getSubColumns().isEmpty() && c.getLocalDeletionTime() <= gcBefore)

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java?rev=1174367&r1=1174366&r2=1174367&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
Thu Sep 22 20:14:14 2011
@@ -229,6 +229,7 @@ public class ParallelCompactionIterable 
                     }
                     else
                     {
+                        // addAll is ok even if cf is an ArrayBackedSortedColumns
                         cf.addAll(thisCF, HeapAllocator.instance);
                     }
                 }

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java?rev=1174367&r1=1174366&r2=1174367&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
Thu Sep 22 20:14:14 2011
@@ -125,6 +125,7 @@ public class PrecompactedRow extends Abs
             }
             else
             {
+                // addAll is ok even if cf is an ArrayBackedSortedColumns
                 cf.addAll(thisCF, HeapAllocator.instance);
             }
         }

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java?rev=1174367&r1=1174366&r2=1174367&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java
Thu Sep 22 20:14:14 2011
@@ -27,9 +27,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.IColumn;
+import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.columniterator.ICountableColumnIterator;
 import org.apache.cassandra.db.marshal.MarshalException;
 import org.apache.cassandra.io.util.RandomAccessReader;
@@ -228,7 +226,7 @@ public class SSTableIdentityIterator imp
     public ColumnFamily getColumnFamilyWithColumns() throws IOException
     {
         assert inputWithTracker.getBytesRead() == headerSize();
-        ColumnFamily cf = columnFamily.cloneMeShallow();
+        ColumnFamily cf = columnFamily.cloneMeShallow(ArrayBackedSortedColumns.factory(),
false);
         // since we already read column count, just pass that value and continue deserialization
         ColumnFamily.serializer().deserializeColumns(inputWithTracker, cf, columnCount, fromRemote);
         if (validateColumns)



Mime
View raw message