cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [1/2] cassandra git commit: Fix reversal of list prepends
Date Wed, 04 Feb 2015 16:55:02 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 8c003a2a5 -> dc74ae67a


Fix reversal of list prepends

Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-8733


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

Branch: refs/heads/cassandra-2.1
Commit: 2d8bddb064f2a6f9292878e2d40805d9db74a09d
Parents: 2dd6944
Author: Tyler Hobbs <tyler@datastax.com>
Authored: Wed Feb 4 10:51:24 2015 -0600
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Wed Feb 4 10:51:24 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                   | 1 +
 NEWS.txt                                      | 9 +++++++++
 src/java/org/apache/cassandra/cql3/Lists.java | 4 ++--
 3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d8bddb0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9e9b772..375dcfe 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.13:
+ * Fix reversal of list prepends (CASSANDRA-8733)
  * Prevent non-zero default_time_to_live on tables with counters
    (CASSANDRA-8678)
  * Fix SSTableSimpleUnsortedWriter ConcurrentModificationException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d8bddb0/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 2bc4fe6..5a4bc3d 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -13,6 +13,15 @@ restore snapshots created with the previous major version using the
 'sstableloader' tool. You can upgrade the file format of your snapshots
 using the provided 'sstableupgrade' tool.
 
+2.0.13
+======
+
+Upgrading
+---------
+    - Prepending a list to a list collection was erroneously resulting in
+      the prepended list being reversed upon insertion.  If you were depending
+      on this buggy behavior, note that it has been corrected.
+
 2.0.12
 ======
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d8bddb0/src/java/org/apache/cassandra/cql3/Lists.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Lists.java b/src/java/org/apache/cassandra/cql3/Lists.java
index d483dd5..f4d1d7a 100644
--- a/src/java/org/apache/cassandra/cql3/Lists.java
+++ b/src/java/org/apache/cassandra/cql3/Lists.java
@@ -385,9 +385,9 @@ public abstract class Lists
 
             List<ByteBuffer> toAdd = ((Lists.Value)value).elements;
             ColumnNameBuilder column = maybeUpdatePrefix(cf.metadata(), prefix).add(columnName.key);
-            for (int i = 0; i < toAdd.size(); i++)
+            for (int i = toAdd.size() - 1; i >= 0; i--)
             {
-                ColumnNameBuilder b = i == toAdd.size() - 1 ? column : column.copy();
+                ColumnNameBuilder b = i == 0 ? column : column.copy();
                 PrecisionTime pt = PrecisionTime.getNext(time);
                 ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(pt.millis, pt.nanos));
                 ByteBuffer cellName = b.add(uuid).build();


Mime
View raw message