cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Changing column_index_size_in_kb on different nodes might corrupt files
Date Mon, 01 Jul 2013 07:42:32 GMT
Updated Branches:
  refs/heads/trunk 4b8897327 -> 82b920b66


Changing column_index_size_in_kb on different nodes might corrupt files

patch by slebresne; reviewed by jbellis for CASSANDRA-5454


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/82b920b6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/82b920b6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/82b920b6

Branch: refs/heads/trunk
Commit: 82b920b66e7bb551856551838e228adad043a685
Parents: 4b88973
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Jul 1 09:40:08 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Jul 1 09:40:08 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../org/apache/cassandra/db/ColumnIndex.java    | 20 +++++---------------
 .../cassandra/io/sstable/SSTableWriter.java     |  2 +-
 3 files changed, 8 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/82b920b6/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 66c8b1e..2520b23 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -67,6 +67,8 @@
  * Fix ALTER RENAME post-5125 (CASSANDRA-5702)
  * Disallow renaming a 2ndary indexed column (CASSANDRA-5705)
  * Rename Table to Keyspace (CASSANDRA-5613)
+ * Ensure changing column_index_size_in_kb on different nodes don't corrupt the
+   sstable (CASSANDRA-5454)
 
 
 1.2.7

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82b920b6/src/java/org/apache/cassandra/db/ColumnIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnIndex.java b/src/java/org/apache/cassandra/db/ColumnIndex.java
index bcc5c2f..1501fcd 100644
--- a/src/java/org/apache/cassandra/db/ColumnIndex.java
+++ b/src/java/org/apache/cassandra/db/ColumnIndex.java
@@ -71,8 +71,7 @@ public class ColumnIndex
 
         public Builder(ColumnFamily cf,
                        ByteBuffer key,
-                       DataOutput output,
-                       boolean fromStream)
+                       DataOutput output)
         {
             assert cf != null;
             assert key != null;
@@ -83,14 +82,7 @@ public class ColumnIndex
             this.indexOffset = rowHeaderSize(key, deletionInfo);
             this.result = new ColumnIndex(new ArrayList<IndexHelper.IndexInfo>());
             this.output = output;
-            this.tombstoneTracker = fromStream ? null : new RangeTombstone.Tracker(cf.getComparator());
-        }
-
-        public Builder(ColumnFamily cf,
-                       ByteBuffer key,
-                       DataOutput output)
-        {
-            this(cf, key, output, false);
+            this.tombstoneTracker = new RangeTombstone.Tracker(cf.getComparator());
         }
 
         /**
@@ -113,7 +105,7 @@ public class ColumnIndex
 
         public int writtenAtomCount()
         {
-            return tombstoneTracker == null ? atomCount : atomCount + tombstoneTracker.writtenAtom();
+            return atomCount + tombstoneTracker.writtenAtom();
         }
 
         /**
@@ -173,8 +165,7 @@ public class ColumnIndex
                 firstColumn = column;
                 startPosition = endPosition;
                 // TODO: have that use the firstColumn as min + make sure we optimize that
on read
-                if (tombstoneTracker != null)
-                    endPosition += tombstoneTracker.writeOpenedMarker(firstColumn, output,
atomSerializer);
+                endPosition += tombstoneTracker.writeOpenedMarker(firstColumn, output, atomSerializer);
                 blockSize = 0; // We don't count repeated tombstone marker in the block size,
to avoid a situation
                                // where we wouldn't make any progress because a block is
filled by said marker
             }
@@ -196,8 +187,7 @@ public class ColumnIndex
             atomSerializer.serializeForSSTable(column, output);
 
             // TODO: Should deal with removing unneeded tombstones
-            if (tombstoneTracker != null)
-                tombstoneTracker.update(column);
+            tombstoneTracker.update(column);
 
             lastColumn = column;
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82b920b6/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index 879c9bc..2f54e1a 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -221,7 +221,7 @@ public class SSTableWriter extends SSTable
         ColumnFamily cf = ArrayBackedSortedColumns.factory.create(metadata);
         cf.delete(deletionInfo);
 
-        ColumnIndex.Builder columnIndexer = new ColumnIndex.Builder(cf, key.key, dataFile.stream,
true);
+        ColumnIndex.Builder columnIndexer = new ColumnIndex.Builder(cf, key.key, dataFile.stream);
         OnDiskAtom.Serializer atomSerializer = Column.onDiskSerializer();
         try
         {


Mime
View raw message