cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [4/6] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Thu, 07 May 2015 10:58:28 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/index/SecondaryIndex.java
	test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java


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

Branch: refs/heads/trunk
Commit: 8c5ce66fe32c8bfdc7712b70164948e82592f91e
Parents: b14236f9 6ab0c30
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Thu May 7 11:57:52 2015 +0100
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Thu May 7 11:57:52 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../cassandra/db/index/SecondaryIndex.java      | 13 ++++++++++++
 .../db/index/SecondaryIndexManager.java         |  4 ++--
 .../cassandra/db/ColumnFamilyStoreTest.java     | 21 +++++++++-----------
 .../db/index/PerRowSecondaryIndexTest.java      | 20 +++++++++++++------
 5 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 6363974,d76606c..41e0340
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,22 @@@
 +2.1.6
 + * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
 + * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
 + * Add support for top-k custom 2i queries (CASSANDRA-8717)
 + * Fix error when dropping table during compaction (CASSANDRA-9251)
 + * cassandra-stress supports validation operations over user profiles (CASSANDRA-8773)
 + * Add support for rate limiting log messages (CASSANDRA-9029)
 + * Log the partition key with tombstone warnings (CASSANDRA-8561)
 + * Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271)
 + * Fix PITR commitlog replay (CASSANDRA-9195)
 + * GCInspector logs very different times (CASSANDRA-9124)
 + * Fix deleting from an empty list (CASSANDRA-9198)
 + * Update tuple and collection types that use a user-defined type when that UDT
 +   is modified (CASSANDRA-9148, CASSANDRA-9192)
 + * Use higher timeout for prepair and snapshot in repair (CASSANDRA-9261)
 + * Fix anticompaction blocking ANTI_ENTROPY stage (CASSANDRA-9151)
 +Merged from 2.0:
+ 2.0.15:
+  * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
   * (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
   * Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
   * Fix partition-level-delete-only workload accounting (CASSANDRA-9194)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index 20fdcec,789cc29..2dc0a22
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -304,11 -290,32 +304,24 @@@ public abstract class SecondaryInde
      }
  
      /**
 -     * Returns true if the provided column name is indexed by this secondary index.
 +     * Returns true if the provided cell name is indexed by this secondary index.
+      *
+      * The default implementation checks whether the name is one the columnDef name,
+      * but this should be overriden but subclass if needed.
       */
 -    public boolean indexes(ByteBuffer name)
 -    {
 -        for (ColumnDefinition columnDef : columnDefs)
 -        {
 -            if (baseCfs.getComparator().compare(columnDef.name, name) == 0)
 -                return true;
 -        }
 -        return false;
 -    }
 -    
 +    public abstract boolean indexes(CellName name);
 +
      /**
+      * Returns true if the provided column definition is indexed by this secondary index.
+      *
+      * The default implementation checks whether it is contained in this index column definitions
set.
+      */
+     public boolean indexes(ColumnDefinition cdef)
+     {
+         return columnDefs.contains(cdef);
+     }
+ 
+     /**
       * This is the primary way to create a secondary index instance for a CF column.
       * It will validate the index_options before initializing.
       *

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 84e7d20,2bcead8..5faab78
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -2168,30 -2178,26 +2168,27 @@@ public class ColumnFamilyStoreTest exte
      @Test
      public void testRebuildSecondaryIndex() throws IOException
      {
 -        RowMutation rm;
 -        
 -        rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
 -        rm.add("Indexed1", ByteBufferUtil.bytes("indexed"), ByteBufferUtil.bytes("foo"),
1);
 +        CellName indexedCellName = cellname("indexed");
 +        Mutation rm;
 +
 +        rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
 +        rm.add("Indexed1", indexedCellName, ByteBufferUtil.bytes("foo"), 1);
++
          rm.apply();
          assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
- 
-         ColumnFamilyStore cfs = Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1");
-         cfs.forceBlockingFlush();
- 
+         
+         Keyspace.open("PerRowSecondaryIndex").getColumnFamilyStore("Indexed1").forceBlockingFlush();
+         
          PerRowSecondaryIndexTest.TestIndex.reset();
- 
+         
          ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
          assertTrue(Arrays.equals("k1".getBytes(), PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY.array()));
- 
+         
          PerRowSecondaryIndexTest.TestIndex.reset();
- 
-         ColumnDefinition indexedColumnDef = cfs.metadata.getColumnDefinition(indexedCellName);
-         cfs.indexManager.getIndexForColumn(indexedColumnDef.name.bytes).getColumnDefs().remove(indexedColumnDef);
- 
 -        
+         PerRowSecondaryIndexTest.TestIndex.ACTIVE = false;
          ColumnFamilyStore.rebuildSecondaryIndex("PerRowSecondaryIndex", "Indexed1", PerRowSecondaryIndexTest.TestIndex.class.getSimpleName());
          assertNull(PerRowSecondaryIndexTest.TestIndex.LAST_INDEXED_KEY);
- 
+         
          PerRowSecondaryIndexTest.TestIndex.reset();
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8c5ce66f/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index 0a84b74,1a4b7d4..2e885aa
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@@ -157,6 -128,18 +159,18 @@@ public class PerRowSecondaryIndexTest e
          }
  
          @Override
 -        public boolean indexes(ByteBuffer name)
++        public boolean indexes(CellName name)
+         {
+             return ACTIVE;
+         }
+         
+         @Override
+         public boolean indexes(ColumnDefinition cdef)
+         {
+             return ACTIVE;
+         }
+         
+         @Override
          public void index(ByteBuffer rowKey, ColumnFamily cf)
          {
              QueryFilter filter = QueryFilter.getIdentityFilter(DatabaseDescriptor.getPartitioner().decorateKey(rowKey),


Mime
View raw message