mirror of https://github.com/apache/cassandra
Fix index selection during rebuild with certain table layouts
patch by Sam Tunnicliffe; reviewed by Jeremiah Jordan for CASSANDRA-9281
This commit is contained in:
parent
f0c7a6f03c
commit
1e35fa4b5a
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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,23 +116,15 @@ 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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue