You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2016/06/05 23:30:52 UTC
[1/3] cassandra git commit: Fix legacy non-compound range tombstone
serialization
Repository: cassandra
Updated Branches:
refs/heads/trunk 640bd2947 -> a07db4945
Fix legacy non-compound range tombstone serialization
Patch by Tyler Hobbs; reviewed by Aleksey Yeschenko for CASSANDRA-11930
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c98b6484
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c98b6484
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c98b6484
Branch: refs/heads/trunk
Commit: c98b6484e124982b455455c9cd847e0b36d5074b
Parents: 02f78f6
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Sun Jun 5 18:27:52 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Sun Jun 5 18:27:52 2016 -0500
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../org/apache/cassandra/db/LegacyLayout.java | 77 +++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c98b6484/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2de1e25..201a36c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
3.0.7
+ * Fix legacy serialization of Thrift-generated non-compound range tombstones
+ when communicating with 2.x nodes (CASSANDRA-11930)
* Fix Directories instantiations where CFS.initialDirectories should be used (CASSANDRA-11849)
* Avoid referencing DatabaseDescriptor in AbstractType (CASSANDRA-11912)
* Fix sstables not being protected from removal during index build (CASSANDRA-11905)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c98b6484/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/LegacyLayout.java b/src/java/org/apache/cassandra/db/LegacyLayout.java
index b90151e..495a12a 100644
--- a/src/java/org/apache/cassandra/db/LegacyLayout.java
+++ b/src/java/org/apache/cassandra/db/LegacyLayout.java
@@ -41,6 +41,8 @@ import org.apache.cassandra.io.util.DataInputPlus;
import org.apache.cassandra.io.util.DataOutputPlus;
import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.utils.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
@@ -49,6 +51,8 @@ import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
*/
public abstract class LegacyLayout
{
+ private static final Logger logger = LoggerFactory.getLogger(LegacyLayout.class);
+
public final static int MAX_CELL_NAME_LENGTH = FBUtilities.MAX_UNSIGNED_SHORT;
public final static int STATIC_PREFIX = 0xFFFF;
@@ -2199,9 +2203,19 @@ public abstract class LegacyLayout
if (size == 0)
return;
+ if (metadata.isCompound())
+ serializeCompound(out, metadata.isDense());
+ else
+ serializeSimple(out);
+ }
+
+ private void serializeCompound(DataOutputPlus out, boolean isDense) throws IOException
+ {
List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes());
- if (!metadata.isDense())
+
+ if (!isDense)
types.add(UTF8Type.instance);
+
CompositeType type = CompositeType.getInstance(types);
for (int i = 0; i < size; i++)
@@ -2230,6 +2244,30 @@ public abstract class LegacyLayout
}
}
+ private void serializeSimple(DataOutputPlus out) throws IOException
+ {
+ List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes());
+ assert types.size() == 1 : types;
+
+ for (int i = 0; i < size; i++)
+ {
+ LegacyBound start = starts[i];
+ LegacyBound end = ends[i];
+
+ ClusteringPrefix startClustering = start.bound.clustering();
+ ClusteringPrefix endClustering = end.bound.clustering();
+
+ assert startClustering.size() == 1;
+ assert endClustering.size() == 1;
+
+ ByteBufferUtil.writeWithShortLength(startClustering.get(0), out);
+ ByteBufferUtil.writeWithShortLength(endClustering.get(0), out);
+
+ out.writeInt(delTimes[i]);
+ out.writeLong(markedAts[i]);
+ }
+ }
+
public long serializedSize(CFMetaData metadata)
{
long size = 0;
@@ -2238,8 +2276,17 @@ public abstract class LegacyLayout
if (this.size == 0)
return size;
+ if (metadata.isCompound())
+ return size + serializedSizeCompound(metadata.isDense());
+ else
+ return size + serializedSizeSimple();
+ }
+
+ private long serializedSizeCompound(boolean isDense)
+ {
+ long size = 0;
List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes());
- if (!metadata.isDense())
+ if (!isDense)
types.add(UTF8Type.instance);
CompositeType type = CompositeType.getInstance(types);
@@ -2269,5 +2316,31 @@ public abstract class LegacyLayout
}
return size;
}
+
+ private long serializedSizeSimple()
+ {
+ long size = 0;
+ List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes());
+ assert types.size() == 1 : types;
+
+ for (int i = 0; i < this.size; i++)
+ {
+ LegacyBound start = starts[i];
+ LegacyBound end = ends[i];
+
+ ClusteringPrefix startClustering = start.bound.clustering();
+ ClusteringPrefix endClustering = end.bound.clustering();
+
+ assert startClustering.size() == 1;
+ assert endClustering.size() == 1;
+
+ size += ByteBufferUtil.serializedSizeWithShortLength(startClustering.get(0));
+ size += ByteBufferUtil.serializedSizeWithShortLength(endClustering.get(0));
+
+ size += TypeSizes.sizeof(delTimes[i]);
+ size += TypeSizes.sizeof(markedAts[i]);
+ }
+ return size;
+ }
}
}
[2/3] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.7
Posted by ty...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.7
Conflicts:
CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/40e4b0b0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/40e4b0b0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/40e4b0b0
Branch: refs/heads/trunk
Commit: 40e4b0b08fc1ffe27e8c0f59234aa496f526fbef
Parents: 5fde342 c98b648
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Sun Jun 5 18:29:16 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Sun Jun 5 18:29:16 2016 -0500
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../org/apache/cassandra/db/LegacyLayout.java | 77 +++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/40e4b0b0/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 9e3857b,201a36c..3605752
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,8 +1,12 @@@
-3.0.7
+3.7
+ * Support multiple folders for user defined compaction tasks (CASSANDRA-11765)
+ * Fix race in CompactionStrategyManager's pause/resume (CASSANDRA-11922)
+Merged from 3.0:
+ * Fix legacy serialization of Thrift-generated non-compound range tombstones
+ when communicating with 2.x nodes (CASSANDRA-11930)
* Fix Directories instantiations where CFS.initialDirectories should be used (CASSANDRA-11849)
* Avoid referencing DatabaseDescriptor in AbstractType (CASSANDRA-11912)
+ * Don't use static dataDirectories field in Directories instances (CASSANDRA-11647)
* Fix sstables not being protected from removal during index build (CASSANDRA-11905)
* cqlsh: Suppress stack trace from Read/WriteFailures (CASSANDRA-11032)
* Remove unneeded code to repair index summaries that have
http://git-wip-us.apache.org/repos/asf/cassandra/blob/40e4b0b0/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------
[3/3] cassandra git commit: Merge branch 'cassandra-3.7' into trunk
Posted by ty...@apache.org.
Merge branch 'cassandra-3.7' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a07db494
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a07db494
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a07db494
Branch: refs/heads/trunk
Commit: a07db4945b020959d3255f67ac6ef50571a26ea8
Parents: 640bd29 40e4b0b
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Sun Jun 5 18:29:39 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Sun Jun 5 18:29:39 2016 -0500
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../org/apache/cassandra/db/LegacyLayout.java | 77 +++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a07db494/CHANGES.txt
----------------------------------------------------------------------