cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject cassandra git commit: Remove unnessary use of streams in IndexTransaction implementations.
Date Tue, 01 Sep 2015 14:31:06 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 44e19947f -> 9c0262529


Remove unnessary use of streams in IndexTransaction implementations.

Patch by Sam Tunnicliffe; reviewed by marcuse for CASSANDRA-10218


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

Branch: refs/heads/cassandra-3.0
Commit: 9c02625292ec36519824a5ce4ef2af94db84ecd3
Parents: 44e1994
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Mon Aug 24 15:23:37 2015 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Sep 1 16:29:35 2015 +0200

----------------------------------------------------------------------
 .../cassandra/index/SecondaryIndexManager.java  | 56 ++++++++++----------
 1 file changed, 27 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9c026252/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
index 233a0f2..c776cb7 100644
--- a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
@@ -642,17 +642,20 @@ public class SecondaryIndexManager implements IndexRegistry
 
         public void start()
         {
-            Arrays.stream(indexers).forEach(Index.Indexer::begin);
+            for (Index.Indexer indexer : indexers)
+                indexer.begin();
         }
 
         public void onPartitionDeletion(DeletionTime deletionTime)
         {
-            Arrays.stream(indexers).forEach(h -> h.partitionDelete(deletionTime));
+            for (Index.Indexer indexer : indexers)
+                indexer.partitionDelete(deletionTime);
         }
 
         public void onRangeTombstone(RangeTombstone tombstone)
         {
-            Arrays.stream(indexers) .forEach(h -> h.rangeTombstone(tombstone));
+            for (Index.Indexer indexer : indexers)
+                indexer.rangeTombstone(tombstone);
         }
 
         public void onInserted(Row row)
@@ -696,12 +699,14 @@ public class SecondaryIndexManager implements IndexRegistry
             Rows.diff(diffListener, updated, updated.columns().mergeTo(existing.columns()),
existing);
             Row oldRow = toRemove.build();
             Row newRow = toInsert.build();
-            Arrays.stream(indexers).forEach(i -> i.updateRow(oldRow, newRow));
+            for (Index.Indexer indexer : indexers)
+                indexer.updateRow(oldRow, newRow);
         }
 
         public void commit()
         {
-            Arrays.stream(indexers).forEach(Index.Indexer::finish);
+            for (Index.Indexer indexer : indexers)
+                indexer.finish();
         }
 
         private boolean shouldCleanupOldValue(Cell oldCell, Cell newCell)
@@ -801,17 +806,15 @@ public class SecondaryIndexManager implements IndexRegistry
 
             try (OpOrder.Group opGroup = Keyspace.writeOrder.start())
             {
-                Index.Indexer[] indexers = Arrays.stream(indexes)
-                                                 .map(i -> i.indexerFor(key, nowInSec,
opGroup, Type.COMPACTION))
-                                                 .toArray(Index.Indexer[]::new);
-
-                Arrays.stream(indexers).forEach(Index.Indexer::begin);
-
-                for (Row row : rows)
-                    if (row != null)
-                        Arrays.stream(indexers).forEach(indexer -> indexer.removeRow(row));
-
-                Arrays.stream(indexers).forEach(Index.Indexer::finish);
+                for (Index index : indexes)
+                {
+                    Index.Indexer indexer = index.indexerFor(key, nowInSec, opGroup, Type.COMPACTION);
+                    indexer.begin();
+                    for (Row row : rows)
+                        if (row != null)
+                            indexer.removeRow(row);
+                    indexer.finish();
+                }
             }
         }
     }
@@ -864,19 +867,14 @@ public class SecondaryIndexManager implements IndexRegistry
 
             try (OpOrder.Group opGroup = Keyspace.writeOrder.start())
             {
-                Index.Indexer[] indexers = Arrays.stream(indexes)
-                                                 .map(i -> i.indexerFor(key, nowInSec,
opGroup, Type.CLEANUP))
-                                                 .toArray(Index.Indexer[]::new);
-
-                Arrays.stream(indexers).forEach(Index.Indexer::begin);
-
-                if (partitionDelete != null)
-                    Arrays.stream(indexers).forEach(indexer -> indexer.partitionDelete(partitionDelete));
-
-                if (row != null)
-                    Arrays.stream(indexers).forEach(indexer -> indexer.removeRow(row));
-
-                Arrays.stream(indexers).forEach(Index.Indexer::finish);
+                for (Index index : indexes)
+                {
+                    Index.Indexer indexer = index.indexerFor(key, nowInSec, opGroup, Type.CLEANUP);
+                    indexer.begin();
+                    if (row != null)
+                        indexer.removeRow(row);
+                    indexer.finish();
+                }
             }
         }
     }


Mime
View raw message