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

[2/6] cassandra git commit: Remove unnecessary ReadCommand.index() method (follow-up to CASSANDRA-13363)

Remove unnecessary ReadCommand.index() method (follow-up to
CASSANDRA-13363)


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

Branch: refs/heads/cassandra-3.11
Commit: ded663622e7861d577bd8ab11ba5e502f57ce038
Parents: 7f297bc
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Wed Aug 30 18:00:38 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Wed Aug 30 18:00:38 2017 +0100

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/ReadCommand.java      | 13 -------------
 .../org/apache/cassandra/db/SecondaryIndexTest.java    | 10 +++++-----
 .../apache/cassandra/io/sstable/SSTableReaderTest.java |  2 +-
 3 files changed, 6 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ded66362/src/java/org/apache/cassandra/db/ReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java
index 66985b6..6a21bb3 100644
--- a/src/java/org/apache/cassandra/db/ReadCommand.java
+++ b/src/java/org/apache/cassandra/db/ReadCommand.java
@@ -297,19 +297,6 @@ public abstract class ReadCommand implements ReadQuery
     }
 
     /**
-     *  Index instance chosen for this query. Can be null.
-     *
-     * @return Index instance chosen for this query. Can be null.
-     */
-    @Nullable
-    public Index index()
-    {
-        return null == index
-             ? null
-             : Keyspace.openAndGetStore(metadata).indexManager.getIndex(index);
-    }
-
-    /**
      * The clustering index filter this command to use for the provided key.
      * <p>
      * Note that that method should only be called on a key actually queried by this command

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ded66362/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
index 2457c4a..adcb68b 100644
--- a/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/SecondaryIndexTest.java
@@ -118,7 +118,7 @@ public class SecondaryIndexTest
                                       .filterOn("birthdate", Operator.EQ, 1L)
                                       .build();
 
-        Index.Searcher searcher = rc.index().searcherFor(rc);
+        Index.Searcher searcher = rc.getIndex(cfs).searcherFor(rc);
         try (ReadOrderGroup orderGroup = rc.startOrderGroup(); UnfilteredPartitionIterator pi = searcher.search(orderGroup))
         {
             assertTrue(pi.hasNext());
@@ -204,7 +204,7 @@ public class SecondaryIndexTest
 
         // verify that it's not being indexed under any other value either
         ReadCommand rc = Util.cmd(cfs).build();
-        assertNull(rc.index());
+        assertNull(rc.getIndex(cfs));
 
         // resurrect w/ a newer timestamp
         new RowUpdateBuilder(cfs.metadata, 2, "k1").clustering("c").add("birthdate", 1L).build().apply();;
@@ -222,13 +222,13 @@ public class SecondaryIndexTest
         // todo - checking the # of index searchers for the command is probably not the best thing to test here
         RowUpdateBuilder.deleteRow(cfs.metadata, 3, "k1", "c").applyUnsafe();
         rc = Util.cmd(cfs).build();
-        assertNull(rc.index());
+        assertNull(rc.getIndex(cfs));
 
         // make sure obsolete mutations don't generate an index entry
         // todo - checking the # of index searchers for the command is probably not the best thing to test here
         new RowUpdateBuilder(cfs.metadata, 3, "k1").clustering("c").add("birthdate", 1L).build().apply();;
         rc = Util.cmd(cfs).build();
-        assertNull(rc.index());
+        assertNull(rc.getIndex(cfs));
     }
 
     @Test
@@ -504,7 +504,7 @@ public class SecondaryIndexTest
         ColumnDefinition cdef = cfs.metadata.getColumnDefinition(col);
 
         ReadCommand rc = Util.cmd(cfs).filterOn(cdef.name.toString(), Operator.EQ, ((AbstractType) cdef.cellValueType()).decompose(val)).build();
-        Index.Searcher searcher = rc.index().searcherFor(rc);
+        Index.Searcher searcher = rc.getIndex(cfs).searcherFor(rc);
         if (count != 0)
             assertNotNull(searcher);
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ded66362/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
index c2598ec..8eefd29 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
@@ -604,7 +604,7 @@ public class SSTableReaderTest
                                              .columns("birthdate")
                                              .filterOn("birthdate", Operator.EQ, 1L)
                                              .build();
-        Index.Searcher searcher = rc.index().searcherFor(rc);
+        Index.Searcher searcher = rc.getIndex(indexedCFS).searcherFor(rc);
         assertNotNull(searcher);
         try (ReadOrderGroup orderGroup = ReadOrderGroup.forCommand(rc))
         {


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