cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/3] git commit: fix 2i updates with indentical values and timestamps patch by Sam Tunnicliffe; reviewed by jbellis for CASSANDRA-5540
Date Thu, 09 May 2013 22:41:48 GMT
fix 2i updates with indentical values and timestamps
patch by Sam Tunnicliffe; reviewed by jbellis for CASSANDRA-5540


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

Branch: refs/heads/trunk
Commit: 95cf9a5f0d5c437a9e042018eadc698e3fd5f9e0
Parents: 6db71b2
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu May 9 17:38:23 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu May 9 17:39:38 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../db/compaction/LazilyCompactedRow.java          |    2 +-
 .../cassandra/db/compaction/PrecompactedRow.java   |    2 +-
 .../cassandra/db/index/SecondaryIndexManager.java  |    7 ++++++-
 4 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/95cf9a5f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ca3f130..dfe3015 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.5
+ * fix 2i updates with indentical values and timestamps (CASSANDRA-5540)
  * fix compaction throttling bursty-ness (CASSANDRA-4316)
  * reduce memory consumption of IndexSummary (CASSANDRA-5506)
  * remove per-row column name bloom filters (CASSANDRA-5492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/95cf9a5f/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
index 48b5b7d..1433add 100644
--- a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
+++ b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
@@ -256,7 +256,7 @@ public class LazilyCompactedRow extends AbstractCompactedRow implements
Iterable
                 container.addColumn(column);
                 if (indexer != SecondaryIndexManager.nullUpdater
                     && !column.isMarkedForDelete()
-                    && container.getColumn(column.name()) != column)
+                    && !container.getColumn(column.name()).equals(column))
                 {
                     indexer.remove(column);
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/95cf9a5f/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java b/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
index 34ddb88..b1f639e 100644
--- a/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
+++ b/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java
@@ -141,7 +141,7 @@ public class PrecompactedRow extends AbstractCompactedRow
                 container.addColumn(column);
                 if (indexer != SecondaryIndexManager.nullUpdater
                     && !column.isMarkedForDelete()
-                    && container.getColumn(column.name()) != column)
+                    && !container.getColumn(column.name()).equals(column))
                 {
                     indexer.remove(column);
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/95cf9a5f/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index 3b27614..2f03515 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -616,15 +616,20 @@ public class SecondaryIndexManager
 
         public void update(IColumn oldColumn, IColumn column)
         {
+            if (oldColumn.equals(column))
+                return;
+
             SecondaryIndex index = indexFor(column.name());
             if (index == null)
                 return;
 
             if (index instanceof PerColumnSecondaryIndex)
             {
-                ((PerColumnSecondaryIndex) index).delete(key.key, oldColumn);
+                // insert the new value before removing the old one, so we never have a period
+                // where the row is invisible to both queries (the opposite seems preferable);
see CASSANDRA-5540
                 if (!column.isMarkedForDelete())
                     ((PerColumnSecondaryIndex) index).insert(key.key, column);
+                ((PerColumnSecondaryIndex) index).delete(key.key, oldColumn);
             }
         }
 


Mime
View raw message