cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [4/6] git commit: merge from 1.2
Date Tue, 08 Oct 2013 16:17:20 GMT
merge from 1.2


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

Branch: refs/heads/trunk
Commit: 21ab8f81a2adde9be27728c22e8b5733079aee9b
Parents: 690dac3 241c70a
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Oct 8 10:55:31 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Oct 8 10:55:31 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 .../db/index/SecondaryIndexSearcher.java          | 18 +++++++++++++++---
 .../db/index/composites/CompositesSearcher.java   |  5 ++++-
 .../cassandra/db/index/keys/KeysSearcher.java     | 15 ++++++++-------
 4 files changed, 28 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/21ab8f81/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index fef5243,adbae91..1877a85
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -39,43 -15,10 +39,44 @@@ Merged from 1.2
   * Fix skipping columns with multiple slices (CASSANDRA-6119)
   * Expose connected thrift + native client counts (CASSANDRA-5084)
   * Optimize auth setup (CASSANDRA-6122)
+  * Trace index selection (CASSANDRA-6001)
  
  
 -1.2.10
 +2.0.1
 + * Fix bug that could allow reading deleted data temporarily (CASSANDRA-6025)
 + * Improve memory use defaults (CASSANDRA-5069)
 + * Make ThriftServer more easlly extensible (CASSANDRA-6058)
 + * Remove Hadoop dependency from ITransportFactory (CASSANDRA-6062)
 + * add file_cache_size_in_mb setting (CASSANDRA-5661)
 + * Improve error message when yaml contains invalid properties (CASSANDRA-5958)
 + * Improve leveled compaction's ability to find non-overlapping L0 compactions
 +   to work on concurrently (CASSANDRA-5921)
 + * Notify indexer of columns shadowed by range tombstones (CASSANDRA-5614)
 + * Log Merkle tree stats (CASSANDRA-2698)
 + * Switch from crc32 to adler32 for compressed sstable checksums (CASSANDRA-5862)
 + * Improve offheap memcpy performance (CASSANDRA-5884)
 + * Use a range aware scanner for cleanup (CASSANDRA-2524)
 + * Cleanup doesn't need to inspect sstables that contain only local data
 +   (CASSANDRA-5722)
 + * Add ability for CQL3 to list partition keys (CASSANDRA-4536)
 + * Improve native protocol serialization (CASSANDRA-5664)
 + * Upgrade Thrift to 0.9.1 (CASSANDRA-5923)
 + * Require superuser status for adding triggers (CASSANDRA-5963)
 + * Make standalone scrubber handle old and new style leveled manifest
 +   (CASSANDRA-6005)
 + * Fix paxos bugs (CASSANDRA-6012, 6013, 6023)
 + * Fix paged ranges with multiple replicas (CASSANDRA-6004)
 + * Fix potential AssertionError during tracing (CASSANDRA-6041)
 + * Fix NPE in sstablesplit (CASSANDRA-6027)
 + * Migrate pre-2.0 key/value/column aliases to system.schema_columns
 +   (CASSANDRA-6009)
 + * Paging filter empty rows too agressively (CASSANDRA-6040)
 + * Support variadic parameters for IN clauses (CASSANDRA-4210)
 + * cqlsh: return the result of CAS writes (CASSANDRA-5796)
 + * Fix validation of IN clauses with 2ndary indexes (CASSANDRA-6050)
 + * Support named bind variables in CQL (CASSANDRA-6033)
 +Merged from 1.2:
 + * Allow cache-keys-to-save to be set at runtime (CASSANDRA-5980)
   * Avoid second-guessing out-of-space state (CASSANDRA-5605)
   * Tuning knobs for dealing with large blobs and many CFs (CASSANDRA-5982)
   * (Hadoop) Fix CQLRW for thrift tables (CASSANDRA-6002)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/21ab8f81/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
index d28afc0,a8c1dde..f3e993d
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
@@@ -21,13 -21,13 +21,15 @@@ import java.nio.ByteBuffer
  import java.util.*;
  
  import org.apache.cassandra.db.*;
 -import org.apache.cassandra.db.filter.IDiskAtomFilter;
 -import org.apache.cassandra.dht.AbstractBounds;
 +import org.apache.cassandra.db.filter.ExtendedFilter;
  import org.apache.cassandra.thrift.IndexExpression;
 +import org.apache.cassandra.thrift.IndexOperator;
++import org.apache.cassandra.tracing.Tracing;
++import org.apache.cassandra.utils.FBUtilities;
  
  public abstract class SecondaryIndexSearcher
  {
--    protected final SecondaryIndexManager    indexManager;
++    protected final SecondaryIndexManager indexManager;
      protected final Set<ByteBuffer> columns;
      protected final ColumnFamilyStore baseCfs;
  
@@@ -43,31 -43,15 +45,41 @@@
      /**
       * @return true this index is able to handle given clauses.
       */
 -    public abstract boolean isIndexing(List<IndexExpression> clause);
 -    
 -    protected boolean isIndexValueStale(ColumnFamily liveData, ByteBuffer indexedColumnName,
ByteBuffer indexedValue)
 +    public boolean isIndexing(List<IndexExpression> clause)
      {
 -        IColumn liveColumn = liveData.getColumn(indexedColumnName);
 -        if (liveColumn == null || liveColumn.isMarkedForDelete())
 -            return true;
 -        
 -        ByteBuffer liveValue = liveColumn.value();
 -        return 0 != liveData.metadata().getValueValidator(indexedColumnName).compare(indexedValue,
liveValue);
 +        return highestSelectivityPredicate(clause) != null;
 +    }
 +
 +    protected IndexExpression highestSelectivityPredicate(List<IndexExpression> clause)
 +    {
 +        IndexExpression best = null;
 +        int bestMeanCount = Integer.MAX_VALUE;
++        Map<SecondaryIndex, Integer> candidates = new HashMap<>();
++
 +        for (IndexExpression expression : clause)
 +        {
-             //skip columns belonging to a different index type
-             if(!columns.contains(expression.column_name))
++            // skip columns belonging to a different index type
++            if (!columns.contains(expression.column_name))
 +                continue;
 +
 +            SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
 +            if (index == null || (expression.op != IndexOperator.EQ))
 +                continue;
 +            int columns = index.getIndexCfs().getMeanColumns();
++            candidates.put(index, columns);
 +            if (columns < bestMeanCount)
 +            {
 +                best = expression;
 +                bestMeanCount = columns;
 +            }
 +        }
++
++        if (best == null)
++            Tracing.trace("No applicable indexes found");
++        else
++            Tracing.trace("Candidate index mean cardinalities are {}. Scanning with {}.",
++                          FBUtilities.toString(candidates), indexManager.getIndexForColumn(best.column_name).getIndexName());
++
 +        return best;
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/21ab8f81/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
index 0242fd2,82e227f..aa35605
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
@@@ -24,9 -24,11 +24,12 @@@ import java.util.*
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
 +import org.apache.cassandra.cql3.ColumnNameBuilder;
  import org.apache.cassandra.db.*;
--import org.apache.cassandra.db.filter.*;
 -import org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex;
 -import org.apache.cassandra.db.index.PerColumnSecondaryIndex;
 -import org.apache.cassandra.db.index.SecondaryIndex;
++import org.apache.cassandra.db.filter.ExtendedFilter;
++import org.apache.cassandra.db.filter.IDiskAtomFilter;
++import org.apache.cassandra.db.filter.QueryFilter;
++import org.apache.cassandra.db.filter.SliceQueryFilter;
  import org.apache.cassandra.db.index.SecondaryIndexManager;
  import org.apache.cassandra.db.index.SecondaryIndexSearcher;
  import org.apache.cassandra.db.marshal.CompositeType;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/21ab8f81/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
index 205efb7,7d23e6c..e14f865
--- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
@@@ -19,18 -19,15 +19,19 @@@ package org.apache.cassandra.db.index.k
  
  import java.io.IOException;
  import java.nio.ByteBuffer;
--import java.util.*;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.List;
++import java.util.Set;
 +
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
  
  import org.apache.cassandra.db.*;
--import org.apache.cassandra.db.filter.*;
--import org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex;
--import org.apache.cassandra.db.index.PerColumnSecondaryIndex;
--import org.apache.cassandra.db.index.SecondaryIndex;
--import org.apache.cassandra.db.index.SecondaryIndexManager;
--import org.apache.cassandra.db.index.SecondaryIndexSearcher;
++import org.apache.cassandra.db.filter.ExtendedFilter;
++import org.apache.cassandra.db.filter.IDiskAtomFilter;
++import org.apache.cassandra.db.filter.QueryFilter;
++import org.apache.cassandra.db.index.*;
  import org.apache.cassandra.dht.AbstractBounds;
  import org.apache.cassandra.dht.Range;
  import org.apache.cassandra.thrift.IndexExpression;


Mime
View raw message