cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [01/12] git commit: Allow manually specifying start/end tokens in CFIF patch by Paulo Gomes; reviewed by Piotr Kołaczkowski for CASSANDRA-6436
Date Wed, 26 Mar 2014 15:40:42 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 485feefb2 -> 3856c37ad
  refs/heads/cassandra-2.1 eefa14f6c -> 45a6373e4
  refs/heads/trunk a0817d541 -> 228041629


Allow manually specifying start/end tokens in CFIF
patch by Paulo Gomes; reviewed by Piotr Kołaczkowski for CASSANDRA-6436


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

Branch: refs/heads/cassandra-2.0
Commit: 33c78d54b8f5300a6566121fcc99b9209677daae
Parents: 485feef
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Mar 26 10:22:47 2014 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Mar 26 10:24:32 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../hadoop/AbstractColumnFamilyInputFormat.java | 22 +++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/33c78d54/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 65f4f3b..477afd9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.7
+ * (Hadoop) Allow manually specifying start/end tokens in CFIF (CASSANDRA-6436)
  * Fix NPE in MeteredFlusher (CASSANDRA-6820)
  * Fix race processing range scan responses (CASSANDRA-6820)
  * Allow deleting snapshots from dropped keyspaces (CASSANDRA-6821)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/33c78d54/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyInputFormat.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyInputFormat.java b/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyInputFormat.java
index ba79eee..03b1576 100644
--- a/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyInputFormat.java
+++ b/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyInputFormat.java
@@ -141,11 +141,7 @@ public abstract class AbstractColumnFamilyInputFormat<K, Y> extends
InputFormat<
             Range<Token> jobRange = null;
             if (jobKeyRange != null)
             {
-                if (jobKeyRange.start_key == null)
-                {
-                    logger.warn("ignoring jobKeyRange specified without start_key");
-                }
-                else
+                if (jobKeyRange.start_key != null)
                 {
                     if (!partitioner.preservesOrder())
                         throw new UnsupportedOperationException("KeyRange based on keys can
only be used with a order preserving paritioner");
@@ -153,9 +149,19 @@ public abstract class AbstractColumnFamilyInputFormat<K, Y> extends
InputFormat<
                         throw new IllegalArgumentException("only start_key supported");
                     if (jobKeyRange.end_token != null)
                         throw new IllegalArgumentException("only start_key supported");
-                    jobRange = new Range<Token>(partitioner.getToken(jobKeyRange.start_key),
-                                                partitioner.getToken(jobKeyRange.end_key),
-                                                partitioner);
+                    jobRange = new Range<>(partitioner.getToken(jobKeyRange.start_key),
+                                           partitioner.getToken(jobKeyRange.end_key),
+                                           partitioner);
+                }
+                else if (jobKeyRange.start_token != null)
+                {
+                    jobRange = new Range<>(partitioner.getTokenFactory().fromString(jobKeyRange.start_token),
+                                           partitioner.getTokenFactory().fromString(jobKeyRange.end_token),
+                                           partitioner);
+                }
+                else
+                {
+                    logger.warn("ignoring jobKeyRange specified without start_key or start_token");
                 }
             }
 


Mime
View raw message