You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bd...@apache.org on 2019/08/06 17:26:16 UTC

[cassandra] 01/01: Merge branch 'cassandra-3.0' into cassandra-3.11

This is an automated email from the ASF dual-hosted git repository.

bdeggleston pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 6b0b792f66fa8dfdf1c8ce814d3f9f012ddb5006
Merge: 71cb061 da8d41f
Author: Blake Eggleston <bd...@gmail.com>
AuthorDate: Tue Aug 6 10:16:48 2019 -0700

    Merge branch 'cassandra-3.0' into cassandra-3.11

 CHANGES.txt                                        |  1 +
 .../cassandra/index/internal/CassandraIndex.java   | 21 ++++++++++++-
 test/unit/org/apache/cassandra/SchemaLoader.java   | 35 ++++++++++++++++++++--
 .../apache/cassandra/db/SecondaryIndexTest.java    | 26 ++++++++++++++++
 4 files changed, 80 insertions(+), 3 deletions(-)

diff --cc CHANGES.txt
index 0233c0f,c2bed92..43dbda3
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,8 -1,5 +1,9 @@@
 -3.0.19
 +3.11.5
 + * Fix cassandra-env.sh to use $CASSANDRA_CONF to find cassandra-jaas.config (CASSANDRA-14305)
 + * Fixed nodetool cfstats printing index name twice (CASSANDRA-14903)
 + * Add flag to disable SASI indexes, and warnings on creation (CASSANDRA-14866)
 +Merged from 3.0:
+  * Use mean row count instead of mean column count for index selectivity calculation (CASSANDRA-15259)
   * Avoid updating unchanged gossip states (CASSANDRA-15097)
   * Prevent recreation of previously dropped columns with a different kind (CASSANDRA-14948)
   * Prevent client requests from blocking on executor task queue (CASSANDRA-15013)
diff --cc test/unit/org/apache/cassandra/SchemaLoader.java
index 567da19,8d61f39..48b8af3
--- a/test/unit/org/apache/cassandra/SchemaLoader.java
+++ b/test/unit/org/apache/cassandra/SchemaLoader.java
@@@ -416,15 -401,10 +416,13 @@@ public class SchemaLoade
                                   .build();
  
      }
 -    public static CFMetaData compositeIndexCFMD(String ksName, String cfName, boolean withIndex) throws ConfigurationException
 +    public static CFMetaData compositeIndexCFMD(String ksName, String cfName, boolean withRegularIndex) throws ConfigurationException
 +    {
 +        return compositeIndexCFMD(ksName, cfName, withRegularIndex, false);
 +    }
 +
 +    public static CFMetaData compositeIndexCFMD(String ksName, String cfName, boolean withRegularIndex, boolean withStaticIndex) throws ConfigurationException
      {
--        // the withIndex flag exists to allow tests index creation
--        // on existing columns
          CFMetaData cfm = CFMetaData.Builder.create(ksName, cfName)
                  .addPartitionKey("key", AsciiType.instance)
                  .addClusteringColumn("c1", AsciiType.instance)
@@@ -444,24 -422,42 +442,57 @@@
                                                          "birthdate_key_index",
                                                          IndexMetadata.Kind.COMPOSITES,
                                                          Collections.EMPTY_MAP)));
 +        }
 +
 +        if (withStaticIndex)
 +        {
 +            cfm.indexes(
 +                    cfm.getIndexes()
 +                       .with(IndexMetadata.fromIndexTargets(cfm,
 +                                                            Collections.singletonList(
 +                                                                new IndexTarget(new ColumnIdentifier("static", true),
 +                                                                                IndexTarget.Type.VALUES)),
 +                                                            "static_index",
 +                                                            IndexMetadata.Kind.COMPOSITES,
 +                                                            Collections.EMPTY_MAP)));
 +        }
  
          return cfm.compression(getCompressionParameters());
+     }
+ 
+     public static CFMetaData compositeMultipleIndexCFMD(String ksName, String cfName) throws ConfigurationException
+     {
++        // the withIndex flag exists to allow tests index creation
++        // on existing columns
+         CFMetaData cfm = CFMetaData.Builder.create(ksName, cfName)
+                                            .addPartitionKey("key", AsciiType.instance)
+                                            .addClusteringColumn("c1", AsciiType.instance)
+                                            .addRegularColumn("birthdate", LongType.instance)
+                                            .addRegularColumn("notbirthdate", LongType.instance)
+                                            .build();
+ 
+         cfm.indexes(
 -            cfm.getIndexes()
 -               .with(IndexMetadata.fromIndexTargets(cfm,
 -                                                    Collections.singletonList(
 -                                                    new IndexTarget(new ColumnIdentifier("birthdate", true),
 -                                                                    IndexTarget.Type.VALUES)),
 -                                                    "birthdate_key_index",
 -                                                    IndexMetadata.Kind.COMPOSITES,
 -                                                    Collections.EMPTY_MAP))
 -               .with(IndexMetadata.fromIndexTargets(cfm,
 -                                                    Collections.singletonList(
 -                                                    new IndexTarget(new ColumnIdentifier("notbirthdate", true),
 -                                                                    IndexTarget.Type.VALUES)),
 -                                                    "notbirthdate_key_index",
 -                                                    IndexMetadata.Kind.COMPOSITES,
 -                                                    Collections.EMPTY_MAP))
++        cfm.getIndexes()
++           .with(IndexMetadata.fromIndexTargets(cfm,
++                                                Collections.singletonList(
++                                                new IndexTarget(new ColumnIdentifier("birthdate", true),
++                                                                IndexTarget.Type.VALUES)),
++                                                "birthdate_key_index",
++                                                IndexMetadata.Kind.COMPOSITES,
++                                                Collections.EMPTY_MAP))
++           .with(IndexMetadata.fromIndexTargets(cfm,
++                                                Collections.singletonList(
++                                                new IndexTarget(new ColumnIdentifier("notbirthdate", true),
++                                                                IndexTarget.Type.VALUES)),
++                                                "notbirthdate_key_index",
++                                                IndexMetadata.Kind.COMPOSITES,
++                                                Collections.EMPTY_MAP))
+         );
+ 
+ 
+         return cfm.compression(getCompressionParameters());
      }
  
 -
      public static CFMetaData keysIndexCFMD(String ksName, String cfName, boolean withIndex) throws ConfigurationException
      {
          CFMetaData cfm = CFMetaData.Builder.createDense(ksName, cfName, false, false)
diff --cc test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
index 33a5fb6,9fb0463..e9a0db6
--- a/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
@@@ -63,8 -67,9 +64,9 @@@ public class SecondaryIndexTes
          SchemaLoader.prepareServer();
          SchemaLoader.createKeyspace(KEYSPACE1,
                                      KeyspaceParams.simple(1),
 -                                    SchemaLoader.compositeIndexCFMD(KEYSPACE1, WITH_COMPOSITE_INDEX, true).gcGraceSeconds(0),
 +                                    SchemaLoader.compositeIndexCFMD(KEYSPACE1, WITH_COMPOSITE_INDEX, true, true).gcGraceSeconds(0),
                                      SchemaLoader.compositeIndexCFMD(KEYSPACE1, COMPOSITE_INDEX_TO_BE_ADDED, false).gcGraceSeconds(0),
+                                     SchemaLoader.compositeMultipleIndexCFMD(KEYSPACE1, WITH_MULTIPLE_COMPOSITE_INDEX).gcGraceSeconds(0),
                                      SchemaLoader.keysIndexCFMD(KEYSPACE1, WITH_KEYS_INDEX, true).gcGraceSeconds(0));
      }
  


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org