Merge branch 'cassandra-2.1' into cassandra-2.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/486b82a6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/486b82a6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/486b82a6 Branch: refs/heads/cassandra-3.0 Commit: 486b82a6b056abee533b67662b927d90178c730e Parents: 6c5ea19 b0db519 Author: adelapena <a.penya.gar...@gmail.com> Authored: Wed May 10 11:02:40 2017 +0100 Committer: adelapena <a.penya.gar...@gmail.com> Committed: Wed May 10 11:02:40 2017 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../AbstractSimplePerColumnSecondaryIndex.java | 2 +- .../validation/entities/SecondaryIndexTest.java | 42 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/486b82a6/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index bb2e3ba,f62f162..ef2e12c --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,24 -1,5 +1,25 @@@ -2.1.18 +2.2.10 + * nodetool upgradesstables should upgrade system tables (CASSANDRA-13119) + * Avoid starting gossiper in RemoveTest (CASSANDRA-13407) + * Fix weightedSize() for row-cache reported by JMX and NodeTool (CASSANDRA-13393) + * Fix JVM metric paths (CASSANDRA-13103) + * Honor truststore-password parameter in cassandra-stress (CASSANDRA-12773) + * Discard in-flight shadow round responses (CASSANDRA-12653) + * Don't anti-compact repaired data to avoid inconsistencies (CASSANDRA-13153) + * Wrong logger name in AnticompactionTask (CASSANDRA-13343) + * Fix queries updating multiple time the same list (CASSANDRA-13130) + * Fix GRANT/REVOKE when keyspace isn't specified (CASSANDRA-13053) + * Avoid race on receiver by starting streaming sender thread after sending init message (CASSANDRA-12886) + * Fix "multiple versions of ant detected..." when running ant test (CASSANDRA-13232) + * Coalescing strategy sleeps too much (CASSANDRA-13090) + * Make sure compaction stats are updated when compaction is interrupted (Backport from 3.0, CASSANDRA-12100) + * Fix flaky LongLeveledCompactionStrategyTest (CASSANDRA-12202) + * Fix failing COPY TO STDOUT (CASSANDRA-12497) + * Fix ColumnCounter::countAll behaviour for reverse queries (CASSANDRA-13222) + * Exceptions encountered calling getSeeds() breaks OTC thread (CASSANDRA-13018) + * Commitlog replay may fail if last mutation is within 4 bytes of end of segment (CASSANDRA-13282) +Merged from 2.1: + * Fix 2ndary indexes on primary key columns to don't create expiring entries (CASSANDRA-13412) * Set javac encoding to utf-8 (CASSANDRA-13466) * Fix 2ndary index queries on partition keys for tables with static columns (CASSANDRA-13147) * Fix ParseError unhashable type list in cqlsh copy from (CASSANDRA-13364) http://git-wip-us.apache.org/repos/asf/cassandra/blob/486b82a6/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/486b82a6/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java index b653f4e,1e63e3a..e3616f6 --- a/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java @@@ -860,109 -820,45 +860,151 @@@ public class SecondaryIndexTest extend row(1, 1, 9, 1)); } + @Test + public void testIndexOnPartitionKeyInsertExpiringColumn() throws Throwable + { + createTable("CREATE TABLE %s (k1 int, k2 int, a int, b int, PRIMARY KEY ((k1, k2)))"); + createIndex("CREATE INDEX on %s(k1)"); + execute("INSERT INTO %s (k1, k2, a, b) VALUES (1, 2, 3, 4)"); + assertRows(execute("SELECT * FROM %s WHERE k1 = 1"), row(1, 2, 3, 4)); + execute("UPDATE %s USING TTL 1 SET b = 10 WHERE k1 = 1 AND k2 = 2"); + Thread.sleep(1000); + assertRows(execute("SELECT * FROM %s WHERE k1 = 1"), row(1, 2, 3, null)); + } + + @Test + public void testIndexOnClusteringKeyInsertExpiringColumn() throws Throwable + { + createTable("CREATE TABLE %s (pk int, ck int, a int, b int, PRIMARY KEY (pk, ck))"); + createIndex("CREATE INDEX on %s(ck)"); + execute("INSERT INTO %s (pk, ck, a, b) VALUES (1, 2, 3, 4)"); + assertRows(execute("SELECT * FROM %s WHERE ck = 2"), row(1, 2, 3, 4)); + execute("UPDATE %s USING TTL 1 SET b = 10 WHERE pk = 1 AND ck = 2"); + Thread.sleep(1000); + assertRows(execute("SELECT * FROM %s WHERE ck = 2"), row(1, 2, 3, null)); + } + + @Test + public void testIndexOnRegularColumnInsertExpiringColumn() throws Throwable + { + createTable("CREATE TABLE %s (pk int, ck int, a int, b int, PRIMARY KEY (pk, ck))"); + createIndex("CREATE INDEX on %s(a)"); + execute("INSERT INTO %s (pk, ck, a, b) VALUES (1, 2, 3, 4)"); + assertRows(execute("SELECT * FROM %s WHERE a = 3"), row(1, 2, 3, 4)); + + execute("UPDATE %s USING TTL 1 SET b = 10 WHERE pk = 1 AND ck = 2"); + Thread.sleep(1000); + assertRows(execute("SELECT * FROM %s WHERE a = 3"), row(1, 2, 3, null)); + + execute("UPDATE %s USING TTL 1 SET a = 5 WHERE pk = 1 AND ck = 2"); + Thread.sleep(1000); + assertEmpty(execute("SELECT * FROM %s WHERE a = 3")); + assertEmpty(execute("SELECT * FROM %s WHERE a = 5")); + } ++ + /** + * Custom index used to test the behavior of the system when the index is not ready. + * As Custom indices cannot by <code>PerColumnSecondaryIndex</code> we use a <code>PerRowSecondaryIndex</code> + * to avoid the check but return a <code>CompositesSearcher</code>. + */ + public static class IndexBlockingOnInitialization extends PerRowSecondaryIndex + { + private volatile CountDownLatch latch = new CountDownLatch(1); + + @Override + public void index(ByteBuffer rowKey, ColumnFamily cf) + { + try + { + latch.await(); + } + catch (InterruptedException e) + { + Thread.interrupted(); + } + } + + @Override + public void delete(DecoratedKey key, Group opGroup) + { + } + + @Override + public void init() + { + } + + @Override + public void reload() + { + } + + @Override + public void validateOptions() throws ConfigurationException + { + } + + @Override + public String getIndexName() + { + return "testIndex"; + } + + @Override + protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) + { + return new CompositesSearcher(baseCfs.indexManager, columns) + { + @Override + public boolean canHandleIndexClause(List<IndexExpression> clause) + { + return true; + } + + @Override + public void validate(IndexExpression indexExpression) throws InvalidRequestException + { + } + }; + } + + @Override + public void forceBlockingFlush() + { + } + + @Override + public ColumnFamilyStore getIndexCfs() + { + return baseCfs; + } + + @Override + public void removeIndex(ByteBuffer columnName) + { + latch.countDown(); + } + + @Override + public void invalidate() + { + } + + @Override + public void truncateBlocking(long truncatedAt) + { + } + + @Override + public boolean indexes(CellName name) + { + return false; + } + + @Override + public long estimateResultRows() + { + return 0; + } + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org