You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2015/05/07 12:58:25 UTC
[1/6] cassandra git commit: Overload SecondaryIndex#indexes to accept
the column definition
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 afe541a48 -> 6ab0c301e
refs/heads/cassandra-2.1 b14236f94 -> 8c5ce66fe
refs/heads/trunk aedce5fc6 -> 2499baeb3
Overload SecondaryIndex#indexes to accept the column definition
patch by sam; reviewed by sergio for CASSANDRA-9314
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6ab0c301
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6ab0c301
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6ab0c301
Branch: refs/heads/cassandra-2.0
Commit: 6ab0c301edaf16544de7f839ffcd345dadef1cf6
Parents: afe541a
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:53:30 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:53:30 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/db/index/SecondaryIndex.java | 12 ++++++++-
.../db/index/SecondaryIndexManager.java | 4 +--
.../cassandra/db/ColumnFamilyStoreTest.java | 27 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 14 ++++++++++
5 files changed, 40 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 45c0238..d76606c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.15:
+ * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
* (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
* Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index a83f5dd..789cc29 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@ -292,7 +292,7 @@ public abstract class SecondaryIndex
/**
* Returns true if the provided column name is indexed by this secondary index.
*
- * The default implement checks whether the name is one the columnDef name,
+ * The default implementation checks whether the name is one the columnDef name,
* but this should be overriden but subclass if needed.
*/
public boolean indexes(ByteBuffer name)
@@ -304,6 +304,16 @@ public abstract class SecondaryIndex
}
return false;
}
+
+ /**
+ * Returns true if the provided column definition is indexed by this secondary index.
+ *
+ * The default implementation checks whether it is contained in this index column definitions set.
+ */
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return columnDefs.contains(cdef);
+ }
/**
* This is the primary way to create a secondary index instance for a CF column.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 d5e88d0..b2f5196 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -133,7 +133,7 @@ public class SecondaryIndexManager
{
idxNames = filterByColumn(idxNames);
if (idxNames.isEmpty())
- return;
+ return;
logger.info(String.format("Submitting index build of %s for data in %s",
idxNames, StringUtils.join(sstables, ", ")));
@@ -589,7 +589,7 @@ public class SecondaryIndexManager
{
for (ColumnDefinition column : baseCfs.metadata.allColumns())
{
- if (candidate.getColumnDefs().contains(column))
+ if (candidate.indexes(column))
{
filtered.add(candidate.getIndexName());
break;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 001f838..2bcead8 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -62,6 +62,7 @@ import org.apache.cassandra.utils.WrappedRunnable;
import static org.junit.Assert.*;
import static org.apache.cassandra.Util.*;
+import org.apache.cassandra.db.index.PerRowSecondaryIndexTest;
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY;
@@ -2173,34 +2174,30 @@ public class ColumnFamilyStoreTest extends SchemaLoader
});
System.err.println("Row key: " + rowKey + " Cols: " + transformed);
}
-
+
@Test
public void testRebuildSecondaryIndex() throws IOException
{
- ByteBuffer indexedColumnName = ByteBufferUtil.bytes("indexed");
RowMutation rm;
-
+
rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", indexedColumnName, ByteBufferUtil.bytes("foo"), 1);
+ rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedColumnName);
- cfs.indexManager.getIndexForColumn(indexedColumnName).getColumnDefs().remove(indexedColumnDef);
-
+
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 81173b2..1a4b7d4 100644
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@ -116,16 +116,30 @@ 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 boolean indexes(ColumnDefinition cdef)
+ {
+ return ACTIVE;
+ }
+
+ @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),
[2/6] cassandra git commit: Overload SecondaryIndex#indexes to accept
the column definition
Posted by be...@apache.org.
Overload SecondaryIndex#indexes to accept the column definition
patch by sam; reviewed by sergio for CASSANDRA-9314
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6ab0c301
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6ab0c301
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6ab0c301
Branch: refs/heads/cassandra-2.1
Commit: 6ab0c301edaf16544de7f839ffcd345dadef1cf6
Parents: afe541a
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:53:30 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:53:30 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/db/index/SecondaryIndex.java | 12 ++++++++-
.../db/index/SecondaryIndexManager.java | 4 +--
.../cassandra/db/ColumnFamilyStoreTest.java | 27 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 14 ++++++++++
5 files changed, 40 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 45c0238..d76606c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.15:
+ * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
* (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
* Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index a83f5dd..789cc29 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@ -292,7 +292,7 @@ public abstract class SecondaryIndex
/**
* Returns true if the provided column name is indexed by this secondary index.
*
- * The default implement checks whether the name is one the columnDef name,
+ * The default implementation checks whether the name is one the columnDef name,
* but this should be overriden but subclass if needed.
*/
public boolean indexes(ByteBuffer name)
@@ -304,6 +304,16 @@ public abstract class SecondaryIndex
}
return false;
}
+
+ /**
+ * Returns true if the provided column definition is indexed by this secondary index.
+ *
+ * The default implementation checks whether it is contained in this index column definitions set.
+ */
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return columnDefs.contains(cdef);
+ }
/**
* This is the primary way to create a secondary index instance for a CF column.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 d5e88d0..b2f5196 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -133,7 +133,7 @@ public class SecondaryIndexManager
{
idxNames = filterByColumn(idxNames);
if (idxNames.isEmpty())
- return;
+ return;
logger.info(String.format("Submitting index build of %s for data in %s",
idxNames, StringUtils.join(sstables, ", ")));
@@ -589,7 +589,7 @@ public class SecondaryIndexManager
{
for (ColumnDefinition column : baseCfs.metadata.allColumns())
{
- if (candidate.getColumnDefs().contains(column))
+ if (candidate.indexes(column))
{
filtered.add(candidate.getIndexName());
break;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 001f838..2bcead8 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -62,6 +62,7 @@ import org.apache.cassandra.utils.WrappedRunnable;
import static org.junit.Assert.*;
import static org.apache.cassandra.Util.*;
+import org.apache.cassandra.db.index.PerRowSecondaryIndexTest;
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY;
@@ -2173,34 +2174,30 @@ public class ColumnFamilyStoreTest extends SchemaLoader
});
System.err.println("Row key: " + rowKey + " Cols: " + transformed);
}
-
+
@Test
public void testRebuildSecondaryIndex() throws IOException
{
- ByteBuffer indexedColumnName = ByteBufferUtil.bytes("indexed");
RowMutation rm;
-
+
rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", indexedColumnName, ByteBufferUtil.bytes("foo"), 1);
+ rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedColumnName);
- cfs.indexManager.getIndexForColumn(indexedColumnName).getColumnDefs().remove(indexedColumnDef);
-
+
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 81173b2..1a4b7d4 100644
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@ -116,16 +116,30 @@ 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 boolean indexes(ColumnDefinition cdef)
+ {
+ return ACTIVE;
+ }
+
+ @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),
[5/6] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
Posted by be...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/db/index/SecondaryIndex.java
test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8c5ce66f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8c5ce66f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8c5ce66f
Branch: refs/heads/cassandra-2.1
Commit: 8c5ce66fe32c8bfdc7712b70164948e82592f91e
Parents: b14236f9 6ab0c30
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:57:52 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:57:52 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../cassandra/db/index/SecondaryIndex.java | 13 ++++++++++++
.../db/index/SecondaryIndexManager.java | 4 ++--
.../cassandra/db/ColumnFamilyStoreTest.java | 21 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 20 +++++++++++++------
5 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 6363974,d76606c..41e0340
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,22 @@@
+2.1.6
+ * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
+ * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
+ * Add support for top-k custom 2i queries (CASSANDRA-8717)
+ * Fix error when dropping table during compaction (CASSANDRA-9251)
+ * cassandra-stress supports validation operations over user profiles (CASSANDRA-8773)
+ * Add support for rate limiting log messages (CASSANDRA-9029)
+ * Log the partition key with tombstone warnings (CASSANDRA-8561)
+ * Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271)
+ * Fix PITR commitlog replay (CASSANDRA-9195)
+ * GCInspector logs very different times (CASSANDRA-9124)
+ * Fix deleting from an empty list (CASSANDRA-9198)
+ * Update tuple and collection types that use a user-defined type when that UDT
+ is modified (CASSANDRA-9148, CASSANDRA-9192)
+ * Use higher timeout for prepair and snapshot in repair (CASSANDRA-9261)
+ * Fix anticompaction blocking ANTI_ENTROPY stage (CASSANDRA-9151)
+Merged from 2.0:
+ 2.0.15:
+ * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
* (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
* Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index 20fdcec,789cc29..2dc0a22
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -304,11 -290,32 +304,24 @@@ public abstract class SecondaryInde
}
/**
- * Returns true if the provided column name is indexed by this secondary index.
+ * Returns true if the provided cell name is indexed by this secondary index.
+ *
+ * The default implementation checks whether the name is one the columnDef name,
+ * but this should be overriden but subclass if needed.
*/
- public boolean indexes(ByteBuffer name)
- {
- for (ColumnDefinition columnDef : columnDefs)
- {
- if (baseCfs.getComparator().compare(columnDef.name, name) == 0)
- return true;
- }
- return false;
- }
-
+ public abstract boolean indexes(CellName name);
+
/**
+ * Returns true if the provided column definition is indexed by this secondary index.
+ *
+ * The default implementation checks whether it is contained in this index column definitions set.
+ */
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return columnDefs.contains(cdef);
+ }
+
+ /**
* This is the primary way to create a secondary index instance for a CF column.
* It will validate the index_options before initializing.
*
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 84e7d20,2bcead8..5faab78
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -2168,30 -2178,26 +2168,27 @@@ public class ColumnFamilyStoreTest exte
@Test
public void testRebuildSecondaryIndex() throws IOException
{
- RowMutation rm;
-
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
+ CellName indexedCellName = cellname("indexed");
+ Mutation rm;
+
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
+ rm.add("Indexed1", indexedCellName, ByteBufferUtil.bytes("foo"), 1);
++
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedCellName);
- cfs.indexManager.getIndexForColumn(indexedColumnDef.name.bytes).getColumnDefs().remove(indexedColumnDef);
-
-
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index 0a84b74,1a4b7d4..2e885aa
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@@ -157,6 -128,18 +159,18 @@@ public class PerRowSecondaryIndexTest e
}
@Override
- public boolean indexes(ByteBuffer name)
++ public boolean indexes(CellName name)
+ {
+ return ACTIVE;
+ }
+
+ @Override
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return ACTIVE;
+ }
+
+ @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),
[3/6] cassandra git commit: Overload SecondaryIndex#indexes to accept
the column definition
Posted by be...@apache.org.
Overload SecondaryIndex#indexes to accept the column definition
patch by sam; reviewed by sergio for CASSANDRA-9314
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6ab0c301
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6ab0c301
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6ab0c301
Branch: refs/heads/trunk
Commit: 6ab0c301edaf16544de7f839ffcd345dadef1cf6
Parents: afe541a
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:53:30 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:53:30 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/db/index/SecondaryIndex.java | 12 ++++++++-
.../db/index/SecondaryIndexManager.java | 4 +--
.../cassandra/db/ColumnFamilyStoreTest.java | 27 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 14 ++++++++++
5 files changed, 40 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 45c0238..d76606c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.15:
+ * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
* (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
* Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index a83f5dd..789cc29 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@ -292,7 +292,7 @@ public abstract class SecondaryIndex
/**
* Returns true if the provided column name is indexed by this secondary index.
*
- * The default implement checks whether the name is one the columnDef name,
+ * The default implementation checks whether the name is one the columnDef name,
* but this should be overriden but subclass if needed.
*/
public boolean indexes(ByteBuffer name)
@@ -304,6 +304,16 @@ public abstract class SecondaryIndex
}
return false;
}
+
+ /**
+ * Returns true if the provided column definition is indexed by this secondary index.
+ *
+ * The default implementation checks whether it is contained in this index column definitions set.
+ */
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return columnDefs.contains(cdef);
+ }
/**
* This is the primary way to create a secondary index instance for a CF column.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 d5e88d0..b2f5196 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -133,7 +133,7 @@ public class SecondaryIndexManager
{
idxNames = filterByColumn(idxNames);
if (idxNames.isEmpty())
- return;
+ return;
logger.info(String.format("Submitting index build of %s for data in %s",
idxNames, StringUtils.join(sstables, ", ")));
@@ -589,7 +589,7 @@ public class SecondaryIndexManager
{
for (ColumnDefinition column : baseCfs.metadata.allColumns())
{
- if (candidate.getColumnDefs().contains(column))
+ if (candidate.indexes(column))
{
filtered.add(candidate.getIndexName());
break;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 001f838..2bcead8 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -62,6 +62,7 @@ import org.apache.cassandra.utils.WrappedRunnable;
import static org.junit.Assert.*;
import static org.apache.cassandra.Util.*;
+import org.apache.cassandra.db.index.PerRowSecondaryIndexTest;
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY;
@@ -2173,34 +2174,30 @@ public class ColumnFamilyStoreTest extends SchemaLoader
});
System.err.println("Row key: " + rowKey + " Cols: " + transformed);
}
-
+
@Test
public void testRebuildSecondaryIndex() throws IOException
{
- ByteBuffer indexedColumnName = ByteBufferUtil.bytes("indexed");
RowMutation rm;
-
+
rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", indexedColumnName, ByteBufferUtil.bytes("foo"), 1);
+ rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedColumnName);
- cfs.indexManager.getIndexForColumn(indexedColumnName).getColumnDefs().remove(indexedColumnDef);
-
+
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ab0c301/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 81173b2..1a4b7d4 100644
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@ -116,16 +116,30 @@ 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 boolean indexes(ColumnDefinition cdef)
+ {
+ return ACTIVE;
+ }
+
+ @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),
[6/6] cassandra git commit: Merge branch 'cassandra-2.1' into trunk
Posted by be...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2499baeb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2499baeb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2499baeb
Branch: refs/heads/trunk
Commit: 2499baeb3c0e3965a52e334e7cbbcfb64640bd47
Parents: aedce5f 8c5ce66
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:58:04 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:58:04 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../cassandra/db/index/SecondaryIndex.java | 13 ++++++++++++
.../db/index/SecondaryIndexManager.java | 4 ++--
.../cassandra/db/ColumnFamilyStoreTest.java | 21 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 20 +++++++++++++------
5 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2499baeb/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2499baeb/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2499baeb/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2499baeb/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 349edbe,5faab78..60fb195
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -2257,27 -2171,24 +2257,24 @@@ public class ColumnFamilyStoreTes
CellName indexedCellName = cellname("indexed");
Mutation rm;
- rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation(KEYSPACE4, ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", indexedCellName, ByteBufferUtil.bytes("foo"), 1);
+
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedCellName);
- cfs.indexManager.getIndexForColumn(indexedColumnDef.name.bytes).getColumnDefs().remove(indexedColumnDef);
-
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2499baeb/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
[4/6] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
Posted by be...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/db/index/SecondaryIndex.java
test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8c5ce66f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8c5ce66f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8c5ce66f
Branch: refs/heads/trunk
Commit: 8c5ce66fe32c8bfdc7712b70164948e82592f91e
Parents: b14236f9 6ab0c30
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:57:52 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:57:52 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../cassandra/db/index/SecondaryIndex.java | 13 ++++++++++++
.../db/index/SecondaryIndexManager.java | 4 ++--
.../cassandra/db/ColumnFamilyStoreTest.java | 21 +++++++++-----------
.../db/index/PerRowSecondaryIndexTest.java | 20 +++++++++++++------
5 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 6363974,d76606c..41e0340
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,22 @@@
+2.1.6
+ * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
+ * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
+ * Add support for top-k custom 2i queries (CASSANDRA-8717)
+ * Fix error when dropping table during compaction (CASSANDRA-9251)
+ * cassandra-stress supports validation operations over user profiles (CASSANDRA-8773)
+ * Add support for rate limiting log messages (CASSANDRA-9029)
+ * Log the partition key with tombstone warnings (CASSANDRA-8561)
+ * Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271)
+ * Fix PITR commitlog replay (CASSANDRA-9195)
+ * GCInspector logs very different times (CASSANDRA-9124)
+ * Fix deleting from an empty list (CASSANDRA-9198)
+ * Update tuple and collection types that use a user-defined type when that UDT
+ is modified (CASSANDRA-9148, CASSANDRA-9192)
+ * Use higher timeout for prepair and snapshot in repair (CASSANDRA-9261)
+ * Fix anticompaction blocking ANTI_ENTROPY stage (CASSANDRA-9151)
+Merged from 2.0:
+ 2.0.15:
+ * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
* (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
* Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
* Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index 20fdcec,789cc29..2dc0a22
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -304,11 -290,32 +304,24 @@@ public abstract class SecondaryInde
}
/**
- * Returns true if the provided column name is indexed by this secondary index.
+ * Returns true if the provided cell name is indexed by this secondary index.
+ *
+ * The default implementation checks whether the name is one the columnDef name,
+ * but this should be overriden but subclass if needed.
*/
- public boolean indexes(ByteBuffer name)
- {
- for (ColumnDefinition columnDef : columnDefs)
- {
- if (baseCfs.getComparator().compare(columnDef.name, name) == 0)
- return true;
- }
- return false;
- }
-
+ public abstract boolean indexes(CellName name);
+
/**
+ * Returns true if the provided column definition is indexed by this secondary index.
+ *
+ * The default implementation checks whether it is contained in this index column definitions set.
+ */
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return columnDefs.contains(cdef);
+ }
+
+ /**
* This is the primary way to create a secondary index instance for a CF column.
* It will validate the index_options before initializing.
*
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 84e7d20,2bcead8..5faab78
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -2168,30 -2178,26 +2168,27 @@@ public class ColumnFamilyStoreTest exte
@Test
public void testRebuildSecondaryIndex() throws IOException
{
- RowMutation rm;
-
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
- rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"), 1);
+ CellName indexedCellName = cellname("indexed");
+ Mutation rm;
+
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
+ rm.add("Indexed1", indexedCellName, ByteBufferUtil.bytes("foo"), 1);
++
rm.apply();
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
- ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
- cfs.forceBlockingFlush();
-
+
+ Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
+
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
-
- ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedCellName);
- cfs.indexManager.getIndexForColumn(indexedColumnDef.name.bytes).getColumnDefs().remove(indexedColumnDef);
-
-
+ PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
-
+
PerRowSecondaryIndexTest.TestIndex.reset();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index 0a84b74,1a4b7d4..2e885aa
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@@ -157,6 -128,18 +159,18 @@@ public class PerRowSecondaryIndexTest e
}
@Override
- public boolean indexes(ByteBuffer name)
++ public boolean indexes(CellName name)
+ {
+ return ACTIVE;
+ }
+
+ @Override
+ public boolean indexes(ColumnDefinition cdef)
+ {
+ return ACTIVE;
+ }
+
+ @Override
public void index(ByteBuffer rowKey, ColumnFamily cf)
{
QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),