cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [2/5] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Tue, 04 Nov 2014 18:31:43 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
	src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java
	src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java


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

Branch: refs/heads/trunk
Commit: 76478043099998de4870e27b0e421ed8ccf1f4cb
Parents: 5117a5d c345f81
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Nov 4 18:42:53 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Nov 4 18:42:53 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../db/index/AbstractSimplePerColumnSecondaryIndex.java     | 5 +++++
 .../apache/cassandra/db/index/PerColumnSecondaryIndex.java  | 7 ++++++-
 src/java/org/apache/cassandra/db/index/SecondaryIndex.java  | 7 +++++++
 .../apache/cassandra/db/index/SecondaryIndexManager.java    | 4 ++--
 .../db/index/composites/CompositesIndexOnClusteringKey.java | 9 +++++++++
 .../db/index/composites/CompositesIndexOnPartitionKey.java  | 9 +++++++++
 7 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 7fb32fe,2fe3a39..9dbb66b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,22 -1,5 +1,23 @@@
 -2.0.12:
 +2.1.2
 + * Fix issues with CONTAINS (KEY) queries on secondary indexes
 +   (CASSANDRA-8147)
 + * Fix read-rate tracking of sstables for some queries (CASSANDRA-8239)
 + * Fix default timestamp in QueryOptions (CASSANDRA-8246)
 + * Set socket timeout when reading remote version (CASSANDRA-8188)
 + * Refactor how we track live size (CASSANDRA-7852)
 + * Make sure unfinished compaction files are removed (CASSANDRA-8124)
 + * Fix shutdown when run as Windows service (CASSANDRA-8136)
 + * Fix DESCRIBE TABLE with custom indexes (CASSANDRA-8031)
 + * Fix race in RecoveryManagerTest (CASSANDRA-8176)
 + * Avoid IllegalArgumentException while sorting sstables in
 +   IndexSummaryManager (CASSANDRA-8182)
 + * Shutdown JVM on file descriptor exhaustion (CASSANDRA-7579)
 + * Add 'die' policy for commit log and disk failure (CASSANDRA-7927)
 + * Fix installing as service on Windows (CASSANDRA-8115)
 + * Fix CREATE TABLE for CQL2 (CASSANDRA-8144)
 + * Avoid boxing in ColumnStats min/max trackers (CASSANDRA-8109)
 +Merged from 2.0:
+  * Fix deletion for indexes on primary key columns (CASSANDRA-8206)
   * Add 'nodetool statusgossip' (CASSANDRA-8125)
   * Improve client notification that nodes are ready for requests (CASSANDRA-7510)
   * Handle negative timestamp in writetime method (CASSANDRA-8139)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
index d8c03fb,553b9d4..4c398c4
--- a/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
@@@ -87,21 -71,28 +87,26 @@@ public abstract class AbstractSimplePer
      {
          return String.format("'%s.%s %s %s'",
                               baseCfs.name,
 -                             getExpressionComparator().getString(expr.column_name),
 -                             expr.op,
 -                             baseCfs.metadata.getColumnDefinition(expr.column_name).getValidator().getString(expr.value));
 +                             getExpressionComparator().getString(expr.column),
 +                             expr.operator,
 +                             baseCfs.metadata.getColumnDefinition(expr.column).type.getString(expr.value));
      }
  
 -    public void delete(ByteBuffer rowKey, Column column)
 +    public void delete(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)
      {
 -        deleteForCleanup(rowKey, column);
++        deleteForCleanup(rowKey, cell, opGroup);
+     }
+ 
 -    public void deleteForCleanup(ByteBuffer rowKey, Column column)
++    public void deleteForCleanup(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)
+     {
 -        if (column.isMarkedForDelete(System.currentTimeMillis()))
 +        if (!cell.isLive())
              return;
  
 -        DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, column));
 +        DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, cell));
          int localDeletionTime = (int) (System.currentTimeMillis() / 1000);
 -        ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata);
 -        ByteBuffer name = makeIndexColumnName(rowKey, column);
 -        assert name.remaining() > 0 && name.remaining() <= Column.MAX_NAME_LENGTH
: name.remaining();
 -        cfi.addTombstone(name, localDeletionTime, column.timestamp());
 -        indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater);
 +        ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata, false,
1);
 +        cfi.addTombstone(makeIndexColumnName(rowKey, cell), localDeletionTime, cell.timestamp());
 +        indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater, opGroup, null);
          if (logger.isDebugEnabled())
              logger.debug("removed index entry for cleaned-up value {}:{}", valueKey, cfi);
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java
index 79087d2,73f53f1..9740d09
--- a/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java
@@@ -35,9 -34,14 +35,14 @@@ public abstract class PerColumnSecondar
       * @param rowKey the underlying row key which is indexed
       * @param col all the column info
       */
 -    public abstract void delete(ByteBuffer rowKey, Column col);
 +    public abstract void delete(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup);
  
      /**
+      * Called when a column has been removed due to a cleanup operation.
+      */
 -    public abstract void deleteForCleanup(ByteBuffer rowKey, Column col);
++    public abstract void deleteForCleanup(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup);
+ 
+     /**
       * insert a column to the index
       *
       * @param rowKey the underlying row key which is indexed

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index e2bafaa,a83f5dd..044912f
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -18,16 -18,11 +18,17 @@@
  package org.apache.cassandra.db.index;
  
  import java.nio.ByteBuffer;
 -import java.util.*;
 -import java.util.concurrent.*;
 +import java.util.Collection;
 +import java.util.Collections;
 +import java.util.Iterator;
 +import java.util.Set;
 +import java.util.concurrent.ConcurrentHashMap;
 +import java.util.concurrent.Future;
 +import java.util.concurrent.FutureTask;
  
+ import com.google.common.base.Objects;
  import org.apache.commons.lang3.StringUtils;
 +
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index 976bbb8,6d9f28a..7f8e845
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@@ -486,7 -465,7 +486,7 @@@ public class SecondaryIndexManage
                  }
                  else
                  {
-                     ((PerColumnSecondaryIndex) index).delete(key.getKey(), cell, opGroup);
 -                    ((PerColumnSecondaryIndex) index).deleteForCleanup(key.key, column);
++                    ((PerColumnSecondaryIndex) index).deleteForCleanup(key.getKey(), cell,
opGroup);
                  }
              }
          }
@@@ -741,25 -602,24 +741,25 @@@
          {
              this.key = key;
              this.cf = cf;
 +            this.opGroup = opGroup;
          }
  
 -        public void insert(Column column)
 +        public void insert(Cell cell)
          {
 -            if (column.isMarkedForDelete(System.currentTimeMillis()))
 +            if (!cell.isLive())
                  return;
  
 -            for (SecondaryIndex index : indexFor(column.name()))
 +            for (SecondaryIndex index : indexFor(cell.name()))
                  if (index instanceof PerColumnSecondaryIndex)
 -                    ((PerColumnSecondaryIndex) index).insert(key.key, column);
 +                    ((PerColumnSecondaryIndex) index).insert(key.getKey(), cell, opGroup);
          }
  
 -        public void update(Column oldColumn, Column column)
 +        public void update(Cell oldCell, Cell cell)
          {
 -            if (oldColumn.equals(column))
 +            if (oldCell.equals(cell))
                  return;
-             
+ 
 -            for (SecondaryIndex index : indexFor(column.name()))
 +            for (SecondaryIndex index : indexFor(cell.name()))
              {
                  if (index instanceof PerColumnSecondaryIndex)
                  {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
index d967971,564d6bb..0243b0d
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnClusteringKey.java
@@@ -23,13 -23,13 +23,14 @@@ 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.composites.*;
  import org.apache.cassandra.db.index.SecondaryIndex;
  import org.apache.cassandra.db.marshal.*;
++import org.apache.cassandra.utils.concurrent.OpOrder;
  
  /**
 - * Index on a CLUSTERING_KEY column definition.
 + * Index on a CLUSTERING_COLUMN column definition.
   *
   * A cell indexed by this index will have the general form:
   *   ck_0 ... ck_n c_name : v
@@@ -105,4 -112,12 +106,12 @@@ public class CompositesIndexOnClusterin
      {
          return data.hasOnlyTombstones(now);
      }
+ 
+     @Override
 -    public void delete(ByteBuffer rowKey, Column column)
++    public void delete(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)
+     {
+         // We only know that one column of the CQL row has been updated/deleted, but we
don't know if the
+         // full row has been deleted so we should not do anything. If it ends up that the
whole row has
+         // been deleted, it will be eventually cleaned up on read because the entry will
be detected stale.
+     }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76478043/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
index b791545,e8956dc..df43057
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesIndexOnPartitionKey.java
@@@ -23,10 -23,10 +23,11 @@@ 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.composites.*;
  import org.apache.cassandra.db.index.SecondaryIndex;
  import org.apache.cassandra.db.marshal.*;
++import org.apache.cassandra.utils.concurrent.OpOrder;
  
  /**
   * Index on a PARTITION_KEY column definition.
@@@ -96,4 -99,12 +97,12 @@@ public class CompositesIndexOnPartition
      {
          return data.hasOnlyTombstones(now);
      }
+ 
+     @Override
 -    public void delete(ByteBuffer rowKey, Column column)
++    public void delete(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)
+     {
+         // We only know that one column of the CQL row has been updated/deleted, but we
don't know if the
+         // full row has been deleted so we should not do anything. If it ends up that the
whole row has
+         // been deleted, it will be eventually cleaned up on read because the entry will
be detected stale.
+     }
  }


Mime
View raw message