Repository: cassandra Updated Branches: refs/heads/trunk 8bc7ab18d -> bf14e5b16
Fix performance regression from CASSANDRA-5614 patch by Sam Tunnicliffe; reviewed by Aleksey Yeschenko for CASSANDRA-6949 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/93edb123 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/93edb123 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/93edb123 Branch: refs/heads/trunk Commit: 93edb123a1ba30a54d42ac2f944e39a84e9b8a70 Parents: 8b8042b Author: beobal <[email protected]> Authored: Tue Apr 15 17:27:25 2014 +0100 Committer: Aleksey Yeschenko <[email protected]> Committed: Tue Apr 22 18:37:09 2014 +0300 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/AtomicSortedColumns.java | 9 --- .../apache/cassandra/db/RangeTombstoneTest.java | 60 +++----------------- 3 files changed, 8 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/93edb123/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index fffb2a5..89a8725 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,7 @@ * Log a warning for large batches (CASSANDRA-6487) * Queries on compact tables can return more rows that requested (CASSANDRA-7052) * USING TIMESTAMP for batches does not work (CASSANDRA-7053) + * Fix performance regression from CASSANDRA-5614 (CASSANDRA-6949) Merged from 1.2: * Fix batchlog to account for CF truncation records (CASSANDRA-6999) * Fix CQLSH parsing of functions and BLOB literals (CASSANDRA-7018) http://git-wip-us.apache.org/repos/asf/cassandra/blob/93edb123/src/java/org/apache/cassandra/db/AtomicSortedColumns.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java index d3a979c..cacd3bb 100644 --- a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java +++ b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java @@ -186,15 +186,6 @@ public class AtomicSortedColumns extends ColumnFamily } modified = new Holder(current.map.clone(), newDelInfo); - if (cm.deletionInfo().hasRanges()) - { - for (Column currentColumn : Iterables.concat(current.map.values(), cm)) - { - if (cm.deletionInfo().isDeleted(currentColumn)) - indexer.remove(currentColumn); - } - } - for (Column column : cm) { sizeDelta += modified.addColumn(transformation.apply(column), allocator, indexer); http://git-wip-us.apache.org/repos/asf/cassandra/blob/93edb123/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java index d66f6db..535b9e2 100644 --- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java +++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java @@ -260,51 +260,6 @@ public class RangeTombstoneTest extends SchemaLoader } @Test - public void testMemtableUpdateWithRangeTombstonesUpdatesSecondaryIndex() throws Exception - { - Keyspace table = Keyspace.open(KSNAME); - ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME); - ByteBuffer key = ByteBufferUtil.bytes("k5"); - ByteBuffer indexedColumnName = ByteBufferUtil.bytes(1); - - cfs.truncateBlocking(); - cfs.disableAutoCompaction(); - cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName()); - if (cfs.indexManager.getIndexForColumn(indexedColumnName) == null) - { - ColumnDefinition cd = new ColumnDefinition(indexedColumnName, - cfs.getComparator(), - IndexType.CUSTOM, - ImmutableMap.of(SecondaryIndex.CUSTOM_INDEX_OPTION_NAME, TestIndex.class.getName()), - "test_index", - 0, - null); - cfs.indexManager.addIndexedColumn(cd); - } - - TestIndex index = ((TestIndex)cfs.indexManager.getIndexForColumn(indexedColumnName)); - index.resetCounts(); - - RowMutation rm = new RowMutation(KSNAME, key); - for (int i = 0; i < 10; i++) - add(rm, i, 0); - rm.apply(); - - // We should have indexed 1 column - assertEquals(1, index.inserts.size()); - - rm = new RowMutation(KSNAME, key); - ColumnFamily cf = rm.addOrGet(CFNAME); - for (int i = 0; i < 10; i += 2) - delete(cf, 0, 7, 0); - rm.apply(); - - // verify that the 1 indexed column was removed from the index - assertEquals(1, index.deletes.size()); - assertEquals(index.deletes.get(0), index.inserts.get(0)); - } - - @Test public void testOverwritesToDeletedColumns() throws Exception { Keyspace table = Keyspace.open(KSNAME); @@ -352,14 +307,13 @@ public class RangeTombstoneTest extends SchemaLoader CompactionManager.instance.performMaximal(cfs); - // verify that the "1" indexed column removed from the index twice: - // the first time by processing the RT, the second time by the - // re-indexing caused by the second insertion. This second write - // deletes from the 2i because the original column was still in the - // main cf's memtable (shadowed by the RT). One thing we're checking - // for here is that there wasn't an additional, bogus delete issued - // to the 2i (CASSANDRA-6517) - assertEquals(2, index.deletes.size()); + // verify that the "1" indexed column removed from the index + // only once, by the re-indexing caused by the second insertion. + // This second write deletes from the 2i because the original column + // was still in the main cf's memtable (shadowed by the RT). One + // thing we're checking for here is that there wasn't an additional, + // bogus delete issued to the 2i (CASSANDRA-6517) + assertEquals(1, index.deletes.size()); } private void runCompactionWithRangeTombstoneAndCheckSecondaryIndex() throws Exception
