You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/05/01 17:56:09 UTC
cassandra git commit: Fix index selection during rebuild with certain
table layouts
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 f0c7a6f03 -> 1e35fa4b5
Fix index selection during rebuild with certain table layouts
patch by Sam Tunnicliffe; reviewed by Jeremiah Jordan for CASSANDRA-9281
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1e35fa4b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1e35fa4b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1e35fa4b
Branch: refs/heads/cassandra-2.0
Commit: 1e35fa4b5a9afb4f37147a7a932a7892f2f450c1
Parents: f0c7a6f
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Fri May 1 10:17:39 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri May 1 18:55:08 2015 +0300
----------------------------------------------------------------------
CHANGES.txt | 3 +++
.../apache/cassandra/db/index/SecondaryIndexManager.java | 2 +-
.../org/apache/cassandra/db/ColumnFamilyStoreTest.java | 10 +++++++---
.../cassandra/db/index/PerRowSecondaryIndexTest.java | 9 +--------
4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e35fa4b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dfdad51..2dabbf9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.15:
+ * Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
* Allow scrub to handle corrupted compressed chunks (CASSANDRA-9140)
* Fix assertion error when resetlocalschema is run during repair (CASSANDRA-9249)
@@ -57,9 +58,11 @@
* Fix MT mismatch between empty and GC-able data (CASSANDRA-8979)
* Fix incorrect validation when snapshotting single table (CASSANDRA-8056)
+
2.0.14
* Bind JMX to localhost unless explicitly configured otherwise (CASSANDRA-9085)
+
2.0.13:
* Add offline tool to relevel sstables (CASSANDRA-8301)
* Preserve stream ID for more protocol errors (CASSANDRA-8848)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e35fa4b/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 1db7de6..d5e88d0 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -589,7 +589,7 @@ public class SecondaryIndexManager
{
for (ColumnDefinition column : baseCfs.metadata.allColumns())
{
- if (candidate.indexes(column.name))
+ if (candidate.getColumnDefs().contains(column))
{
filtered.add(candidate.getIndexName());
break;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e35fa4b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 8f4a18f..001f838 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -2177,14 +2177,16 @@ public class ColumnFamilyStoreTest extends SchemaLoader
@Test
public void testRebuildSecondaryIndex() throws IOException
{
+ ByteBuffer indexedColumnName = ByteBufferUtil.bytes("indexed");
RowMutation rm;
rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
+ rm.add("Indexed1", indexedColumnName, ByteBufferUtil.bytes("foo"), 1);
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
- Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+ ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
+ cfs.forceBlockingFlush();
PerRowSecondaryIndexTest.TestIndex.reset();
@@ -2193,7 +2195,9 @@ public class ColumnFamilyStoreTest extends SchemaLoader
PerRowSecondaryIndexTest.TestIndex.reset();
- PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
+ ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedColumnName);
+ cfs.indexManager.getIndexForColumn(indexedColumnName).getColumnDefs().remove(indexedColumnDef);
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1e35fa4b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index 6a6956c..81173b2 100644
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@ -27,6 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.ColumnDefinition;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.QueryFilter;
@@ -115,24 +116,16 @@ public class PerRowSecondaryIndexTest extends SchemaLoader
public static class TestIndex extends PerRowSecondaryIndex
{
- public static volatile boolean ACTIVE = true;
public static ColumnFamily LAST_INDEXED_ROW;
public static ByteBuffer LAST_INDEXED_KEY;
public static void reset()
{
- ACTIVE = true;
LAST_INDEXED_KEY = null;
LAST_INDEXED_ROW = null;
}
@Override
- public boolean indexes(ByteBuffer name)
- {
- return ACTIVE;
- }
-
- @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),