Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
        src/java/org/apache/cassandra/service/StorageProxy.java


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

Branch: refs/heads/trunk
Commit: 2d607324b3a31aa71a15c2cf9f8a4ad62deba08e
Parents: e66e523 133cfd3
Author: Tyler Hobbs <[email protected]>
Authored: Wed Apr 2 15:36:25 2014 -0500
Committer: Tyler Hobbs <[email protected]>
Committed: Wed Apr 2 15:36:25 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                             |  2 ++
 src/java/org/apache/cassandra/service/StorageProxy.java | 12 ++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d607324/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d607324/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageProxy.java
index 932ae25,5a8dc8d..a9d061a
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@@ -1450,21 -1413,16 +1451,28 @@@ public class StorageProxy implements St
          try
          {
              int cql3RowCount = 0;
-             rows = new ArrayList<Row>();
-             List<AbstractBounds<RowPosition>> ranges = 
getRestrictedRanges(command.keyRange);
+             rows = new ArrayList<>();
+ 
+             // when dealing with LocalStrategy keyspaces, we can skip the 
range splitting and merging (which can be
+             // expensive in clusters with vnodes)
+             List<? extends AbstractBounds<RowPosition>> ranges;
+             if (keyspace.getReplicationStrategy() instanceof LocalStrategy)
+                 ranges = command.keyRange.unwrap();
+             else
+                 ranges = getRestrictedRanges(command.keyRange);
  
 +            // our estimate of how many result rows there will be per-range
 +            float resultRowsPerRange = estimateResultRowsPerRange(command, 
keyspace);
 +            // underestimate how many rows we will get per-range in order to 
increase the likelihood that we'll
 +            // fetch enough rows in the first round
 +            resultRowsPerRange -= resultRowsPerRange * 
CONCURRENT_SUBREQUESTS_MARGIN;
 +            int concurrencyFactor = resultRowsPerRange == 0.0
 +                                  ? 1
 +                                  : Math.max(1, Math.min(ranges.size(), (int) 
Math.ceil(command.limit() / resultRowsPerRange)));
 +            logger.debug("Estimated result rows per range: {}; requested 
rows: {}, ranges.size(): {}; concurrent range requests: {}",
 +                         resultRowsPerRange, command.limit(), ranges.size(), 
concurrencyFactor);
 +
 +            boolean haveSufficientRows = false;
              int i = 0;
              AbstractBounds<RowPosition> nextRange = null;
              List<InetAddress> nextEndpoints = null;

Reply via email to