Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C81FA200B59 for ; Mon, 8 Aug 2016 19:38:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C6B90160AB4; Mon, 8 Aug 2016 17:38:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 20A90160A77 for ; Mon, 8 Aug 2016 19:38:46 +0200 (CEST) Received: (qmail 31356 invoked by uid 500); 8 Aug 2016 17:38:46 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 31326 invoked by uid 99); 8 Aug 2016 17:38:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2016 17:38:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1E8BEDFC56; Mon, 8 Aug 2016 17:38:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aleksey@apache.org To: commits@cassandra.apache.org Date: Mon, 08 Aug 2016 17:38:46 -0000 Message-Id: <665d886bd6054f3490dc7583fc4e98b6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] cassandra git commit: Fix encoding of cell names for super columns (CASSANDRA-12235 follow-up) archived-at: Mon, 08 Aug 2016 17:38:48 -0000 Repository: cassandra Updated Branches: refs/heads/cassandra-3.9 55aea2db8 -> ae816cb84 refs/heads/trunk 938faa216 -> e9132b29a Fix encoding of cell names for super columns (CASSANDRA-12235 follow-up) patch by Sylvain Lebresne; reviewed by Aleksey Yeschenko for CASSANDRA-12335 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ae816cb8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ae816cb8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ae816cb8 Branch: refs/heads/cassandra-3.9 Commit: ae816cb84f24de410a5e4b0b2e73507eca37f655 Parents: 55aea2d Author: Sylvain Lebresne Authored: Fri Aug 5 09:36:09 2016 +0200 Committer: Aleksey Yeschenko Committed: Mon Aug 8 18:36:59 2016 +0100 ---------------------------------------------------------------------- .../org/apache/cassandra/db/LegacyLayout.java | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/ae816cb8/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 b5190ad..9e7e9b6 100644 --- a/src/java/org/apache/cassandra/db/LegacyLayout.java +++ b/src/java/org/apache/cassandra/db/LegacyLayout.java @@ -264,6 +264,8 @@ public abstract class LegacyLayout // We use comparator.size() rather than clustering.size() because of static clusterings int clusteringSize = metadata.comparator.size(); int size = clusteringSize + (metadata.isDense() ? 0 : 1) + (collectionElement == null ? 0 : 1); + if (metadata.isSuper()) + size = clusteringSize + 1; ByteBuffer[] values = new ByteBuffer[size]; for (int i = 0; i < clusteringSize; i++) { @@ -282,10 +284,23 @@ public abstract class LegacyLayout values[i] = v; } - if (!metadata.isDense()) - values[clusteringSize] = columnName; - if (collectionElement != null) - values[clusteringSize + 1] = collectionElement; + if (metadata.isSuper()) + { + // We need to set the "column" (in thrift terms) name, i.e. the value corresponding to the subcomparator. + // What it is depends if this a cell for a declared "static" column or a "dynamic" column part of the + // super-column internal map. + assert columnName != null; // This should never be null for supercolumns, see decodeForSuperColumn() above + values[clusteringSize] = columnName.equals(CompactTables.SUPER_COLUMN_MAP_COLUMN) + ? collectionElement + : columnName; + } + else + { + if (!metadata.isDense()) + values[clusteringSize] = columnName; + if (collectionElement != null) + values[clusteringSize + 1] = collectionElement; + } return CompositeType.build(isStatic, values); }