Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0BAD9200CA8 for ; Wed, 10 May 2017 12:47:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 09B73160BC6; Wed, 10 May 2017 10:47:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 615DC160BC9 for ; Wed, 10 May 2017 12:47:37 +0200 (CEST) Received: (qmail 65736 invoked by uid 500); 10 May 2017 10:47:36 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 65332 invoked by uid 99); 10 May 2017 10:47:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 10:47:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 06983E028C; Wed, 10 May 2017 10:47:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: adelapena@apache.org To: commits@cassandra.apache.org Date: Wed, 10 May 2017 10:47:38 -0000 Message-Id: <4c4e143b4cfd4d77a42f7e27d50e7756@git.apache.org> In-Reply-To: <5a9785a863f3405186bf1eed69639c52@git.apache.org> References: <5a9785a863f3405186bf1eed69639c52@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/9] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2 archived-at: Wed, 10 May 2017 10:47:38 -0000 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/trunk Commit: 486b82a6b056abee533b67662b927d90178c730e Parents: 6c5ea19 b0db519 Author: adelapena Authored: Wed May 10 11:02:40 2017 +0100 Committer: adelapena 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 PerColumnSecondaryIndex we use a PerRowSecondaryIndex + * to avoid the check but return a CompositesSearcher. + */ + 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 columns) + { + return new CompositesSearcher(baseCfs.indexManager, columns) + { + @Override + public boolean canHandleIndexClause(List 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-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org