cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject [2/2] git commit: Merge branch 'cassandra-1.2' into trunk
Date Sat, 06 Apr 2013 22:34:37 GMT
Merge branch 'cassandra-1.2' into trunk


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

Branch: refs/heads/trunk
Commit: bc6b5f49201fe9c04524a0ba000ceca140caae3d
Parents: 26bcbee 56f35db
Author: Dave Brosius <dbrosius@apache.org>
Authored: Sat Apr 6 18:33:35 2013 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Sat Apr 6 18:33:35 2013 -0400

----------------------------------------------------------------------
 .../apache/cassandra/concurrent/StageManager.java  |    1 -
 .../org/apache/cassandra/config/CFMetaData.java    |    6 ++----
 .../cassandra/cql/CreateColumnFamilyStatement.java |    1 -
 .../org/apache/cassandra/cql3/AbstractMarker.java  |    2 --
 .../org/apache/cassandra/cql3/CFDefinition.java    |    1 -
 .../apache/cassandra/cql3/ColumnNameBuilder.java   |    3 ---
 src/java/org/apache/cassandra/cql3/Constants.java  |    4 ----
 src/java/org/apache/cassandra/cql3/Maps.java       |    1 -
 .../org/apache/cassandra/cql3/QueryProcessor.java  |    1 -
 src/java/org/apache/cassandra/cql3/Term.java       |    5 -----
 .../cassandra/cql3/functions/AbstractFunction.java |    2 --
 .../cassandra/cql3/functions/FunctionCall.java     |    1 -
 .../apache/cassandra/cql3/functions/Functions.java |    2 --
 .../cassandra/cql3/functions/TimeuuidFcts.java     |    4 ----
 .../apache/cassandra/cql3/functions/TokenFct.java  |    2 --
 .../cql3/statements/CreateIndexStatement.java      |    4 ----
 .../cql3/statements/ListUsersStatement.java        |    1 -
 .../cassandra/cql3/statements/SelectStatement.java |    2 --
 src/java/org/apache/cassandra/db/Column.java       |    1 -
 src/java/org/apache/cassandra/db/Directories.java  |    7 +++----
 .../org/apache/cassandra/db/RangeTombstone.java    |    1 -
 src/java/org/apache/cassandra/db/ReadCommand.java  |    4 ----
 .../cassandra/db/SliceByNamesReadCommand.java      |    1 -
 .../apache/cassandra/db/SliceFromReadCommand.java  |    1 -
 src/java/org/apache/cassandra/db/SystemTable.java  |    2 +-
 src/java/org/apache/cassandra/db/Table.java        |    2 --
 .../cassandra/db/commitlog/CommitLogSegment.java   |    5 ++---
 .../db/compaction/AbstractCompactionIterable.java  |    1 -
 .../db/compaction/AbstractCompactionTask.java      |    2 --
 .../cassandra/db/compaction/CompactionManager.java |    9 +++++++--
 .../cassandra/db/compaction/LeveledManifest.java   |    1 -
 .../apache/cassandra/db/compaction/Scrubber.java   |    1 -
 .../apache/cassandra/db/index/SecondaryIndex.java  |    1 -
 .../db/index/composites/CompositesIndex.java       |    1 -
 .../composites/CompositesIndexOnClusteringKey.java |    1 -
 .../composites/CompositesIndexOnPartitionKey.java  |    1 -
 .../index/composites/CompositesIndexOnRegular.java |    1 -
 .../db/index/composites/CompositesSearcher.java    |    4 ----
 .../apache/cassandra/db/index/keys/KeysIndex.java  |    1 -
 .../cassandra/db/index/keys/KeysSearcher.java      |    3 +--
 .../apache/cassandra/db/marshal/AbstractType.java  |    1 -
 .../apache/cassandra/db/marshal/BooleanType.java   |    1 -
 .../apache/cassandra/db/marshal/CompositeType.java |    2 --
 .../cassandra/db/marshal/CounterColumnType.java    |    1 -
 .../org/apache/cassandra/db/marshal/DateType.java  |    1 -
 .../apache/cassandra/db/marshal/TimeUUIDType.java  |    1 -
 .../org/apache/cassandra/db/marshal/UTF8Type.java  |    1 -
 .../org/apache/cassandra/db/marshal/UUIDType.java  |    1 -
 .../io/compress/CompressedRandomAccessReader.java  |    3 ---
 .../io/sstable/SSTableBoundedScanner.java          |    3 ---
 .../cassandra/io/util/RandomAccessReader.java      |    1 -
 .../apache/cassandra/locator/LocalStrategy.java    |    1 -
 .../cassandra/locator/NetworkTopologyStrategy.java |    1 -
 .../locator/OldNetworkTopologyStrategy.java        |    1 -
 .../apache/cassandra/locator/SimpleStrategy.java   |    1 -
 .../cassandra/service/AbstractReadExecutor.java    |    5 -----
 .../apache/cassandra/service/CassandraDaemon.java  |    3 +--
 .../DatacenterSyncWriteResponseHandler.java        |    6 ------
 .../service/DatacenterWriteResponseHandler.java    |    5 -----
 .../apache/cassandra/service/MigrationManager.java |    1 -
 .../cassandra/service/WriteResponseHandler.java    |    3 ---
 .../cassandra/streaming/AbstractStreamSession.java |    1 -
 .../apache/cassandra/streaming/FileStreamTask.java |    1 -
 .../cassandra/streaming/StreamOutSession.java      |    2 --
 .../apache/cassandra/thrift/CustomTHsHaServer.java |    3 +--
 .../apache/cassandra/thrift/ThriftClientState.java |    2 --
 .../apache/cassandra/thrift/ThriftValidation.java  |    1 -
 .../cassandra/tools/SSTableLevelResetter.java      |    2 --
 .../apache/cassandra/transport/SimpleClient.java   |    2 --
 .../transport/messages/ExecuteMessage.java         |    1 -
 .../transport/messages/PrepareMessage.java         |    1 -
 .../cassandra/transport/messages/QueryMessage.java |    1 -
 .../transport/messages/ResultMessage.java          |    1 -
 src/java/org/apache/cassandra/utils/UUIDGen.java   |    4 ----
 .../apache/cassandra/config/CFMetaDataTest.java    |    6 ++----
 .../apache/cassandra/cql/jdbc/ClientUtilsTest.java |    1 -
 .../apache/cassandra/db/ColumnFamilyStoreTest.java |   10 +++++-----
 .../apache/cassandra/db/CounterMutationTest.java   |    2 --
 .../org/apache/cassandra/db/ReadMessageTest.java   |    2 --
 .../cassandra/db/SecondaryIndexColumnSizeTest.java |    2 --
 .../db/compaction/CompactionsPurgeTest.java        |    1 -
 .../db/index/PerRowSecondaryIndexTest.java         |    1 -
 .../cassandra/db/marshal/CompositeTypeTest.java    |    1 -
 .../apache/cassandra/db/marshal/RoundTripTest.java |    3 ---
 .../cassandra/db/marshal/TimeUUIDTypeTest.java     |    1 -
 .../org/apache/cassandra/dht/BootStrapperTest.java |    1 -
 .../apache/cassandra/gms/SerializationsTest.java   |    1 -
 .../cassandra/thrift/ThriftValidationTest.java     |    2 --
 88 files changed, 25 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/CFMetaData.java
index 417929a,31720b2..3ccf641
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@@ -24,9 -23,6 +24,8 @@@ import java.lang.reflect.Method
  import java.nio.ByteBuffer;
  import java.util.*;
  
 +import com.google.common.annotations.VisibleForTesting;
 +import com.google.common.base.Objects;
- import com.google.common.collect.AbstractIterator;
  import com.google.common.collect.MapDifference;
  import com.google.common.collect.Maps;
  import org.apache.commons.lang.ArrayUtils;
@@@ -51,10 -47,9 +50,9 @@@ import org.apache.cassandra.exceptions.
  import org.apache.cassandra.exceptions.InvalidRequestException;
  import org.apache.cassandra.exceptions.RequestValidationException;
  import org.apache.cassandra.exceptions.SyntaxException;
 -import org.apache.cassandra.io.IColumnSerializer;
  import org.apache.cassandra.io.compress.CompressionParameters;
 -import org.apache.cassandra.io.compress.SnappyCompressor;
 +import org.apache.cassandra.io.compress.LZ4Compressor;
- import org.apache.cassandra.io.compress.SnappyCompressor;
 +import org.apache.cassandra.io.sstable.Descriptor;
  import org.apache.cassandra.thrift.IndexType;
  import org.apache.cassandra.tracing.Tracing;
  import org.apache.cassandra.utils.ByteBufferUtil;
@@@ -683,26 -569,6 +681,26 @@@ public final class CFMetaDat
          return caching;
      }
  
 +    public int getIndexInterval()
 +    {
 +        return indexInterval;
 +    }
 +
 +    public SpeculativeRetry getSpeculativeRetry()
 +    {
 +        return speculativeRetry;
 +    }
 +
 +    public int getMemtableFlushPeriod()
 +    {
 +        return memtableFlushPeriod;
 +    }
 +
 +    public int getDefaultTimeToLive()
 +    {
 +        return defaultTimeToLive;
 +    }
-     
++
      public boolean equals(Object obj)
      {
          if (obj == this)
@@@ -1747,166 -1520,21 +1745,166 @@@
          return cqlCfDef;
      }
  
 +    private void rebuildCQL3Metadata()
 +    {
 +        List<ColumnDefinition> pkCols = nullInitializedList(keyValidator.componentsCount());
 +        int nbCkCols = isDense(comparator, column_metadata.values())
 +                     ? comparator.componentsCount()
 +                     : comparator.componentsCount() - (hasCollection() ? 2 : 1);
 +        List<ColumnDefinition> ckCols = nullInitializedList(nbCkCols);
 +        Set<ColumnDefinition> regCols = new HashSet<ColumnDefinition>();
 +        ColumnDefinition compactCol = null;
 +
 +        for (ColumnDefinition def : column_metadata.values())
 +        {
 +            switch (def.type)
 +            {
 +                case PARTITION_KEY:
 +                    assert !(def.componentIndex == null && keyValidator instanceof CompositeType);
 +                    pkCols.set(def.componentIndex == null ? 0 : def.componentIndex, def);
 +                    break;
 +                case CLUSTERING_KEY:
 +                    assert !(def.componentIndex == null && comparator instanceof CompositeType);
 +                    ckCols.set(def.componentIndex == null ? 0 : def.componentIndex, def);
 +                    break;
 +                case REGULAR:
 +                    regCols.add(def);
 +                    break;
 +                case COMPACT_VALUE:
 +                    assert compactCol == null : "There shouldn't be more than one compact value defined";
 +                    compactCol = def;
 +                    break;
 +            }
 +        }
 +
 +        // Now actually assign the correct value. This is not atomic, but then again, updating CFMetaData is never atomic anyway.
 +        partitionKeyColumns = pkCols;
 +        clusteringKeyColumns = ckCols;
 +        regularColumns = regCols;
 +        compactValueColumn = compactCol;
 +    }
 +
 +    private boolean hasCollection()
 +    {
 +        if (isSuper() || !(comparator instanceof CompositeType))
 +            return false;
 +
 +        List<AbstractType<?>> types = ((CompositeType)comparator).types;
 +        return types.get(types.size() - 1) instanceof ColumnToCollectionType;
 +    }
 +
 +    /*
 +     * We call dense a CF for which each component of the comparator is a clustering column, i.e. no
 +     * component is used to store a regular column names. In other words, non-composite static "thrift"
 +     * and CQL3 CF are *not* dense.
 +     * Note that his method is only used by rebuildCQL3Metadata. Once said metadata are built, finding
 +     * if a CF is dense amounts more simply to check if clusteringKeyColumns.size() == comparator.componentsCount().
 +     */
 +    private static boolean isDense(AbstractType<?> comparator, Collection<ColumnDefinition> defs)
 +    {
 +        /*
 +         * This is a bit subtle to compute because of thrift upgrades. A CQL3
 +         * CF will have all it's column metadata set up from creation, so
 +         * checking isDense should just be looking the ColumnDefinition of
 +         * type CLUSTERING_KEY having the biggest componentIndex and comparing that
 +         * to comparator.componentsCount.
 +         * However, thrift CF will have no or only some (through ALTER RENAME)
 +         * metadata set and we still need to make our best effort at finding whether
 +         * it is intended as a dense CF or not.
 +         */
 +
-         // First, we compute the number of clustering columns metadata actually defined (and 
++        // First, we compute the number of clustering columns metadata actually defined (and
 +        // whether there is some "hole" in the metadata)
 +        boolean[] definedClusteringKeys = new boolean[comparator.componentsCount()];
 +        boolean hasRegular = false;
 +        for (ColumnDefinition def : defs)
 +        {
 +            switch (def.type)
 +            {
 +                case CLUSTERING_KEY:
 +                    definedClusteringKeys[def.componentIndex == null ? 0 : def.componentIndex] = true;
 +                    break;
 +                case REGULAR:
 +                    hasRegular = true;
 +                    break;
 +            }
 +        }
 +        boolean hasNulls = false;
 +        int maxIdx = -1;
 +        for (int i = definedClusteringKeys.length - 1; i >= 0; i--)
 +        {
 +            if (maxIdx == -1)
 +            {
 +                if (definedClusteringKeys[i])
 +                    maxIdx = i;
 +            }
 +            else
 +            {
 +                if (!definedClusteringKeys[i])
 +                    hasNulls = true;
 +            }
 +        }
 +
 +        if (comparator instanceof CompositeType)
 +        {
 +            List<AbstractType<?>> types = ((CompositeType)comparator).types;
 +            /*
 +             * There was no real way to define a non-dense composite CF in thrift (the ColumnDefinition.componentIndex
 +             * is not exposed), so consider dense anything that don't look like a CQL3 created CF.
 +             *
 +             * Note that this is not perfect: if someone upgrading from thrift "renames" all but
 +             * the last column alias, the cf will be considered "sparse" and he will be stuck with
 +             * that even though that might not be what he wants. But the simple workaround is
 +             * for that user to rename all the aliases at the same time in the first place.
 +             */
 +            AbstractType<?> lastType = types.get(types.size() - 1);
 +            if (lastType instanceof ColumnToCollectionType)
 +                return false;
 +
 +            return !(maxIdx == types.size() - 2 && lastType instanceof UTF8Type && !hasNulls);
 +        }
 +        else
 +        {
 +            /*
 +             * For non-composite, we only need to "detect" case where the CF is clearly used as static.
 +             * For that, just check if we have regular columns metadata sets up and no defined clustering key.
 +             */
 +            return !(hasRegular && maxIdx == -1);
 +        }
 +    }
 +
 +    private static <T> List<T> nullInitializedList(int size)
 +    {
 +        List<T> l = new ArrayList(size);
 +        for (int i = 0; i < size; ++i)
 +            l.add(null);
 +        return l;
 +    }
 +
      /**
 -     * Returns whether this CFMetaData has information non exposed on thrift so
 -     * that it cannot be correctly handled automatically by thrift clients.
 +     * Returns whether this CFMetaData can be fully translated to a thrift
 +     * definition, i.e. if it doesn't store information that have an equivalent
 +     * in thrift CfDef.
       */
 -    public boolean isThriftIncompatible()
 +    public boolean isThriftCompatible()
      {
 -        if (!cqlCfDef.isComposite)
 -            return false;
 +        // Super CF are always "thrift compatible". But since they may have defs with a componentIndex != null,
 +        // we have to special case here.
 +        if (isSuper())
 +            return true;
  
 -        for (ColumnDefinition columnDef : column_metadata.values())
 +        for (ColumnDefinition def : column_metadata.values())
          {
 -            if (columnDef.componentIndex != null)
 -                return true;
 +            if (!def.isThriftCompatible())
 +                return false;
          }
 -        return false;
 +        return true;
 +    }
 +
 +    public void validateColumns(Iterable<Column> columns)
 +    {
 +        for (Column column : columns)
 +            column.validateFields(this);
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
index 00d8352,3221e48..2f04c38
--- a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
@@@ -19,7 -19,7 +19,6 @@@ package org.apache.cassandra.cql
  
  import java.nio.ByteBuffer;
  import java.util.ArrayList;
--import java.util.Collections;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/CFDefinition.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/Constants.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/Constants.java
index 274db70,096c0a8..3cdcb46
--- a/src/java/org/apache/cassandra/cql3/Constants.java
+++ b/src/java/org/apache/cassandra/cql3/Constants.java
@@@ -27,7 -24,7 +24,6 @@@ import org.slf4j.Logger
  import org.slf4j.LoggerFactory;
  
  import org.apache.cassandra.db.ColumnFamily;
--import org.apache.cassandra.db.filter.QueryPath;
  import org.apache.cassandra.db.marshal.AbstractType;
  import org.apache.cassandra.db.marshal.BytesType;
  import org.apache.cassandra.db.marshal.CollectionType;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/QueryProcessor.java
index 052bbe0,7dcd467..d926175
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@@ -30,7 -30,7 +30,6 @@@ import org.apache.cassandra.transport.m
  import org.apache.cassandra.config.*;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.filter.*;
--import org.apache.cassandra.db.marshal.AbstractType;
  import org.apache.cassandra.exceptions.*;
  import org.apache.cassandra.service.ClientState;
  import org.apache.cassandra.service.QueryState;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
index 1acd475,4e0f536..8cd3acd
--- a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
@@@ -18,8 -18,8 +18,6 @@@
  package org.apache.cassandra.cql3.statements;
  
  import java.util.Collections;
--import java.util.HashMap;
--import java.util.Map;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
@@@ -29,8 -29,8 +27,6 @@@ import org.apache.cassandra.config.CFMe
  import org.apache.cassandra.config.ColumnDefinition;
  import org.apache.cassandra.exceptions.ConfigurationException;
  import org.apache.cassandra.cql3.*;
--import org.apache.cassandra.db.index.composites.CompositesIndex;
--import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.exceptions.UnauthorizedException;
  import org.apache.cassandra.service.ClientState;
  import org.apache.cassandra.service.MigrationManager;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Column.java
index 60e6db9,616f3c0..c2ee226
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@@ -24,8 -22,7 +24,7 @@@ import java.net.InetAddress
  import java.nio.ByteBuffer;
  import java.security.MessageDigest;
  import java.util.ArrayList;
--import java.util.Collection;
 +import java.util.Iterator;
  import java.util.List;
  
  import org.apache.cassandra.config.CFMetaData;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/Directories.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/RangeTombstone.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/RangeTombstone.java
index 468588e,1d472c3..4be8006
--- a/src/java/org/apache/cassandra/db/RangeTombstone.java
+++ b/src/java/org/apache/cassandra/db/RangeTombstone.java
@@@ -25,7 -25,7 +25,6 @@@ import java.security.MessageDigest
  import java.util.*;
  
  import org.apache.cassandra.config.CFMetaData;
--import org.apache.cassandra.db.marshal.AbstractType;
  import org.apache.cassandra.db.marshal.MarshalException;
  import org.apache.cassandra.io.ISSTableSerializer;
  import org.apache.cassandra.io.sstable.Descriptor;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/ReadCommand.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ReadCommand.java
index 55ec58d,294da69..3cff8b6
--- a/src/java/org/apache/cassandra/db/ReadCommand.java
+++ b/src/java/org/apache/cassandra/db/ReadCommand.java
@@@ -21,17 -21,13 +21,14 @@@ import java.io.DataInput
  import java.io.DataOutput;
  import java.io.IOException;
  import java.nio.ByteBuffer;
--import java.util.HashMap;
--import java.util.Map;
  
 +import org.apache.cassandra.config.CFMetaData;
  import org.apache.cassandra.config.DatabaseDescriptor;
 +import org.apache.cassandra.config.Schema;
  import org.apache.cassandra.db.filter.IDiskAtomFilter;
 -import org.apache.cassandra.db.filter.QueryPath;
 -import org.apache.cassandra.db.marshal.AbstractType;
 +import org.apache.cassandra.db.filter.NamesQueryFilter;
 +import org.apache.cassandra.db.filter.SliceQueryFilter;
- import org.apache.cassandra.db.marshal.AbstractType;
 +import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.io.IVersionedSerializer;
  import org.apache.cassandra.net.MessageOut;
  import org.apache.cassandra.net.MessagingService;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
index 82ba720,bb3b7b9..909ba76
--- a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
@@@ -19,16 -19,13 +19,15 @@@ package org.apache.cassandra.db
  
  import java.io.*;
  import java.nio.ByteBuffer;
--import java.util.*;
  
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.Schema;
  import org.apache.cassandra.db.filter.*;
  import org.apache.cassandra.db.marshal.AbstractType;
 +import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.io.IVersionedSerializer;
 +import org.apache.cassandra.net.MessagingService;
  import org.apache.cassandra.service.StorageService;
 -import org.apache.cassandra.thrift.ColumnParent;
  import org.apache.cassandra.utils.ByteBufferUtil;
  
  public class SliceByNamesReadCommand extends ReadCommand

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SliceFromReadCommand.java
index dfc94ba,889038d..be64ae1
--- a/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
@@@ -31,12 -29,10 +31,11 @@@ import org.apache.cassandra.db.filter.I
  import org.apache.cassandra.db.filter.QueryFilter;
  import org.apache.cassandra.db.filter.QueryPath;
  import org.apache.cassandra.db.filter.SliceQueryFilter;
- import org.apache.cassandra.db.marshal.AbstractType;
 +import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.io.IVersionedSerializer;
 +import org.apache.cassandra.net.MessagingService;
  import org.apache.cassandra.service.RowDataResolver;
  import org.apache.cassandra.service.StorageService;
 -import org.apache.cassandra.thrift.ColumnParent;
  import org.apache.cassandra.utils.ByteBufferUtil;
  
  public class SliceFromReadCommand extends ReadCommand

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SystemTable.java
index 567cf06,2e36aeb..2117f2c
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@@ -46,11 -43,10 +46,11 @@@ import org.apache.cassandra.db.marshal.
  import org.apache.cassandra.dht.Range;
  import org.apache.cassandra.dht.Token;
  import org.apache.cassandra.exceptions.ConfigurationException;
- import org.apache.cassandra.io.sstable.SSTableReader;
  import org.apache.cassandra.io.util.DataOutputBuffer;
++import org.apache.cassandra.io.sstable.SSTableReader;
  import org.apache.cassandra.locator.IEndpointSnitch;
  import org.apache.cassandra.service.StorageService;
 -import org.apache.cassandra.thrift.Constants;
 +import org.apache.cassandra.thrift.cassandraConstants;
  import org.apache.cassandra.utils.*;
  
  import static org.apache.cassandra.cql3.QueryProcessor.processInternal;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/Table.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Table.java
index 2366d3d,c718586..a6dc92f
--- a/src/java/org/apache/cassandra/db/Table.java
+++ b/src/java/org/apache/cassandra/db/Table.java
@@@ -23,7 -23,7 +23,6 @@@ import java.nio.ByteBuffer
  import java.util.*;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.concurrent.ConcurrentMap;
--import java.util.concurrent.ExecutionException;
  import java.util.concurrent.Future;
  import java.util.concurrent.locks.ReentrantReadWriteLock;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index 45bede3,c0c7918..df3d257
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@@ -30,7 -29,7 +30,6 @@@ import java.util.UUID
  import java.util.concurrent.atomic.AtomicInteger;
  import java.util.zip.Checksum;
  
--import org.apache.cassandra.utils.FBUtilities;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
@@@ -383,14 -376,14 +382,14 @@@ public class CommitLogSegmen
          return buffer.position();
      }
  
--    
++
      public static class CommitLogSegmentFileComparator implements Comparator<File>
      {
          public int compare(File f, File f2)
          {
              CommitLogDescriptor desc = CommitLogDescriptor.fromFileName(f.getName());
              CommitLogDescriptor desc2 = CommitLogDescriptor.fromFileName(f2.getName());
--            return (int) (desc.id - desc2.id);        
++            return (int) (desc.id - desc2.id);
          }
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 96ea54d,1d273b6..0a05ef2
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@@ -26,7 -28,8 +26,11 @@@ import javax.management.MBeanServer
  import javax.management.ObjectName;
  
  import com.google.common.base.Throwables;
- import com.google.common.collect.*;
++import com.google.common.collect.ArrayListMultimap;
+ import com.google.common.collect.ConcurrentHashMultiset;
++import com.google.common.collect.Iterables;
++import com.google.common.collect.Multimap;
+ import com.google.common.collect.Multiset;
  import com.google.common.primitives.Longs;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
@@@ -47,7 -52,8 +51,8 @@@ import org.apache.cassandra.dht.Token
  import org.apache.cassandra.io.sstable.*;
  import org.apache.cassandra.io.util.FileUtils;
  import org.apache.cassandra.metrics.CompactionMetrics;
 -import org.apache.cassandra.service.AntiEntropyService;
 +import org.apache.cassandra.service.ActiveRepairService;
+ import org.apache.cassandra.service.CacheService;
  import org.apache.cassandra.service.StorageService;
  import org.apache.cassandra.utils.CloseableIterator;
  import org.apache.cassandra.utils.CounterId;
@@@ -983,15 -1136,11 +988,15 @@@ public class CompactionManager implemen
  
      /**
       * Try to stop all of the compactions for given ColumnFamilies.
-      * 
 -     * Note that this method does not wait indefinitely for all compactions to finish, maximum wait time is 30 secs.
++     *
 +     * Note that this method does not wait for all compactions to finish; you'll need to loop against
 +     * isCompacting if you want that behavior.
       *
       * @param columnFamilies The ColumnFamilies to try to stop compaction upon.
 +     * @param interruptValidation true if validation operations for repair should also be interrupted
 +     *
       */
 -    public void stopCompactionFor(Collection<CFMetaData> columnFamilies)
 +    public void interruptCompactionFor(Iterable<CFMetaData> columnFamilies, boolean interruptValidation)
      {
          assert columnFamilies != null;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
index e9cd73f,dd186d4..f34ec80
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@@ -34,10 -38,11 +34,9 @@@ import org.slf4j.LoggerFactory
  
  import org.apache.cassandra.db.ColumnFamilyStore;
  import org.apache.cassandra.db.RowPosition;
- import org.apache.cassandra.db.Table;
  import org.apache.cassandra.dht.Bounds;
  import org.apache.cassandra.dht.Token;
 -import org.apache.cassandra.io.FSWriteError;
 -import org.apache.cassandra.io.sstable.SSTable;
 -import org.apache.cassandra.io.sstable.SSTableReader;
 +import org.apache.cassandra.io.sstable.*;
  import org.apache.cassandra.io.util.FileUtils;
  
  public class LeveledManifest

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/compaction/Scrubber.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/Scrubber.java
index 5e77a46,0601857..f87a626
--- a/src/java/org/apache/cassandra/db/compaction/Scrubber.java
+++ b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
@@@ -23,7 -23,7 +23,6 @@@ import java.util.*
  
  import com.google.common.base.Throwables;
  
--import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.io.sstable.*;
  import org.apache.cassandra.io.util.FileUtils;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index 2153ff9,315ee77..06633c2
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -37,7 -36,7 +37,6 @@@ import org.apache.cassandra.db.index.ke
  import org.apache.cassandra.db.index.composites.CompositesIndex;
  import org.apache.cassandra.db.marshal.AbstractType;
  import org.apache.cassandra.db.marshal.BytesType;
--import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.db.marshal.LocalByPartionerType;
  import org.apache.cassandra.dht.*;
  import org.apache.cassandra.io.sstable.ReducingKeyIterator;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java
index d7302f7,f1aa4aa..26ad84d
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java
@@@ -18,17 -18,12 +18,16 @@@
  package org.apache.cassandra.db.index.composites;
  
  import java.nio.ByteBuffer;
 +import java.util.HashMap;
 +import java.util.Map;
  import java.util.Set;
  
 +import org.apache.cassandra.config.CFMetaData;
  import org.apache.cassandra.config.ColumnDefinition;
 +import org.apache.cassandra.cql3.ColumnNameBuilder;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex;
--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.marshal.*;
  import org.apache.cassandra.exceptions.ConfigurationException;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
index f1df078,0000000..8ad990e
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
@@@ -1,116 -1,0 +1,115 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.db.index.composites;
 +
 +import java.nio.ByteBuffer;
 +import java.util.ArrayList;
 +import java.util.List;
 +
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.ColumnDefinition;
 +import org.apache.cassandra.cql3.ColumnNameBuilder;
 +import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.index.SecondaryIndex;
- import org.apache.cassandra.db.index.SecondaryIndexSearcher;
 +import org.apache.cassandra.db.marshal.*;
 +
 +/**
 + * Index on a CLUSTERING_KEY column definition.
 + *
 + * A cell indexed by this index will have the general form:
 + *   ck_0 ... ck_n c_name : v
 + * where ck_i are the cluster keys, c_name the last component of the cell
 + * composite name (or second to last if collections are in use, but this
 + * has no impact) and v the cell value.
 + *
 + * Such a cell is always indexed by this index (or rather, it is indexed if
 + * n >= columnDef.componentIndex, which will always be the case in practice)
 + * and it will generate (makeIndexColumnName()) an index entry whose:
 + *   - row key will be ck_i (getIndexedValue()) where i == columnDef.componentIndex.
 + *   - cell name will
 + *       rk ck_0 ... ck_{i-1} ck_{i+1} ck_n
 + *     where rk is the row key of the initial cell and i == columnDef.componentIndex.
 + */
 +public class CompositesIndexOnClusteringKey extends CompositesIndex
 +{
 +    public static CompositeType buildIndexComparator(CFMetaData baseMetadata, ColumnDefinition columnDef)
 +    {
 +        // Index cell names are rk ck_0 ... ck_{i-1} ck_{i+1} ck_n, so n
 +        // components total (where n is the number of clustering keys)
 +        int ckCount = baseMetadata.clusteringKeyColumns().size();
 +        List<AbstractType<?>> types = new ArrayList<AbstractType<?>>(ckCount);
 +        List<AbstractType<?>> ckTypes = baseMetadata.comparator.getComponents();
 +        types.add(SecondaryIndex.keyComparator);
 +        for (int i = 0; i < columnDef.componentIndex; i++)
 +            types.add(ckTypes.get(i));
 +        for (int i = columnDef.componentIndex + 1; i < ckCount; i++)
 +            types.add(ckTypes.get(i));
 +        return CompositeType.getInstance(types);
 +    }
 +
 +    protected ByteBuffer getIndexedValue(ByteBuffer rowKey, Column column)
 +    {
 +        CompositeType baseComparator = (CompositeType)baseCfs.getComparator();
 +        ByteBuffer[] components = baseComparator.split(column.name());
 +        return components[columnDef.componentIndex];
 +    }
 +
 +    protected ColumnNameBuilder makeIndexColumnNameBuilder(ByteBuffer rowKey, ByteBuffer columnName)
 +    {
 +        int ckCount = baseCfs.metadata.clusteringKeyColumns().size();
 +        CompositeType baseComparator = (CompositeType)baseCfs.getComparator();
 +        ByteBuffer[] components = baseComparator.split(columnName);
 +        CompositeType.Builder builder = getIndexComparator().builder();
 +        builder.add(rowKey);
 +        for (int i = 0; i < columnDef.componentIndex; i++)
 +            builder.add(components[i]);
 +        for (int i = columnDef.componentIndex + 1; i < ckCount; i++)
 +            builder.add(components[i]);
 +        return builder;
 +    }
 +
 +    public IndexedEntry decodeEntry(DecoratedKey indexedValue, Column indexEntry)
 +    {
 +        int ckCount = baseCfs.metadata.clusteringKeyColumns().size();
 +        ByteBuffer[] components = getIndexComparator().split(indexEntry.name());
 +
 +        ColumnNameBuilder builder = getBaseComparator().builder();
 +        for (int i = 0; i < columnDef.componentIndex; i++)
 +            builder.add(components[i + 1]);
 +
 +        builder.add(indexedValue.key);
 +
 +        for (int i = columnDef.componentIndex + 1; i < ckCount; i++)
 +            builder.add(components[i]);
 +
 +        return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), components[0], builder);
 +    }
 +
 +    @Override
 +    public boolean indexes(ByteBuffer name)
 +    {
 +        // For now, assume this is only used in CQL3 when we know name has enough component.
 +        return true;
 +    }
 +
 +    public boolean isStale(IndexedEntry entry, ColumnFamily data)
 +    {
 +        return data == null || data.hasOnlyTombstones();
 +    }
 +}
 +

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
index fce7700,0000000..2034c71
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
@@@ -1,105 -1,0 +1,104 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.db.index.composites;
 +
 +import java.nio.ByteBuffer;
 +import java.util.ArrayList;
 +import java.util.List;
 +
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.ColumnDefinition;
 +import org.apache.cassandra.cql3.ColumnNameBuilder;
 +import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.index.SecondaryIndex;
- import org.apache.cassandra.db.index.SecondaryIndexSearcher;
 +import org.apache.cassandra.db.marshal.*;
 +
 +/**
 + * Index on a PARTITION_KEY column definition.
 + *
 + * This suppose a composite row key:
 + *   rk = rk_0 ... rk_n
 + *
 + * The corresponding index entry will be:
 + *   - index row key will be rk_i (where i == columnDef.componentIndex)
 + *   - cell name will be: rk ck
 + *     where rk is the fully partition key and ck the clustering keys of the
 + *     original cell names (thus excluding the last column name as we want to refer to
 + *     the whole CQL3 row, not just the cell itself)
 + *
 + * Note that contrarily to other type of index, we repeat the indexed value in
 + * the index cell name (we use the whole partition key). The reason is that we
 + * want to order the index cell name by partitioner first, and skipping a part
 + * of the row key would change the order.
 + */
 +public class CompositesIndexOnPartitionKey extends CompositesIndex
 +{
 +    public static CompositeType buildIndexComparator(CFMetaData baseMetadata, ColumnDefinition columnDef)
 +    {
 +        int ckCount = baseMetadata.clusteringKeyColumns().size();
 +        List<AbstractType<?>> types = new ArrayList<AbstractType<?>>(ckCount + 1);
 +        types.add(SecondaryIndex.keyComparator);
 +        types.addAll(baseMetadata.comparator.getComponents());
 +        return CompositeType.getInstance(types);
 +    }
 +
 +    protected ByteBuffer getIndexedValue(ByteBuffer rowKey, Column column)
 +    {
 +        CompositeType keyComparator = (CompositeType)baseCfs.metadata.getKeyValidator();
 +        ByteBuffer[] components = keyComparator.split(rowKey);
 +        return components[columnDef.componentIndex];
 +    }
 +
 +    protected ColumnNameBuilder makeIndexColumnNameBuilder(ByteBuffer rowKey, ByteBuffer columnName)
 +    {
 +        int ckCount = baseCfs.metadata.clusteringKeyColumns().size();
 +        CompositeType baseComparator = (CompositeType)baseCfs.getComparator();
 +        ByteBuffer[] components = baseComparator.split(columnName);
 +        CompositeType.Builder builder = getIndexComparator().builder();
 +        builder.add(rowKey);
 +        for (int i = 0; i < ckCount; i++)
 +            builder.add(components[i]);
 +        return builder;
 +    }
 +
 +    public IndexedEntry decodeEntry(DecoratedKey indexedValue, Column indexEntry)
 +    {
 +        int ckCount = baseCfs.metadata.clusteringKeyColumns().size();
 +        ByteBuffer[] components = getIndexComparator().split(indexEntry.name());
 +
 +        ColumnNameBuilder builder = getBaseComparator().builder();
 +        for (int i = 0; i < ckCount; i++)
 +            builder.add(components[i + 1]);
 +
 +        return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), components[0], builder);
 +    }
 +
 +    @Override
 +    public boolean indexes(ByteBuffer name)
 +    {
 +        // Since a partition key is always full, we always index it
 +        return true;
 +    }
 +
 +    public boolean isStale(IndexedEntry entry, ColumnFamily data)
 +    {
 +        return data == null || data.hasOnlyTombstones();
 +    }
 +}
 +
 +

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnRegular.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnRegular.java
index 03649c0,0000000..40a2ee1
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnRegular.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnRegular.java
@@@ -1,105 -1,0 +1,104 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.db.index.composites;
 +
 +import java.nio.ByteBuffer;
 +import java.util.ArrayList;
 +import java.util.List;
 +
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.ColumnDefinition;
 +import org.apache.cassandra.cql3.ColumnNameBuilder;
 +import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.index.SecondaryIndex;
- import org.apache.cassandra.db.index.SecondaryIndexSearcher;
 +import org.apache.cassandra.db.marshal.*;
 +
 +/**
 + * Index on a REGULAR column definition on a composite type.
 + *
 + * A cell indexed by this index will have the general form:
 + *   ck_0 ... ck_n c_name : v
 + * where ck_i are the cluster keys, c_name the last component of the cell
 + * composite name (or second to last if collections are in use, but this
 + * has no impact) and v the cell value.
 + *
 + * Such a cell is indexed if c_name == columnDef.name, and it will generate
 + * (makeIndexColumnName()) an index entry whose:
 + *   - row key will be the value v (getIndexedValue()).
 + *   - cell name will
 + *       rk ck_0 ... ck_n
 + *     where rk is the row key of the initial cell. I.e. the index entry store
 + *     all the information require to locate back the indexed cell.
 + */
 +public class CompositesIndexOnRegular extends CompositesIndex
 +{
 +    public static CompositeType buildIndexComparator(CFMetaData baseMetadata, ColumnDefinition columnDef)
 +    {
 +        int prefixSize = columnDef.componentIndex;
 +        List<AbstractType<?>> types = new ArrayList<AbstractType<?>>(prefixSize + 1);
 +        types.add(SecondaryIndex.keyComparator);
 +        for (int i = 0; i < prefixSize; i++)
 +            types.add(((CompositeType)baseMetadata.comparator).types.get(i));
 +        return CompositeType.getInstance(types);
 +    }
 +
 +    protected ByteBuffer getIndexedValue(ByteBuffer rowKey, Column column)
 +    {
 +        return column.value();
 +    }
 +
 +    protected ColumnNameBuilder makeIndexColumnNameBuilder(ByteBuffer rowKey, ByteBuffer columnName)
 +    {
 +        CompositeType baseComparator = (CompositeType)baseCfs.getComparator();
 +        ByteBuffer[] components = baseComparator.split(columnName);
 +        CompositeType.Builder builder = getIndexComparator().builder();
 +        builder.add(rowKey);
 +        for (int i = 0; i < Math.min(columnDef.componentIndex, components.length); i++)
 +            builder.add(components[i]);
 +        return builder;
 +    }
 +
 +    public IndexedEntry decodeEntry(DecoratedKey indexedValue, Column indexEntry)
 +    {
 +        ByteBuffer[] components = getIndexComparator().split(indexEntry.name());
 +        CompositeType.Builder builder = getBaseComparator().builder();
 +        for (int i = 0; i < columnDef.componentIndex; i++)
 +            builder.add(components[i + 1]);
 +        return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), components[0], builder);
 +    }
 +
 +    @Override
 +    public boolean indexes(ByteBuffer name)
 +    {
 +        ByteBuffer[] components = getBaseComparator().split(name);
 +        AbstractType<?> comp = baseCfs.metadata.getColumnDefinitionComparator(columnDef);
 +        return components.length > columnDef.componentIndex
 +            && comp.compare(components[columnDef.componentIndex], columnDef.name) == 0;
 +    }
 +
 +    public boolean isStale(IndexedEntry entry, ColumnFamily data)
 +    {
 +        ByteBuffer bb = entry.indexedEntryNameBuilder.copy().add(columnDef.name).build();
 +        Column liveColumn = data.getColumn(bb);
 +        if (liveColumn == null || liveColumn.isMarkedForDelete())
 +            return true;
 +
 +        ByteBuffer liveValue = liveColumn.value();
 +        return columnDef.getValidator().compare(entry.indexValue.key, liveValue) != 0;
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
index 0d8cdb9,4817a00..992061d
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
@@@ -25,15 -24,15 +25,11 @@@ import org.apache.cassandra.cql3.Column
  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.marshal.CompositeType;
  import org.apache.cassandra.dht.AbstractBounds;
--import org.apache.cassandra.dht.Range;
  import org.apache.cassandra.thrift.IndexExpression;
--import org.apache.cassandra.thrift.IndexOperator;
  import org.apache.cassandra.utils.ByteBufferUtil;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
index 190afc1,04c9946..cd89e92
--- a/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
@@@ -20,9 -20,8 +20,8 @@@ package org.apache.cassandra.db.index.k
  import java.nio.ByteBuffer;
  import java.util.Set;
  
--import org.apache.cassandra.config.ColumnDefinition;
 -import org.apache.cassandra.db.IColumn;
 +import org.apache.cassandra.db.ColumnFamily;
 +import org.apache.cassandra.db.Column;
  import org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex;
  import org.apache.cassandra.db.index.SecondaryIndexSearcher;
  import org.apache.cassandra.db.marshal.AbstractType;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
index 9f5c594,4be7988..8901bf5
--- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
@@@ -31,7 -31,7 +31,6 @@@ import org.apache.cassandra.db.index.Se
  import org.apache.cassandra.dht.AbstractBounds;
  import org.apache.cassandra.dht.Range;
  import org.apache.cassandra.thrift.IndexExpression;
--import org.apache.cassandra.thrift.IndexOperator;
  import org.apache.cassandra.utils.ByteBufferUtil;
  import org.apache.cassandra.utils.HeapAllocator;
  import org.slf4j.Logger;
@@@ -159,12 -188,12 +158,12 @@@ public class KeysSearcher extends Secon
                          }
  
                          logger.trace("Returning index hit for {}", dk);
 -                        ColumnFamily data = baseCfs.getColumnFamily(new QueryFilter(dk, path, filter.initialFilter()));
 +                        ColumnFamily data = baseCfs.getColumnFamily(new QueryFilter(dk, baseCfs.name, filter.initialFilter()));
                          // While the column family we'll get in the end should contains the primary clause column, the initialFilter may not have found it and can thus be null
                          if (data == null)
 -                            data = ColumnFamily.create(baseCfs.metadata);
 +                            data = TreeMapBackedSortedColumns.factory.create(baseCfs.metadata);
  
--                        // as in CFS.filter - extend the filter to ensure we include the columns 
++                        // as in CFS.filter - extend the filter to ensure we include the columns
                          // from the index expressions, just in case they weren't included in the initialFilter
                          IDiskAtomFilter extraFilter = filter.getExtraFilter(data);
                          if (extraFilter != null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/marshal/AbstractType.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/marshal/AbstractType.java
index 6804034,cbba89c..93e9309
--- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java
+++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
@@@ -19,11 -19,8 +19,10 @@@ package org.apache.cassandra.db.marshal
  
  import java.nio.ByteBuffer;
  import java.util.Collection;
 +import java.util.Collections;
  import java.util.Comparator;
 +import java.util.List;
  import java.util.Map;
- import java.util.Set;
  
  import org.apache.cassandra.cql3.CQL3Type;
  import org.apache.cassandra.exceptions.SyntaxException;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/io/sstable/SSTableBoundedScanner.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/io/util/RandomAccessReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/RandomAccessReader.java
index 4d7bfbb,3210372..bcf6ae3
--- a/src/java/org/apache/cassandra/io/util/RandomAccessReader.java
+++ b/src/java/org/apache/cassandra/io/util/RandomAccessReader.java
@@@ -24,7 -24,7 +24,6 @@@ import java.nio.channels.FileChannel
  import com.google.common.annotations.VisibleForTesting;
  
  import org.apache.cassandra.io.FSReadError;
--import org.apache.cassandra.utils.CLibrary;
  
  public class RandomAccessReader extends RandomAccessFile implements FileDataInput
  {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/service/AbstractReadExecutor.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/AbstractReadExecutor.java
index 9c17678,0000000..c49dabb
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/service/AbstractReadExecutor.java
+++ b/src/java/org/apache/cassandra/service/AbstractReadExecutor.java
@@@ -1,245 -1,0 +1,240 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.service;
 +
- import java.io.IOException;
 +import java.net.InetAddress;
- import java.util.Arrays;
- import java.util.Comparator;
 +import java.util.List;
 +
 +import org.apache.cassandra.concurrent.Stage;
 +import org.apache.cassandra.concurrent.StageManager;
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.Schema;
 +import org.apache.cassandra.db.ColumnFamilyStore;
 +import org.apache.cassandra.db.ConsistencyLevel;
 +import org.apache.cassandra.db.ReadCommand;
 +import org.apache.cassandra.db.ReadResponse;
 +import org.apache.cassandra.db.Row;
 +import org.apache.cassandra.db.Table;
 +import org.apache.cassandra.exceptions.ReadTimeoutException;
 +import org.apache.cassandra.exceptions.UnavailableException;
 +import org.apache.cassandra.net.MessageOut;
 +import org.apache.cassandra.net.MessagingService;
 +import org.apache.cassandra.service.StorageProxy.LocalReadRunnable;
 +import org.apache.cassandra.utils.FBUtilities;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
- import com.google.common.primitives.Longs;
- 
 +public abstract class AbstractReadExecutor
 +{
 +    private static final Logger logger = LoggerFactory.getLogger(AbstractReadExecutor.class);
 +    protected final ReadCallback<ReadResponse, Row> handler;
 +    protected final ReadCommand command;
 +    protected final RowDigestResolver resolver;
 +    protected final List<InetAddress> unfiltered;
 +    protected final List<InetAddress> endpoints;
 +    protected final ColumnFamilyStore cfs;
 +
 +    AbstractReadExecutor(ColumnFamilyStore cfs,
 +                         ReadCommand command,
 +                         ConsistencyLevel consistency_level,
 +                         List<InetAddress> allReplicas,
 +                         List<InetAddress> queryTargets)
 +    throws UnavailableException
 +    {
 +        unfiltered = allReplicas;
 +        this.endpoints = queryTargets;
 +        this.resolver = new RowDigestResolver(command.table, command.key);
 +        this.handler = new ReadCallback<ReadResponse, Row>(resolver, consistency_level, command, this.endpoints);
 +        this.command = command;
 +        this.cfs = cfs;
 +
 +        handler.assureSufficientLiveNodes();
 +        assert !handler.endpoints.isEmpty();
 +    }
 +
 +    void executeAsync()
 +    {
 +        // The data-request message is sent to dataPoint, the node that will actually get the data for us
 +        InetAddress dataPoint = handler.endpoints.get(0);
 +        if (dataPoint.equals(FBUtilities.getBroadcastAddress()) && StorageProxy.OPTIMIZE_LOCAL_REQUESTS)
 +        {
 +            logger.trace("reading data locally");
 +            StageManager.getStage(Stage.READ).execute(new LocalReadRunnable(command, handler));
 +        }
 +        else
 +        {
 +            logger.trace("reading data from {}", dataPoint);
 +            MessagingService.instance().sendRR(command.createMessage(), dataPoint, handler);
 +        }
 +
 +        if (handler.endpoints.size() == 1)
 +            return;
 +
 +        // send the other endpoints a digest request
 +        ReadCommand digestCommand = command.copy();
 +        digestCommand.setDigestQuery(true);
 +        MessageOut<?> message = null;
 +        for (int i = 1; i < handler.endpoints.size(); i++)
 +        {
 +            InetAddress digestPoint = handler.endpoints.get(i);
 +            if (digestPoint.equals(FBUtilities.getBroadcastAddress()))
 +            {
 +                logger.trace("reading digest locally");
 +                StageManager.getStage(Stage.READ).execute(new LocalReadRunnable(digestCommand, handler));
 +            }
 +            else
 +            {
 +                logger.trace("reading digest from {}", digestPoint);
 +                // (We lazy-construct the digest Message object since it may not be necessary if we
 +                // are doing a local digest read, or no digest reads at all.)
 +                if (message == null)
 +                    message = digestCommand.createMessage();
 +                MessagingService.instance().sendRR(message, digestPoint, handler);
 +            }
 +        }
 +    }
 +
 +    void speculate()
 +    {
 +        // noop by default.
 +    }
 +
 +    Row get() throws ReadTimeoutException, DigestMismatchException
 +    {
 +        return handler.get();
 +    }
 +
 +    public static AbstractReadExecutor getReadExecutor(ReadCommand command, ConsistencyLevel consistency_level) throws UnavailableException
 +    {
 +        Table table = Table.open(command.table);
 +        List<InetAddress> allReplicas = StorageProxy.getLiveSortedEndpoints(table, command.key);
 +        CFMetaData metaData = Schema.instance.getCFMetaData(command.table, command.cfName);
 +        List<InetAddress> queryTargets = consistency_level.filterForQuery(table, allReplicas, metaData.newReadRepairDecision());
 +
 +        if (StorageService.instance.isClientMode())
 +        {
 +            return new DefaultReadExecutor(null, command, consistency_level, allReplicas, queryTargets);
 +        }
 +
 +        ColumnFamilyStore cfs = table.getColumnFamilyStore(command.cfName);
 +
 +        switch (metaData.getSpeculativeRetry().type)
 +        {
 +            case ALWAYS:
 +                return new SpeculateAlwaysExecutor(cfs, command, consistency_level, allReplicas, queryTargets);
 +            case PERCENTILE:
 +            case CUSTOM:
 +                return queryTargets.size() < allReplicas.size()
 +                       ? new SpeculativeReadExecutor(cfs, command, consistency_level, allReplicas, queryTargets)
 +                       : new DefaultReadExecutor(cfs, command, consistency_level, allReplicas, queryTargets);
 +            default:
 +                return new DefaultReadExecutor(cfs, command, consistency_level, allReplicas, queryTargets);
 +        }
 +    }
 +
 +    private static class DefaultReadExecutor extends AbstractReadExecutor
 +    {
 +        public DefaultReadExecutor(ColumnFamilyStore cfs, ReadCommand command, ConsistencyLevel consistency_level, List<InetAddress> allReplicas, List<InetAddress> queryTargets) throws UnavailableException
 +        {
 +            super(cfs, command, consistency_level, allReplicas, queryTargets);
 +        }
 +    }
 +
 +    private static class SpeculativeReadExecutor extends AbstractReadExecutor
 +    {
 +        public SpeculativeReadExecutor(ColumnFamilyStore cfs, ReadCommand command, ConsistencyLevel consistency_level, List<InetAddress> allReplicas, List<InetAddress> queryTargets) throws UnavailableException
 +        {
 +            super(cfs, command, consistency_level, allReplicas, queryTargets);
 +            assert handler.endpoints.size() < unfiltered.size();
 +        }
 +
 +        @Override
 +        void speculate()
 +        {
 +            // no latency information, or we're overloaded
 +            if (cfs.sampleLatency > command.getTimeout())
 +                return;
 +
 +            if (!handler.await(cfs.sampleLatency))
 +            {
 +                InetAddress endpoint = unfiltered.get(handler.endpoints.size());
 +
 +                // could be waiting on the data, or on enough digests
 +                ReadCommand scommand = command;
 +                if (resolver.getData() != null)
 +                {
 +                    scommand = command.copy();
 +                    scommand.setDigestQuery(true);
 +                }
 +
 +                logger.trace("Speculating read retry on {}", endpoint);
 +                MessagingService.instance().sendRR(scommand.createMessage(), endpoint, handler);
 +                cfs.metric.speculativeRetry.inc();
 +            }
 +        }
 +    }
 +
 +    private static class SpeculateAlwaysExecutor extends AbstractReadExecutor
 +    {
 +        public SpeculateAlwaysExecutor(ColumnFamilyStore cfs, ReadCommand command, ConsistencyLevel consistency_level, List<InetAddress> allReplicas, List<InetAddress> queryTargets) throws UnavailableException
 +        {
 +            super(cfs, command, consistency_level, allReplicas, queryTargets);
 +        }
 +
 +        @Override
 +        void executeAsync()
 +        {
 +            int limit = unfiltered.size() >= 2 ? 2 : 1;
 +            for (int i = 0; i < limit; i++)
 +            {
 +                InetAddress endpoint = unfiltered.get(i);
 +                if (endpoint.equals(FBUtilities.getBroadcastAddress()))
 +                {
 +                    logger.trace("reading full data locally");
 +                    StageManager.getStage(Stage.READ).execute(new LocalReadRunnable(command, handler));
 +                }
 +                else
 +                {
 +                    logger.trace("reading full data from {}", endpoint);
 +                    MessagingService.instance().sendRR(command.createMessage(), endpoint, handler);
 +                }
 +            }
 +            if (handler.endpoints.size() <= limit)
 +                return;
 +
 +            ReadCommand digestCommand = command.copy();
 +            digestCommand.setDigestQuery(true);
 +            MessageOut<?> message = digestCommand.createMessage();
 +            for (int i = limit; i < handler.endpoints.size(); i++)
 +            {
 +                // Send the message
 +                InetAddress endpoint = handler.endpoints.get(i);
 +                if (endpoint.equals(FBUtilities.getBroadcastAddress()))
 +                {
 +                    logger.trace("reading data locally, isDigest: {}", command.isDigestQuery());
 +                    StageManager.getStage(Stage.READ).execute(new LocalReadRunnable(digestCommand, handler));
 +                }
 +                else
 +                {
 +                    logger.trace("reading full data from {}, isDigest: {}", endpoint, command.isDigestQuery());
 +                    MessagingService.instance().sendRR(message, endpoint, handler);
 +                }
 +            }
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java
index 7de0abc,1eae488..0d329e7
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@@ -27,10 -27,6 +27,8 @@@ import java.util.concurrent.TimeUnit
  import java.util.concurrent.atomic.AtomicInteger;
  
  import com.google.common.collect.Iterables;
 +import com.google.common.collect.SetMultimap;
 +
- import org.apache.cassandra.db.compaction.LegacyLeveledManifest;
- import org.apache.cassandra.db.compaction.LeveledManifest;
  import org.apache.log4j.PropertyConfigurator;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
@@@ -42,6 -38,6 +40,7 @@@ import org.apache.cassandra.config.Sche
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.commitlog.CommitLog;
  import org.apache.cassandra.db.compaction.CompactionManager;
++import org.apache.cassandra.db.compaction.LegacyLeveledManifest;
  import org.apache.cassandra.io.FSError;
  import org.apache.cassandra.io.util.FileUtils;
  import org.apache.cassandra.thrift.ThriftServer;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/MigrationManager.java
index b9fcddb,127b2b8..d02226a
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@@ -24,7 -24,7 +24,6 @@@ import java.net.InetAddress
  import java.nio.ByteBuffer;
  import java.util.*;
  import java.util.concurrent.CopyOnWriteArrayList;
--import java.util.concurrent.ExecutionException;
  import java.util.concurrent.Future;
  import java.util.concurrent.TimeUnit;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/streaming/FileStreamTask.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
index 4606fbc,a199a27..557a5d8
--- a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
+++ b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
@@@ -22,7 -29,8 +22,6 @@@ import java.util.concurrent.ExecutorSer
  import java.util.concurrent.SynchronousQueue;
  import java.util.concurrent.TimeUnit;
  
--import org.apache.cassandra.utils.FBUtilities;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
@@@ -90,7 -373,7 +89,7 @@@ public class CustomTHsHaServer extends 
                                                                                 TimeUnit.SECONDS,
                                                                                 new SynchronousQueue<Runnable>(),
                                                                                 new NamedThreadFactory("RPC-Thread"), "RPC-THREAD-POOL");
-            THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory) 
 -            TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory)
++           THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory)
                                                                                 .outputTransportFactory(args.outTransportFactory)
                                                                                 .inputProtocolFactory(args.tProtocolFactory)
                                                                                 .outputProtocolFactory(args.tProtocolFactory)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/thrift/ThriftValidation.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/thrift/ThriftValidation.java
index 16fe91a,5882e27..5dc1e44
--- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
@@@ -30,10 -30,8 +30,9 @@@ import org.apache.cassandra.db.filter.N
  import org.apache.cassandra.db.filter.SliceQueryFilter;
  import org.apache.cassandra.db.index.SecondaryIndexManager;
  import org.apache.cassandra.db.marshal.AbstractType;
 +import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.db.marshal.MarshalException;
  import org.apache.cassandra.dht.IPartitioner;
- import org.apache.cassandra.dht.RandomPartitioner;
  import org.apache.cassandra.dht.Token;
  import org.apache.cassandra.service.StorageService;
  import org.apache.cassandra.utils.ByteBufferUtil;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/src/java/org/apache/cassandra/tools/SSTableLevelResetter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/SSTableLevelResetter.java
index 7fe8059,0000000..7598750
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/tools/SSTableLevelResetter.java
+++ b/src/java/org/apache/cassandra/tools/SSTableLevelResetter.java
@@@ -1,80 -1,0 +1,78 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.tools;
 +
 +import java.io.IOException;
 +import java.io.PrintStream;
- import java.util.List;
 +import java.util.Map;
 +import java.util.Set;
 +
 +import org.apache.cassandra.db.Directories;
 +import org.apache.cassandra.db.compaction.LeveledManifest;
 +import org.apache.cassandra.io.sstable.Component;
 +import org.apache.cassandra.io.sstable.Descriptor;
 +import org.apache.cassandra.io.sstable.SSTableMetadata;
- import org.apache.cassandra.io.sstable.SSTableReader;
 +
 +/**
 + * Reset level to 0 on a given set of sstables
 + */
 +public class SSTableLevelResetter
 +{
 +    /**
 +     * @param args a list of sstables whose metadata we are changing
 +     */
 +    public static void main(String[] args) throws IOException
 +    {
 +        PrintStream out = System.out;
 +        if (args.length == 0)
 +        {
 +            out.println("This command should be run with Cassandra stopped!");
 +            out.println("Usage: sstablelevelreset <keyspace> <columnfamily>");
 +            System.exit(1);
 +        }
 +
 +        if (!args[0].equals("--really-reset") || args.length != 3)
 +        {
 +            out.println("This command should be run with Cassandra stopped, otherwise you will get very strange behavior");
 +            out.println("Verify that Cassandra is not running and then execute the command like this:");
 +            out.println("Usage: sstablelevelreset --really-reset <keyspace> <columnfamily>");
 +            System.exit(1);
 +        }
 +
 +        String keyspace = args[1];
 +        String columnfamily = args[2];
 +        Directories directories = Directories.create(keyspace, columnfamily);
 +        boolean foundSSTable = false;
 +        for (Map.Entry<Descriptor, Set<Component>> sstable : directories.sstableLister().list().entrySet())
 +        {
 +            if (sstable.getValue().contains(Component.STATS))
 +            {
 +                foundSSTable = true;
 +                Descriptor descriptor = sstable.getKey();
 +                SSTableMetadata metadata = SSTableMetadata.serializer.deserialize(descriptor);
 +                out.println("Changing level from " + metadata.sstableLevel + " to 0 on " + descriptor.filenameFor(Component.DATA));
 +                LeveledManifest.mutateLevel(metadata, descriptor, descriptor.filenameFor(Component.STATS), 0);
 +            }
 +        }
 +
 +        if (!foundSSTable)
 +        {
 +            out.println("Found no sstables, did you give the correct keyspace/columnfamily?");
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/config/CFMetaDataTest.java
index d6670ed,8ca83ce..1621776
--- a/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
+++ b/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
@@@ -18,11 -18,11 +18,9 @@@
   */
  package org.apache.cassandra.config;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.HashMap;
--import java.util.Map;
  
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.cql3.QueryProcessor;
@@@ -125,15 -125,16 +123,15 @@@ public class CFMetaDataTest extends Sch
      {
          DecoratedKey k = StorageService.getPartitioner().decorateKey(ByteBufferUtil.bytes(cfm.ksName));
  
--        // This is a nasty hack to work around the fact that non-null componentIndex 
++        // This is a nasty hack to work around the fact that non-null componentIndex
          // are only used by CQL (so far) so we don't expose them through thrift
--        // There is a CFM with componentIndex defined in Keyspace2 which is used by 
++        // There is a CFM with componentIndex defined in Keyspace2 which is used by
          // ColumnFamilyStoreTest to verify index repair (CASSANDRA-2897)
 -        for (Map.Entry<ByteBuffer, ColumnDefinition> cMeta: cfm.column_metadata.entrySet())
 +        for (ColumnDefinition def: cfm.allColumns())
          {
 -            // Non-null componentIndex are only used by CQL (so far) so we don't expose
 -            // them through thrift
 -            if (cMeta.getValue().componentIndex != null)
 -                cfm.column_metadata.remove(cMeta.getKey());
 +            // Remove what we know is not thrift compatible
 +            if (!def.isThriftCompatible())
 +                cfm.removeColumnDefinition(def);
          }
  
          // Test thrift conversion

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 8ac0bae,fc18b88..c986c7b
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -417,10 -425,10 +417,10 @@@ public class ColumnFamilyStoreTest exte
  
          Table table = Table.open(keySpace);
          ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
 -        cfs.truncate().get();
 +        cfs.truncateBlocking();
  
          ByteBuffer rowKey = ByteBufferUtil.bytes("k1");
-         ByteBuffer colName = ByteBufferUtil.bytes("birthdate"); 
+         ByteBuffer colName = ByteBufferUtil.bytes("birthdate");
          ByteBuffer val1 = ByteBufferUtil.bytes(1L);
          ByteBuffer val2 = ByteBufferUtil.bytes(2L);
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/CounterMutationTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/CounterMutationTest.java
index e65fd85,10fafa5..82141d8
--- a/test/unit/org/apache/cassandra/db/CounterMutationTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterMutationTest.java
@@@ -26,12 -26,12 +26,10 @@@ import org.junit.Test
  import static org.junit.Assert.fail;
  
  import org.apache.cassandra.db.context.CounterContext;
--import org.apache.cassandra.db.filter.*;
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.utils.*;
  import org.apache.cassandra.Util;
  import static org.apache.cassandra.db.context.CounterContext.ContextState;
--import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
  
  public class CounterMutationTest extends SchemaLoader
  {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/ReadMessageTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ReadMessageTest.java
index 825e52c,4b56b96..87700fe
--- a/test/unit/org/apache/cassandra/db/ReadMessageTest.java
+++ b/test/unit/org/apache/cassandra/db/ReadMessageTest.java
@@@ -22,10 -22,8 +22,8 @@@ import static org.junit.Assert.*
  
  import java.io.*;
  import java.nio.ByteBuffer;
--import java.util.ArrayList;
--import java.util.Arrays;
 +import java.util.SortedSet;
 +import java.util.TreeSet;
  
  import org.junit.Test;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
index 3329300,9629017..a351fd2
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
@@@ -19,7 -19,7 +19,6 @@@
  package org.apache.cassandra.db.compaction;
  
  import java.io.IOException;
--import java.nio.ByteBuffer;
  import java.util.Collection;
  import java.util.concurrent.ExecutionException;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index 4ca84cb,3a4f947..4708bec
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@@ -22,7 -22,7 +22,6 @@@ import org.apache.cassandra.SchemaLoade
  import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.filter.QueryFilter;
--import org.apache.cassandra.db.filter.QueryPath;
  import org.apache.cassandra.exceptions.ConfigurationException;
  import org.apache.cassandra.utils.ByteBufferUtil;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc6b5f49/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
index e4f058c,45ab748..fdf0ebb
--- a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
+++ b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
@@@ -22,8 -22,8 +22,6 @@@ package org.apache.cassandra.thrift
  
  import org.junit.Test;
  
--import java.util.Collections;
--
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.config.*;
  import org.apache.cassandra.db.marshal.AsciiType;


Mime
View raw message