Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CCA541744C for ; Tue, 1 Sep 2015 14:31:22 +0000 (UTC) Received: (qmail 5089 invoked by uid 500); 1 Sep 2015 14:31:06 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 5051 invoked by uid 500); 1 Sep 2015 14:31:06 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 5040 invoked by uid 99); 1 Sep 2015 14:31:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2015 14:31:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 489AEDFF82; Tue, 1 Sep 2015 14:31:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: marcuse@apache.org To: commits@cassandra.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cassandra git commit: Remove unnessary use of streams in IndexTransaction implementations. Date: Tue, 1 Sep 2015 14:31:06 +0000 (UTC) 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 Authored: Mon Aug 24 15:23:37 2015 +0100 Committer: Marcus Eriksson 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(); + } } } }