You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2017/04/20 09:31:55 UTC

[1/6] cassandra git commit: Avoid name clashes in CassandraIndexTest

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 5089e74ef -> e5c2a1839
  refs/heads/cassandra-3.11 5f6445480 -> fc834186f
  refs/heads/trunk 9b1295e41 -> 37f5005a1


Avoid name clashes in CassandraIndexTest

Patch by Alex Petrov; reviewed by Andr�s de la Pe�a for CASSANDRA-13427

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e5c2a183
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e5c2a183
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e5c2a183

Branch: refs/heads/cassandra-3.0
Commit: e5c2a1839f2cdf16771dcba726f862e61fda8d4f
Parents: 5089e74
Author: Alex Petrov <ol...@gmail.com>
Authored: Fri Mar 10 15:39:30 2017 +0100
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:26:25 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e55d4cb..11881e9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.14
+ * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
  * Handling partially written hint files (CASSANDRA-12728) 
  * Interrupt replaying hints on decommission (CASSANDRA-13308)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index 6c309ac..68fe42d 100644
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@ -60,7 +60,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("v")
-                        .indexName("v_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -77,7 +76,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("c")
-                        .indexName("c_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -92,7 +90,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c1 int, c2 int, v int, PRIMARY KEY (k, c1, c2));")
                         .target("c2")
-                        .indexName("c2_index")
                         .withFirstRow(row(0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1))
                         .missingIndexMessage(String.format("PRIMARY KEY column \"%s\" cannot be restricted " +
@@ -109,7 +106,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k1")
-                        .indexName("k1_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k2 must be restricted as other parts are")
@@ -124,7 +120,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k2")
-                        .indexName("k2_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k1 must be restricted as other parts are")
@@ -138,7 +133,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index1")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -154,7 +148,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index2")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -170,7 +163,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index1")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -186,7 +178,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index2")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -202,7 +193,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index1")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -218,7 +208,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index2")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -234,7 +223,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index3")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -250,7 +238,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index4")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -266,7 +253,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index5")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -282,7 +268,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index6")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -298,7 +283,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l frozen<list<int>>, PRIMARY KEY (k, c));")
                         .target("full(l)")
-                        .indexName("fl_index")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -314,7 +298,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s frozen<set<int>>, PRIMARY KEY (k, c));")
                         .target("full(s)")
-                        .indexName("fs_index")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -330,7 +313,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m frozen<map<text,int>>, PRIMARY KEY (k, c));")
                         .target("full(m)")
-                        .indexName("fm_index")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -346,7 +328,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, v int, PRIMARY KEY (k)) WITH COMPACT STORAGE;")
                         .target("v")
-                        .indexName("cv_index")
                         .withFirstRow(row(0, 0))
                         .withSecondRow(row(1,1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -391,8 +372,8 @@ public class CassandraIndexTest extends CQLTester
         Object[] row1 = row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30));
         Object[] row2 = row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 32));
         createTable("CREATE TABLE %s (k int, c int, m map<text, int>, PRIMARY KEY(k, c))");
-        createIndex("CREATE INDEX mkey_index on %s(keys(m))");
-        createIndex("CREATE INDEX mval_index on %s(m)");
+        createIndex("CREATE INDEX ON %s(keys(m))");
+        createIndex("CREATE INDEX ON %s(m)");
 
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row1);
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row2);
@@ -409,7 +390,7 @@ public class CassandraIndexTest extends CQLTester
         int key = 0;
         int indexedValue = 99;
         createTable("CREATE TABLE %s (k int, v int, PRIMARY KEY(k))");
-        createIndex("CREATE INDEX v_index on %s(v)");
+        createIndex("CREATE INDEX ON %s(v)");
         execute("INSERT INTO %s (k, v) VALUES (?, ?)", key, indexedValue);
 
         assertRows(execute("SELECT * FROM %s WHERE v = ?", indexedValue), row(key, indexedValue));
@@ -544,6 +525,9 @@ public class CassandraIndexTest extends CQLTester
         }
     }
 
+    // Used in order to generate the unique names for indexes
+    private static int indexCounter;
+
     private class TestScript
     {
         String tableDefinition;
@@ -558,12 +542,6 @@ public class CassandraIndexTest extends CQLTester
         Object[] firstRow;
         Object[] secondRow;
 
-        TestScript indexName(String indexName)
-        {
-            this.indexName = indexName;
-            return this;
-        }
-
         TestScript target(String indexTarget)
         {
             this.indexTarget = indexTarget;
@@ -621,7 +599,6 @@ public class CassandraIndexTest extends CQLTester
         void run() throws Throwable
         {
             // check minimum required setup
-            assertNotNull(indexName);
             assertNotNull(indexTarget);
             assertNotNull(queryExpression1);
             assertNotNull(queryExpression2);
@@ -632,7 +609,9 @@ public class CassandraIndexTest extends CQLTester
                 assertNotNull(postUpdateQueryExpression);
 
             // first, create the table as we need the CFMetaData to build the other cql statements
-            createTable(tableDefinition);
+            String tableName = createTable(tableDefinition);
+
+            indexName = String.format("index_%s_%d", tableName, indexCounter++);
 
             // now setup the cql statements the test will run through. Some are dependent on
             // the table definition, others are not.


[4/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by if...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fc834186
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fc834186
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fc834186

Branch: refs/heads/trunk
Commit: fc834186ff0faa5ff78512637badc59990e51173
Parents: 5f64454 e5c2a18
Author: Alex Petrov <ol...@gmail.com>
Authored: Thu Apr 20 11:29:22 2017 +0200
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:29:22 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 11 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc834186/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 92ecb39,11881e9..8a2926b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,34 -1,9 +1,36 @@@
 -3.0.14
 +3.11.0
 + * V5 protocol flags decoding broken (CASSANDRA-13443)
 + * Use write lock not read lock for removing sstables from compaction strategies. (CASSANDRA-13422)
 + * Use corePoolSize equal to maxPoolSize in JMXEnabledThreadPoolExecutors (CASSANDRA-13329)
 + * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962)
 + * Add charset to Analyser input stream (CASSANDRA-13151)
 + * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
 + * cdc column addition strikes again (CASSANDRA-13382)
 + * Fix static column indexes (CASSANDRA-13277)
 + * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
 + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370)
 + * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247)
 + * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317)
 + * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366)
 + * Support unaligned memory access for AArch64 (CASSANDRA-13326)
 + * Improve SASI range iterator efficiency on intersection with an empty range (CASSANDRA-12915).
 + * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
 + * Obfuscate password in stress-graphs (CASSANDRA-12233)
 + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
 + * nodetool stopdaemon errors out (CASSANDRA-13030)
 + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
 + * Fix primary index calculation for SASI (CASSANDRA-12910)
 + * More fixes to the TokenAllocator (CASSANDRA-12990)
 + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
 + * Address message coalescing regression (CASSANDRA-12676)
 + * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 + * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
 +Merged from 3.0:
+  * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
 - * Handling partially written hint files (CASSANDRA-12728) 
++ * Handling partially written hint files (CASSANDRA-12728)
   * Interrupt replaying hints on decommission (CASSANDRA-13308)
 -
 -3.0.13
 + * Handling partially written hint files (CASSANDRA-12728)
 + * Fix NPE issue in StorageService (CASSANDRA-13060)
   * Make reading of range tombstones more reliable (CASSANDRA-12811)
   * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213)
   * Fix view builder bug that can filter out data on restart (CASSANDRA-13405)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc834186/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index bfe3c32,68fe42d..1f8fe71
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@@ -110,10 -106,9 +107,9 @@@ public class CassandraIndexTest extend
          // No update allowed on primary key columns, so this script has no update expression
          new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                          .target("k1")
-                         .indexName("k1_index")
                          .withFirstRow(row(0, 0, 0, 0, 0))
                          .withSecondRow(row(1, 1, 1, 1, 1))
 -                        .missingIndexMessage("Partition key parts: k2 must be restricted as other parts are")
 +                        .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
                          .firstQueryExpression("k1=0")
                          .secondQueryExpression("k1=1")
                          .run();
@@@ -125,10 -120,9 +121,9 @@@
          // No update allowed on primary key columns, so this script has no update expression
          new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                          .target("k2")
-                         .indexName("k2_index")
                          .withFirstRow(row(0, 0, 0, 0, 0))
                          .withSecondRow(row(1, 1, 1, 1, 1))
 -                        .missingIndexMessage("Partition key parts: k1 must be restricted as other parts are")
 +                        .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
                          .firstQueryExpression("k2=0")
                          .secondQueryExpression("k2=1")
                          .run();


[6/6] cassandra git commit: Merge branch 'cassandra-3.11' into trunk

Posted by if...@apache.org.
Merge branch 'cassandra-3.11' into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/37f5005a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/37f5005a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/37f5005a

Branch: refs/heads/trunk
Commit: 37f5005a15c9addc3b99c5a35cb72f9fc9c2c912
Parents: 9b1295e fc83418
Author: Alex Petrov <ol...@gmail.com>
Authored: Thu Apr 20 11:31:29 2017 +0200
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:31:29 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 11 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/37f5005a/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index c742570,8a2926b..2cd4bae
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -80,7 -24,10 +80,9 @@@
   * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
   * Address message coalescing regression (CASSANDRA-12676)
   * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 - * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
  Merged from 3.0:
+  * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
+  * Handling partially written hint files (CASSANDRA-12728)
   * Interrupt replaying hints on decommission (CASSANDRA-13308)
   * Handling partially written hint files (CASSANDRA-12728)
   * Fix NPE issue in StorageService (CASSANDRA-13060)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/37f5005a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index 2b43f36,1f8fe71..8b9402b
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@@ -658,8 -635,10 +635,10 @@@ public class CassandraIndexTest extend
              if (updateExpression != null)
                  assertNotNull(postUpdateQueryExpression);
  
 -            // first, create the table as we need the CFMetaData to build the other cql statements
 +            // first, create the table as we need the Tablemetadata to build the other cql statements
-             createTable(tableDefinition);
+             String tableName = createTable(tableDefinition);
+ 
+             indexName = String.format("index_%s_%d", tableName, indexCounter++);
  
              // now setup the cql statements the test will run through. Some are dependent on
              // the table definition, others are not.


[5/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by if...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fc834186
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fc834186
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fc834186

Branch: refs/heads/cassandra-3.11
Commit: fc834186ff0faa5ff78512637badc59990e51173
Parents: 5f64454 e5c2a18
Author: Alex Petrov <ol...@gmail.com>
Authored: Thu Apr 20 11:29:22 2017 +0200
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:29:22 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 11 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc834186/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 92ecb39,11881e9..8a2926b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,34 -1,9 +1,36 @@@
 -3.0.14
 +3.11.0
 + * V5 protocol flags decoding broken (CASSANDRA-13443)
 + * Use write lock not read lock for removing sstables from compaction strategies. (CASSANDRA-13422)
 + * Use corePoolSize equal to maxPoolSize in JMXEnabledThreadPoolExecutors (CASSANDRA-13329)
 + * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962)
 + * Add charset to Analyser input stream (CASSANDRA-13151)
 + * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
 + * cdc column addition strikes again (CASSANDRA-13382)
 + * Fix static column indexes (CASSANDRA-13277)
 + * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
 + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370)
 + * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247)
 + * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317)
 + * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366)
 + * Support unaligned memory access for AArch64 (CASSANDRA-13326)
 + * Improve SASI range iterator efficiency on intersection with an empty range (CASSANDRA-12915).
 + * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
 + * Obfuscate password in stress-graphs (CASSANDRA-12233)
 + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
 + * nodetool stopdaemon errors out (CASSANDRA-13030)
 + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
 + * Fix primary index calculation for SASI (CASSANDRA-12910)
 + * More fixes to the TokenAllocator (CASSANDRA-12990)
 + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
 + * Address message coalescing regression (CASSANDRA-12676)
 + * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 + * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
 +Merged from 3.0:
+  * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
 - * Handling partially written hint files (CASSANDRA-12728) 
++ * Handling partially written hint files (CASSANDRA-12728)
   * Interrupt replaying hints on decommission (CASSANDRA-13308)
 -
 -3.0.13
 + * Handling partially written hint files (CASSANDRA-12728)
 + * Fix NPE issue in StorageService (CASSANDRA-13060)
   * Make reading of range tombstones more reliable (CASSANDRA-12811)
   * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213)
   * Fix view builder bug that can filter out data on restart (CASSANDRA-13405)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc834186/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index bfe3c32,68fe42d..1f8fe71
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@@ -110,10 -106,9 +107,9 @@@ public class CassandraIndexTest extend
          // No update allowed on primary key columns, so this script has no update expression
          new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                          .target("k1")
-                         .indexName("k1_index")
                          .withFirstRow(row(0, 0, 0, 0, 0))
                          .withSecondRow(row(1, 1, 1, 1, 1))
 -                        .missingIndexMessage("Partition key parts: k2 must be restricted as other parts are")
 +                        .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
                          .firstQueryExpression("k1=0")
                          .secondQueryExpression("k1=1")
                          .run();
@@@ -125,10 -120,9 +121,9 @@@
          // No update allowed on primary key columns, so this script has no update expression
          new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                          .target("k2")
-                         .indexName("k2_index")
                          .withFirstRow(row(0, 0, 0, 0, 0))
                          .withSecondRow(row(1, 1, 1, 1, 1))
 -                        .missingIndexMessage("Partition key parts: k1 must be restricted as other parts are")
 +                        .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
                          .firstQueryExpression("k2=0")
                          .secondQueryExpression("k2=1")
                          .run();


[3/6] cassandra git commit: Avoid name clashes in CassandraIndexTest

Posted by if...@apache.org.
Avoid name clashes in CassandraIndexTest

Patch by Alex Petrov; reviewed by Andr�s de la Pe�a for CASSANDRA-13427

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e5c2a183
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e5c2a183
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e5c2a183

Branch: refs/heads/trunk
Commit: e5c2a1839f2cdf16771dcba726f862e61fda8d4f
Parents: 5089e74
Author: Alex Petrov <ol...@gmail.com>
Authored: Fri Mar 10 15:39:30 2017 +0100
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:26:25 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e55d4cb..11881e9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.14
+ * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
  * Handling partially written hint files (CASSANDRA-12728) 
  * Interrupt replaying hints on decommission (CASSANDRA-13308)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index 6c309ac..68fe42d 100644
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@ -60,7 +60,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("v")
-                        .indexName("v_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -77,7 +76,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("c")
-                        .indexName("c_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -92,7 +90,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c1 int, c2 int, v int, PRIMARY KEY (k, c1, c2));")
                         .target("c2")
-                        .indexName("c2_index")
                         .withFirstRow(row(0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1))
                         .missingIndexMessage(String.format("PRIMARY KEY column \"%s\" cannot be restricted " +
@@ -109,7 +106,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k1")
-                        .indexName("k1_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k2 must be restricted as other parts are")
@@ -124,7 +120,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k2")
-                        .indexName("k2_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k1 must be restricted as other parts are")
@@ -138,7 +133,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index1")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -154,7 +148,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index2")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -170,7 +163,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index1")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -186,7 +178,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index2")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -202,7 +193,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index1")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -218,7 +208,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index2")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -234,7 +223,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index3")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -250,7 +238,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index4")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -266,7 +253,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index5")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -282,7 +268,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index6")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -298,7 +283,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l frozen<list<int>>, PRIMARY KEY (k, c));")
                         .target("full(l)")
-                        .indexName("fl_index")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -314,7 +298,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s frozen<set<int>>, PRIMARY KEY (k, c));")
                         .target("full(s)")
-                        .indexName("fs_index")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -330,7 +313,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m frozen<map<text,int>>, PRIMARY KEY (k, c));")
                         .target("full(m)")
-                        .indexName("fm_index")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -346,7 +328,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, v int, PRIMARY KEY (k)) WITH COMPACT STORAGE;")
                         .target("v")
-                        .indexName("cv_index")
                         .withFirstRow(row(0, 0))
                         .withSecondRow(row(1,1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -391,8 +372,8 @@ public class CassandraIndexTest extends CQLTester
         Object[] row1 = row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30));
         Object[] row2 = row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 32));
         createTable("CREATE TABLE %s (k int, c int, m map<text, int>, PRIMARY KEY(k, c))");
-        createIndex("CREATE INDEX mkey_index on %s(keys(m))");
-        createIndex("CREATE INDEX mval_index on %s(m)");
+        createIndex("CREATE INDEX ON %s(keys(m))");
+        createIndex("CREATE INDEX ON %s(m)");
 
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row1);
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row2);
@@ -409,7 +390,7 @@ public class CassandraIndexTest extends CQLTester
         int key = 0;
         int indexedValue = 99;
         createTable("CREATE TABLE %s (k int, v int, PRIMARY KEY(k))");
-        createIndex("CREATE INDEX v_index on %s(v)");
+        createIndex("CREATE INDEX ON %s(v)");
         execute("INSERT INTO %s (k, v) VALUES (?, ?)", key, indexedValue);
 
         assertRows(execute("SELECT * FROM %s WHERE v = ?", indexedValue), row(key, indexedValue));
@@ -544,6 +525,9 @@ public class CassandraIndexTest extends CQLTester
         }
     }
 
+    // Used in order to generate the unique names for indexes
+    private static int indexCounter;
+
     private class TestScript
     {
         String tableDefinition;
@@ -558,12 +542,6 @@ public class CassandraIndexTest extends CQLTester
         Object[] firstRow;
         Object[] secondRow;
 
-        TestScript indexName(String indexName)
-        {
-            this.indexName = indexName;
-            return this;
-        }
-
         TestScript target(String indexTarget)
         {
             this.indexTarget = indexTarget;
@@ -621,7 +599,6 @@ public class CassandraIndexTest extends CQLTester
         void run() throws Throwable
         {
             // check minimum required setup
-            assertNotNull(indexName);
             assertNotNull(indexTarget);
             assertNotNull(queryExpression1);
             assertNotNull(queryExpression2);
@@ -632,7 +609,9 @@ public class CassandraIndexTest extends CQLTester
                 assertNotNull(postUpdateQueryExpression);
 
             // first, create the table as we need the CFMetaData to build the other cql statements
-            createTable(tableDefinition);
+            String tableName = createTable(tableDefinition);
+
+            indexName = String.format("index_%s_%d", tableName, indexCounter++);
 
             // now setup the cql statements the test will run through. Some are dependent on
             // the table definition, others are not.


[2/6] cassandra git commit: Avoid name clashes in CassandraIndexTest

Posted by if...@apache.org.
Avoid name clashes in CassandraIndexTest

Patch by Alex Petrov; reviewed by Andr�s de la Pe�a for CASSANDRA-13427

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e5c2a183
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e5c2a183
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e5c2a183

Branch: refs/heads/cassandra-3.11
Commit: e5c2a1839f2cdf16771dcba726f862e61fda8d4f
Parents: 5089e74
Author: Alex Petrov <ol...@gmail.com>
Authored: Fri Mar 10 15:39:30 2017 +0100
Committer: Alex Petrov <ol...@gmail.com>
Committed: Thu Apr 20 11:26:25 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../index/internal/CassandraIndexTest.java      | 39 +++++---------------
 2 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e55d4cb..11881e9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.14
+ * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
  * Handling partially written hint files (CASSANDRA-12728) 
  * Interrupt replaying hints on decommission (CASSANDRA-13308)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5c2a183/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
index 6c309ac..68fe42d 100644
--- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
@@ -60,7 +60,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("v")
-                        .indexName("v_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -77,7 +76,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, v int, PRIMARY KEY (k, c));")
                         .target("c")
-                        .indexName("c_index")
                         .withFirstRow(row(0, 0, 0))
                         .withSecondRow(row(1, 1, 1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -92,7 +90,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c1 int, c2 int, v int, PRIMARY KEY (k, c1, c2));")
                         .target("c2")
-                        .indexName("c2_index")
                         .withFirstRow(row(0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1))
                         .missingIndexMessage(String.format("PRIMARY KEY column \"%s\" cannot be restricted " +
@@ -109,7 +106,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k1")
-                        .indexName("k1_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k2 must be restricted as other parts are")
@@ -124,7 +120,6 @@ public class CassandraIndexTest extends CQLTester
         // No update allowed on primary key columns, so this script has no update expression
         new TestScript().tableDefinition("CREATE TABLE %s (k1 int, k2 int, c1 int, c2 int, v int, PRIMARY KEY ((k1, k2), c1, c2));")
                         .target("k2")
-                        .indexName("k2_index")
                         .withFirstRow(row(0, 0, 0, 0, 0))
                         .withSecondRow(row(1, 1, 1, 1, 1))
                         .missingIndexMessage("Partition key parts: k1 must be restricted as other parts are")
@@ -138,7 +133,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index1")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -154,7 +148,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l list<int>, PRIMARY KEY (k, c));")
                         .target("l")
-                        .indexName("l_index2")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -170,7 +163,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index1")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -186,7 +178,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s set<int>, PRIMARY KEY (k, c));")
                         .target("s")
-                        .indexName("s_index2")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -202,7 +193,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index1")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -218,7 +208,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("m")
-                        .indexName("m_index2")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -234,7 +223,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index3")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -250,7 +238,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("keys(m)")
-                        .indexName("m_index4")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -266,7 +253,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index5")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -282,7 +268,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m map<text,int>, PRIMARY KEY (k, c));")
                         .target("entries(m)")
-                        .indexName("m_index6")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -298,7 +283,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, l frozen<list<int>>, PRIMARY KEY (k, c));")
                         .target("full(l)")
-                        .indexName("fl_index")
                         .withFirstRow(row(0, 0, Lists.newArrayList(10, 20, 30)))
                         .withSecondRow(row(1, 1, Lists.newArrayList(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -314,7 +298,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, s frozen<set<int>>, PRIMARY KEY (k, c));")
                         .target("full(s)")
-                        .indexName("fs_index")
                         .withFirstRow(row(0, 0, Sets.newHashSet(10, 20, 30)))
                         .withSecondRow(row(1, 1, Sets.newHashSet(11, 21, 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -330,7 +313,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, c int, m frozen<map<text,int>>, PRIMARY KEY (k, c));")
                         .target("full(m)")
-                        .indexName("fm_index")
                         .withFirstRow(row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30)))
                         .withSecondRow(row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 31)))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -346,7 +328,6 @@ public class CassandraIndexTest extends CQLTester
     {
         new TestScript().tableDefinition("CREATE TABLE %s (k int, v int, PRIMARY KEY (k)) WITH COMPACT STORAGE;")
                         .target("v")
-                        .indexName("cv_index")
                         .withFirstRow(row(0, 0))
                         .withSecondRow(row(1,1))
                         .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE)
@@ -391,8 +372,8 @@ public class CassandraIndexTest extends CQLTester
         Object[] row1 = row(0, 0, ImmutableMap.of("a", 10, "b", 20, "c", 30));
         Object[] row2 = row(1, 1, ImmutableMap.of("d", 11, "e", 21, "f", 32));
         createTable("CREATE TABLE %s (k int, c int, m map<text, int>, PRIMARY KEY(k, c))");
-        createIndex("CREATE INDEX mkey_index on %s(keys(m))");
-        createIndex("CREATE INDEX mval_index on %s(m)");
+        createIndex("CREATE INDEX ON %s(keys(m))");
+        createIndex("CREATE INDEX ON %s(m)");
 
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row1);
         execute("INSERT INTO %s (k, c, m) VALUES (?, ?, ?)", row2);
@@ -409,7 +390,7 @@ public class CassandraIndexTest extends CQLTester
         int key = 0;
         int indexedValue = 99;
         createTable("CREATE TABLE %s (k int, v int, PRIMARY KEY(k))");
-        createIndex("CREATE INDEX v_index on %s(v)");
+        createIndex("CREATE INDEX ON %s(v)");
         execute("INSERT INTO %s (k, v) VALUES (?, ?)", key, indexedValue);
 
         assertRows(execute("SELECT * FROM %s WHERE v = ?", indexedValue), row(key, indexedValue));
@@ -544,6 +525,9 @@ public class CassandraIndexTest extends CQLTester
         }
     }
 
+    // Used in order to generate the unique names for indexes
+    private static int indexCounter;
+
     private class TestScript
     {
         String tableDefinition;
@@ -558,12 +542,6 @@ public class CassandraIndexTest extends CQLTester
         Object[] firstRow;
         Object[] secondRow;
 
-        TestScript indexName(String indexName)
-        {
-            this.indexName = indexName;
-            return this;
-        }
-
         TestScript target(String indexTarget)
         {
             this.indexTarget = indexTarget;
@@ -621,7 +599,6 @@ public class CassandraIndexTest extends CQLTester
         void run() throws Throwable
         {
             // check minimum required setup
-            assertNotNull(indexName);
             assertNotNull(indexTarget);
             assertNotNull(queryExpression1);
             assertNotNull(queryExpression2);
@@ -632,7 +609,9 @@ public class CassandraIndexTest extends CQLTester
                 assertNotNull(postUpdateQueryExpression);
 
             // first, create the table as we need the CFMetaData to build the other cql statements
-            createTable(tableDefinition);
+            String tableName = createTable(tableDefinition);
+
+            indexName = String.format("index_%s_%d", tableName, indexCounter++);
 
             // now setup the cql statements the test will run through. Some are dependent on
             // the table definition, others are not.