You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2014/07/18 19:36:37 UTC
[01/17] git commit: Merge branch 'cassandra-2.1'
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 062addb4c -> 337e4a829
refs/heads/cassandra-2.1 e5625fcad -> 0ad170603
refs/heads/cassandra-2.1.0 43c2c169b -> 8fd8832a8
refs/heads/trunk ddc0f66d9 -> 3d9db291a
Merge branch 'cassandra-2.1'
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e5625fca
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e5625fca
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e5625fca
Branch: refs/heads/trunk
Commit: e5625fcad96fa9decef927937e70c2ec39dc96d7
Parents: 7a1edab 5dfee58
Author: Brandon Williams <br...@datastax.com>
Authored: Thu Jul 17 15:59:49 2014 -0500
Committer: Brandon Williams <br...@datastax.com>
Committed: Thu Jul 17 15:59:49 2014 -0500
----------------------------------------------------------------------
bin/cqlsh | 46 +++++++++++++++++++++++++++++++++-------------
build.xml | 12 ++++++++----
2 files changed, 41 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[13/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8fd8832a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8fd8832a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8fd8832a
Branch: refs/heads/cassandra-2.1
Commit: 8fd8832a8723ef5e663834def078ea0afc7ff8d6
Parents: 2215a4f
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:57 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..e514d63 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCount.java b/examples/hadoop_word_count/src/WordCount.java
index ce9565d..f6bca77 100644
--- a/examples/hadoop_word_count/src/WordCount.java
+++ b/examples/hadoop_word_count/src/WordCount.java
@@ -18,8 +18,11 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.*;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.hadoop.ColumnFamilyOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +86,7 @@ public class WordCount extends Configured implements Tool
{
for (Cell cell : columns.values())
{
- String name = ByteBufferUtil.string(cell.name());
+ String name = ByteBufferUtil.string(cell.name().toByteBuffer());
String value = null;
if (name.contains("int"))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountCounters.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountCounters.java b/examples/hadoop_word_count/src/WordCountCounters.java
index 4ea063b..39fb778 100644
--- a/examples/hadoop_word_count/src/WordCountCounters.java
+++ b/examples/hadoop_word_count/src/WordCountCounters.java
@@ -18,8 +18,10 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.SortedMap;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..0ef5341 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[08/17] git commit: Make cql3 word count executable
Posted by br...@apache.org.
Make cql3 word count executable
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bf50717f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bf50717f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bf50717f
Branch: refs/heads/cassandra-2.1
Commit: bf50717fdf688dacac2369607d94e50a4fcbe521
Parents: 43c2c16
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 11 14:20:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:34:39 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[12/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8fd8832a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8fd8832a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8fd8832a
Branch: refs/heads/trunk
Commit: 8fd8832a8723ef5e663834def078ea0afc7ff8d6
Parents: 2215a4f
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:57 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..e514d63 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCount.java b/examples/hadoop_word_count/src/WordCount.java
index ce9565d..f6bca77 100644
--- a/examples/hadoop_word_count/src/WordCount.java
+++ b/examples/hadoop_word_count/src/WordCount.java
@@ -18,8 +18,11 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.*;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.hadoop.ColumnFamilyOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +86,7 @@ public class WordCount extends Configured implements Tool
{
for (Cell cell : columns.values())
{
- String name = ByteBufferUtil.string(cell.name());
+ String name = ByteBufferUtil.string(cell.name().toByteBuffer());
String value = null;
if (name.contains("int"))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountCounters.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountCounters.java b/examples/hadoop_word_count/src/WordCountCounters.java
index 4ea063b..39fb778 100644
--- a/examples/hadoop_word_count/src/WordCountCounters.java
+++ b/examples/hadoop_word_count/src/WordCountCounters.java
@@ -18,8 +18,10 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.SortedMap;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..0ef5341 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[02/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/337e4a82
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/337e4a82
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/337e4a82
Branch: refs/heads/cassandra-2.1
Commit: 337e4a8292d29ea1a07c932d8853ca62939548ed
Parents: 062addb
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:31:17 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:31:17 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
6 files changed, 38 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..cffe272 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..6dd2ba7 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[15/17] git commit: Merge branch 'cassandra-2.1.0' into cassandra-2.1
Posted by br...@apache.org.
Merge branch 'cassandra-2.1.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0ad17060
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0ad17060
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0ad17060
Branch: refs/heads/trunk
Commit: 0ad1706037d799885add47fffa282274e00e6797
Parents: e5625fc 8fd8832
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:36:20 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:36:20 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[17/17] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by br...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3d9db291
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3d9db291
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3d9db291
Branch: refs/heads/trunk
Commit: 3d9db291af2accb34dbd72d6438b0e959e1411da
Parents: ddc0f66 0ad1706
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:36:31 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:36:31 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[10/17] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1.0
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2215a4fd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2215a4fd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2215a4fd
Branch: refs/heads/cassandra-2.1.0
Commit: 2215a4fdc2b46dc35bd957cb491d8146c2ee5562
Parents: bf50717 337e4a8
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:46 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:46 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[07/17] git commit: Make cql3 word count executable
Posted by br...@apache.org.
Make cql3 word count executable
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bf50717f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bf50717f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bf50717f
Branch: refs/heads/cassandra-2.1.0
Commit: bf50717fdf688dacac2369607d94e50a4fcbe521
Parents: 43c2c16
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 11 14:20:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:34:39 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[16/17] git commit: Merge branch 'cassandra-2.1.0' into cassandra-2.1
Posted by br...@apache.org.
Merge branch 'cassandra-2.1.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0ad17060
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0ad17060
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0ad17060
Branch: refs/heads/cassandra-2.1
Commit: 0ad1706037d799885add47fffa282274e00e6797
Parents: e5625fc 8fd8832
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:36:20 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:36:20 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[06/17] git commit: Make cql3 word count executable
Posted by br...@apache.org.
Make cql3 word count executable
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bf50717f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bf50717f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bf50717f
Branch: refs/heads/trunk
Commit: bf50717fdf688dacac2369607d94e50a4fcbe521
Parents: 43c2c16
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 11 14:20:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:34:39 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[04/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/337e4a82
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/337e4a82
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/337e4a82
Branch: refs/heads/cassandra-2.1.0
Commit: 337e4a8292d29ea1a07c932d8853ca62939548ed
Parents: 062addb
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:31:17 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:31:17 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
6 files changed, 38 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..cffe272 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..6dd2ba7 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[11/17] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1.0
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2215a4fd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2215a4fd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2215a4fd
Branch: refs/heads/trunk
Commit: 2215a4fdc2b46dc35bd957cb491d8146c2ee5562
Parents: bf50717 337e4a8
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:46 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:46 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[05/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/337e4a82
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/337e4a82
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/337e4a82
Branch: refs/heads/trunk
Commit: 337e4a8292d29ea1a07c932d8853ca62939548ed
Parents: 062addb
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:31:17 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:31:17 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
6 files changed, 38 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..cffe272 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..6dd2ba7 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[14/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8fd8832a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8fd8832a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8fd8832a
Branch: refs/heads/cassandra-2.1.0
Commit: 8fd8832a8723ef5e663834def078ea0afc7ff8d6
Parents: 2215a4f
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:57 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:57 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
examples/hadoop_word_count/src/WordCount.java | 5 +++-
.../src/WordCountCounters.java | 2 ++
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..e514d63 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCount.java b/examples/hadoop_word_count/src/WordCount.java
index ce9565d..f6bca77 100644
--- a/examples/hadoop_word_count/src/WordCount.java
+++ b/examples/hadoop_word_count/src/WordCount.java
@@ -18,8 +18,11 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.*;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.hadoop.ColumnFamilyOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +86,7 @@ public class WordCount extends Configured implements Tool
{
for (Cell cell : columns.values())
{
- String name = ByteBufferUtil.string(cell.name());
+ String name = ByteBufferUtil.string(cell.name().toByteBuffer());
String value = null;
if (name.contains("int"))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountCounters.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountCounters.java b/examples/hadoop_word_count/src/WordCountCounters.java
index 4ea063b..39fb778 100644
--- a/examples/hadoop_word_count/src/WordCountCounters.java
+++ b/examples/hadoop_word_count/src/WordCountCounters.java
@@ -18,8 +18,10 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.SortedMap;
import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.thrift.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8fd8832a/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..0ef5341 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
[09/17] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1.0
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2215a4fd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2215a4fd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2215a4fd
Branch: refs/heads/cassandra-2.1
Commit: 2215a4fdc2b46dc35bd957cb491d8146c2ee5562
Parents: bf50717 337e4a8
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:35:46 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:35:46 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[03/17] git commit: Fix word count
Posted by br...@apache.org.
Fix word count
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-7200
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/337e4a82
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/337e4a82
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/337e4a82
Branch: refs/heads/cassandra-2.0
Commit: 337e4a8292d29ea1a07c932d8853ca62939548ed
Parents: 062addb
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 18 12:31:17 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 18 12:31:17 2014 -0500
----------------------------------------------------------------------
examples/hadoop_cql3_word_count/README.txt | 6 +++--
.../conf/log4j.properties | 2 +-
.../src/WordCountSetup.java | 5 +++-
examples/hadoop_word_count/README.txt | 6 +++--
.../hadoop_word_count/conf/log4j.properties | 2 +-
.../hadoop_word_count/src/WordCountSetup.java | 25 +++++++++++++++++++-
6 files changed, 38 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index f984b02..e01632b 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -36,8 +36,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/conf/log4j.properties b/examples/hadoop_cql3_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_cql3_word_count/conf/log4j.properties
+++ b/examples/hadoop_cql3_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_cql3_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/src/WordCountSetup.java b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
index ebf7485..cffe272 100644
--- a/examples/hadoop_cql3_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_cql3_word_count/src/WordCountSetup.java
@@ -70,7 +70,10 @@ public class WordCountSetup
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+ String verifyQuery = "select count(*) from system.peers";
+ CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
+
+ long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index cf8a344..9a93908 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -37,8 +37,10 @@ Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
-*If you want to point wordcount at a real cluster, modify the seed
-and listenaddress settings accordingly.
+*It is recommended to turn off vnodes when running Cassandra with hadoop.
+This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
+point wordcount at a real cluster, modify the seed and listenaddress
+settings accordingly.
Troubleshooting
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
index 70f7657..508d60f 100644
--- a/examples/hadoop_word_count/conf/log4j.properties
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-log4j.rootLogger=DEBUG,stdout,F
+log4j.rootLogger=INFO,stdout,F
#stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
http://git-wip-us.apache.org/repos/asf/cassandra/blob/337e4a82/examples/hadoop_word_count/src/WordCountSetup.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java
index e222327..6dd2ba7 100644
--- a/examples/hadoop_word_count/src/WordCountSetup.java
+++ b/examples/hadoop_word_count/src/WordCountSetup.java
@@ -176,10 +176,33 @@ public class WordCountSetup
KsDef ksDef = new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", cfDefList);
ksDef.putToStrategy_options("replication_factor", "1");
client.system_add_keyspace(ksDef);
- int magnitude = client.describe_ring(WordCount.KEYSPACE).size();
+
+ int magnitude = getNumberOfHosts(client);
Uninterruptibles.sleepUninterruptibly(magnitude, TimeUnit.SECONDS);
}
+ private static int getNumberOfHosts(Cassandra.Iface client)
+ throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ {
+ client.set_keyspace("system");
+ SlicePredicate predicate = new SlicePredicate();
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ predicate.setSlice_range(sliceRange);
+
+ KeyRange keyrRange = new KeyRange();
+ keyrRange.setStart_key(new byte[0]);
+ keyrRange.setEnd_key(new byte[0]);
+ //keyrRange.setCount(100);
+
+ ColumnParent parent = new ColumnParent("peers");
+
+ List<KeySlice> ls = client.get_range_slices(parent, predicate, keyrRange, ConsistencyLevel.ONE);
+
+ return ls.size();
+ }
+
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)