Repository: cassandra Updated Branches: refs/heads/trunk 2fea59d5e -> 5f4cc45cd
Fix CommitLogUpgradeTest filter hashed/counted rows to only the ones containing the required data. patch by Branimir Lambov; reviewed by Aleksey Yeschenko for CASSANDRA-9790 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fb34b795 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fb34b795 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fb34b795 Branch: refs/heads/trunk Commit: fb34b7950483abc5a15c09e802852183699c0ecb Parents: 2fea59d Author: Branimir Lambov <[email protected]> Authored: Wed Jul 29 18:56:14 2015 +0300 Committer: Aleksey Yeschenko <[email protected]> Committed: Wed Jul 29 20:23:41 2015 +0300 ---------------------------------------------------------------------- .../db/commitlog/CommitLogUpgradeTest.java | 18 +++++++++--------- .../db/commitlog/CommitLogUpgradeTestMaker.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/fb34b795/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java index ce4e605..d8784d9 100644 --- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java +++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java @@ -23,8 +23,6 @@ package org.apache.cassandra.db.commitlog; import java.io.*; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.Iterator; import java.util.Properties; import java.util.UUID; @@ -42,7 +40,6 @@ import org.apache.cassandra.db.Mutation; import org.apache.cassandra.db.rows.Cell; import org.apache.cassandra.db.rows.Row; import org.apache.cassandra.db.marshal.AsciiType; -import org.apache.cassandra.db.marshal.UTF8Type; import org.apache.cassandra.db.marshal.BytesType; import org.apache.cassandra.db.partitions.PartitionUpdate; import org.apache.cassandra.schema.KeyspaceParams; @@ -57,6 +54,7 @@ public class CommitLogUpgradeTest static final String TABLE = "Standard1"; static final String KEYSPACE = "Keyspace1"; + static final String CELLNAME = "name"; @Test public void test20() throws Exception @@ -75,7 +73,7 @@ public class CommitLogUpgradeTest { CFMetaData metadata = CFMetaData.Builder.createDense(KEYSPACE, TABLE, false, false) .addPartitionKey("key", AsciiType.instance) - .addClusteringColumn("col", BytesType.instance) + .addClusteringColumn("col", AsciiType.instance) .addRegularColumn("val", BytesType.instance) .build() .compressionParameters(SchemaLoader.getCompressionParameters()); @@ -142,13 +140,15 @@ public class CommitLogUpgradeTest for (PartitionUpdate update : mutation.getPartitionUpdates()) { for (Row row : update) - { - for (Cell cell : row.cells()) + if (row.clustering().size() > 0 && + AsciiType.instance.compose(row.clustering().get(0)).startsWith(CELLNAME)) { - hash = hash(hash, cell.value()); - ++cells; + for (Cell cell : row.cells()) + { + hash = hash(hash, cell.value()); + ++cells; + } } - } } return true; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/fb34b795/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTestMaker.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTestMaker.java b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTestMaker.java index cbae7e3..dbdb7fc 100644 --- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTestMaker.java +++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTestMaker.java @@ -239,7 +239,7 @@ public class CommitLogUpgradeTestMaker { int sz = randomSize ? tlr.nextInt(cellSize) : cellSize; ByteBuffer bytes = randomBytes(sz, tlr); - builder.newRow("name" + ii).add("val", bytes); + builder.newRow(CommitLogUpgradeTest.CELLNAME + ii).add("val", bytes); hash = hash(hash, bytes); ++cells; dataSize += sz;
