You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by wd...@apache.org on 2018/03/28 22:24:51 UTC

[01/50] kudu git commit: Merge pull request #7 from danburkert/master

Repository: kudu
Updated Branches:
  refs/heads/master d364f01b5 -> c83f6eb35


Merge pull request #7 from danburkert/master

Update quickstart VM user credentials in script output

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

Branch: refs/heads/master
Commit: e45733c521d0950f008917579791db41ba6a62eb
Parents: 43c59d3 f93cba2
Author: jdcryans <jd...@gmail.com>
Authored: Sun Sep 27 15:40:16 2015 -0400
Committer: jdcryans <jd...@gmail.com>
Committed: Sun Sep 27 15:40:16 2015 -0400

----------------------------------------------------------------------
 demo-vm-setup/README.md             | 6 +++---
 demo-vm-setup/setup-kudu-demo-vm.sh | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[08/50] kudu git commit: Turn on logging in examples

Posted by wd...@apache.org.
Turn on logging in examples


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/0a66e237
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/0a66e237
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/0a66e237

Branch: refs/heads/master
Commit: 0a66e237b7f4d3c04c627e62a629fcde8eb108e1
Parents: e8065ef
Author: Mike Percy <mp...@cloudera.com>
Authored: Sun Sep 27 21:56:16 2015 -0400
Committer: Mike Percy <mp...@cloudera.com>
Committed: Sun Sep 27 21:56:16 2015 -0400

----------------------------------------------------------------------
 java/collectl/pom.xml    | 9 +++++++++
 java/java-sample/README  | 2 +-
 java/java-sample/pom.xml | 9 +++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0a66e237/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 70bf48b..a862635 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -54,11 +54,20 @@
   </repositories>
 
   <dependencies>
+
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
       <version>0.5.0</version>
     </dependency>
+
+    <!-- for logging messages -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.12</version>
+    </dependency>
+
   </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/0a66e237/java/java-sample/README
----------------------------------------------------------------------
diff --git a/java/java-sample/README b/java/java-sample/README
index 5d8efb0..71cd034 100644
--- a/java/java-sample/README
+++ b/java/java-sample/README
@@ -5,7 +5,7 @@ its table.
 To build and run, do the following:
 
 $ mvn package
-$ java -jar target/kudu-java-sample-1.0-SNAPSHOT.jar 
+$ java -jar target/kudu-java-sample-1.0-SNAPSHOT.jar
 
 This example assumes that you are running the Quickstart VM with the host name
 "quickstart.cloudera". If you are running against a different cluster, pass the

http://git-wip-us.apache.org/repos/asf/kudu/blob/0a66e237/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index b0aa946..1c224fb 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -54,11 +54,20 @@
   </repositories>
 
   <dependencies>
+
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
       <version>0.5.0</version>
     </dependency>
+
+    <!-- for logging messages -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.12</version>
+    </dependency>
+
   </dependencies>
 
 </project>


[35/50] kudu git commit: Merge pull request #29 from dineshabbi/kudu-setup-demo

Posted by wd...@apache.org.
Merge pull request #29 from dineshabbi/kudu-setup-demo

Allow setup-kudu-demo script to use a pre-built VM image

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/59eb7042
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/59eb7042
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/59eb7042

Branch: refs/heads/master
Commit: 59eb7042d07e7135b6fb81ceef63cba175df5fd4
Parents: 81157cc 5eb22e4
Author: jdcryans <jd...@gmail.com>
Authored: Wed Jan 25 12:56:07 2017 -0800
Committer: GitHub <no...@github.com>
Committed: Wed Jan 25 12:56:07 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[26/50] kudu git commit: Update to 0.10.0 API, update Spark examples

Posted by wd...@apache.org.
Update to 0.10.0 API, update Spark examples

This changes the poms and Java code to use the new org.apache.kudu
package name, updates to 0.10.0, and updates the spark example
in collectl/README to use Spark SQL instead of RDDs.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/3349b9a6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/3349b9a6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/3349b9a6

Branch: refs/heads/master
Commit: 3349b9a690da22524551da6f4aa410941acbfa52
Parents: 02d6eaa
Author: Todd Lipcon <to...@cloudera.com>
Authored: Tue Aug 23 12:10:00 2016 -0700
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Tue Aug 23 12:10:00 2016 -0700

----------------------------------------------------------------------
 java/collectl/README                            | 32 ++++++++------------
 java/collectl/pom.xml                           |  4 +--
 .../examples/collectl/KuduCollectlExample.java  | 24 +++++++--------
 java/insert-loadgen/pom.xml                     |  4 +--
 .../kududb/examples/loadgen/InsertLoadgen.java  | 16 +++++-----
 java/java-sample/pom.xml                        |  4 +--
 .../java/org/kududb/examples/sample/Sample.java |  8 ++---
 7 files changed, 43 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/collectl/README
----------------------------------------------------------------------
diff --git a/java/collectl/README b/java/collectl/README
index e8b7c40..74a2fd7 100644
--- a/java/collectl/README
+++ b/java/collectl/README
@@ -60,29 +60,23 @@ You can install it by running:
 
 Download the Kudu MR jar and run Spark with it on the classpath:
 
-    wget http://d2106.halxg.cloudera.com/kudu-2015-08-13-1/org/kududb/kudu-mapreduce/0.1.0-SNAPSHOT/kudu-mapreduce-0.1.0-20150813.213926-1-jar-with-dependencies.jar
-    spark-shell --jars kudu-mapred*jar
+    wget https://repository.cloudera.com/artifactory/cloudera-repos/org/apache/kudu/kudu-spark_2.10/0.10.0/kudu-spark_2.10-0.10.0.jar
+    spark-shell --jars kudu-spark*jar
 
 You can then paste this example script:
 
-    import org.kududb.mapreduce._
-    import org.apache.hadoop.conf.Configuration
-    import org.kududb.client._
-    import org.apache.hadoop.io.NullWritable;
-    
-    val conf = new Configuration
-    conf.set("kudu.mapreduce.master.address", "quickstart.cloudera");
-    conf.set("kudu.mapreduce.input.table", "metrics");
-    conf.set("kudu.mapreduce.column.projection", "host,metric,timestamp,value");
-    val kuduRdd = sc.newAPIHadoopRDD(conf, classOf[KuduTableInputFormat], classOf[NullWritable], classOf[RowResult])
-    
+    import org.apache.kudu.spark.kudu._
+
+    val df = sqlContext.read.options(Map(
+      "kudu.master" -> "quickstart.cloudera",
+      "kudu.table" -> "metrics")).kudu
+    df.registerTempTable("metrics")
+
     // Print the first five values
-    kuduRdd.values.map(r => r.rowToString()).take(5).foreach(x => print(x + "\n"))
+    sqlContext.sql("select * from metrics limit 5").show()
     
     // Calculate the average value of every host/metric pair
-    (kuduRdd.values.map(r => (r.getString(0) + "/" + r.getString(1), r.getDouble(3))).
-        mapValues(x => (x, 1))
-        .reduceByKey((x, y) => (x._1 + y._1, x._2 + y._2))
-        .mapValues(result => result._1)
-        .take(5))
+    sqlContext.sql("select host, metric, avg(value) from metrics group by host, metric").show()
     
+Note that if you are still running the 'collectl' command above, you can see
+the data changing in real time by re-running the queries.

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 65d1f36..0744dec 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -55,9 +55,9 @@
   <dependencies>
 
     <dependency>
-      <groupId>org.kududb</groupId>
+      <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.9.0</version>
+      <version>0.10.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
----------------------------------------------------------------------
diff --git a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
index 3e1ae29..f7c7d1c 100644
--- a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
+++ b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
@@ -10,18 +10,18 @@ import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.kududb.ColumnSchema;
-import org.kududb.ColumnSchema.ColumnSchemaBuilder;
-import org.kududb.Schema;
-import org.kududb.Type;
-import org.kududb.client.CreateTableOptions;
-import org.kududb.client.Insert;
-import org.kududb.client.KuduClient;
-import org.kududb.client.KuduSession;
-import org.kududb.client.KuduTable;
-import org.kududb.client.OperationResponse;
-import org.kududb.client.RowError;
-import org.kududb.client.SessionConfiguration.FlushMode;
+import org.apache.kudu.ColumnSchema;
+import org.apache.kudu.ColumnSchema.ColumnSchemaBuilder;
+import org.apache.kudu.Schema;
+import org.apache.kudu.Type;
+import org.apache.kudu.client.CreateTableOptions;
+import org.apache.kudu.client.Insert;
+import org.apache.kudu.client.KuduClient;
+import org.apache.kudu.client.KuduSession;
+import org.apache.kudu.client.KuduTable;
+import org.apache.kudu.client.OperationResponse;
+import org.apache.kudu.client.RowError;
+import org.apache.kudu.client.SessionConfiguration.FlushMode;
 
 
 public class KuduCollectlExample {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index fddcdf9..e7a4872 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -55,9 +55,9 @@
   <dependencies>
 
     <dependency>
-      <groupId>org.kududb</groupId>
+      <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.9.0</version>
+      <version>0.10.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
index f7438c0..2b32af1 100644
--- a/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
+++ b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
@@ -1,13 +1,13 @@
 package org.kududb.examples.loadgen;
 
-import org.kududb.Schema;
-import org.kududb.Type;
-import org.kududb.client.Insert;
-import org.kududb.client.KuduClient;
-import org.kududb.client.KuduSession;
-import org.kududb.client.KuduTable;
-import org.kududb.client.PartialRow;
-import org.kududb.client.SessionConfiguration;
+import org.apache.kudu.Schema;
+import org.apache.kudu.Type;
+import org.apache.kudu.client.Insert;
+import org.apache.kudu.client.KuduClient;
+import org.apache.kudu.client.KuduSession;
+import org.apache.kudu.client.KuduTable;
+import org.apache.kudu.client.PartialRow;
+import org.apache.kudu.client.SessionConfiguration;
 
 import java.util.ArrayList;
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index 2f66c99..a948bf3 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -55,9 +55,9 @@
   <dependencies>
 
     <dependency>
-      <groupId>org.kududb</groupId>
+      <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.9.0</version>
+      <version>0.10.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/3349b9a6/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
----------------------------------------------------------------------
diff --git a/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java b/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
index bd4b37b..5c5285f 100644
--- a/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
+++ b/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
@@ -1,9 +1,9 @@
 package org.kududb.examples.sample;
 
-import org.kududb.ColumnSchema;
-import org.kududb.Schema;
-import org.kududb.Type;
-import org.kududb.client.*;
+import org.apache.kudu.ColumnSchema;
+import org.apache.kudu.Schema;
+import org.apache.kudu.Type;
+import org.apache.kudu.client.*;
 
 import java.util.ArrayList;
 import java.util.List;


[47/50] kudu git commit: KUDU-2385: Fix typo in KinitContext::DoRenewal()

Posted by wd...@apache.org.
KUDU-2385: Fix typo in KinitContext::DoRenewal()

On platforms without krb5_get_init_creds_opt_set_out_ccache(),
krb5_cc_store_cred() is called to insert the newly acquired
credential into the ccache. However, there was a typo in the code
which resulted in inserting the old credential into ccache.
This change fixes the typo to make sure the new credential is
inserted into ccache.

Testing done: confirmed on SLES11 that the new credential
is being inserted by checking the 'auth time' of the ticket
in ccache. Impala uses a slightly different #ifdef which
explicitly checks if krb5_get_init_creds_opt_set_out_ccache()
is defined on the platform so this code path is actually
used when running Impala on SLES11.

Change-Id: I3a22b8d41d15eb1982a3fd5b96575e28edaad31c
Reviewed-on: http://gerrit.cloudera.org:8080/9840
Reviewed-by: Todd Lipcon <to...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>


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

Branch: refs/heads/master
Commit: f7ab95e7d70faa07a64e73d9d0bda367e9d4fafc
Parents: 6a323db
Author: Michael Ho <kw...@cloudera.com>
Authored: Wed Mar 28 10:53:24 2018 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Mar 28 20:39:10 2018 +0000

----------------------------------------------------------------------
 src/kudu/security/init.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/f7ab95e7/src/kudu/security/init.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/init.cc b/src/kudu/security/init.cc
index cd15df3..2b50fb2 100644
--- a/src/kudu/security/init.cc
+++ b/src/kudu/security/init.cc
@@ -276,7 +276,7 @@ Status KinitContext::DoRenewal() {
       KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_initialize(g_krb5_ctx, ccache_, principal_),
                                  "Reacquire error: could not init ccache");
 
-      KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_store_cred(g_krb5_ctx, ccache_, &creds),
+      KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_store_cred(g_krb5_ctx, ccache_, &new_creds),
                                  "Reacquire error: could not store creds in cache");
 #endif
     }


[09/50] kudu git commit: Merge pull request #10 from mpercy/master

Posted by wd...@apache.org.
Merge pull request #10 from mpercy/master

Various fixes to the java examples

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

Branch: refs/heads/master
Commit: aac4a91e8f891f34c06bf0ab539ff113207a184b
Parents: aefb1ab 0a66e23
Author: jdcryans <jd...@gmail.com>
Authored: Sun Sep 27 22:11:12 2015 -0400
Committer: jdcryans <jd...@gmail.com>
Committed: Sun Sep 27 22:11:12 2015 -0400

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh             | 56 ++++++++++----------
 java/collectl/pom.xml                           | 27 +++++++---
 .../examples/collectl/KuduCollectlExample.java  | 26 +++++----
 java/java-sample/README                         |  2 +-
 java/java-sample/pom.xml                        | 26 +++++++--
 5 files changed, 84 insertions(+), 53 deletions(-)
----------------------------------------------------------------------



[12/50] kudu git commit: Use final public repository URL for java examples

Posted by wd...@apache.org.
Use final public repository URL for java examples


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

Branch: refs/heads/master
Commit: c5cfe17f421648a26241d39c7a67df9429870e78
Parents: 0a66e23
Author: Mike Percy <mp...@cloudera.com>
Authored: Sun Sep 27 23:38:57 2015 -0400
Committer: Mike Percy <mp...@cloudera.com>
Committed: Sun Sep 27 23:38:57 2015 -0400

----------------------------------------------------------------------
 java/collectl/pom.xml    | 3 +--
 java/java-sample/pom.xml | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/c5cfe17f/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index a862635..4200054 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -45,8 +45,7 @@
     <repository>
       <id>cdh.repo</id>
       <name>Cloudera Repositories</name>
-      <!-- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url> -->
-      <url>http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local</url>
+      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>

http://git-wip-us.apache.org/repos/asf/kudu/blob/c5cfe17f/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index 1c224fb..6e20dce 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -45,8 +45,7 @@
     <repository>
       <id>cdh.repo</id>
       <name>Cloudera Repositories</name>
-      <!-- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url> -->
-      <url>http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local</url>
+      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>


[21/50] kudu git commit: Merge pull request #19 from adembo/work

Posted by wd...@apache.org.
Merge pull request #19 from adembo/work

Update for 0.7.1 release

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

Branch: refs/heads/master
Commit: fa7845442efd1e480293bf953ff5b1c941e29bb1
Parents: 4425e9f c549302
Author: Todd Lipcon <to...@lipcon.org>
Authored: Mon Mar 14 15:43:18 2016 -0700
Committer: Todd Lipcon <to...@lipcon.org>
Committed: Mon Mar 14 15:43:18 2016 -0700

----------------------------------------------------------------------
 java/collectl/pom.xml       | 2 +-
 java/insert-loadgen/pom.xml | 2 +-
 java/java-sample/pom.xml    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[05/50] kudu git commit: Merge pull request #9 from grundprinzip/master

Posted by wd...@apache.org.
Merge pull request #9 from grundprinzip/master

Fix Python example

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

Branch: refs/heads/master
Commit: aefb1abf0a70f5a1038309a7817e1821ec0908b9
Parents: 8aa7d06 afc5f1a
Author: jdcryans <jd...@gmail.com>
Authored: Sun Sep 27 17:32:17 2015 -0400
Committer: jdcryans <jd...@gmail.com>
Committed: Sun Sep 27 17:32:17 2015 -0400

----------------------------------------------------------------------
 clients/install_python_client.sh | 3 ++-
 python/dstat-kudu/README.md      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[16/50] kudu git commit: Update examples dependencies to use the 0.6.0 release

Posted by wd...@apache.org.
Update examples dependencies to use the 0.6.0 release


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/77713fb9
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/77713fb9
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/77713fb9

Branch: refs/heads/master
Commit: 77713fb9847dc072e7fd27a1e58178456fd13da8
Parents: b853815
Author: Mike Percy <mp...@cloudera.com>
Authored: Mon Nov 23 15:55:52 2015 -0800
Committer: Mike Percy <mp...@cloudera.com>
Committed: Mon Nov 23 15:58:18 2015 -0800

----------------------------------------------------------------------
 java/collectl/pom.xml       | 2 +-
 java/insert-loadgen/pom.xml | 2 +-
 java/java-sample/pom.xml    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/77713fb9/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 4200054..fc24660 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.5.0</version>
+      <version>0.6.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/77713fb9/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index 13f5cd5..5e44746 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.5.0</version>
+      <version>0.6.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/77713fb9/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index 6e20dce..090bd74 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.5.0</version>
+      <version>0.6.0</version>
     </dependency>
 
     <!-- for logging messages -->


[27/50] kudu git commit: Fix username in README instructions

Posted by wd...@apache.org.
Fix username in README instructions


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

Branch: refs/heads/master
Commit: b69bb7dab3b858d65f70728d77de9d098a2b2414
Parents: 3349b9a
Author: Todd Lipcon <to...@cloudera.com>
Authored: Tue Aug 23 12:11:03 2016 -0700
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Tue Aug 23 12:11:53 2016 -0700

----------------------------------------------------------------------
 README.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/b69bb7da/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 82438fd..3e4e3af 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,10 @@ download and setup the VM. Simply execute the following command:
 
     curl -s https://raw.githubusercontent.com/cloudera/kudu-examples/master/demo-vm-setup/bootstrap.sh | bash
 
-Once the setup is complete, you can ssh into the machine using
+Once the setup is complete, you can ssh into the machine using the username
+and password 'demo'.
 
-    ssh cloudera@quickstart.cloudera
+    ssh demo@quickstart.cloudera
 
 and you can access this directory containing the examples in the following
 location: `/media/sf_examples`.


[18/50] kudu git commit: Update for 0.7.0 release

Posted by wd...@apache.org.
Update for 0.7.0 release

There's also a new version of the quickstart VM.


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

Branch: refs/heads/master
Commit: 9a22e9f6280094f029c049a7776cce3458150e7f
Parents: 579f7db
Author: Adar Dembo <ad...@cloudera.com>
Authored: Mon Feb 29 18:05:21 2016 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Mon Feb 29 18:05:21 2016 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 java/collectl/pom.xml               | 2 +-
 java/insert-loadgen/pom.xml         | 2 +-
 java/java-sample/pom.xml            | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9a22e9f6/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 540581d..73abcd0 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,7 +8,7 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.4.2-kudu-virtualbox}
+: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.4.9-kudu-virtualbox}
 : ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${VIRTUALBOX_NAME}.ova}
 
 # VM Settings default.

http://git-wip-us.apache.org/repos/asf/kudu/blob/9a22e9f6/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index fc24660..42446da 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.6.0</version>
+      <version>0.7.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/9a22e9f6/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index 5e44746..9dd14ae 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.6.0</version>
+      <version>0.7.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/9a22e9f6/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index 090bd74..f249ce8 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.6.0</version>
+      <version>0.7.0</version>
     </dependency>
 
     <!-- for logging messages -->


[29/50] kudu git commit: Python example update - 0.3.0

Posted by wd...@apache.org.
Python example update - 0.3.0

Updating the dstat example to work with the current
version of the kudu-python package (0.3.0). Works
in both python 2 and 3.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/26b81875
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/26b81875
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/26b81875

Branch: refs/heads/master
Commit: 26b81875168b2ccfd87c965e873bc876f1ad16ef
Parents: 8bf1839
Author: Jordan Birdsell <jo...@gmail.com>
Authored: Mon Sep 26 22:28:23 2016 -0400
Committer: Jordan Birdsell <jo...@gmail.com>
Committed: Wed Sep 28 23:20:23 2016 -0400

----------------------------------------------------------------------
 python/dstat-kudu/kudu_dstat.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/26b81875/python/dstat-kudu/kudu_dstat.py
----------------------------------------------------------------------
diff --git a/python/dstat-kudu/kudu_dstat.py b/python/dstat-kudu/kudu_dstat.py
index 7da8932..f1f5bb2 100644
--- a/python/dstat-kudu/kudu_dstat.py
+++ b/python/dstat-kudu/kudu_dstat.py
@@ -4,16 +4,12 @@ import subprocess
 import sys
 import tempfile
 import time
+from kudu.client import Partitioning
 
 DSTAT_COL_NAMES = ["usr", "sys", "idl", "wai", "hiq", "siq", "read", "writ", "recv", "send",
                   "in","out","int","csw"]
 
 
-def connect_to(host, port=7051):
-  """Returns a kudu client object connecting to the specified kudu master"""
-  return kudu.Client("{0}:{1}".format(host, port))
-
-
 def open_or_create_table(client, table, drop=False):
   """Based on the default dstat column names create a new table indexed by a timstamp col"""
   exists = False
@@ -25,23 +21,27 @@ def open_or_create_table(client, table, drop=False):
 
   if not exists:
     # Create the schema for the table, basically all float cols
-    cols = [kudu.ColumnSchema.create("ts", kudu.INT64)]
-    cols += [kudu.ColumnSchema.create(x, kudu.FLOAT) for x in DSTAT_COL_NAMES]
+    builder = kudu.schema_builder()
+    builder.add_column("ts", kudu.int64, nullable=False, primary_key=True)
+    for col in DSTAT_COL_NAMES:
+      builder.add_column(col, kudu.float_)
+    schema = builder.build()
+
+    # Create hash partitioning buckets
+    partitioning = Partitioning().add_hash_partitions('ts', 2)
 
-    # Based on the column meta data create a new schema object, where the first column
-    # is the key column.
-    schema = kudu.schema_from_list(cols, 1)
-    client.create_table(table, schema)
+    client.create_table(table, schema, partitioning)
 
-  return client.open_table(table)
+  return client.table(table)
 
 def append_row(table, line):
   """The line is the raw string read from stdin, that is then splitted by , and prepended
   with the current timestamp."""
   data = [float(x.strip()) for x in line.split(",")]
 
-  op = table.insert()
-  op["ts"] = int(time.time())
+  op = table.new_insert()
+  # Convert to microseconds
+  op["ts"] = int(time.time() * 1000000)
   for c, v in zip(DSTAT_COL_NAMES, data):
     op[c] = v
   return op
@@ -62,7 +62,7 @@ if __name__ == "__main__":
     if operation in ["drop"]:
       drop = True
 
-  client = connect_to("127.0.0.1")
+  client = kudu.connect("127.0.0.1", 7051)
   table = open_or_create_table(client, "dstat", drop)
 
   # Start dstat


[38/50] kudu git commit: Merge pull request #31 from adembo/work

Posted by wd...@apache.org.
Merge pull request #31 from adembo/work

Update for 5.10.0 release

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/53a882c0
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/53a882c0
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/53a882c0

Branch: refs/heads/master
Commit: 53a882c02d9fcb0eea33a83f785bce0c63e75347
Parents: 472770c 20f7d86
Author: jdcryans <jd...@gmail.com>
Authored: Tue Jan 31 18:53:10 2017 -0800
Committer: GitHub <no...@github.com>
Committed: Tue Jan 31 18:53:10 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[20/50] kudu git commit: Update for 0.7.1 release

Posted by wd...@apache.org.
Update for 0.7.1 release


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

Branch: refs/heads/master
Commit: c549302e843825dcdf22eed93db7b42861c24993
Parents: 4425e9f
Author: Adar Dembo <ad...@cloudera.com>
Authored: Mon Mar 14 14:39:19 2016 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Mon Mar 14 14:39:19 2016 -0700

----------------------------------------------------------------------
 java/collectl/pom.xml       | 2 +-
 java/insert-loadgen/pom.xml | 2 +-
 java/java-sample/pom.xml    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/c549302e/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 42446da..f90faae 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.0</version>
+      <version>0.7.1</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/c549302e/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index 9dd14ae..2d3bb40 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.0</version>
+      <version>0.7.1</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/c549302e/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index f249ce8..183ba2d 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.0</version>
+      <version>0.7.1</version>
     </dependency>
 
     <!-- for logging messages -->


[24/50] kudu git commit: Enable SSE passthrough when starting VM

Posted by wd...@apache.org.
Enable SSE passthrough when starting VM


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

Branch: refs/heads/master
Commit: 5066504412cd350a34db4e8f5de0688b9cf0b777
Parents: 5d3e245
Author: Todd Lipcon <to...@cloudera.com>
Authored: Tue Aug 16 17:00:21 2016 -0700
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Tue Aug 16 17:00:21 2016 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/50665044/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 0dd8571..941343a 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -59,6 +59,10 @@ if ! VBoxManage list vms | grep -q '"kudu-demo"'; then
   VBoxManage sharedfolder add ${VM_NAME} --name examples --hostpath $SHARED_FOLDER_PATH --automount
 fi
 
+# Enable SSE4 pass-through.
+VBoxManage setextradata ${VM_NAME} VBoxInternal/CPUM/SSE4.1 1
+VBoxManage setextradata ${VM_NAME} VBoxInternal/CPUM/SSE4.2 1
+
 # Start the VM
 VBoxManage startvm ${VM_NAME}
 


[33/50] kudu git commit: Fix insert-loadgen example to handle insert errors

Posted by wd...@apache.org.
Fix insert-loadgen example to handle insert errors

This commit makes a few changes:

- multi-threading in insert-loadgen is removed. insert-loadgen used
  separate clients per-thread anyway, so there isn't much advantage to
  running with threads over just starting more instances as separate
  processes. The threading made shutting down on errors harder since the
  shutdown had to be communicated to all threads.
- insert-loadgen now fails on row errors by periodically checking the
  accumulated errors instead of ignoring them.
- All java projects have been updated to use the latest 1.1.0 Kudu
  client.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/4d2c46f2
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/4d2c46f2
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/4d2c46f2

Branch: refs/heads/master
Commit: 4d2c46f236562f0631ce5c6020431e0f93a5f55a
Parents: 81157cc
Author: Dan Burkert <da...@apache.org>
Authored: Tue Dec 6 20:37:10 2016 -0800
Committer: Dan Burkert <da...@apache.org>
Committed: Wed Dec 7 09:51:56 2016 -0800

----------------------------------------------------------------------
 java/collectl/pom.xml                           |  2 +-
 java/insert-loadgen/pom.xml                     |  2 +-
 .../kududb/examples/loadgen/InsertLoadgen.java  | 68 ++++++--------------
 java/java-sample/pom.xml                        |  2 +-
 4 files changed, 22 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/4d2c46f2/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 0744dec..3727201 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.10.0</version>
+      <version>1.1.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/4d2c46f2/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index e7a4872..09bc0d1 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.10.0</version>
+      <version>1.1.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/4d2c46f2/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
index 2b32af1..4b76c34 100644
--- a/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
+++ b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
@@ -1,5 +1,10 @@
 package org.kududb.examples.loadgen;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+
 import org.apache.kudu.Schema;
 import org.apache.kudu.Type;
 import org.apache.kudu.client.Insert;
@@ -9,14 +14,7 @@ import org.apache.kudu.client.KuduTable;
 import org.apache.kudu.client.PartialRow;
 import org.apache.kudu.client.SessionConfiguration;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-
 public class InsertLoadgen {
-
   private static class RandomDataGenerator {
     private final Random rng;
     private final int index;
@@ -50,7 +48,7 @@ public class InsertLoadgen {
           row.addInt(index, rng.nextInt(Integer.MAX_VALUE));
           return;
         case INT64:
-        case TIMESTAMP:
+        case UNIXTIME_MICROS:
           row.addLong(index, rng.nextLong());
           return;
         case BINARY:
@@ -76,10 +74,16 @@ public class InsertLoadgen {
     }
   }
 
-  public static void runLoad(String masterHost, String tableName) {
-    KuduClient client = new KuduClient.KuduClientBuilder(masterHost).build();
+  public static void main(String[] args) throws Exception {
+    if (args.length != 2) {
+      System.err.println("Usage: InsertLoadgen kudu_master_host kudu_table");
+      System.exit(1);
+    }
+
+    String masterHost = args[0];
+    String tableName = args[1];
 
-    try {
+    try (KuduClient client = new KuduClient.KuduClientBuilder(masterHost).build()) {
       KuduTable table = client.openTable(tableName);
       Schema schema = table.getSchema();
       List<RandomDataGenerator> generators = new ArrayList<>(schema.getColumnCount());
@@ -89,52 +93,18 @@ public class InsertLoadgen {
 
       KuduSession session = client.newSession();
       session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
-      while (true) {
+      for (int insertCount = 0; ; insertCount++) {
         Insert insert = table.newInsert();
         PartialRow row = insert.getRow();
         for (int i = 0; i < schema.getColumnCount(); i++) {
           generators.get(i).generateColumnData(row);
         }
         session.apply(insert);
-      }
 
-    } catch (Exception e) {
-      e.printStackTrace();
-    } finally {
-      try {
-        client.shutdown();
-      } catch (Exception e) {
-        e.printStackTrace();
-      }
-    }
-  }
-
-  public static void main(String[] args) {
-    if (args.length != 3) {
-      System.err.println("Usage: InsertLoadgen kudu_master_host kudu_table num_threads");
-      System.exit(1);
-    }
-
-    final String masterHost = args[0];
-    final String tableName = args[1];
-    int numThreads = Integer.parseInt(args[2]);
-
-    final CountDownLatch latch = new CountDownLatch(numThreads);
-
-    List<Thread> threads = new ArrayList<>(numThreads);
-    for (int i = 0; i < numThreads; i++) {
-      threads.add(new Thread(new Runnable() {
-        public void run() {
-          runLoad(masterHost, tableName);
-          latch.countDown();
+        if (insertCount % 1000 == 0 && session.countPendingErrors() > 0) {
+          throw new RuntimeException(session.getPendingErrors().getRowErrors()[0].toString());
         }
-      }));
-      threads.get(i).start();
-    }
-    try {
-      latch.await();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
+      }
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/4d2c46f2/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index a948bf3..b078b04 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.10.0</version>
+      <version>1.1.0</version>
     </dependency>
 
     <!-- for logging messages -->


[06/50] kudu git commit: Update artifact versions and make examples compile again

Posted by wd...@apache.org.
Update artifact versions and make examples compile again

There were some API changes during development so the collectl example
no longer compiled.


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

Branch: refs/heads/master
Commit: e4fc37ac129de39a3f3f5855d2c750093d1b0e39
Parents: aefb1ab
Author: Mike Percy <mp...@cloudera.com>
Authored: Sun Sep 27 18:16:29 2015 -0400
Committer: Mike Percy <mp...@cloudera.com>
Committed: Sun Sep 27 18:39:43 2015 -0400

----------------------------------------------------------------------
 java/collectl/pom.xml                           | 18 +++++++++-----
 .../examples/collectl/KuduCollectlExample.java  | 26 +++++++++-----------
 java/java-sample/pom.xml                        | 17 +++++++++----
 3 files changed, 36 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e4fc37ac/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index 469eca0..70bf48b 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -6,7 +6,7 @@
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>kudu-collectl-example</name>
-  
+
   <build>
     <plugins>
       <plugin>
@@ -40,19 +40,25 @@
       </plugin>
     </plugins>
   </build>
+
   <repositories>
     <repository>
-      <id>kudu-internal</id>
-      <name>Kudu client on Cloudera network</name>
-      <url>http://d2106.halxg.cloudera.com/kudu-2015-08-13-1/</url>
+      <id>cdh.repo</id>
+      <name>Cloudera Repositories</name>
+      <!-- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url> -->
+      <url>http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
     </repository>
   </repositories>
-        
+
   <dependencies>
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.1.0-SNAPSHOT</version>
+      <version>0.5.0</version>
     </dependency>
   </dependencies>
+
 </project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/e4fc37ac/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
----------------------------------------------------------------------
diff --git a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
index d35ffd3..effcca2 100644
--- a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
+++ b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
@@ -6,6 +6,7 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -13,11 +14,11 @@ import org.kududb.ColumnSchema;
 import org.kududb.ColumnSchema.ColumnSchemaBuilder;
 import org.kududb.Schema;
 import org.kududb.Type;
-import org.kududb.client.BatchResponse;
 import org.kududb.client.Insert;
 import org.kududb.client.KuduClient;
 import org.kududb.client.KuduSession;
 import org.kududb.client.KuduTable;
+import org.kududb.client.OperationResponse;
 import org.kududb.client.RowError;
 import org.kududb.client.SessionConfiguration.FlushMode;
 
@@ -160,20 +161,17 @@ public class KuduCollectlExample {
         // If there's more data to read, don't flush yet -- better to accumulate
         // a larger batch.
         if (!br.ready()) {
-          ArrayList<BatchResponse> responses = session.flush();
-          // TODO: the client should not group BatchResponse by tablet, since tablets
-          // are an implementation detail.
-          for (BatchResponse r : responses) {
-            for (RowError e : r.getRowErrors()) {
-              // TODO: the client should offer an enum for different row errors, instead
-              // of string comparison!
-              if ("ALREADY_PRESENT".equals(e.getStatus())) {
-                continue;
-              }
-              System.err.println("Error inserting " + e.getOperation().toString()
-                  + ": " + e.toString());
+          List<OperationResponse> responses = session.flush();
+          for (OperationResponse r : responses) {
+            RowError e = r.getRowError();
+            // TODO: the client should offer an enum for different row errors, instead
+            // of string comparison!
+            if ("ALREADY_PRESENT".equals(e.getStatus())) {
+              continue;
+            }
+            System.err.println("Error inserting " + e.getOperation().toString()
+                + ": " + e.toString());
             }
-          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/e4fc37ac/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index f20e7ba..b0aa946 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -6,7 +6,7 @@
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>kudu-java-sample</name>
-  
+
   <build>
     <plugins>
       <plugin>
@@ -40,18 +40,25 @@
       </plugin>
     </plugins>
   </build>
+
   <repositories>
     <repository>
-      <id>kudu-internal</id>
-      <name>Kudu client on Cloudera network</name>
-      <url>http://d2106.halxg.cloudera.com/kudu-2015-08-13-1/</url>
+      <id>cdh.repo</id>
+      <name>Cloudera Repositories</name>
+      <!-- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url> -->
+      <url>http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
     </repository>
   </repositories>
+
   <dependencies>
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.1.0-SNAPSHOT</version>
+      <version>0.5.0</version>
     </dependency>
   </dependencies>
+
 </project>


[19/50] kudu git commit: Merge pull request #18 from adembo/update_for_070

Posted by wd...@apache.org.
Merge pull request #18 from adembo/update_for_070

Update for 0.7.0 release

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/4425e9f1
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/4425e9f1
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/4425e9f1

Branch: refs/heads/master
Commit: 4425e9f1a9cf6c3e1f760d14b8cb52a04f335280
Parents: 579f7db 9a22e9f
Author: jdcryans <jd...@gmail.com>
Authored: Tue Mar 1 16:42:12 2016 -0800
Committer: jdcryans <jd...@gmail.com>
Committed: Tue Mar 1 16:42:12 2016 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 java/collectl/pom.xml               | 2 +-
 java/insert-loadgen/pom.xml         | 2 +-
 java/java-sample/pom.xml            | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[03/50] kudu git commit: Merge pull request #8 from grundprinzip/master

Posted by wd...@apache.org.
Merge pull request #8 from grundprinzip/master

Changes to the python exampls due to username change in VM

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/8aa7d06e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/8aa7d06e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/8aa7d06e

Branch: refs/heads/master
Commit: 8aa7d06e9837f499d7a7868e38e95db40f836a14
Parents: e45733c 0dd2032
Author: jdcryans <jd...@gmail.com>
Authored: Sun Sep 27 17:28:35 2015 -0400
Committer: jdcryans <jd...@gmail.com>
Committed: Sun Sep 27 17:28:35 2015 -0400

----------------------------------------------------------------------
 clients/impala-shell             | 2 +-
 clients/install_python_client.sh | 4 ++--
 clients/remote_python            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[49/50] kudu git commit: Improve the C++ client example

Posted by wd...@apache.org.
Improve the C++ client example

This does some small things to improve the C++ client example:

1. I used shellcheck to find and fix some warnings with
   client_examples-test.sh. Mostly pedantic stuff.
2. I fixed a bug with the lsof command where it wasn't filtering
   lines, so it ran some bogus numeric comparisons on extra lines.
   Obviously this didn't break the script but it generated errors.
3. I added support for multimaster to the example script. I tested it
   manually but I didn't change client_examples-test.sh to use
   multimaster, since it seemed like it would just make it more
   complex and possibly more flaky without much payoff.
4. I fixed up the example code so it no longer uses any deprecated
   APIs. Specifically, I got rid of a use of 'split_rows' in the
   table creation step and the swapped in KuduScanBatch for
   vector<RowResult> in the scanner part.
5. I fixed up the wording and removed a duplicated section from the
   example's README.

Change-Id: I7fcc9f46b5e28b18f1a96082fd61a1f3402f59ff
Reviewed-on: http://gerrit.cloudera.org:8080/9838
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <aw...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/32d276e0
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/32d276e0
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/32d276e0

Branch: refs/heads/master
Commit: 32d276e08fe7bf7a0e68236e01312813b68d0eee
Parents: 9bf32a4
Author: Will Berkeley <wd...@apache.org>
Authored: Wed Mar 28 01:40:58 2018 -0700
Committer: Will Berkeley <wd...@gmail.com>
Committed: Wed Mar 28 21:42:51 2018 +0000

----------------------------------------------------------------------
 examples/cpp/README.adoc                | 146 +++++++++++++--------------
 examples/cpp/example.cc                 |  64 ++++++------
 src/kudu/client/client_examples-test.sh |  88 ++++++++--------
 src/kudu/client/scan_batch.h            |   2 +-
 4 files changed, 149 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/32d276e0/examples/cpp/README.adoc
----------------------------------------------------------------------
diff --git a/examples/cpp/README.adoc b/examples/cpp/README.adoc
index 6bad943..ba77682 100644
--- a/examples/cpp/README.adoc
+++ b/examples/cpp/README.adoc
@@ -19,7 +19,7 @@
 :homepage: https://kudu.apache.org/
 
 == Summary
-The Kudu {cpp} client library distribution contains {cpp} example application
+The Kudu {cpp} client library distribution contains a {cpp} example application
 that demonstrates how to use the Kudu {cpp} client API.  The example
 can be used as a starting point for a custom Kudu {cpp} client application.
 This note contains information on how to build the Kudu {cpp} client example.
@@ -45,63 +45,37 @@ super-user access and pollutes the `example` directory with
 intermediate files.
 For example, to copy the `/usr/share/doc/kuduClient/examples` directory
 recursively into `/tmp/kuduClient`:
-[source,shell]
++
+[source,bash]
+----
 cp -r /usr/share/doc/kuduClient/examples /tmp/kuduClient
+----
 
 . Navigate into the directory where the `example.cc.gz` file was copied and
 unpack the example source file.  For example:
-[source,shell]
++
+[source,bash]
+----
 cd /tmp/kuduClient/examples
 gunzip example.cc.gz
+----
 
 . Run `cmake` to generate appropriate makefiles.  For example, if targeting
 for a debug build
-(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
-[source,shell]
++
+[source,bash]
+----
 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug
+----
++
+For a release build, use `release` for `CMAKE_BUILD_TYPE` instead.
 
 . Run `make` to build the example:
-[source,shell]
++
+[source,bash]
+----
 make
-
-. After the example is built, it is ready to run against your Kudu master server.
-The example application assumes the target Kudu cluster has at least 3
-tablet servers up and running (because it creates a table with replication
-factor 3).  If it's not the case, you can modify the `example.cc` accordingly
-and re-compile it.  Below is the example output with log messages in the middle
-removed: the `example` binary runs against Kudu master server running
-with the default parameters at the same machine.  Port 7051 is the default
-one and could be omitted along with the preceding colomn because the master
-server is running with the default parameters (it's left only to illustrate how
-to specify port number).
-[source,shell]
-$ ./example 127.0.0.1:7051
-Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
-Long version info: kudu 1.1.0-SNAPSHOT
-revision 91a1ed09c4c572a22bab15360ddaf481d5632927
-build type DEBUG
-built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
- Line number: 546
- Time: Thu Oct 06 14:50:47 2016
- Message: Started thread 11197 - kernel-watchdog:kernel-watcher
-...
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
- Line number: 534
- Time: Thu Oct 06 14:50:47 2016
- Message: Considering host 10.17.240.17 local
-Created a client connection
-Created a schema
-Created a table
-Altered a table
-Inserted some rows into a table
-Scanned some rows out of a table
-Deleted a table
-Done
+----
 
 == How to build the example if building Kudu from source
 This section describes how to build the example if building Kudu from source.
@@ -109,7 +83,7 @@ To install the `example.cc` and other files, an alternate destination root
 is used.
 
 Specifying an alternate destination root allows you to install the
-Kudu {cpp} client library, the example file and other content
+Kudu {cpp} client library, the example file, and other content
 under the specified destination prefix.
 
 . Follow the https://kudu.apache.org/docs/installation.html#_build_from_source[instructions on the Kudu Web site]
@@ -118,57 +92,72 @@ to build the project from source.
 . Once the project is built, change into the `<build_dir>/src/kudu/client`
 sub-directory.
 
-. Run `make install` with an alternate destination root.  For example, if
+. Run `make install` with an alternate destination root. For example, if
 installing into `/tmp/client_alt_root`
-[source,shell]
++
+[source,bash]
+----
 make install DESTDIR=/tmp/client_alt_root
+----
 
 . Change the current working directory into the
 `usr/local/share/doc/kuduClient/examples` subdirectory of the alternate
 destination root.  For example, if installing into `/tmp/client_alt_root`
-[source,shell]
++
+[source,bash]
+----
 cd /tmp/client_alt_root/usr/local/share/doc/kuduClient/examples
+----
 
-. Run `cmake` to generate appropriate makefiles.  For example, if installing
+. Run `cmake` to generate appropriate makefiles. For example, if installing
 into `/tmp/client_alt_root` and targeting for a debug build
-(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
-[source,shell]
++
+[source,bash]
+----
 cmake -G "Unix Makefiles" -DkuduClient_DIR=/tmp/client_alt_root/usr/local/share/kuduClient/cmake -DCMAKE_BUILD_TYPE=debug
+----
++
+For a release build, set `release` for `CMAKE_BUILD_TYPE` instead.
 
 . Run `make` to build the example:
-[source,shell]
++
+[source,bash]
+----
 make
+----
 
-. After the example is built, it is ready to run against your Kudu master server.
+== Running the sample application
+After the example is built, it is ready to run against your Kudu cluster.
 The example application assumes the target Kudu cluster has at least 3
-tablet servers up and running (because it creates a table with replication
-factor 3).  If it's not the case, you can modify the `example.cc` accordingly
-and re-compile it.  Below is the example output with log messages in the middle
-removed: the `example` binary runs against Kudu master server running
-with the default parameters at the same machine.  Port 7051 is the default
-one and could be omitted along with the preceding colomn because the master
-server is running with the default parameters (it's left only to illustrate how
-to specify port number).
-[source,shell]
-$ ./example 127.0.0.1:7051
-Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
-Long version info: kudu 1.1.0-SNAPSHOT
-revision 91a1ed09c4c572a22bab15360ddaf481d5632927
+running tablet servers, because it creates a table with replication factor 3.
+If that's not the case, modify `example.cc` accordingly and re-compile. By
+default, the `example` binary runs against a local Kudu master using the
+default port 7051. You may also specify a different master or multiple masters
+as arguments to the binary, as shown. The following output shows a successful
+invocation of the example application, with some uninteresting log messages
+removed:
+
+[source,bash]
+----
+$ ./example localhost:9876 localhost:9877 localhost:9878
+Running with Kudu client version: kudu 1.8.0-SNAPSHOT (rev bbbb45fd31f2eb1570563e925639e549047b0707)
+Long version info: kudu 1.8.0-SNAPSHOT
+revision bbbb45fd31f2eb1570563e925639e549047b0707
 build type DEBUG
-built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
+built by wdberkeley at 27 Mar 2018 23:52:18 PST on cloudbook.local
 Received log message from Kudu client library
  Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
- Line number: 546
- Time: Thu Oct 06 14:50:47 2016
- Message: Started thread 11197 - kernel-watchdog:kernel-watcher
-...
-Received log message from Kudu client library
+ Filename: /Users/wdberkeley/src/kudu/src/kudu/util/thread.cc
+ Line number: 570
+ Time: Wed Mar 28 01:50:48 2018
+ Message: Started thread 17452818 - kernel-watchdog:kernel-watcher
+ ...
+ Received log message from Kudu client library
  Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
- Line number: 534
- Time: Thu Oct 06 14:50:47 2016
- Message: Considering host 10.17.240.17 local
+ Filename: /Users/wdberkeley/src/kudu/src/kudu/client/client-internal.cc
+ Line number: 581
+ Time: Wed Mar 28 01:50:48 2018
+ Message: Considering host 192.168.1.4 local
 Created a client connection
 Created a schema
 Created a table
@@ -177,6 +166,7 @@ Inserted some rows into a table
 Scanned some rows out of a table
 Deleted a table
 Done
+----
 
 == References
 . https://kudu.apache.org/[The Kudu Project Web Site]

http://git-wip-us.apache.org/repos/asf/kudu/blob/32d276e0/examples/cpp/example.cc
----------------------------------------------------------------------
diff --git a/examples/cpp/example.cc b/examples/cpp/example.cc
index 9b5d65e..5d17ac2 100644
--- a/examples/cpp/example.cc
+++ b/examples/cpp/example.cc
@@ -34,7 +34,7 @@ using kudu::client::KuduColumnSchema;
 using kudu::client::KuduError;
 using kudu::client::KuduInsert;
 using kudu::client::KuduPredicate;
-using kudu::client::KuduRowResult;
+using kudu::client::KuduScanBatch;
 using kudu::client::KuduScanner;
 using kudu::client::KuduSchema;
 using kudu::client::KuduSchemaBuilder;
@@ -53,10 +53,10 @@ using std::ostringstream;
 using std::string;
 using std::vector;
 
-static Status CreateClient(const string& addr,
+static Status CreateClient(const vector<string>& master_addrs,
                            shared_ptr<KuduClient>* client) {
   return KuduClientBuilder()
-      .add_master_server_addr(addr)
+      .master_server_addrs(master_addrs)
       .default_admin_operation_timeout(MonoDelta::FromSeconds(20))
       .Build(client);
 }
@@ -91,25 +91,24 @@ static Status CreateTable(const shared_ptr<KuduClient>& client,
                           const string& table_name,
                           const KuduSchema& schema,
                           int num_tablets) {
-  // Generate the split keys for the table.
-  vector<const KuduPartialRow*> splits;
+  vector<string> column_names;
+  column_names.push_back("key");
+
+  // Set the schema and range partition columns.
+  KuduTableCreator* table_creator = client->NewTableCreator();
+  table_creator->table_name(table_name)
+      .schema(&schema)
+      .set_range_partition_columns(column_names);
+
+  // Generate and add the range partition splits for the table.
   int32_t increment = 1000 / num_tablets;
   for (int32_t i = 1; i < num_tablets; i++) {
     KuduPartialRow* row = schema.NewRow();
     KUDU_CHECK_OK(row->SetInt32(0, i * increment));
-    splits.push_back(row);
+    table_creator->add_range_partition_split(row);
   }
 
-  vector<string> column_names;
-  column_names.push_back("key");
-
-  // Create the table.
-  KuduTableCreator* table_creator = client->NewTableCreator();
-  Status s = table_creator->table_name(table_name)
-      .schema(&schema)
-      .set_range_partition_columns(column_names)
-      .split_rows(splits)
-      .Create();
+  Status s = table_creator->Create();
   delete table_creator;
   return s;
 }
@@ -127,7 +126,7 @@ static Status AlterTable(const shared_ptr<KuduClient>& client,
 
 static void StatusCB(void* unused, const Status& status) {
   KUDU_LOG(INFO) << "Asynchronous flush finished with status: "
-                      << status.ToString();
+                 << status.ToString();
 }
 
 static Status InsertRows(const shared_ptr<KuduTable>& table, int num_rows) {
@@ -176,6 +175,11 @@ static Status ScanRows(const shared_ptr<KuduTable>& table) {
 
   KuduScanner scanner(table.get());
 
+  // To be guaranteed results are returned in primary key order, make the
+  // scanner fault-tolerant. This also means the scanner can recover if,
+  // for example, the server it is scanning fails in the middle of a scan.
+  KUDU_RETURN_NOT_OK(scanner.SetFaultTolerant());
+
   // Add a predicate: WHERE key >= 5
   KuduPredicate* p = table->NewComparisonPredicate(
       "key", KuduPredicate::GREATER_EQUAL, KuduValue::FromInt(kLowerBound));
@@ -187,17 +191,17 @@ static Status ScanRows(const shared_ptr<KuduTable>& table) {
   KUDU_RETURN_NOT_OK(scanner.AddConjunctPredicate(p));
 
   KUDU_RETURN_NOT_OK(scanner.Open());
-  vector<KuduRowResult> results;
+  KuduScanBatch batch;
 
   int next_row = kLowerBound;
   while (scanner.HasMoreRows()) {
-    KUDU_RETURN_NOT_OK(scanner.NextBatch(&results));
-    for (vector<KuduRowResult>::iterator iter = results.begin();
-        iter != results.end();
-        iter++, next_row++) {
-      const KuduRowResult& result = *iter;
+    KUDU_RETURN_NOT_OK(scanner.NextBatch(&batch));
+    for (KuduScanBatch::const_iterator it = batch.begin();
+         it != batch.end();
+         ++it, ++next_row) {
+      KuduScanBatch::RowPtr row(*it);
       int32_t val;
-      KUDU_RETURN_NOT_OK(result.GetInt32("key", &val));
+      KUDU_RETURN_NOT_OK(row.GetInt32("key", &val));
       if (val != next_row) {
         ostringstream out;
         out << "Scan returned the wrong results. Expected key "
@@ -205,7 +209,6 @@ static Status ScanRows(const shared_ptr<KuduTable>& table) {
         return Status::IOError(out.str());
       }
     }
-    results.clear();
   }
 
   // next_row is now one past the last row we read.
@@ -263,10 +266,13 @@ int main(int argc, char* argv[]) {
   // This is to install and automatically un-install custom logging callback.
   LogCallbackHelper log_cb_helper;
 
-  if (argc != 2) {
-    KUDU_LOG(FATAL) << "usage: " << argv[0] << " <master host>";
+  if (argc < 2) {
+    KUDU_LOG(FATAL) << "usage: " << argv[0] << " <master host> ...";
+  }
+  vector<string> master_addrs;
+  for (int i = 1; i < argc; i++) {
+    master_addrs.push_back(argv[i]);
   }
-  const string master_host = argv[1];
 
   const string kTableName = "test_table";
 
@@ -275,7 +281,7 @@ int main(int argc, char* argv[]) {
 
   // Create and connect a client.
   shared_ptr<KuduClient> client;
-  KUDU_CHECK_OK(CreateClient(master_host, &client));
+  KUDU_CHECK_OK(CreateClient(master_addrs, &client));
   KUDU_LOG(INFO) << "Created a client connection";
 
   // Disable the verbose logging.

http://git-wip-us.apache.org/repos/asf/kudu/blob/32d276e0/src/kudu/client/client_examples-test.sh
----------------------------------------------------------------------
diff --git a/src/kudu/client/client_examples-test.sh b/src/kudu/client/client_examples-test.sh
index ad0e86c..75d5ac7 100755
--- a/src/kudu/client/client_examples-test.sh
+++ b/src/kudu/client/client_examples-test.sh
@@ -24,18 +24,18 @@
 
 # Clean up after the test. Must be idempotent.
 cleanup() {
-  if [ -n "$TS_PID" ]; then
+  if [[ -n $TS_PID ]]; then
       kill -9 "$TS_PID" || :
-      wait $TS_PID || :
+      wait "$TS_PID" || :
   fi
-  if [ -n "$MASTER_PID" ]; then
+  if [[ -n $MASTER_PID ]]; then
       kill -9 "$MASTER_PID" || :
-      wait $MASTER_PID || :
+      wait "$MASTER_PID" || :
   fi
-  if [ -n "$BASE_DIR" -a -d "$BASE_DIR" ]; then
+  if [[ -n $BASE_DIR ]] && [[ -d $BASE_DIR ]]; then
       rm -rf "$BASE_DIR"
   fi
-  if [ -n "$LIBRARY_DIR" -a -d "$LIBRARY_DIR" ]; then
+  if [[ -n $LIBRARY_DIR ]] && [[ -d $LIBRARY_DIR ]]; then
       rm -rf "$LIBRARY_DIR"
   fi
 }
@@ -51,24 +51,25 @@ wait_for_listen_port() {
   local num_attempts=$3
 
   local attempt=0
-  while [ true ]; do
+  while true; do
     # The lsof utility does not allow to distinguish between an existing
     # process not listening to the specified port and a non-existing process
     # by its return code. For the fast check let's verify that the process
     # is still running.
-    if ! kill -0 $pid; then
+    if ! kill -0 "$pid"; then
       return 1
     fi
-    local ports=$(lsof -wbnP -Fn -p $pid -a -i 4TCP -a -s TCP:LISTEN | \
-        sed '1d;s/^[^:].*://')
+    local ports
+    ports=$(lsof -wbnP -Fn -p "$pid" -a -i 4TCP -a -s TCP:LISTEN | \
+            sed -n '/^n/ s/^[^:].*://p')
     for i in $ports; do
-      if [ $i -eq $expected_port ]; then
+      if [[ $i -eq $expected_port ]]; then
         return 0
       fi
     done
 
     attempt=$((attempt+1))
-    if [ $attempt -ge $num_attempts ]; then
+    if [[ $attempt -ge $num_attempts ]]; then
       break
     fi
     sleep 1
@@ -82,40 +83,41 @@ exit_error() {
 
   set +x
   echo ----------------------------------------------------------------------
-  echo ERROR: $err_msg
+  echo ERROR: "$err_msg"
   echo ----------------------------------------------------------------------
   exit 1
 }
 
-OUTPUT_DIR=$(cd $(dirname "$BASH_SOURCE"); pwd)
+OUTPUT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
 
 # Install the client library to a temporary directory.
 # Try to detect whether we're building using Ninja or Make.
 LIBRARY_DIR=$(mktemp -d -t kudu-examples-test.XXXXXXXXXXXXX)
 PREFIX_DIR=$LIBRARY_DIR/usr/local
 EXAMPLES_DIR=$PREFIX_DIR/share/doc/kuduClient/examples
-pushd $OUTPUT_DIR/..
+pushd "$OUTPUT_DIR/.."
 NINJA=$(which ninja 2>/dev/null) || NINJA=""
-if [ -r build.ninja -a -n "$NINJA" ]; then
+if [[ -r build.ninja ]] && [[ -n $NINJA ]]; then
   DESTDIR=$LIBRARY_DIR ninja install
 else
-  make -j$(getconf _NPROCESSORS_ONLN) DESTDIR=$LIBRARY_DIR install
+  # nproc is not available on macOS.
+  make -j"$(getconf _NPROCESSORS_ONLN)" DESTDIR="$LIBRARY_DIR" install
 fi
 popd
 
 # Test that all of the installed headers can be compiled on their own.
 # This catches bugs where we've made a mistake in 'include-what-you-use'
 # within the library.
-for include_file in $(find $LIBRARY_DIR -name \*.h) ; do
-  echo Checking standalone compilation of $include_file...
+for include_file in $(find "$LIBRARY_DIR" -name \*.h) ; do
+  echo Checking standalone compilation of "$include_file"...
   if ! ${CXX:-g++} \
        -o /dev/null \
-       -I$LIBRARY_DIR/usr/local/include \
-       $include_file ; then
+       -I"$LIBRARY_DIR/usr/local/include" \
+       "$include_file" ; then
     set +x
     echo
     echo -----------------------------------------
-    echo $include_file fails to build on its own.
+    echo "$include_file" fails to build on its own.
     echo See log above for details.
     echo -----------------------------------------
     exit 1
@@ -126,23 +128,23 @@ done
 # to be usable with older versions of cmake. But if it isn't there,
 # use the one from thirdparty.
 CMAKE=$(which cmake || :)
-if [ -z "$CMAKE" ]; then
+if [[ -z $CMAKE ]]; then
   # TODO: temporary hack which assumes this script is in src/build/<type>/bin
   CMAKE=$OUTPUT_DIR/../../../thirdparty/installed/common/bin/cmake
 fi
 
 # Build the client examples using the client library.
 # We can just always use Make here, since we're calling cmake ourselves.
-pushd $EXAMPLES_DIR
+pushd "$EXAMPLES_DIR"
 CMAKE_PREFIX_PATH=$PREFIX_DIR $CMAKE .
-make -j$(getconf _NPROCESSORS_ONLN)
+make -j"$(getconf _NPROCESSORS_ONLN)"
 popd
 
 LOCALHOST_IP=127.0.0.1
-if [ "$(uname)" == "Linux" ]; then
+if [[ $(uname) == Linux ]]; then
   # Pick a unique localhost IP address so this can run in parallel with other
   # tests. This only works on Linux.
-  LOCALHOST_IP=127.$[($$ >> 8) & 0xff].$[$$ & 0xff].1
+  LOCALHOST_IP=127.$((($$ >> 8) & 0xff)).$(($$ & 0xff)).1
 fi
 echo Using localhost IP $LOCALHOST_IP
 
@@ -150,16 +152,16 @@ echo Using localhost IP $LOCALHOST_IP
 # Start master+ts
 export TMPDIR=${TMPDIR:-/tmp}
 export TEST_TMPDIR=${TEST_TMPDIR:-$TMPDIR/kudutest-$UID}
-mkdir -p $TEST_TMPDIR
-BASE_DIR=$(mktemp -d $TEST_TMPDIR/client_examples-test.XXXXXXXX)
+mkdir -p "$TEST_TMPDIR"
+BASE_DIR=$(mktemp -d "$TEST_TMPDIR/client_examples-test.XXXXXXXX")
 MASTER_RPC_PORT=7051
 mkdir -p "$BASE_DIR/master/logs"
-$OUTPUT_DIR/kudu-master \
+"$OUTPUT_DIR/kudu-master" \
   --unlock_experimental_flags \
   --default_num_replicas=1 \
-  --log_dir=$BASE_DIR/master/logs \
-  --fs_wal_dir=$BASE_DIR/master/wals \
-  --fs_data_dirs=$BASE_DIR/master/data \
+  --log_dir="$BASE_DIR/master/logs" \
+  --fs_wal_dir="$BASE_DIR/master/wals" \
+  --fs_data_dirs="$BASE_DIR/master/data" \
   --webserver_interface=$LOCALHOST_IP \
   --webserver_port=0 \
   --rpc_bind_addresses=$LOCALHOST_IP:$MASTER_RPC_PORT &
@@ -167,13 +169,13 @@ MASTER_PID=$!
 
 TSERVER_RPC_PORT=7050
 mkdir -p "$BASE_DIR/ts/logs"
-$OUTPUT_DIR/kudu-tserver \
+"$OUTPUT_DIR/kudu-tserver" \
   --unlock_experimental_flags \
   --heartbeat_interval_ms=200 \
   --heartbeat_rpc_timeout_ms=1000 \
-  --log_dir=$BASE_DIR/ts/logs \
-  --fs_wal_dir=$BASE_DIR/ts/wals \
-  --fs_data_dirs=$BASE_DIR/ts/data \
+  --log_dir="$BASE_DIR/ts/logs" \
+  --fs_wal_dir="$BASE_DIR/ts/wals" \
+  --fs_data_dirs="$BASE_DIR/ts/data" \
   --rpc_bind_addresses=$LOCALHOST_IP:$TSERVER_RPC_PORT \
   --local_ip_for_outbound_sockets=$LOCALHOST_IP \
   --webserver_interface=$LOCALHOST_IP \
@@ -195,24 +197,24 @@ fi
 max_attempts=10
 attempt=0
 num_tservers=0
-while [ true ]; do
-  if ! num_tservers=$($OUTPUT_DIR/kudu tserver list \
+while true; do
+  if ! num_tservers=$("$OUTPUT_DIR/kudu" tserver list \
       $LOCALHOST_IP:$MASTER_RPC_PORT -format=space | wc -l); then
     exit_error "failed to determine number of registered tservers"
   fi
-  if [ $num_tservers -ge 1 ]; then
+  if [[ $num_tservers -ge 1 ]]; then
     break
   fi
   attempt=$((attempt+1))
-  if [ $attempt -ge $max_attempts ]; then
+  if [[ $attempt -ge $max_attempts ]]; then
     break
   fi
   sleep 1
 done
 
-if [ $num_tservers -lt 1 ]; then
+if [[ $num_tservers -lt 1 ]]; then
   exit_error "tserver has not registered with the master"
 fi
 
 # Run the examples.
-$EXAMPLES_DIR/example $LOCALHOST_IP
+"$EXAMPLES_DIR/example" $LOCALHOST_IP

http://git-wip-us.apache.org/repos/asf/kudu/blob/32d276e0/src/kudu/client/scan_batch.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/scan_batch.h b/src/kudu/client/scan_batch.h
index 30fe2b1..f381ae2 100644
--- a/src/kudu/client/scan_batch.h
+++ b/src/kudu/client/scan_batch.h
@@ -63,7 +63,7 @@ class KuduSchema;
 /// regular for loop (C++03):
 /// @code
 ///   for (KuduScanBatch::const_iterator it = batch.begin(), it != batch.end();
-///        ++i) {
+///        ++it) {
 ///     KuduScanBatch::RowPtr row(*it);
 ///     ...
 ///   }


[40/50] kudu git commit: Merge pull request #32 from dineshabbi/setup-branch

Posted by wd...@apache.org.
Merge pull request #32 from dineshabbi/setup-branch

Allow setup-kudu-demo script to use a pre-built VM image

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6bf86299
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6bf86299
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6bf86299

Branch: refs/heads/master
Commit: 6bf862997f4a3497efbea1c3d77178c0eff84e3d
Parents: 53a882c ae32aea
Author: adembo <ad...@gmail.com>
Authored: Wed Feb 1 19:15:21 2017 -0800
Committer: GitHub <no...@github.com>
Committed: Wed Feb 1 19:15:21 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[13/50] kudu git commit: Merge pull request #12 from mpercy/master

Posted by wd...@apache.org.
Merge pull request #12 from mpercy/master

Use final public repository URL for java examples

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/4de32011
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/4de32011
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/4de32011

Branch: refs/heads/master
Commit: 4de32011fbb3a759ec95fb2fc6ce25a9e66a477d
Parents: 25a123c c5cfe17
Author: David Ribeiro Alves <da...@gmail.com>
Authored: Sun Sep 27 20:49:20 2015 -0700
Committer: David Ribeiro Alves <da...@gmail.com>
Committed: Sun Sep 27 20:49:20 2015 -0700

----------------------------------------------------------------------
 java/collectl/pom.xml    | 3 +--
 java/java-sample/pom.xml | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[22/50] kudu git commit: Point to new VM, based on Kudu 0.9.0

Posted by wd...@apache.org.
Point to new VM, based on Kudu 0.9.0


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/5bf7455d
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/5bf7455d
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/5bf7455d

Branch: refs/heads/master
Commit: 5bf7455d82246af45d612bb2b86c611176472572
Parents: fa78454
Author: Jean-Daniel Cryans <jd...@cloudera.com>
Authored: Wed Jun 15 21:03:06 2016 -0700
Committer: Jean-Daniel Cryans <jd...@cloudera.com>
Committed: Wed Jun 15 21:03:06 2016 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5bf7455d/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 73abcd0..0dd8571 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,7 +8,7 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.4.9-kudu-virtualbox}
+: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.7.1-kudu-virtualbox}
 : ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${VIRTUALBOX_NAME}.ova}
 
 # VM Settings default.


[25/50] kudu git commit: Update VM to 0.10.0 quickstart

Posted by wd...@apache.org.
Update VM to 0.10.0 quickstart


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/02d6eaa4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/02d6eaa4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/02d6eaa4

Branch: refs/heads/master
Commit: 02d6eaa47c5e6f78678aab7ae344e0a489f01708
Parents: 5066504
Author: Todd Lipcon <to...@cloudera.com>
Authored: Tue Aug 23 11:45:53 2016 -0700
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Tue Aug 23 11:45:53 2016 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/02d6eaa4/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 941343a..c1c5490 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,7 +8,7 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.7.1-kudu-virtualbox}
+: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox}
 : ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${VIRTUALBOX_NAME}.ova}
 
 # VM Settings default.


[45/50] kudu git commit: Merge pull request #34 from adembo/master

Posted by wd...@apache.org.
Merge pull request #34 from adembo/master

Update for 5.13.0 release

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/7545decc
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/7545decc
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/7545decc

Branch: refs/heads/master
Commit: 7545deccb8e12effa17a955ab5b841bdcc5afe85
Parents: 82708e9 cd58992
Author: jdcryans <jd...@gmail.com>
Authored: Thu Oct 12 08:03:43 2017 -0700
Committer: GitHub <no...@github.com>
Committed: Thu Oct 12 08:03:43 2017 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[07/50] kudu git commit: Make it so that we can run setup-kudu-demo-vm.sh multiple times

Posted by wd...@apache.org.
Make it so that we can run setup-kudu-demo-vm.sh multiple times

Previously, running it multiple times would result in a few problems:
* Repeated creation of new host-only networks
* Failure to re-import the VM
* Stale IP of the VM left in /etc/hosts


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

Branch: refs/heads/master
Commit: e8065efc54e29c4c34cff77d08344c5bb7c8959a
Parents: e4fc37a
Author: Mike Percy <mp...@cloudera.com>
Authored: Sun Sep 27 21:07:10 2015 -0400
Committer: Mike Percy <mp...@cloudera.com>
Committed: Sun Sep 27 21:36:39 2015 -0400

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 56 +++++++++++++++++---------------
 1 file changed, 29 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e8065efc/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index aacff92..540581d 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -31,29 +31,33 @@ else
   curl -O ${VIRTUALBOX_URL}
 fi
 
-# Create a host only network interface
-VBoxManage hostonlyif create
+# Set up the VM for the first time if it doesn't already exist.
+if ! VBoxManage list vms | grep -q '"kudu-demo"'; then
+  # Create a host only network interface
+  VBoxManage hostonlyif create
 
-# Find the last one created
-last_if=`VBoxManage list -l hostonlyifs | grep "^Name:" | tail -n 1 | tr " " "\n" | tail -n 1`
-host_ip=`VBoxManage list -l hostonlyifs | grep "^IPAddress:" | tail -n 1 | tr " " "\n" | tail -n 1`
+  # Find the last one created
+  last_if=`VBoxManage list -l hostonlyifs | grep "^Name:" | tail -n 1 | tr " " "\n" | tail -n 1`
+  host_ip=`VBoxManage list -l hostonlyifs | grep "^IPAddress:" | tail -n 1 | tr " " "\n" | tail -n 1`
 
-lower_ip=`echo $host_ip | sed 's/\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)\.[0-9]\{1,3\}/\1/g'`
+  lower_ip=`echo $host_ip | sed 's/\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)\.[0-9]\{1,3\}/\1/g'`
 
-VBoxManage hostonlyif ipconfig $last_if --ip $host_ip
-VBoxManage dhcpserver add --ifname $last_if --ip $host_ip --netmask 255.255.255.0 --lowerip $lower_ip.100 --upperip $lower_ip.200 || :
-VBoxManage dhcpserver modify --ifname $last_if --enable
+  VBoxManage hostonlyif ipconfig $last_if --ip $host_ip
+  VBoxManage dhcpserver add --ifname $last_if --ip $host_ip --netmask 255.255.255.0 --lowerip $lower_ip.100 --upperip $lower_ip.200 || :
+  VBoxManage dhcpserver modify --ifname $last_if --enable
 
-# Import the ovf
-VBoxManage import ${OVF} --vsys 0 --cpus ${VM_NUM_CPUS} --memory ${VM_MEM_MB} --vmname ${VM_NAME} --options keepallmacs
-VBoxManage modifyvm ${VM_NAME} --nic1 hostonly
-VBoxManage modifyvm ${VM_NAME} --hostonlyadapter1 $last_if
-VBoxManage modifyvm ${VM_NAME} --nic2 nat
+  # Import the ovf
+  echo "Importing VM ${OVF}..."
+  VBoxManage import ${OVF} --vsys 0 --cpus ${VM_NUM_CPUS} --memory ${VM_MEM_MB} --vmname ${VM_NAME} --options keepallmacs
+  VBoxManage modifyvm ${VM_NAME} --nic1 hostonly
+  VBoxManage modifyvm ${VM_NAME} --hostonlyadapter1 $last_if
+  VBoxManage modifyvm ${VM_NAME} --nic2 nat
 
-# Create a shared folder with the current checkout available to the VM
-REL_PATH=`pwd`/../
-SHARED_FOLDER_PATH=`dir_resolve $REL_PATH`
-VBoxManage sharedfolder add ${VM_NAME} --name examples --hostpath $SHARED_FOLDER_PATH --automount
+  # Create a shared folder with the current checkout available to the VM
+  REL_PATH=`pwd`/../
+  SHARED_FOLDER_PATH=`dir_resolve $REL_PATH`
+  VBoxManage sharedfolder add ${VM_NAME} --name examples --hostpath $SHARED_FOLDER_PATH --automount
+fi
 
 # Start the VM
 VBoxManage startvm ${VM_NAME}
@@ -72,20 +76,18 @@ while true; do
     sleep 5
 done
 
-if ! grep -q quickstart.cloudera /etc/hosts ; then
 echo "Updating the /etc/hosts file requires sudo rights."
-sudo bash -e -c 'echo "#Kudu Quickstart VM" >> /etc/hosts'
-sudo bash -c "echo $ip quickstart.cloudera >> /etc/hosts"
-else
-echo "Hostname setup already done, check if the IP address of the VM"
-echo "matches the hosts entry."
-echo "IP VM: $ip"
-cat /etc/hosts
+if grep -q quickstart.cloudera /etc/hosts ; then
+  # Strip out the old entry since it's probably wrong now.
+  grep -v quickstart.cloudera /etc/hosts > ./etc-hosts.new
+  sudo mv ./etc-hosts.new /etc/hosts
 fi
+sudo bash -c "echo '$ip quickstart.cloudera # Kudu quickstart VM' >> /etc/hosts"
 
 echo "========================================================================="
 echo "Kudu Quickstart VM installed successfully"
 echo "To use the C++ and Python examples from this repository, you have to SSH"
-echo "to the VM using the user 'demo' with the password 'demo'. "
+echo "to the VM using the user 'demo' with the password 'demo'."
+echo "You can use this command: ssh demo@quickstart.cloudera"
 echo ""
 echo "You'll find the examples mounted as a shared folder at /media/sf_examples"


[34/50] kudu git commit: Allow setup-kudu-demo script to use a pre-built VM image

Posted by wd...@apache.org.
Allow setup-kudu-demo script to use a pre-built VM image

setup-kudu-demo-vm.sh script currently either downloads
a VM image or let us use an already downloaded image.
It is easier for future testing if we allow it use a pre-built
VM image in situations where we want to use an image built out
of quickstart-vm repository and then run few kudu-examples.
This change lets the script take an OVA file as an argument.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/5eb22e43
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/5eb22e43
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/5eb22e43

Branch: refs/heads/master
Commit: 5eb22e43560744db08e10d5813379ebcd143ba18
Parents: 81157cc
Author: Dinesh Bhat <di...@gmail.com>
Authored: Tue Jan 24 16:26:20 2017 -0800
Committer: Dinesh Bhat <di...@gmail.com>
Committed: Tue Jan 24 18:18:02 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5eb22e43/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index e1e7def..511be41 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,10 +8,6 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox}
-OVF=${VIRTUALBOX_NAME}.ova
-: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}}
-
 # VM Settings default.
 : ${VM_NAME:=kudu-demo}
 : ${VM_NUM_CPUS:=2}
@@ -23,9 +19,28 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-# Download quickstart VM appliance
+OVF=cloudera-quickstart-vm-5.8.0-kudu-virtualbox.ova
+if [ $# -gt 2 ]; then
+    echo "$0 [--image|-i VM image file]"
+  exit 1
+elif [ $# -gt 0 ]; then
+  case $1 in
+    --image|-i)
+      OVF=$2
+      if [ ! -e $OVF ]; then
+        echo "Specified VM image file doesn't exist"
+        exit 1
+      fi
+      ;;
+    *)
+      echo "$0 [--image|-i VM image file]"
+      exit 1
+  esac
+fi
+
+# Use/download quickstart VM image
 if [ -e ${OVF} ]; then
-  echo Using previously downloaded image
+  echo Using image $OVF
 else
   echo "Downloading Virtualbox Image file: ${VIRTUALBOX_URL}"
   if ! curl -fLSs ${VIRTUALBOX_URL} --output ${OVF}; then
@@ -35,7 +50,7 @@ else
 fi
 
 # Set up the VM for the first time if it doesn't already exist.
-if ! VBoxManage list vms | grep -q '"kudu-demo"'; then
+if ! VBoxManage list vms | grep -q '{$VM_NAME}'; then
   # Create a host only network interface
   VBoxManage hostonlyif create
 


[46/50] kudu git commit: [java] Fix javadoc issues

Posted by wd...@apache.org.
[java] Fix javadoc issues

Fixes some javadoc warnings:
- Removed @link and @see to external classes
- Remove invalid @inheritDoc tags
- Fixed code block
- Fixed a couple @return statment

This is far from all of the correctness issue, but the few
that were resulting in Javadoc Gradle errors.

Also disabled the super strict doc linter for Java 8+
in the gradle build to prevent a ton of warning output
and potnetial build failures. We could enable this at
somepoint after we correct the hundreds of warnings.

Change-Id: I5914b416e1b084a4f50dd8ea878be2f065acbe94
Reviewed-on: http://gerrit.cloudera.org:8080/9839
Tested-by: Grant Henke <gr...@apache.org>
Reviewed-by: Adar Dembo <ad...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6a323db4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6a323db4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6a323db4

Branch: refs/heads/master
Commit: 6a323db4681ae350edbabbe130e35ccd338817dc
Parents: d364f01
Author: Grant Henke <gr...@apache.org>
Authored: Wed Mar 28 10:04:31 2018 -0500
Committer: Grant Henke <gr...@apache.org>
Committed: Wed Mar 28 17:21:50 2018 +0000

----------------------------------------------------------------------
 java/gradle/compile.gradle                                   | 8 ++++++++
 .../main/java/org/apache/kudu/client/AsyncKuduClient.java    | 8 ++++----
 .../src/main/java/org/apache/kudu/client/Bytes.java          | 3 +--
 .../src/main/java/org/apache/kudu/client/KuduException.java  | 2 +-
 .../java/org/apache/kudu/mapreduce/KuduTableInputFormat.java | 2 +-
 .../org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java    | 6 ------
 6 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/gradle/compile.gradle
----------------------------------------------------------------------
diff --git a/java/gradle/compile.gradle b/java/gradle/compile.gradle
index 1e42acf..44d011c 100644
--- a/java/gradle/compile.gradle
+++ b/java/gradle/compile.gradle
@@ -25,6 +25,14 @@ tasks.withType(JavaCompile) {
   options.incremental = true // enable incremental compilation.
 }
 
+// Javadoc Configuration
+tasks.withType(Javadoc) {
+  if (JavaVersion.current().isJava8Compatible()) {
+    // Disable the super-strict doclint tool in Java 8+
+    options.addStringOption('Xdoclint:none', '-quiet')
+  }
+}
+
 // Scala configuration
 tasks.withType(ScalaCompile) {
   sourceCompatibility = javaCompatibility

http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
index 1bf2184..102df11 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
@@ -166,7 +166,7 @@ import org.apache.kudu.util.Pair;
  * <p>
  * In the context of the Hadoop ecosystem, the {@code UserGroupInformation}
  * class provides utility methods to login from a keytab and then run code as
- * the resulting {@link javax.security.auth.Subject}: <code><pre>
+ * the resulting {@link javax.security.auth.Subject}: <pre>{@code
  *   UserGroupInformation.loginUserFromKeytab("my-app", "/path/to/app.keytab");
  *   KuduClient c = UserGroupInformation.getLoginUser().doAs(
  *     new PrivilegedExceptionAction<KuduClient>() {
@@ -176,7 +176,7 @@ import org.apache.kudu.util.Pair;
  *       }
  *     }
  *   );
- * </pre></code> The {@code UserGroupInformation} class will also automatically
+ * }</pre> The {@code UserGroupInformation} class will also automatically
  * start a thread to periodically re-login from the keytab.
  *
  * <h3>Debugging Kudu's usage of Kerberos credentials</h3>
@@ -221,13 +221,13 @@ import org.apache.kudu.util.Pair;
  * <h1>API Compatibility</h1>
  *
  * Note that some methods in the Kudu client implementation are public but
- * annotated with the {@link InterfaceAudience.Private} annotation. This
+ * annotated with the InterfaceAudience.Private annotation. This
  * annotation indicates that, despite having {@code public} visibility, the
  * method is not part of the public API and there is no guarantee that its
  * existence or behavior will be maintained in subsequent versions of the Kudu
  * client library.
  *
- * Other APIs are annotated with the {@link InterfaceStability.Unstable} annotation.
+ * Other APIs are annotated with the InterfaceStability.Unstable annotation.
  * These APIs are meant for public consumption but may change between minor releases.
  * Note that the asynchronous client is currently considered unstable.
  *

http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/kudu-client/src/main/java/org/apache/kudu/client/Bytes.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Bytes.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Bytes.java
index 11b8849..0f31d6d 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Bytes.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Bytes.java
@@ -108,7 +108,6 @@ public final class Bytes {
    * Reads a byte from an offset in the given array.
    * @param b The array to read from.
    * @return A byte
-   * @return
    */
   public static byte getByte(final byte[] b, final int offset) {
     return b[offset];
@@ -1268,7 +1267,7 @@ public final class Bytes {
   /**
    * Utility method to read a byte array written the way {@link #writeByteArray} does it.
    * @param dataInput
-   * @return
+   * @return The read byte array
    * @throws IOException
    */
   public static byte[] readByteArray(DataInput dataInput) throws IOException {

http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
index d6dacf2..c9aa9a6 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
@@ -80,7 +80,7 @@ public abstract class KuduException extends IOException {
    * Thus, when the synchronous Kudu client wraps and throws the exception,
    * we suppress that stack trace and replace it with the stack trace of the user's
    * calling thread. The original stack trace is added to the {@link KuduException}
-   * as a suppressed exception ({@see Throwable#addSuppressed(Throwable)}) of
+   * as a suppressed exception (see Throwable#addSuppressed(Throwable)) of
    * this
    */
   @InterfaceAudience.Public

http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java
----------------------------------------------------------------------
diff --git a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java
index a018ae2..aa8d877 100644
--- a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java
+++ b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java
@@ -87,7 +87,7 @@ import org.apache.kudu.client.RowResultIterator;
  * Therefore, total number of Kudu clients opened over the course of a MR application can be
  * estimated by (#Tablets +1). To reduce the number of concurrent open clients, it might be
  * advisable to restrict resources of the MR application or implement the
- * {@link org.apache.hadoop.mapred.lib.CombineFileInputFormat} over this InputFormat.
+ * org.apache.hadoop.mapred.lib.CombineFileInputFormat over this InputFormat.
  * </p>
  */
 @InterfaceAudience.Public

http://git-wip-us.apache.org/repos/asf/kudu/blob/6a323db4/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java
----------------------------------------------------------------------
diff --git a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java
index 52c6b1d..800bfd5 100644
--- a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java
+++ b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java
@@ -305,9 +305,6 @@ public class KuduTableMapReduceUtil {
   public static class TableOutputFormatConfiguratorWithCommandLineParser extends
       AbstractTableOutputFormatConfigurator<TableOutputFormatConfiguratorWithCommandLineParser> {
 
-    /**
-     * {@inheritDoc}
-     */
     public TableOutputFormatConfiguratorWithCommandLineParser(Job job, String table) {
       super(job, table);
       CommandLineParser parser = new CommandLineParser(job.getConfiguration());
@@ -382,9 +379,6 @@ public class KuduTableMapReduceUtil {
   public static class TableInputFormatConfiguratorWithCommandLineParser extends
       AbstractTableInputFormatConfigurator<TableInputFormatConfiguratorWithCommandLineParser> {
 
-    /**
-     * {@inheritDoc}
-     */
     public TableInputFormatConfiguratorWithCommandLineParser(Job job,
                                                              String table,
                                                              String columnProjection) {


[39/50] kudu git commit: Allow setup-kudu-demo script to use a pre-built VM image

Posted by wd...@apache.org.
Allow setup-kudu-demo script to use a pre-built VM image

setup-kudu-demo-vm.sh script currently either downloads
a VM image or let us use an already downloaded image.
It is easier for future testing if we allow it to use a pre-built
VM image in situations where we want to use an image built out
of quickstart-vm repository and then run few kudu-examples.

This change lets the script take an OVA file as an argument
and retains the original usage of either downloading the image
or using a downloaded image if it is present in current directory.

Testing: Verified that all 3 modes of input work as expected.


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

Branch: refs/heads/master
Commit: ae32aea390d7959af0d6f59006d26277b6af5623
Parents: 53a882c
Author: Dinesh Bhat <di...@gmail.com>
Authored: Wed Feb 1 18:58:38 2017 -0800
Committer: Dinesh Bhat <di...@gmail.com>
Committed: Wed Feb 1 18:58:47 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/ae32aea3/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 0aaa202..847a226 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,10 +8,6 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.10.0-kudu-virtualbox}
-OVF=${VIRTUALBOX_NAME}.ova
-: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}}
-
 # VM Settings default.
 : ${VM_NAME:=kudu-demo}
 : ${VM_NUM_CPUS:=2}
@@ -23,10 +19,30 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-# Download quickstart VM appliance
+OVF=cloudera-quickstart-vm-5.10.0-kudu-virtualbox.ova
+if [ $# -gt 2 ]; then
+    echo "$0 [--image|-i VM image file]"
+  exit 1
+elif [ $# -gt 0 ]; then
+  case $1 in
+    --image|-i)
+      OVF=$2
+      if [ ! -e $OVF ]; then
+        echo "Specified VM image file doesn't exist"
+        exit 1
+      fi
+      ;;
+    *)
+      echo "$0 [--image|-i VM image file]"
+      exit 1
+  esac
+fi
+
+# Use/download quickstart VM image
 if [ -e ${OVF} ]; then
-  echo Using previously downloaded image
+  echo Using image $OVF
 else
+  VIRTUALBOX_URL=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}
   echo "Downloading Virtualbox Image file: ${VIRTUALBOX_URL}"
   if ! curl -fLSs ${VIRTUALBOX_URL} --output ${OVF}; then
     echo "Failed to download VirtuaBox appliance from ${VIRTUALBOX_URL}"
@@ -35,7 +51,7 @@ else
 fi
 
 # Set up the VM for the first time if it doesn't already exist.
-if ! VBoxManage list vms | grep -q '"kudu-demo"'; then
+if ! VBoxManage list vms | grep -q '{$VM_NAME}'; then
   # Create a host only network interface
   VBoxManage hostonlyif create
 


[31/50] kudu git commit: [demo-vm-setup] added curl error handling

Posted by wd...@apache.org.
[demo-vm-setup] added curl error handling

Stop once it's clear the VBox appliance has failed to download:
do not try to interpret S3 server output for HTTP 403 and other
errors as a valid VBox appliance file.

Also made curl to follow HTTP redirects, if any.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6c30e2a0
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6c30e2a0
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6c30e2a0

Branch: refs/heads/master
Commit: 6c30e2a05785b042d10de9cc5f827762bc6cd958
Parents: 95654d8
Author: Alexey Serbin <as...@cloudera.com>
Authored: Fri Oct 28 17:34:31 2016 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Fri Oct 28 17:34:31 2016 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6c30e2a0/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index c1c5490..e1e7def 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -9,7 +9,8 @@ dir_resolve()
 }
 
 : ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox}
-: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${VIRTUALBOX_NAME}.ova}
+OVF=${VIRTUALBOX_NAME}.ova
+: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}}
 
 # VM Settings default.
 : ${VM_NAME:=kudu-demo}
@@ -22,13 +23,15 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-# Download quickstart VM
-OVF=${VIRTUALBOX_NAME}.ova
-if [ -e ${VIRTUALBOX_NAME}.ova ]; then
+# Download quickstart VM appliance
+if [ -e ${OVF} ]; then
   echo Using previously downloaded image
 else
   echo "Downloading Virtualbox Image file: ${VIRTUALBOX_URL}"
-  curl -O ${VIRTUALBOX_URL}
+  if ! curl -fLSs ${VIRTUALBOX_URL} --output ${OVF}; then
+    echo "Failed to download VirtuaBox appliance from ${VIRTUALBOX_URL}"
+    exit 1
+  fi
 fi
 
 # Set up the VM for the first time if it doesn't already exist.


[23/50] kudu git commit: Update Java examples for 0.9.0

Posted by wd...@apache.org.
Update Java examples for 0.9.0


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/5d3e245c
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/5d3e245c
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/5d3e245c

Branch: refs/heads/master
Commit: 5d3e245ca16024a88470defe1d7c519d53350033
Parents: 5bf7455
Author: Jean-Daniel Cryans <jd...@cloudera.com>
Authored: Wed Jun 15 21:18:40 2016 -0700
Committer: Jean-Daniel Cryans <jd...@cloudera.com>
Committed: Wed Jun 15 21:18:40 2016 -0700

----------------------------------------------------------------------
 java/collectl/pom.xml                           |  2 +-
 .../examples/collectl/KuduCollectlExample.java  | 20 +++++++++++++++++---
 java/insert-loadgen/pom.xml                     |  2 +-
 java/java-sample/pom.xml                        |  2 +-
 .../java/org/kududb/examples/sample/Sample.java |  6 +++++-
 5 files changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5d3e245c/java/collectl/pom.xml
----------------------------------------------------------------------
diff --git a/java/collectl/pom.xml b/java/collectl/pom.xml
index f90faae..65d1f36 100644
--- a/java/collectl/pom.xml
+++ b/java/collectl/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.1</version>
+      <version>0.9.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/5d3e245c/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
----------------------------------------------------------------------
diff --git a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
index 4480982..3e1ae29 100644
--- a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
+++ b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
@@ -14,6 +14,7 @@ import org.kududb.ColumnSchema;
 import org.kududb.ColumnSchema.ColumnSchemaBuilder;
 import org.kududb.Schema;
 import org.kududb.Type;
+import org.kududb.client.CreateTableOptions;
 import org.kududb.client.Insert;
 import org.kududb.client.KuduClient;
 import org.kududb.client.KuduSession;
@@ -64,7 +65,7 @@ public class KuduCollectlExample {
       return;
     }
     
-    ArrayList<ColumnSchema> cols = new ArrayList<>();
+    List<ColumnSchema> cols = new ArrayList<>();
     cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).encoding(
         ColumnSchema.Encoding.DICT_ENCODING).build());
     cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).encoding(
@@ -74,7 +75,14 @@ public class KuduCollectlExample {
     cols.add(new ColumnSchemaBuilder("value", Type.DOUBLE)
         .encoding(ColumnSchema.Encoding.BIT_SHUFFLE).build());
 
-    client.createTable(TABLE_NAME, new Schema(cols));
+    // Need to set this up since we're not pre-partitioning.
+    List<String> rangeKeys = new ArrayList<>();
+    rangeKeys.add("host");
+    rangeKeys.add("metric");
+    rangeKeys.add("timestamp");
+
+    client.createTable(TABLE_NAME, new Schema(cols),
+                       new CreateTableOptions().setRangePartitionColumns(rangeKeys));
   }
   
   private void createIdTableIfNecessary() throws Exception {
@@ -86,7 +94,13 @@ public class KuduCollectlExample {
     cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).build());
     cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).build());
 
-    client.createTable(ID_TABLE_NAME, new Schema(cols));
+    // Need to set this up since we're not pre-partitioning.
+    List<String> rangeKeys = new ArrayList<>();
+    rangeKeys.add("host");
+    rangeKeys.add("metric");
+
+    client.createTable(ID_TABLE_NAME, new Schema(cols),
+                       new CreateTableOptions().setRangePartitionColumns(rangeKeys));
   }
 
   class HandlerThread extends Thread {

http://git-wip-us.apache.org/repos/asf/kudu/blob/5d3e245c/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
index 2d3bb40..fddcdf9 100644
--- a/java/insert-loadgen/pom.xml
+++ b/java/insert-loadgen/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.1</version>
+      <version>0.9.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/5d3e245c/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --git a/java/java-sample/pom.xml b/java/java-sample/pom.xml
index 183ba2d..2f66c99 100644
--- a/java/java-sample/pom.xml
+++ b/java/java-sample/pom.xml
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.kududb</groupId>
       <artifactId>kudu-client</artifactId>
-      <version>0.7.1</version>
+      <version>0.9.0</version>
     </dependency>
 
     <!-- for logging messages -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/5d3e245c/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
----------------------------------------------------------------------
diff --git a/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java b/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
index 816d8f3..bd4b37b 100644
--- a/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
+++ b/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
@@ -28,8 +28,12 @@ public class Sample {
           .build());
       columns.add(new ColumnSchema.ColumnSchemaBuilder("value", Type.STRING)
           .build());
+      List<String> rangeKeys = new ArrayList<>();
+      rangeKeys.add("key");
+
       Schema schema = new Schema(columns);
-      client.createTable(tableName, schema);
+      client.createTable(tableName, schema,
+                         new CreateTableOptions().setRangePartitionColumns(rangeKeys));
 
       KuduTable table = client.openTable(tableName);
       KuduSession session = client.newSession();


[36/50] kudu git commit: Revert "Allow setup-kudu-demo script to use a pre-built VM image"

Posted by wd...@apache.org.
Revert "Allow setup-kudu-demo script to use a pre-built VM image"

This reverts commit 5eb22e43560744db08e10d5813379ebcd143ba18.

This commit broke people since it removed the code to actually download
the image.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/472770cc
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/472770cc
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/472770cc

Branch: refs/heads/master
Commit: 472770cce58699f816a5501e978f44128390448b
Parents: 59eb704
Author: Todd Lipcon <to...@cloudera.com>
Authored: Thu Jan 26 11:14:46 2017 -0800
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Thu Jan 26 11:14:46 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/472770cc/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 511be41..e1e7def 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,6 +8,10 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
+: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox}
+OVF=${VIRTUALBOX_NAME}.ova
+: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}}
+
 # VM Settings default.
 : ${VM_NAME:=kudu-demo}
 : ${VM_NUM_CPUS:=2}
@@ -19,28 +23,9 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-OVF=cloudera-quickstart-vm-5.8.0-kudu-virtualbox.ova
-if [ $# -gt 2 ]; then
-    echo "$0 [--image|-i VM image file]"
-  exit 1
-elif [ $# -gt 0 ]; then
-  case $1 in
-    --image|-i)
-      OVF=$2
-      if [ ! -e $OVF ]; then
-        echo "Specified VM image file doesn't exist"
-        exit 1
-      fi
-      ;;
-    *)
-      echo "$0 [--image|-i VM image file]"
-      exit 1
-  esac
-fi
-
-# Use/download quickstart VM image
+# Download quickstart VM appliance
 if [ -e ${OVF} ]; then
-  echo Using image $OVF
+  echo Using previously downloaded image
 else
   echo "Downloading Virtualbox Image file: ${VIRTUALBOX_URL}"
   if ! curl -fLSs ${VIRTUALBOX_URL} --output ${OVF}; then
@@ -50,7 +35,7 @@ else
 fi
 
 # Set up the VM for the first time if it doesn't already exist.
-if ! VBoxManage list vms | grep -q '{$VM_NAME}'; then
+if ! VBoxManage list vms | grep -q '"kudu-demo"'; then
   # Create a host only network interface
   VBoxManage hostonlyif create
 


[10/50] kudu git commit: Fix the collectl example and add encodings

Posted by wd...@apache.org.
Fix the collectl example and add encodings


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/75b08098
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/75b08098
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/75b08098

Branch: refs/heads/master
Commit: 75b08098e9449f6f5f3f162aa944783cfe10d681
Parents: aac4a91
Author: David Alves <da...@cloudera.com>
Authored: Sun Sep 27 19:31:48 2015 -0700
Committer: David Alves <da...@cloudera.com>
Committed: Sun Sep 27 19:41:23 2015 -0700

----------------------------------------------------------------------
 .../examples/collectl/KuduCollectlExample.java  | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/75b08098/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
----------------------------------------------------------------------
diff --git a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
index effcca2..4480982 100644
--- a/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
+++ b/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
@@ -65,10 +65,14 @@ public class KuduCollectlExample {
     }
     
     ArrayList<ColumnSchema> cols = new ArrayList<>();
-    cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).build());
-    cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).build());
-    cols.add(new ColumnSchemaBuilder("timestamp", Type.INT32).key(true).build());
-    cols.add(new ColumnSchemaBuilder("value", Type.DOUBLE).build());
+    cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).encoding(
+        ColumnSchema.Encoding.DICT_ENCODING).build());
+    cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).encoding(
+        ColumnSchema.Encoding.DICT_ENCODING).build());
+    cols.add(new ColumnSchemaBuilder("timestamp", Type.INT32).key(true).encoding(
+        ColumnSchema.Encoding.BIT_SHUFFLE).build());
+    cols.add(new ColumnSchemaBuilder("value", Type.DOUBLE)
+        .encoding(ColumnSchema.Encoding.BIT_SHUFFLE).build());
 
     client.createTable(TABLE_NAME, new Schema(cols));
   }
@@ -163,15 +167,17 @@ public class KuduCollectlExample {
         if (!br.ready()) {
           List<OperationResponse> responses = session.flush();
           for (OperationResponse r : responses) {
-            RowError e = r.getRowError();
-            // TODO: the client should offer an enum for different row errors, instead
-            // of string comparison!
-            if ("ALREADY_PRESENT".equals(e.getStatus())) {
-              continue;
-            }
-            System.err.println("Error inserting " + e.getOperation().toString()
-                + ": " + e.toString());
+            if (r.hasRowError()) {
+              RowError e = r.getRowError();
+              // TODO: the client should offer an enum for different row errors, instead
+              // of string comparison!
+              if ("ALREADY_PRESENT".equals(e.getStatus())) {
+                continue;
+              }
+              System.err.println("Error inserting " + e.getOperation().toString()
+                  + ": " + e.toString());
             }
+          }
         }
       }
     }


[44/50] kudu git commit: Update for 5.13.0 release

Posted by wd...@apache.org.
Update for 5.13.0 release


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

Branch: refs/heads/master
Commit: cd58992e9080836d4fef334ab0ea62dbed53bf4e
Parents: 82708e9
Author: Adar Dembo <ad...@cloudera.com>
Authored: Wed Oct 11 12:56:05 2017 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Wed Oct 11 12:56:49 2017 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/cd58992e/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index c59e11e..ada9f8c 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -19,7 +19,7 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-OVF=cloudera-quickstart-vm-5.11.0-kudu-virtualbox.ova
+OVF=cloudera-quickstart-vm-5.13.0-kudu-virtualbox.ova
 if [ $# -gt 2 ]; then
     echo "$0 [--image|-i VM image file]"
   exit 1


[28/50] kudu git commit: Merge pull request #22 from toddlipcon/master

Posted by wd...@apache.org.
Merge pull request #22 from toddlipcon/master

Update to 0.10 API, some cleanup

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/8bf18396
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/8bf18396
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/8bf18396

Branch: refs/heads/master
Commit: 8bf183963c44d83198be2e21b60fd6dfeee84261
Parents: 02d6eaa b69bb7d
Author: Todd Lipcon <to...@lipcon.org>
Authored: Tue Aug 23 12:52:18 2016 -0700
Committer: GitHub <no...@github.com>
Committed: Tue Aug 23 12:52:18 2016 -0700

----------------------------------------------------------------------
 README.md                                       |  5 +--
 java/collectl/README                            | 32 ++++++++------------
 java/collectl/pom.xml                           |  4 +--
 .../examples/collectl/KuduCollectlExample.java  | 24 +++++++--------
 java/insert-loadgen/pom.xml                     |  4 +--
 .../kududb/examples/loadgen/InsertLoadgen.java  | 16 +++++-----
 java/java-sample/pom.xml                        |  4 +--
 .../java/org/kududb/examples/sample/Sample.java |  8 ++---
 8 files changed, 46 insertions(+), 51 deletions(-)
----------------------------------------------------------------------



[41/50] kudu git commit: Use the 5.11 vm instead of 5.10

Posted by wd...@apache.org.
Use the 5.11 vm instead of 5.10


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

Branch: refs/heads/master
Commit: baf86dcc58fa65a4736f50d0236ef70549fc5999
Parents: 6bf8629
Author: Jean-Daniel Cryans <jd...@cloudera.com>
Authored: Thu Apr 20 22:34:47 2017 -0700
Committer: Jean-Daniel Cryans <jd...@cloudera.com>
Committed: Thu Apr 20 22:34:47 2017 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/baf86dcc/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index 847a226..c59e11e 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -19,7 +19,7 @@ if ! which VBoxManage >/dev/null ; then
   exit 1
 fi
 
-OVF=cloudera-quickstart-vm-5.10.0-kudu-virtualbox.ova
+OVF=cloudera-quickstart-vm-5.11.0-kudu-virtualbox.ova
 if [ $# -gt 2 ]; then
     echo "$0 [--image|-i VM image file]"
   exit 1


[42/50] kudu git commit: Merge pull request #33 from jdcryans/master

Posted by wd...@apache.org.
Merge pull request #33 from jdcryans/master

Use the 5.11 vm instead of 5.10

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/54348ce1
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/54348ce1
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/54348ce1

Branch: refs/heads/master
Commit: 54348ce1c9670d8118dc493be8a8a5c263fe2970
Parents: 6bf8629 baf86dc
Author: adembo <ad...@gmail.com>
Authored: Fri Apr 21 10:27:31 2017 -0700
Committer: GitHub <no...@github.com>
Committed: Fri Apr 21 10:27:31 2017 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[14/50] kudu git commit: Add insert-loadgen example to repo

Posted by wd...@apache.org.
Add insert-loadgen example to repo

This is a load generator designed to write random data to an arbitrary
schema as quickly as possible.


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/565743a4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/565743a4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/565743a4

Branch: refs/heads/master
Commit: 565743a4ca4ed52af25b3b7275de1a1e3467d1f3
Parents: 4de3201
Author: Mike Percy <mp...@cloudera.com>
Authored: Thu Nov 5 14:29:03 2015 -0800
Committer: Mike Percy <mp...@cloudera.com>
Committed: Fri Nov 6 16:46:12 2015 -0800

----------------------------------------------------------------------
 java/.gitignore                                 |   2 +
 java/insert-loadgen/README                      |  17 +++
 java/insert-loadgen/pom.xml                     |  72 ++++++++++
 .../kududb/examples/loadgen/InsertLoadgen.java  | 140 +++++++++++++++++++
 4 files changed, 231 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/565743a4/java/.gitignore
----------------------------------------------------------------------
diff --git a/java/.gitignore b/java/.gitignore
index 4afb9e4..b2dce6e 100644
--- a/java/.gitignore
+++ b/java/.gitignore
@@ -3,3 +3,5 @@ target/
 .classpath
 .project
 .settings
+.idea
+*.iml

http://git-wip-us.apache.org/repos/asf/kudu/blob/565743a4/java/insert-loadgen/README
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/README b/java/insert-loadgen/README
new file mode 100644
index 0000000..7c0628e
--- /dev/null
+++ b/java/insert-loadgen/README
@@ -0,0 +1,17 @@
+Random insert load generator. This will insert as fast as it can using
+AUTO_BACKGROUND_FLUSH with the specified number of threads. All fields are
+randomized, and insert failures (including errors from collisions) are ignored.
+
+To build and run, do the following:
+
+$ mvn package
+$ java -jar target/kudu-insert-loadgen-0.1-SNAPSHOT.jar kudu_master_host kudu_table_name num_threads
+
+For example, if you are running the Quickstart VM with the host name
+"quickstart.cloudera", then you can use:
+
+$ java -jar target/kudu-insert-loadgen-0.1-SNAPSHOT.jar quickstart.cloudera test_table 16
+
+Note: This program will not create the "test_table" table. You must do that
+via other means, such as through impala-shell or using the create-demo-table
+program included in the Kudu source tree.

http://git-wip-us.apache.org/repos/asf/kudu/blob/565743a4/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/pom.xml b/java/insert-loadgen/pom.xml
new file mode 100644
index 0000000..13f5cd5
--- /dev/null
+++ b/java/insert-loadgen/pom.xml
@@ -0,0 +1,72 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>kudu-examples</groupId>
+  <artifactId>kudu-insert-loadgen</artifactId>
+  <packaging>jar</packaging>
+  <version>0.1-SNAPSHOT</version>
+  <name>Random Insert Load Generator for Kudu</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.1</version>
+        <configuration>
+          <source>1.7</source>
+          <target>1.7</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <transformers>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <mainClass>org.kududb.examples.loadgen.InsertLoadgen</mainClass>
+                </transformer>
+              </transformers>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>cdh.repo</id>
+      <name>Cloudera Repositories</name>
+      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.kududb</groupId>
+      <artifactId>kudu-client</artifactId>
+      <version>0.5.0</version>
+    </dependency>
+
+    <!-- for logging messages -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.12</version>
+    </dependency>
+
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/565743a4/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
----------------------------------------------------------------------
diff --git a/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
new file mode 100644
index 0000000..f7438c0
--- /dev/null
+++ b/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
@@ -0,0 +1,140 @@
+package org.kududb.examples.loadgen;
+
+import org.kududb.Schema;
+import org.kududb.Type;
+import org.kududb.client.Insert;
+import org.kududb.client.KuduClient;
+import org.kududb.client.KuduSession;
+import org.kududb.client.KuduTable;
+import org.kududb.client.PartialRow;
+import org.kududb.client.SessionConfiguration;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+public class InsertLoadgen {
+
+  private static class RandomDataGenerator {
+    private final Random rng;
+    private final int index;
+    private final Type type;
+
+    /**
+     * Instantiate a random data generator for a specific field.
+     * @param index The numerical index of the column in the row schema
+     * @param type The type of the data at index {@code index}
+     */
+    public RandomDataGenerator(int index, Type type) {
+      this.rng = new Random();
+      this.index = index;
+      this.type = type;
+    }
+
+    /**
+     * Add random data to the given row for the column at index {@code index}
+     * of type {@code type}
+     * @param row The row to add the field to
+     */
+    void generateColumnData(PartialRow row) {
+      switch (type) {
+        case INT8:
+          row.addByte(index, (byte) rng.nextInt(Byte.MAX_VALUE));
+          return;
+        case INT16:
+          row.addShort(index, (short)rng.nextInt(Short.MAX_VALUE));
+          return;
+        case INT32:
+          row.addInt(index, rng.nextInt(Integer.MAX_VALUE));
+          return;
+        case INT64:
+        case TIMESTAMP:
+          row.addLong(index, rng.nextLong());
+          return;
+        case BINARY:
+          byte bytes[] = new byte[16];
+          rng.nextBytes(bytes);
+          row.addBinary(index, bytes);
+          return;
+        case STRING:
+          row.addString(index, UUID.randomUUID().toString());
+          return;
+        case BOOL:
+          row.addBoolean(index, rng.nextBoolean());
+          return;
+        case FLOAT:
+          row.addFloat(index, rng.nextFloat());
+          return;
+        case DOUBLE:
+          row.addDouble(index, rng.nextDouble());
+          return;
+        default:
+          throw new UnsupportedOperationException("Unknown type " + type);
+      }
+    }
+  }
+
+  public static void runLoad(String masterHost, String tableName) {
+    KuduClient client = new KuduClient.KuduClientBuilder(masterHost).build();
+
+    try {
+      KuduTable table = client.openTable(tableName);
+      Schema schema = table.getSchema();
+      List<RandomDataGenerator> generators = new ArrayList<>(schema.getColumnCount());
+      for (int i = 0; i < schema.getColumnCount(); i++) {
+        generators.add(new RandomDataGenerator(i, schema.getColumnByIndex(i).getType()));
+      }
+
+      KuduSession session = client.newSession();
+      session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
+      while (true) {
+        Insert insert = table.newInsert();
+        PartialRow row = insert.getRow();
+        for (int i = 0; i < schema.getColumnCount(); i++) {
+          generators.get(i).generateColumnData(row);
+        }
+        session.apply(insert);
+      }
+
+    } catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      try {
+        client.shutdown();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+  }
+
+  public static void main(String[] args) {
+    if (args.length != 3) {
+      System.err.println("Usage: InsertLoadgen kudu_master_host kudu_table num_threads");
+      System.exit(1);
+    }
+
+    final String masterHost = args[0];
+    final String tableName = args[1];
+    int numThreads = Integer.parseInt(args[2]);
+
+    final CountDownLatch latch = new CountDownLatch(numThreads);
+
+    List<Thread> threads = new ArrayList<>(numThreads);
+    for (int i = 0; i < numThreads; i++) {
+      threads.add(new Thread(new Runnable() {
+        public void run() {
+          runLoad(masterHost, tableName);
+          latch.countDown();
+        }
+      }));
+      threads.get(i).start();
+    }
+    try {
+      latch.await();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    }
+  }
+}


[37/50] kudu git commit: Update for 5.10.0 release

Posted by wd...@apache.org.
Update for 5.10.0 release


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/20f7d86f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/20f7d86f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/20f7d86f

Branch: refs/heads/master
Commit: 20f7d86f379f2291306f521b819d61d957b3294f
Parents: 472770c
Author: Adar Dembo <ad...@cloudera.com>
Authored: Tue Jan 31 18:29:26 2017 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Tue Jan 31 18:29:26 2017 -0800

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/20f7d86f/demo-vm-setup/setup-kudu-demo-vm.sh
----------------------------------------------------------------------
diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh
index e1e7def..0aaa202 100755
--- a/demo-vm-setup/setup-kudu-demo-vm.sh
+++ b/demo-vm-setup/setup-kudu-demo-vm.sh
@@ -8,7 +8,7 @@ dir_resolve()
   echo "`pwd -P`"
 }
 
-: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox}
+: ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.10.0-kudu-virtualbox}
 OVF=${VIRTUALBOX_NAME}.ova
 : ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}}
 


[30/50] kudu git commit: Merge pull request #23 from jtbirdsell/master

Posted by wd...@apache.org.
Merge pull request #23 from jtbirdsell/master

Python example update - 0.3.0

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/95654d82
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/95654d82
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/95654d82

Branch: refs/heads/master
Commit: 95654d82d4420a6c745207b9a52039de5fadcb1d
Parents: 8bf1839 26b8187
Author: Todd Lipcon <to...@lipcon.org>
Authored: Fri Sep 30 12:25:39 2016 -0700
Committer: GitHub <no...@github.com>
Committed: Fri Sep 30 12:25:39 2016 -0700

----------------------------------------------------------------------
 python/dstat-kudu/kudu_dstat.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------



[48/50] kudu git commit: Introduce examples directory

Posted by wd...@apache.org.
Introduce examples directory

This introduces the top-level examples directory, which will be for
examples of how to use the Kudu clients and integrations.

As a first step, I moved the client examples from src/kudu/client/examples
to examples/cpp. I also renamed "sample" -> "example" generally.

I also manually verified that the instructions in the README for building the
example application still work.

Change-Id: Iceca48771541f95e4f0caf8c098bc85d34aa558e
Reviewed-on: http://gerrit.cloudera.org:8080/9837
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <aw...@cloudera.com>


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

Branch: refs/heads/master
Commit: 9bf32a42486bdb4f97834737283c30129ffe71a6
Parents: f7ab95e
Author: Will Berkeley <wd...@apache.org>
Authored: Tue Mar 27 21:52:37 2018 -0700
Committer: Will Berkeley <wd...@gmail.com>
Committed: Wed Mar 28 21:42:38 2018 +0000

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt             |  26 +++
 examples/cpp/README.adoc                | 183 +++++++++++++++
 examples/cpp/example.cc                 | 320 +++++++++++++++++++++++++++
 src/kudu/client/CMakeLists.txt          |  12 +-
 src/kudu/client/client_examples-test.sh | 218 ++++++++++++++++++
 src/kudu/client/client_samples-test.sh  | 218 ------------------
 src/kudu/client/samples/CMakeLists.txt  |  26 ---
 src/kudu/client/samples/README.adoc     | 183 ---------------
 src/kudu/client/samples/sample.cc       | 320 ---------------------------
 9 files changed, 753 insertions(+), 753 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
new file mode 100644
index 0000000..62bc177
--- /dev/null
+++ b/examples/cpp/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Client API example executables
+
+cmake_minimum_required(VERSION 2.8)
+
+find_package(kuduClient REQUIRED)
+include_directories(${KUDU_CLIENT_INCLUDE_DIR})
+
+add_executable(example example.cc)
+target_link_libraries(example kudu_client)

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/examples/cpp/README.adoc
----------------------------------------------------------------------
diff --git a/examples/cpp/README.adoc b/examples/cpp/README.adoc
new file mode 100644
index 0000000..6bad943
--- /dev/null
+++ b/examples/cpp/README.adoc
@@ -0,0 +1,183 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+= Kudu {cpp} client example README
+:author: Kudu Team
+:homepage: https://kudu.apache.org/
+
+== Summary
+The Kudu {cpp} client library distribution contains {cpp} example application
+that demonstrates how to use the Kudu {cpp} client API.  The example
+can be used as a starting point for a custom Kudu {cpp} client application.
+This note contains information on how to build the Kudu {cpp} client example.
+
+== How to build the example if installing Kudu from packages
+This section describes how to build the example if installing Kudu
+using pre-built packages.
+
+. Install the required packages as described in the
+https://kudu.apache.org/docs/installation.html#install_packages[documentation on the Kudu Web site].
+The `kudu-client0` package (`libkuduclient0` on Debian/Ubuntu Linux
+distributions) contains the Kudu {cpp} client library, and the `kudu-client-dev`
+package (`libkuduclient-dev` on Debian/Ubuntu Linux distributions) contains
+the Kudu {cpp} client header files and {cpp} code example (`example.cc`)
+along with other auxiliary content.
+
+. Make sure `cmake` of version at least 2.8 is installed on the system.
+
+. Copy the example into a custom location where you would like to work
+with the code. Working in the `/usr/share/doc/kuduClient/examples`
+directory is possible but is not recommended since it requires
+super-user access and pollutes the `example` directory with
+intermediate files.
+For example, to copy the `/usr/share/doc/kuduClient/examples` directory
+recursively into `/tmp/kuduClient`:
+[source,shell]
+cp -r /usr/share/doc/kuduClient/examples /tmp/kuduClient
+
+. Navigate into the directory where the `example.cc.gz` file was copied and
+unpack the example source file.  For example:
+[source,shell]
+cd /tmp/kuduClient/examples
+gunzip example.cc.gz
+
+. Run `cmake` to generate appropriate makefiles.  For example, if targeting
+for a debug build
+(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
+[source,shell]
+cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug
+
+. Run `make` to build the example:
+[source,shell]
+make
+
+. After the example is built, it is ready to run against your Kudu master server.
+The example application assumes the target Kudu cluster has at least 3
+tablet servers up and running (because it creates a table with replication
+factor 3).  If it's not the case, you can modify the `example.cc` accordingly
+and re-compile it.  Below is the example output with log messages in the middle
+removed: the `example` binary runs against Kudu master server running
+with the default parameters at the same machine.  Port 7051 is the default
+one and could be omitted along with the preceding colomn because the master
+server is running with the default parameters (it's left only to illustrate how
+to specify port number).
+[source,shell]
+$ ./example 127.0.0.1:7051
+Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
+Long version info: kudu 1.1.0-SNAPSHOT
+revision 91a1ed09c4c572a22bab15360ddaf481d5632927
+build type DEBUG
+built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
+Received log message from Kudu client library
+ Severity: 0
+ Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
+ Line number: 546
+ Time: Thu Oct 06 14:50:47 2016
+ Message: Started thread 11197 - kernel-watchdog:kernel-watcher
+...
+Received log message from Kudu client library
+ Severity: 0
+ Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
+ Line number: 534
+ Time: Thu Oct 06 14:50:47 2016
+ Message: Considering host 10.17.240.17 local
+Created a client connection
+Created a schema
+Created a table
+Altered a table
+Inserted some rows into a table
+Scanned some rows out of a table
+Deleted a table
+Done
+
+== How to build the example if building Kudu from source
+This section describes how to build the example if building Kudu from source.
+To install the `example.cc` and other files, an alternate destination root
+is used.
+
+Specifying an alternate destination root allows you to install the
+Kudu {cpp} client library, the example file and other content
+under the specified destination prefix.
+
+. Follow the https://kudu.apache.org/docs/installation.html#_build_from_source[instructions on the Kudu Web site]
+to build the project from source.
+
+. Once the project is built, change into the `<build_dir>/src/kudu/client`
+sub-directory.
+
+. Run `make install` with an alternate destination root.  For example, if
+installing into `/tmp/client_alt_root`
+[source,shell]
+make install DESTDIR=/tmp/client_alt_root
+
+. Change the current working directory into the
+`usr/local/share/doc/kuduClient/examples` subdirectory of the alternate
+destination root.  For example, if installing into `/tmp/client_alt_root`
+[source,shell]
+cd /tmp/client_alt_root/usr/local/share/doc/kuduClient/examples
+
+. Run `cmake` to generate appropriate makefiles.  For example, if installing
+into `/tmp/client_alt_root` and targeting for a debug build
+(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
+[source,shell]
+cmake -G "Unix Makefiles" -DkuduClient_DIR=/tmp/client_alt_root/usr/local/share/kuduClient/cmake -DCMAKE_BUILD_TYPE=debug
+
+. Run `make` to build the example:
+[source,shell]
+make
+
+. After the example is built, it is ready to run against your Kudu master server.
+The example application assumes the target Kudu cluster has at least 3
+tablet servers up and running (because it creates a table with replication
+factor 3).  If it's not the case, you can modify the `example.cc` accordingly
+and re-compile it.  Below is the example output with log messages in the middle
+removed: the `example` binary runs against Kudu master server running
+with the default parameters at the same machine.  Port 7051 is the default
+one and could be omitted along with the preceding colomn because the master
+server is running with the default parameters (it's left only to illustrate how
+to specify port number).
+[source,shell]
+$ ./example 127.0.0.1:7051
+Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
+Long version info: kudu 1.1.0-SNAPSHOT
+revision 91a1ed09c4c572a22bab15360ddaf481d5632927
+build type DEBUG
+built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
+Received log message from Kudu client library
+ Severity: 0
+ Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
+ Line number: 546
+ Time: Thu Oct 06 14:50:47 2016
+ Message: Started thread 11197 - kernel-watchdog:kernel-watcher
+...
+Received log message from Kudu client library
+ Severity: 0
+ Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
+ Line number: 534
+ Time: Thu Oct 06 14:50:47 2016
+ Message: Considering host 10.17.240.17 local
+Created a client connection
+Created a schema
+Created a table
+Altered a table
+Inserted some rows into a table
+Scanned some rows out of a table
+Deleted a table
+Done
+
+== References
+. https://kudu.apache.org/[The Kudu Project Web Site]
+. https://kudu.apache.org/cpp-client-api/[Kudu {cpp} client API documentation]

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/examples/cpp/example.cc
----------------------------------------------------------------------
diff --git a/examples/cpp/example.cc b/examples/cpp/example.cc
new file mode 100644
index 0000000..9b5d65e
--- /dev/null
+++ b/examples/cpp/example.cc
@@ -0,0 +1,320 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <ctime>
+#include <iostream>
+#include <sstream>
+
+#include "kudu/client/callbacks.h"
+#include "kudu/client/client.h"
+#include "kudu/client/row_result.h"
+#include "kudu/client/stubs.h"
+#include "kudu/client/value.h"
+#include "kudu/client/write_op.h"
+#include "kudu/common/partial_row.h"
+#include "kudu/util/monotime.h"
+
+using kudu::client::KuduClient;
+using kudu::client::KuduClientBuilder;
+using kudu::client::KuduColumnSchema;
+using kudu::client::KuduError;
+using kudu::client::KuduInsert;
+using kudu::client::KuduPredicate;
+using kudu::client::KuduRowResult;
+using kudu::client::KuduScanner;
+using kudu::client::KuduSchema;
+using kudu::client::KuduSchemaBuilder;
+using kudu::client::KuduSession;
+using kudu::client::KuduStatusFunctionCallback;
+using kudu::client::KuduTable;
+using kudu::client::KuduTableAlterer;
+using kudu::client::KuduTableCreator;
+using kudu::client::KuduValue;
+using kudu::client::sp::shared_ptr;
+using kudu::KuduPartialRow;
+using kudu::MonoDelta;
+using kudu::Status;
+
+using std::ostringstream;
+using std::string;
+using std::vector;
+
+static Status CreateClient(const string& addr,
+                           shared_ptr<KuduClient>* client) {
+  return KuduClientBuilder()
+      .add_master_server_addr(addr)
+      .default_admin_operation_timeout(MonoDelta::FromSeconds(20))
+      .Build(client);
+}
+
+static KuduSchema CreateSchema() {
+  KuduSchema schema;
+  KuduSchemaBuilder b;
+  b.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
+  b.AddColumn("int_val")->Type(KuduColumnSchema::INT32)->NotNull();
+  b.AddColumn("string_val")->Type(KuduColumnSchema::STRING)->NotNull();
+  b.AddColumn("non_null_with_default")->Type(KuduColumnSchema::INT32)->NotNull()
+    ->Default(KuduValue::FromInt(12345));
+  KUDU_CHECK_OK(b.Build(&schema));
+  return schema;
+}
+
+static Status DoesTableExist(const shared_ptr<KuduClient>& client,
+                             const string& table_name,
+                             bool *exists) {
+  shared_ptr<KuduTable> table;
+  Status s = client->OpenTable(table_name, &table);
+  if (s.ok()) {
+    *exists = true;
+  } else if (s.IsNotFound()) {
+    *exists = false;
+    s = Status::OK();
+  }
+  return s;
+}
+
+static Status CreateTable(const shared_ptr<KuduClient>& client,
+                          const string& table_name,
+                          const KuduSchema& schema,
+                          int num_tablets) {
+  // Generate the split keys for the table.
+  vector<const KuduPartialRow*> splits;
+  int32_t increment = 1000 / num_tablets;
+  for (int32_t i = 1; i < num_tablets; i++) {
+    KuduPartialRow* row = schema.NewRow();
+    KUDU_CHECK_OK(row->SetInt32(0, i * increment));
+    splits.push_back(row);
+  }
+
+  vector<string> column_names;
+  column_names.push_back("key");
+
+  // Create the table.
+  KuduTableCreator* table_creator = client->NewTableCreator();
+  Status s = table_creator->table_name(table_name)
+      .schema(&schema)
+      .set_range_partition_columns(column_names)
+      .split_rows(splits)
+      .Create();
+  delete table_creator;
+  return s;
+}
+
+static Status AlterTable(const shared_ptr<KuduClient>& client,
+                         const string& table_name) {
+  KuduTableAlterer* table_alterer = client->NewTableAlterer(table_name);
+  table_alterer->AlterColumn("int_val")->RenameTo("integer_val");
+  table_alterer->AddColumn("another_val")->Type(KuduColumnSchema::BOOL);
+  table_alterer->DropColumn("string_val");
+  Status s = table_alterer->Alter();
+  delete table_alterer;
+  return s;
+}
+
+static void StatusCB(void* unused, const Status& status) {
+  KUDU_LOG(INFO) << "Asynchronous flush finished with status: "
+                      << status.ToString();
+}
+
+static Status InsertRows(const shared_ptr<KuduTable>& table, int num_rows) {
+  shared_ptr<KuduSession> session = table->client()->NewSession();
+  KUDU_RETURN_NOT_OK(session->SetFlushMode(KuduSession::MANUAL_FLUSH));
+  session->SetTimeoutMillis(5000);
+
+  for (int i = 0; i < num_rows; i++) {
+    KuduInsert* insert = table->NewInsert();
+    KuduPartialRow* row = insert->mutable_row();
+    KUDU_CHECK_OK(row->SetInt32("key", i));
+    KUDU_CHECK_OK(row->SetInt32("integer_val", i * 2));
+    KUDU_CHECK_OK(row->SetInt32("non_null_with_default", i * 5));
+    KUDU_CHECK_OK(session->Apply(insert));
+  }
+  Status s = session->Flush();
+  if (s.ok()) {
+    return s;
+  }
+
+  // Test asynchronous flush.
+  KuduStatusFunctionCallback<void*> status_cb(&StatusCB, NULL);
+  session->FlushAsync(&status_cb);
+
+  // Look at the session's errors.
+  vector<KuduError*> errors;
+  bool overflow;
+  session->GetPendingErrors(&errors, &overflow);
+  if (!errors.empty()) {
+    s = overflow ? Status::IOError("Overflowed pending errors in session") :
+        errors.front()->status();
+    while (!errors.empty()) {
+      delete errors.back();
+      errors.pop_back();
+    }
+  }
+  KUDU_RETURN_NOT_OK(s);
+
+  // Close the session.
+  return session->Close();
+}
+
+static Status ScanRows(const shared_ptr<KuduTable>& table) {
+  const int kLowerBound = 5;
+  const int kUpperBound = 600;
+
+  KuduScanner scanner(table.get());
+
+  // Add a predicate: WHERE key >= 5
+  KuduPredicate* p = table->NewComparisonPredicate(
+      "key", KuduPredicate::GREATER_EQUAL, KuduValue::FromInt(kLowerBound));
+  KUDU_RETURN_NOT_OK(scanner.AddConjunctPredicate(p));
+
+  // Add a predicate: WHERE key <= 600
+  p = table->NewComparisonPredicate(
+      "key", KuduPredicate::LESS_EQUAL, KuduValue::FromInt(kUpperBound));
+  KUDU_RETURN_NOT_OK(scanner.AddConjunctPredicate(p));
+
+  KUDU_RETURN_NOT_OK(scanner.Open());
+  vector<KuduRowResult> results;
+
+  int next_row = kLowerBound;
+  while (scanner.HasMoreRows()) {
+    KUDU_RETURN_NOT_OK(scanner.NextBatch(&results));
+    for (vector<KuduRowResult>::iterator iter = results.begin();
+        iter != results.end();
+        iter++, next_row++) {
+      const KuduRowResult& result = *iter;
+      int32_t val;
+      KUDU_RETURN_NOT_OK(result.GetInt32("key", &val));
+      if (val != next_row) {
+        ostringstream out;
+        out << "Scan returned the wrong results. Expected key "
+            << next_row << " but got " << val;
+        return Status::IOError(out.str());
+      }
+    }
+    results.clear();
+  }
+
+  // next_row is now one past the last row we read.
+  int last_row_seen = next_row - 1;
+
+  if (last_row_seen != kUpperBound) {
+    ostringstream out;
+    out << "Scan returned the wrong results. Expected last row to be "
+        << kUpperBound << " rows but got " << last_row_seen;
+    return Status::IOError(out.str());
+  }
+  return Status::OK();
+}
+
+// A helper class providing custom logging callback. It also manages
+// automatic callback installation and removal.
+class LogCallbackHelper {
+ public:
+  LogCallbackHelper() : log_cb_(&LogCallbackHelper::LogCb, NULL) {
+    kudu::client::InstallLoggingCallback(&log_cb_);
+  }
+
+  ~LogCallbackHelper() {
+    kudu::client::UninstallLoggingCallback();
+  }
+
+  static void LogCb(void* unused,
+                    kudu::client::KuduLogSeverity severity,
+                    const char* filename,
+                    int line_number,
+                    const struct ::tm* time,
+                    const char* message,
+                    size_t message_len) {
+    KUDU_LOG(INFO) << "Received log message from Kudu client library";
+    KUDU_LOG(INFO) << " Severity: " << severity;
+    KUDU_LOG(INFO) << " Filename: " << filename;
+    KUDU_LOG(INFO) << " Line number: " << line_number;
+    char time_buf[32];
+    // Example: Tue Mar 24 11:46:43 2015.
+    KUDU_CHECK(strftime(time_buf, sizeof(time_buf), "%a %b %d %T %Y", time));
+    KUDU_LOG(INFO) << " Time: " << time_buf;
+    KUDU_LOG(INFO) << " Message: " << string(message, message_len);
+  }
+
+ private:
+  kudu::client::KuduLoggingFunctionCallback<void*> log_cb_;
+};
+
+int main(int argc, char* argv[]) {
+  KUDU_LOG(INFO) << "Running with Kudu client version: " <<
+      kudu::client::GetShortVersionString();
+  KUDU_LOG(INFO) << "Long version info: " <<
+      kudu::client::GetAllVersionInfo();
+
+  // This is to install and automatically un-install custom logging callback.
+  LogCallbackHelper log_cb_helper;
+
+  if (argc != 2) {
+    KUDU_LOG(FATAL) << "usage: " << argv[0] << " <master host>";
+  }
+  const string master_host = argv[1];
+
+  const string kTableName = "test_table";
+
+  // Enable verbose debugging for the client library.
+  kudu::client::SetVerboseLogLevel(2);
+
+  // Create and connect a client.
+  shared_ptr<KuduClient> client;
+  KUDU_CHECK_OK(CreateClient(master_host, &client));
+  KUDU_LOG(INFO) << "Created a client connection";
+
+  // Disable the verbose logging.
+  kudu::client::SetVerboseLogLevel(0);
+
+  // Create a schema.
+  KuduSchema schema(CreateSchema());
+  KUDU_LOG(INFO) << "Created a schema";
+
+  // Create a table with that schema.
+  bool exists;
+  KUDU_CHECK_OK(DoesTableExist(client, kTableName, &exists));
+  if (exists) {
+    client->DeleteTable(kTableName);
+    KUDU_LOG(INFO) << "Deleting old table before creating new one";
+  }
+  KUDU_CHECK_OK(CreateTable(client, kTableName, schema, 10));
+  KUDU_LOG(INFO) << "Created a table";
+
+  // Alter the table.
+  KUDU_CHECK_OK(AlterTable(client, kTableName));
+  KUDU_LOG(INFO) << "Altered a table";
+
+  // Insert some rows into the table.
+  shared_ptr<KuduTable> table;
+  KUDU_CHECK_OK(client->OpenTable(kTableName, &table));
+  KUDU_CHECK_OK(InsertRows(table, 1000));
+  KUDU_LOG(INFO) << "Inserted some rows into a table";
+
+  // Scan some rows.
+  KUDU_CHECK_OK(ScanRows(table));
+  KUDU_LOG(INFO) << "Scanned some rows out of a table";
+
+  // Delete the table.
+  KUDU_CHECK_OK(client->DeleteTable(kTableName));
+  KUDU_LOG(INFO) << "Deleted a table";
+
+  // Done!
+  KUDU_LOG(INFO) << "Done";
+
+  return 0;
+}

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/client/CMakeLists.txt b/src/kudu/client/CMakeLists.txt
index 776acdb..2e6ab1c 100644
--- a/src/kudu/client/CMakeLists.txt
+++ b/src/kudu/client/CMakeLists.txt
@@ -199,13 +199,13 @@ install(FILES
   ../util/status.h
   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/kudu/util)
 
-# Client sample code.
+# Client example code.
 #
 # Can't use CMAKE_INSTALL_DOCDIR because we don't ever call project().
 install(FILES
-  samples/CMakeLists.txt
-  samples/sample.cc
-  DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/kuduClient/samples)
+  ../../../examples/cpp/CMakeLists.txt
+  ../../../examples/cpp/example.cc
+  DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/kuduClient/examples)
 
 # Exported cmake file for just the library's targets.
 #
@@ -252,9 +252,9 @@ if (NOT APPLE AND NOT "${KUDU_GENERATE_COVERAGE}")
   ADD_KUDU_TEST(client_symbol-test.sh LABELS no_dist_test)
 endif()
 
-# The samples are never built with ASAN/TSAN.
+# The examples are never built with ASAN/TSAN.
 if(NOT "${KUDU_USE_ASAN}" AND NOT "${KUDU_USE_TSAN}")
-  ADD_KUDU_TEST(client_samples-test.sh RUN_SERIAL true LABELS no_dist_test)
+  ADD_KUDU_TEST(client_examples-test.sh RUN_SERIAL true LABELS no_dist_test)
 endif()
 set(KUDU_TEST_LINK_LIBS
   itest_util

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/client_examples-test.sh
----------------------------------------------------------------------
diff --git a/src/kudu/client/client_examples-test.sh b/src/kudu/client/client_examples-test.sh
new file mode 100755
index 0000000..ad0e86c
--- /dev/null
+++ b/src/kudu/client/client_examples-test.sh
@@ -0,0 +1,218 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This script verifies that the Kudu client library can be installed outside
+# the build tree, that the installed headers are sane, and that the example code
+# can be built and runs correctly.
+
+# Clean up after the test. Must be idempotent.
+cleanup() {
+  if [ -n "$TS_PID" ]; then
+      kill -9 "$TS_PID" || :
+      wait $TS_PID || :
+  fi
+  if [ -n "$MASTER_PID" ]; then
+      kill -9 "$MASTER_PID" || :
+      wait $MASTER_PID || :
+  fi
+  if [ -n "$BASE_DIR" -a -d "$BASE_DIR" ]; then
+      rm -rf "$BASE_DIR"
+  fi
+  if [ -n "$LIBRARY_DIR" -a -d "$LIBRARY_DIR" ]; then
+      rm -rf "$LIBRARY_DIR"
+  fi
+}
+trap cleanup EXIT
+
+set -e
+set -o pipefail
+set -x
+
+wait_for_listen_port() {
+  local pid=$1
+  local expected_port=$2
+  local num_attempts=$3
+
+  local attempt=0
+  while [ true ]; do
+    # The lsof utility does not allow to distinguish between an existing
+    # process not listening to the specified port and a non-existing process
+    # by its return code. For the fast check let's verify that the process
+    # is still running.
+    if ! kill -0 $pid; then
+      return 1
+    fi
+    local ports=$(lsof -wbnP -Fn -p $pid -a -i 4TCP -a -s TCP:LISTEN | \
+        sed '1d;s/^[^:].*://')
+    for i in $ports; do
+      if [ $i -eq $expected_port ]; then
+        return 0
+      fi
+    done
+
+    attempt=$((attempt+1))
+    if [ $attempt -ge $num_attempts ]; then
+      break
+    fi
+    sleep 1
+  done
+
+  return 1
+}
+
+exit_error() {
+  local err_msg="$1"
+
+  set +x
+  echo ----------------------------------------------------------------------
+  echo ERROR: $err_msg
+  echo ----------------------------------------------------------------------
+  exit 1
+}
+
+OUTPUT_DIR=$(cd $(dirname "$BASH_SOURCE"); pwd)
+
+# Install the client library to a temporary directory.
+# Try to detect whether we're building using Ninja or Make.
+LIBRARY_DIR=$(mktemp -d -t kudu-examples-test.XXXXXXXXXXXXX)
+PREFIX_DIR=$LIBRARY_DIR/usr/local
+EXAMPLES_DIR=$PREFIX_DIR/share/doc/kuduClient/examples
+pushd $OUTPUT_DIR/..
+NINJA=$(which ninja 2>/dev/null) || NINJA=""
+if [ -r build.ninja -a -n "$NINJA" ]; then
+  DESTDIR=$LIBRARY_DIR ninja install
+else
+  make -j$(getconf _NPROCESSORS_ONLN) DESTDIR=$LIBRARY_DIR install
+fi
+popd
+
+# Test that all of the installed headers can be compiled on their own.
+# This catches bugs where we've made a mistake in 'include-what-you-use'
+# within the library.
+for include_file in $(find $LIBRARY_DIR -name \*.h) ; do
+  echo Checking standalone compilation of $include_file...
+  if ! ${CXX:-g++} \
+       -o /dev/null \
+       -I$LIBRARY_DIR/usr/local/include \
+       $include_file ; then
+    set +x
+    echo
+    echo -----------------------------------------
+    echo $include_file fails to build on its own.
+    echo See log above for details.
+    echo -----------------------------------------
+    exit 1
+  fi
+done
+
+# Prefer the cmake on the system path, since we expect our client library
+# to be usable with older versions of cmake. But if it isn't there,
+# use the one from thirdparty.
+CMAKE=$(which cmake || :)
+if [ -z "$CMAKE" ]; then
+  # TODO: temporary hack which assumes this script is in src/build/<type>/bin
+  CMAKE=$OUTPUT_DIR/../../../thirdparty/installed/common/bin/cmake
+fi
+
+# Build the client examples using the client library.
+# We can just always use Make here, since we're calling cmake ourselves.
+pushd $EXAMPLES_DIR
+CMAKE_PREFIX_PATH=$PREFIX_DIR $CMAKE .
+make -j$(getconf _NPROCESSORS_ONLN)
+popd
+
+LOCALHOST_IP=127.0.0.1
+if [ "$(uname)" == "Linux" ]; then
+  # Pick a unique localhost IP address so this can run in parallel with other
+  # tests. This only works on Linux.
+  LOCALHOST_IP=127.$[($$ >> 8) & 0xff].$[$$ & 0xff].1
+fi
+echo Using localhost IP $LOCALHOST_IP
+
+
+# Start master+ts
+export TMPDIR=${TMPDIR:-/tmp}
+export TEST_TMPDIR=${TEST_TMPDIR:-$TMPDIR/kudutest-$UID}
+mkdir -p $TEST_TMPDIR
+BASE_DIR=$(mktemp -d $TEST_TMPDIR/client_examples-test.XXXXXXXX)
+MASTER_RPC_PORT=7051
+mkdir -p "$BASE_DIR/master/logs"
+$OUTPUT_DIR/kudu-master \
+  --unlock_experimental_flags \
+  --default_num_replicas=1 \
+  --log_dir=$BASE_DIR/master/logs \
+  --fs_wal_dir=$BASE_DIR/master/wals \
+  --fs_data_dirs=$BASE_DIR/master/data \
+  --webserver_interface=$LOCALHOST_IP \
+  --webserver_port=0 \
+  --rpc_bind_addresses=$LOCALHOST_IP:$MASTER_RPC_PORT &
+MASTER_PID=$!
+
+TSERVER_RPC_PORT=7050
+mkdir -p "$BASE_DIR/ts/logs"
+$OUTPUT_DIR/kudu-tserver \
+  --unlock_experimental_flags \
+  --heartbeat_interval_ms=200 \
+  --heartbeat_rpc_timeout_ms=1000 \
+  --log_dir=$BASE_DIR/ts/logs \
+  --fs_wal_dir=$BASE_DIR/ts/wals \
+  --fs_data_dirs=$BASE_DIR/ts/data \
+  --rpc_bind_addresses=$LOCALHOST_IP:$TSERVER_RPC_PORT \
+  --local_ip_for_outbound_sockets=$LOCALHOST_IP \
+  --webserver_interface=$LOCALHOST_IP \
+  --webserver_port=0 \
+  --tserver_master_addrs=$LOCALHOST_IP:$MASTER_RPC_PORT &
+TS_PID=$!
+
+# Make sure that at least it's possible to establish a TCP connection to the
+# master's and the tablet server's RPC ports before running the client example
+# application.
+if ! wait_for_listen_port $MASTER_PID $MASTER_RPC_PORT 30; then
+  exit_error "master is not accepting connections"
+fi
+if ! wait_for_listen_port $TS_PID $TSERVER_RPC_PORT 30; then
+  exit_error "tserver is not accepting connections"
+fi
+
+# Allow for the tablet server registering with the master: wait for ~10s max.
+max_attempts=10
+attempt=0
+num_tservers=0
+while [ true ]; do
+  if ! num_tservers=$($OUTPUT_DIR/kudu tserver list \
+      $LOCALHOST_IP:$MASTER_RPC_PORT -format=space | wc -l); then
+    exit_error "failed to determine number of registered tservers"
+  fi
+  if [ $num_tservers -ge 1 ]; then
+    break
+  fi
+  attempt=$((attempt+1))
+  if [ $attempt -ge $max_attempts ]; then
+    break
+  fi
+  sleep 1
+done
+
+if [ $num_tservers -lt 1 ]; then
+  exit_error "tserver has not registered with the master"
+fi
+
+# Run the examples.
+$EXAMPLES_DIR/example $LOCALHOST_IP

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/client_samples-test.sh
----------------------------------------------------------------------
diff --git a/src/kudu/client/client_samples-test.sh b/src/kudu/client/client_samples-test.sh
deleted file mode 100755
index c2160c6..0000000
--- a/src/kudu/client/client_samples-test.sh
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# This script verifies that the Kudu client library can be installed outside
-# the build tree, that the installed headers are sane, and that the sample code
-# can be built and runs correctly.
-
-# Clean up after the test. Must be idempotent.
-cleanup() {
-  if [ -n "$TS_PID" ]; then
-      kill -9 "$TS_PID" || :
-      wait $TS_PID || :
-  fi
-  if [ -n "$MASTER_PID" ]; then
-      kill -9 "$MASTER_PID" || :
-      wait $MASTER_PID || :
-  fi
-  if [ -n "$BASE_DIR" -a -d "$BASE_DIR" ]; then
-      rm -rf "$BASE_DIR"
-  fi
-  if [ -n "$LIBRARY_DIR" -a -d "$LIBRARY_DIR" ]; then
-      rm -rf "$LIBRARY_DIR"
-  fi
-}
-trap cleanup EXIT
-
-set -e
-set -o pipefail
-set -x
-
-wait_for_listen_port() {
-  local pid=$1
-  local expected_port=$2
-  local num_attempts=$3
-
-  local attempt=0
-  while [ true ]; do
-    # The lsof utility does not allow to distinguish between an existing
-    # process not listening to the specified port and a non-existing process
-    # by its return code. For the fast check let's verify that the process
-    # is still running.
-    if ! kill -0 $pid; then
-      return 1
-    fi
-    local ports=$(lsof -wbnP -Fn -p $pid -a -i 4TCP -a -s TCP:LISTEN | \
-        sed '1d;s/^[^:].*://')
-    for i in $ports; do
-      if [ $i -eq $expected_port ]; then
-        return 0
-      fi
-    done
-
-    attempt=$((attempt+1))
-    if [ $attempt -ge $num_attempts ]; then
-      break
-    fi
-    sleep 1
-  done
-
-  return 1
-}
-
-exit_error() {
-  local err_msg="$1"
-
-  set +x
-  echo ----------------------------------------------------------------------
-  echo ERROR: $err_msg
-  echo ----------------------------------------------------------------------
-  exit 1
-}
-
-OUTPUT_DIR=$(cd $(dirname "$BASH_SOURCE"); pwd)
-
-# Install the client library to a temporary directory.
-# Try to detect whether we're building using Ninja or Make.
-LIBRARY_DIR=$(mktemp -d -t kudu-samples-test.XXXXXXXXXXXXX)
-PREFIX_DIR=$LIBRARY_DIR/usr/local
-SAMPLES_DIR=$PREFIX_DIR/share/doc/kuduClient/samples
-pushd $OUTPUT_DIR/..
-NINJA=$(which ninja 2>/dev/null) || NINJA=""
-if [ -r build.ninja -a -n "$NINJA" ]; then
-  DESTDIR=$LIBRARY_DIR ninja install
-else
-  make -j$(getconf _NPROCESSORS_ONLN) DESTDIR=$LIBRARY_DIR install
-fi
-popd
-
-# Test that all of the installed headers can be compiled on their own.
-# This catches bugs where we've made a mistake in 'include-what-you-use'
-# within the library.
-for include_file in $(find $LIBRARY_DIR -name \*.h) ; do
-  echo Checking standalone compilation of $include_file...
-  if ! ${CXX:-g++} \
-       -o /dev/null \
-       -I$LIBRARY_DIR/usr/local/include \
-       $include_file ; then
-    set +x
-    echo
-    echo -----------------------------------------
-    echo $include_file fails to build on its own.
-    echo See log above for details.
-    echo -----------------------------------------
-    exit 1
-  fi
-done
-
-# Prefer the cmake on the system path, since we expect our client library
-# to be usable with older versions of cmake. But if it isn't there,
-# use the one from thirdparty.
-CMAKE=$(which cmake || :)
-if [ -z "$CMAKE" ]; then
-  # TODO: temporary hack which assumes this script is in src/build/<type>/bin
-  CMAKE=$OUTPUT_DIR/../../../thirdparty/installed/common/bin/cmake
-fi
-
-# Build the client samples using the client library.
-# We can just always use Make here, since we're calling cmake ourselves.
-pushd $SAMPLES_DIR
-CMAKE_PREFIX_PATH=$PREFIX_DIR $CMAKE .
-make -j$(getconf _NPROCESSORS_ONLN)
-popd
-
-LOCALHOST_IP=127.0.0.1
-if [ "$(uname)" == "Linux" ]; then
-  # Pick a unique localhost IP address so this can run in parallel with other
-  # tests. This only works on Linux.
-  LOCALHOST_IP=127.$[($$ >> 8) & 0xff].$[$$ & 0xff].1
-fi
-echo Using localhost IP $LOCALHOST_IP
-
-
-# Start master+ts
-export TMPDIR=${TMPDIR:-/tmp}
-export TEST_TMPDIR=${TEST_TMPDIR:-$TMPDIR/kudutest-$UID}
-mkdir -p $TEST_TMPDIR
-BASE_DIR=$(mktemp -d $TEST_TMPDIR/client_samples-test.XXXXXXXX)
-MASTER_RPC_PORT=7051
-mkdir -p "$BASE_DIR/master/logs"
-$OUTPUT_DIR/kudu-master \
-  --unlock_experimental_flags \
-  --default_num_replicas=1 \
-  --log_dir=$BASE_DIR/master/logs \
-  --fs_wal_dir=$BASE_DIR/master/wals \
-  --fs_data_dirs=$BASE_DIR/master/data \
-  --webserver_interface=$LOCALHOST_IP \
-  --webserver_port=0 \
-  --rpc_bind_addresses=$LOCALHOST_IP:$MASTER_RPC_PORT &
-MASTER_PID=$!
-
-TSERVER_RPC_PORT=7050
-mkdir -p "$BASE_DIR/ts/logs"
-$OUTPUT_DIR/kudu-tserver \
-  --unlock_experimental_flags \
-  --heartbeat_interval_ms=200 \
-  --heartbeat_rpc_timeout_ms=1000 \
-  --log_dir=$BASE_DIR/ts/logs \
-  --fs_wal_dir=$BASE_DIR/ts/wals \
-  --fs_data_dirs=$BASE_DIR/ts/data \
-  --rpc_bind_addresses=$LOCALHOST_IP:$TSERVER_RPC_PORT \
-  --local_ip_for_outbound_sockets=$LOCALHOST_IP \
-  --webserver_interface=$LOCALHOST_IP \
-  --webserver_port=0 \
-  --tserver_master_addrs=$LOCALHOST_IP:$MASTER_RPC_PORT &
-TS_PID=$!
-
-# Make sure that at least it's possible to establish a TCP connection to the
-# master's and the tablet server's RPC ports before running the client sample
-# application.
-if ! wait_for_listen_port $MASTER_PID $MASTER_RPC_PORT 30; then
-  exit_error "master is not accepting connections"
-fi
-if ! wait_for_listen_port $TS_PID $TSERVER_RPC_PORT 30; then
-  exit_error "tserver is not accepting connections"
-fi
-
-# Allow for the tablet server registering with the master: wait for ~10s max.
-max_attempts=10
-attempt=0
-num_tservers=0
-while [ true ]; do
-  if ! num_tservers=$($OUTPUT_DIR/kudu tserver list \
-      $LOCALHOST_IP:$MASTER_RPC_PORT -format=space | wc -l); then
-    exit_error "failed to determine number of registered tservers"
-  fi
-  if [ $num_tservers -ge 1 ]; then
-    break
-  fi
-  attempt=$((attempt+1))
-  if [ $attempt -ge $max_attempts ]; then
-    break
-  fi
-  sleep 1
-done
-
-if [ $num_tservers -lt 1 ]; then
-  exit_error "tserver has not registered with the master"
-fi
-
-# Run the samples.
-$SAMPLES_DIR/sample $LOCALHOST_IP

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/samples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/client/samples/CMakeLists.txt b/src/kudu/client/samples/CMakeLists.txt
deleted file mode 100644
index 85ff85b..0000000
--- a/src/kudu/client/samples/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# Client API sample executables
-
-cmake_minimum_required(VERSION 2.8)
-
-find_package(kuduClient REQUIRED)
-include_directories(${KUDU_CLIENT_INCLUDE_DIR})
-
-add_executable(sample sample.cc)
-target_link_libraries(sample kudu_client)

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/samples/README.adoc
----------------------------------------------------------------------
diff --git a/src/kudu/client/samples/README.adoc b/src/kudu/client/samples/README.adoc
deleted file mode 100644
index f65723c..0000000
--- a/src/kudu/client/samples/README.adoc
+++ /dev/null
@@ -1,183 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-= Kudu {cpp} client sample README
-:author: Kudu Team
-:homepage: https://kudu.apache.org/
-
-== Summary
-The Kudu {cpp} client library distribution contains {cpp} example application
-that demonstrates how to use the Kudu {cpp} client API.  The sample
-can be used as a starting point for a custom Kudu {cpp} client application.
-This note contains information on how to build the Kudu {cpp} client sample.
-
-== How to build the example if installing Kudu from packages
-This section describes how to build the example if installing Kudu
-using pre-built packages.
-
-. Install the required packages as described in the
-https://kudu.apache.org/docs/installation.html#install_packages[documentation on the Kudu Web site].
-The `kudu-client0` package (`libkuduclient0` on Debian/Ubuntu Linux
-distributions) contains the Kudu {cpp} client library, and the `kudu-client-dev`
-package (`libkuduclient-dev` on Debian/Ubuntu Linux distributions) contains
-the Kudu {cpp} client header files and {cpp} code sample (`sample.cc`)
-along with other auxiliary content.
-
-. Make sure `cmake` of version at least 2.8 is installed on the system.
-
-. Copy the sample into a custom location where you would like to work
-with the code. Working in the `/usr/share/doc/kuduClient/samples`
-directory is possible but is not recommended since it requires
-super-user access and pollutes the `sample` directory with
-intermediate files.
-For example, to copy the `/usr/share/doc/kuduClient/samples` directory
-recursively into `/tmp/kuduClient`:
-[source,shell]
-cp -r /usr/share/doc/kuduClient/samples /tmp/kuduClient
-
-. Navigate into the directory where the `sample.cc.gz` file was copied and
-unpack the sample source file.  For example:
-[source,shell]
-cd /tmp/kuduClient/samples
-gunzip sample.cc.gz
-
-. Run `cmake` to generate appropriate makefiles.  For example, if targeting
-for a debug build
-(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
-[source,shell]
-cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug
-
-. Run `make` to build the sample:
-[source,shell]
-make
-
-. After the sample is built, it is ready to run against your Kudu master server.
-The sample application assumes the target Kudu cluster has at least 3
-tablet servers up and running (because it creates a table with replication
-factor 3).  If it's not the case, you can modify the `sample.cc` accordingly
-and re-compile it.  Below is the sample output with log messages in the middle
-removed: the `sample` binary runs against Kudu master server running
-with the default parameters at the same machine.  Port 7051 is the default
-one and could be omitted along with the preceding colomn because the master
-server is running with the default parameters (it's left only to illustrate how
-to specify port number).
-[source,shell]
-$ ./sample 127.0.0.1:7051
-Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
-Long version info: kudu 1.1.0-SNAPSHOT
-revision 91a1ed09c4c572a22bab15360ddaf481d5632927
-build type DEBUG
-built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
- Line number: 546
- Time: Thu Oct 06 14:50:47 2016
- Message: Started thread 11197 - kernel-watchdog:kernel-watcher
-...
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
- Line number: 534
- Time: Thu Oct 06 14:50:47 2016
- Message: Considering host 10.17.240.17 local
-Created a client connection
-Created a schema
-Created a table
-Altered a table
-Inserted some rows into a table
-Scanned some rows out of a table
-Deleted a table
-Done
-
-== How to build the example if building Kudu from source
-This section describes how to build the example if building Kudu from source.
-To install the `sample.cc` and other files, an alternate destination root
-is used.
-
-Specifying an alternate destination root allows you to install the
-Kudu {cpp} client library, the sample file and other content
-under the specified destination prefix.
-
-. Follow the https://kudu.apache.org/docs/installation.html#_build_from_source[instructions on the Kudu Web site]
-to build the project from source.
-
-. Once the project is built, change into the `<build_dir>/src/kudu/client`
-sub-directory.
-
-. Run `make install` with an alternate destination root.  For example, if
-installing into `/tmp/client_alt_root`
-[source,shell]
-make install DESTDIR=/tmp/client_alt_root
-
-. Change the current working directory into the
-`usr/local/share/doc/kuduClient/samples` subdirectory of the alternate
-destination root.  For example, if installing into `/tmp/client_alt_root`
-[source,shell]
-cd /tmp/client_alt_root/usr/local/share/doc/kuduClient/samples
-
-. Run `cmake` to generate appropriate makefiles.  For example, if installing
-into `/tmp/client_alt_root` and targeting for a debug build
-(for a release build, use `release` for `CMAKE_BUILD_TYPE` correspondingly):
-[source,shell]
-cmake -G "Unix Makefiles" -DkuduClient_DIR=/tmp/client_alt_root/usr/local/share/kuduClient/cmake -DCMAKE_BUILD_TYPE=debug
-
-. Run `make` to build the sample:
-[source,shell]
-make
-
-. After the sample is built, it is ready to run against your Kudu master server.
-The sample application assumes the target Kudu cluster has at least 3
-tablet servers up and running (because it creates a table with replication
-factor 3).  If it's not the case, you can modify the `sample.cc` accordingly
-and re-compile it.  Below is the sample output with log messages in the middle
-removed: the `sample` binary runs against Kudu master server running
-with the default parameters at the same machine.  Port 7051 is the default
-one and could be omitted along with the preceding colomn because the master
-server is running with the default parameters (it's left only to illustrate how
-to specify port number).
-[source,shell]
-$ ./sample 127.0.0.1:7051
-Running with Kudu client version: kudu 1.1.0-SNAPSHOT (rev 91a1ed09c4c572a22bab15360ddaf481d5632927)
-Long version info: kudu 1.1.0-SNAPSHOT
-revision 91a1ed09c4c572a22bab15360ddaf481d5632927
-build type DEBUG
-built by aserbin at 06 Oct 2016 14:15:10 PST on ve0518.halxg.cloudera.com
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/util/thread.cc
- Line number: 546
- Time: Thu Oct 06 14:50:47 2016
- Message: Started thread 11197 - kernel-watchdog:kernel-watcher
-...
-Received log message from Kudu client library
- Severity: 0
- Filename: /home/aserbin/Projects/kudu/src/kudu/client/client-internal.cc
- Line number: 534
- Time: Thu Oct 06 14:50:47 2016
- Message: Considering host 10.17.240.17 local
-Created a client connection
-Created a schema
-Created a table
-Altered a table
-Inserted some rows into a table
-Scanned some rows out of a table
-Deleted a table
-Done
-
-== References
-. https://kudu.apache.org/[The Kudu Project Web Site]
-. https://kudu.apache.org/cpp-client-api/[Kudu {cpp} client API documentation]

http://git-wip-us.apache.org/repos/asf/kudu/blob/9bf32a42/src/kudu/client/samples/sample.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/samples/sample.cc b/src/kudu/client/samples/sample.cc
deleted file mode 100644
index 9b5d65e..0000000
--- a/src/kudu/client/samples/sample.cc
+++ /dev/null
@@ -1,320 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include <ctime>
-#include <iostream>
-#include <sstream>
-
-#include "kudu/client/callbacks.h"
-#include "kudu/client/client.h"
-#include "kudu/client/row_result.h"
-#include "kudu/client/stubs.h"
-#include "kudu/client/value.h"
-#include "kudu/client/write_op.h"
-#include "kudu/common/partial_row.h"
-#include "kudu/util/monotime.h"
-
-using kudu::client::KuduClient;
-using kudu::client::KuduClientBuilder;
-using kudu::client::KuduColumnSchema;
-using kudu::client::KuduError;
-using kudu::client::KuduInsert;
-using kudu::client::KuduPredicate;
-using kudu::client::KuduRowResult;
-using kudu::client::KuduScanner;
-using kudu::client::KuduSchema;
-using kudu::client::KuduSchemaBuilder;
-using kudu::client::KuduSession;
-using kudu::client::KuduStatusFunctionCallback;
-using kudu::client::KuduTable;
-using kudu::client::KuduTableAlterer;
-using kudu::client::KuduTableCreator;
-using kudu::client::KuduValue;
-using kudu::client::sp::shared_ptr;
-using kudu::KuduPartialRow;
-using kudu::MonoDelta;
-using kudu::Status;
-
-using std::ostringstream;
-using std::string;
-using std::vector;
-
-static Status CreateClient(const string& addr,
-                           shared_ptr<KuduClient>* client) {
-  return KuduClientBuilder()
-      .add_master_server_addr(addr)
-      .default_admin_operation_timeout(MonoDelta::FromSeconds(20))
-      .Build(client);
-}
-
-static KuduSchema CreateSchema() {
-  KuduSchema schema;
-  KuduSchemaBuilder b;
-  b.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
-  b.AddColumn("int_val")->Type(KuduColumnSchema::INT32)->NotNull();
-  b.AddColumn("string_val")->Type(KuduColumnSchema::STRING)->NotNull();
-  b.AddColumn("non_null_with_default")->Type(KuduColumnSchema::INT32)->NotNull()
-    ->Default(KuduValue::FromInt(12345));
-  KUDU_CHECK_OK(b.Build(&schema));
-  return schema;
-}
-
-static Status DoesTableExist(const shared_ptr<KuduClient>& client,
-                             const string& table_name,
-                             bool *exists) {
-  shared_ptr<KuduTable> table;
-  Status s = client->OpenTable(table_name, &table);
-  if (s.ok()) {
-    *exists = true;
-  } else if (s.IsNotFound()) {
-    *exists = false;
-    s = Status::OK();
-  }
-  return s;
-}
-
-static Status CreateTable(const shared_ptr<KuduClient>& client,
-                          const string& table_name,
-                          const KuduSchema& schema,
-                          int num_tablets) {
-  // Generate the split keys for the table.
-  vector<const KuduPartialRow*> splits;
-  int32_t increment = 1000 / num_tablets;
-  for (int32_t i = 1; i < num_tablets; i++) {
-    KuduPartialRow* row = schema.NewRow();
-    KUDU_CHECK_OK(row->SetInt32(0, i * increment));
-    splits.push_back(row);
-  }
-
-  vector<string> column_names;
-  column_names.push_back("key");
-
-  // Create the table.
-  KuduTableCreator* table_creator = client->NewTableCreator();
-  Status s = table_creator->table_name(table_name)
-      .schema(&schema)
-      .set_range_partition_columns(column_names)
-      .split_rows(splits)
-      .Create();
-  delete table_creator;
-  return s;
-}
-
-static Status AlterTable(const shared_ptr<KuduClient>& client,
-                         const string& table_name) {
-  KuduTableAlterer* table_alterer = client->NewTableAlterer(table_name);
-  table_alterer->AlterColumn("int_val")->RenameTo("integer_val");
-  table_alterer->AddColumn("another_val")->Type(KuduColumnSchema::BOOL);
-  table_alterer->DropColumn("string_val");
-  Status s = table_alterer->Alter();
-  delete table_alterer;
-  return s;
-}
-
-static void StatusCB(void* unused, const Status& status) {
-  KUDU_LOG(INFO) << "Asynchronous flush finished with status: "
-                      << status.ToString();
-}
-
-static Status InsertRows(const shared_ptr<KuduTable>& table, int num_rows) {
-  shared_ptr<KuduSession> session = table->client()->NewSession();
-  KUDU_RETURN_NOT_OK(session->SetFlushMode(KuduSession::MANUAL_FLUSH));
-  session->SetTimeoutMillis(5000);
-
-  for (int i = 0; i < num_rows; i++) {
-    KuduInsert* insert = table->NewInsert();
-    KuduPartialRow* row = insert->mutable_row();
-    KUDU_CHECK_OK(row->SetInt32("key", i));
-    KUDU_CHECK_OK(row->SetInt32("integer_val", i * 2));
-    KUDU_CHECK_OK(row->SetInt32("non_null_with_default", i * 5));
-    KUDU_CHECK_OK(session->Apply(insert));
-  }
-  Status s = session->Flush();
-  if (s.ok()) {
-    return s;
-  }
-
-  // Test asynchronous flush.
-  KuduStatusFunctionCallback<void*> status_cb(&StatusCB, NULL);
-  session->FlushAsync(&status_cb);
-
-  // Look at the session's errors.
-  vector<KuduError*> errors;
-  bool overflow;
-  session->GetPendingErrors(&errors, &overflow);
-  if (!errors.empty()) {
-    s = overflow ? Status::IOError("Overflowed pending errors in session") :
-        errors.front()->status();
-    while (!errors.empty()) {
-      delete errors.back();
-      errors.pop_back();
-    }
-  }
-  KUDU_RETURN_NOT_OK(s);
-
-  // Close the session.
-  return session->Close();
-}
-
-static Status ScanRows(const shared_ptr<KuduTable>& table) {
-  const int kLowerBound = 5;
-  const int kUpperBound = 600;
-
-  KuduScanner scanner(table.get());
-
-  // Add a predicate: WHERE key >= 5
-  KuduPredicate* p = table->NewComparisonPredicate(
-      "key", KuduPredicate::GREATER_EQUAL, KuduValue::FromInt(kLowerBound));
-  KUDU_RETURN_NOT_OK(scanner.AddConjunctPredicate(p));
-
-  // Add a predicate: WHERE key <= 600
-  p = table->NewComparisonPredicate(
-      "key", KuduPredicate::LESS_EQUAL, KuduValue::FromInt(kUpperBound));
-  KUDU_RETURN_NOT_OK(scanner.AddConjunctPredicate(p));
-
-  KUDU_RETURN_NOT_OK(scanner.Open());
-  vector<KuduRowResult> results;
-
-  int next_row = kLowerBound;
-  while (scanner.HasMoreRows()) {
-    KUDU_RETURN_NOT_OK(scanner.NextBatch(&results));
-    for (vector<KuduRowResult>::iterator iter = results.begin();
-        iter != results.end();
-        iter++, next_row++) {
-      const KuduRowResult& result = *iter;
-      int32_t val;
-      KUDU_RETURN_NOT_OK(result.GetInt32("key", &val));
-      if (val != next_row) {
-        ostringstream out;
-        out << "Scan returned the wrong results. Expected key "
-            << next_row << " but got " << val;
-        return Status::IOError(out.str());
-      }
-    }
-    results.clear();
-  }
-
-  // next_row is now one past the last row we read.
-  int last_row_seen = next_row - 1;
-
-  if (last_row_seen != kUpperBound) {
-    ostringstream out;
-    out << "Scan returned the wrong results. Expected last row to be "
-        << kUpperBound << " rows but got " << last_row_seen;
-    return Status::IOError(out.str());
-  }
-  return Status::OK();
-}
-
-// A helper class providing custom logging callback. It also manages
-// automatic callback installation and removal.
-class LogCallbackHelper {
- public:
-  LogCallbackHelper() : log_cb_(&LogCallbackHelper::LogCb, NULL) {
-    kudu::client::InstallLoggingCallback(&log_cb_);
-  }
-
-  ~LogCallbackHelper() {
-    kudu::client::UninstallLoggingCallback();
-  }
-
-  static void LogCb(void* unused,
-                    kudu::client::KuduLogSeverity severity,
-                    const char* filename,
-                    int line_number,
-                    const struct ::tm* time,
-                    const char* message,
-                    size_t message_len) {
-    KUDU_LOG(INFO) << "Received log message from Kudu client library";
-    KUDU_LOG(INFO) << " Severity: " << severity;
-    KUDU_LOG(INFO) << " Filename: " << filename;
-    KUDU_LOG(INFO) << " Line number: " << line_number;
-    char time_buf[32];
-    // Example: Tue Mar 24 11:46:43 2015.
-    KUDU_CHECK(strftime(time_buf, sizeof(time_buf), "%a %b %d %T %Y", time));
-    KUDU_LOG(INFO) << " Time: " << time_buf;
-    KUDU_LOG(INFO) << " Message: " << string(message, message_len);
-  }
-
- private:
-  kudu::client::KuduLoggingFunctionCallback<void*> log_cb_;
-};
-
-int main(int argc, char* argv[]) {
-  KUDU_LOG(INFO) << "Running with Kudu client version: " <<
-      kudu::client::GetShortVersionString();
-  KUDU_LOG(INFO) << "Long version info: " <<
-      kudu::client::GetAllVersionInfo();
-
-  // This is to install and automatically un-install custom logging callback.
-  LogCallbackHelper log_cb_helper;
-
-  if (argc != 2) {
-    KUDU_LOG(FATAL) << "usage: " << argv[0] << " <master host>";
-  }
-  const string master_host = argv[1];
-
-  const string kTableName = "test_table";
-
-  // Enable verbose debugging for the client library.
-  kudu::client::SetVerboseLogLevel(2);
-
-  // Create and connect a client.
-  shared_ptr<KuduClient> client;
-  KUDU_CHECK_OK(CreateClient(master_host, &client));
-  KUDU_LOG(INFO) << "Created a client connection";
-
-  // Disable the verbose logging.
-  kudu::client::SetVerboseLogLevel(0);
-
-  // Create a schema.
-  KuduSchema schema(CreateSchema());
-  KUDU_LOG(INFO) << "Created a schema";
-
-  // Create a table with that schema.
-  bool exists;
-  KUDU_CHECK_OK(DoesTableExist(client, kTableName, &exists));
-  if (exists) {
-    client->DeleteTable(kTableName);
-    KUDU_LOG(INFO) << "Deleting old table before creating new one";
-  }
-  KUDU_CHECK_OK(CreateTable(client, kTableName, schema, 10));
-  KUDU_LOG(INFO) << "Created a table";
-
-  // Alter the table.
-  KUDU_CHECK_OK(AlterTable(client, kTableName));
-  KUDU_LOG(INFO) << "Altered a table";
-
-  // Insert some rows into the table.
-  shared_ptr<KuduTable> table;
-  KUDU_CHECK_OK(client->OpenTable(kTableName, &table));
-  KUDU_CHECK_OK(InsertRows(table, 1000));
-  KUDU_LOG(INFO) << "Inserted some rows into a table";
-
-  // Scan some rows.
-  KUDU_CHECK_OK(ScanRows(table));
-  KUDU_LOG(INFO) << "Scanned some rows out of a table";
-
-  // Delete the table.
-  KUDU_CHECK_OK(client->DeleteTable(kTableName));
-  KUDU_LOG(INFO) << "Deleted a table";
-
-  // Done!
-  KUDU_LOG(INFO) << "Done";
-
-  return 0;
-}


[04/50] kudu git commit: Fix Python example

Posted by wd...@apache.org.
Fix Python example


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

Branch: refs/heads/master
Commit: afc5f1a8222095911a8394b944ef6d8f9d9f7eb3
Parents: 0dd2032
Author: Martin Grund <mg...@cloudera.com>
Authored: Sun Sep 27 14:30:56 2015 -0700
Committer: Martin Grund <mg...@cloudera.com>
Committed: Sun Sep 27 14:30:56 2015 -0700

----------------------------------------------------------------------
 clients/install_python_client.sh | 3 ++-
 python/dstat-kudu/README.md      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/afc5f1a8/clients/install_python_client.sh
----------------------------------------------------------------------
diff --git a/clients/install_python_client.sh b/clients/install_python_client.sh
index 363ce57..f9a57e5 100755
--- a/clients/install_python_client.sh
+++ b/clients/install_python_client.sh
@@ -13,7 +13,8 @@ sudo chmod -R g+rw python
 sudo chmod -R o+r python
 
 # Install python client
-sudo easy_install cython
+sudo easy_install pip
 cd python
+sudo  pip install --disable-pip-version-check -r requirements.txt
 sudo python setup.py install
 ENDSSH

http://git-wip-us.apache.org/repos/asf/kudu/blob/afc5f1a8/python/dstat-kudu/README.md
----------------------------------------------------------------------
diff --git a/python/dstat-kudu/README.md b/python/dstat-kudu/README.md
index a78cf3a..a4f443c 100644
--- a/python/dstat-kudu/README.md
+++ b/python/dstat-kudu/README.md
@@ -35,7 +35,7 @@ To drop the table in Kudu and start fresh start the program with:
 To query the data via Impala, create a new Kudu table in Impala using the
 following command in the impala-shell.
 
-    CREATE TABLE dstat (
+    CREATE EXTERNAL TABLE dstat (
     `ts` BIGINT,
     `usr` FLOAT,
     `sys` FLOAT,


[11/50] kudu git commit: Merge pull request #11 from dralves/master

Posted by wd...@apache.org.
Merge pull request #11 from dralves/master

Fix the collectl example and add encodings

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/25a123c0
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/25a123c0
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/25a123c0

Branch: refs/heads/master
Commit: 25a123c0ef441097c1ed6860e46a7cc41b1ee2df
Parents: aac4a91 75b0809
Author: jdcryans <jd...@gmail.com>
Authored: Sun Sep 27 22:46:48 2015 -0400
Committer: jdcryans <jd...@gmail.com>
Committed: Sun Sep 27 22:46:48 2015 -0400

----------------------------------------------------------------------
 .../examples/collectl/KuduCollectlExample.java  | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[15/50] kudu git commit: Merge pull request #13 from mpercy/master

Posted by wd...@apache.org.
Merge pull request #13 from mpercy/master

Add insert-loadgen example to repo

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

Branch: refs/heads/master
Commit: b853815d3493430495dd7b4625c9e7b07bf04bde
Parents: 4de3201 565743a
Author: jdcryans <jd...@gmail.com>
Authored: Tue Nov 17 11:18:24 2015 -0800
Committer: jdcryans <jd...@gmail.com>
Committed: Tue Nov 17 11:18:24 2015 -0800

----------------------------------------------------------------------
 java/.gitignore                                 |   2 +
 java/insert-loadgen/README                      |  17 +++
 java/insert-loadgen/pom.xml                     |  72 ++++++++++
 .../kududb/examples/loadgen/InsertLoadgen.java  | 140 +++++++++++++++++++
 4 files changed, 231 insertions(+)
----------------------------------------------------------------------



[43/50] kudu git commit: Merge pull request #27 from danburkert/insert-loadgen-error-handling

Posted by wd...@apache.org.
Merge pull request #27 from danburkert/insert-loadgen-error-handling

Fix insert-loadgen example to handle insert errors

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/82708e9a
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/82708e9a
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/82708e9a

Branch: refs/heads/master
Commit: 82708e9a49f28112a48230e0380843480f69e016
Parents: 54348ce 4d2c46f
Author: adembo <ad...@gmail.com>
Authored: Wed Oct 11 12:32:14 2017 -0700
Committer: GitHub <no...@github.com>
Committed: Wed Oct 11 12:32:14 2017 -0700

----------------------------------------------------------------------
 java/collectl/pom.xml                           |  2 +-
 java/insert-loadgen/pom.xml                     |  2 +-
 .../kududb/examples/loadgen/InsertLoadgen.java  | 68 ++++++--------------
 java/java-sample/pom.xml                        |  2 +-
 4 files changed, 22 insertions(+), 52 deletions(-)
----------------------------------------------------------------------



[02/50] kudu git commit: Changing username for VM in Python examples

Posted by wd...@apache.org.
Changing username for VM in Python examples


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/0dd20320
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/0dd20320
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/0dd20320

Branch: refs/heads/master
Commit: 0dd20320c48e9c2dc5df719885a0abd67e42d84a
Parents: e45733c
Author: Martin Grund <mg...@cloudera.com>
Authored: Sun Sep 27 14:14:46 2015 -0700
Committer: Martin Grund <mg...@cloudera.com>
Committed: Sun Sep 27 14:22:26 2015 -0700

----------------------------------------------------------------------
 clients/impala-shell             | 2 +-
 clients/install_python_client.sh | 4 ++--
 clients/remote_python            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0dd20320/clients/impala-shell
----------------------------------------------------------------------
diff --git a/clients/impala-shell b/clients/impala-shell
index d3e42ff..ce5b634 100755
--- a/clients/impala-shell
+++ b/clients/impala-shell
@@ -1,4 +1,4 @@
 #!/bin/bash
 HOST=quickstart.cloudera
-USER=cloudera
+USER=demo
 ssh $USER@$HOST -t impala-shell

http://git-wip-us.apache.org/repos/asf/kudu/blob/0dd20320/clients/install_python_client.sh
----------------------------------------------------------------------
diff --git a/clients/install_python_client.sh b/clients/install_python_client.sh
index d48ead4..363ce57 100755
--- a/clients/install_python_client.sh
+++ b/clients/install_python_client.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 HOST=quickstart.cloudera
-USER=cloudera
+USER=demo
 ssh $USER@$HOST <<'ENDSSH'
 set +x
 # Install dependencies
@@ -8,7 +8,7 @@ sudo yum install -y gcc-c++ python-devel python-ipython
 
 # Copy python client
 cp -R /media/sf_examples/clients/python ~/
-sudo chown cloudera:cloudera python
+sudo chown demo python
 sudo chmod -R g+rw python
 sudo chmod -R o+r python
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0dd20320/clients/remote_python
----------------------------------------------------------------------
diff --git a/clients/remote_python b/clients/remote_python
index 4823198..3aed8b4 100755
--- a/clients/remote_python
+++ b/clients/remote_python
@@ -1,4 +1,4 @@
 #!/bin/bash
 HOST=quickstart.cloudera
-USER=cloudera
+USER=demo
 ssh $USER@$HOST -t python


[32/50] kudu git commit: Merge pull request #26 from alexeyserbin/master

Posted by wd...@apache.org.
Merge pull request #26 from alexeyserbin/master

[demo-vm-setup] added curl error handling

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/81157cc5
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/81157cc5
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/81157cc5

Branch: refs/heads/master
Commit: 81157cc5e952134faf3192a0b51d6ca210e51228
Parents: 95654d8 6c30e2a
Author: jdcryans <jd...@gmail.com>
Authored: Mon Oct 31 09:28:46 2016 -0700
Committer: GitHub <no...@github.com>
Committed: Mon Oct 31 09:28:46 2016 -0700

----------------------------------------------------------------------
 demo-vm-setup/setup-kudu-demo-vm.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[17/50] kudu git commit: Merge pull request #14 from mpercy/master

Posted by wd...@apache.org.
Merge pull request #14 from mpercy/master

Update examples dependencies to use the 0.6.0 release

Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/579f7dbd
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/579f7dbd
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/579f7dbd

Branch: refs/heads/master
Commit: 579f7dbdeba2eb33d32fd21f6d82ff3eb097baad
Parents: b853815 77713fb
Author: jdcryans <jd...@gmail.com>
Authored: Mon Nov 23 17:27:24 2015 -0800
Committer: jdcryans <jd...@gmail.com>
Committed: Mon Nov 23 17:27:24 2015 -0800

----------------------------------------------------------------------
 java/collectl/pom.xml       | 2 +-
 java/insert-loadgen/pom.xml | 2 +-
 java/java-sample/pom.xml    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[50/50] kudu git commit: Merge cloudera/kudu-examples into the examples subdirectory

Posted by wd...@apache.org.
Merge cloudera/kudu-examples into the examples subdirectory

This merges the cloudera-kudu[1] repository into the examples
subdirectory.

I scrubbed Cloudera-specific bits, namely
- Removed the extra license (which was also Apache 2.0)
- Removed the demo-vm-setup directory
- Removed demo vm instructions from the README
- Removed the python directory, as it contained an early version
  of the Python client, which is already integrated.

Fix-ups to improve and integrate the java and python examples
will be in follow-ups.

[1]: https://github.com/cloudera/kudu-examples

Change-Id: I4ebaa902b7af6f87bfd1cfba07f0ed2ea6de1460


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

Branch: refs/heads/master
Commit: c83f6eb35da5708e893ed4dc1540c01da074ea08
Parents: 32d276e 7545dec
Author: Will Berkeley <wd...@apache.org>
Authored: Wed Mar 28 14:48:21 2018 -0700
Committer: Will Berkeley <wd...@apache.org>
Committed: Wed Mar 28 14:49:39 2018 -0700

----------------------------------------------------------------------
 examples/README.md                              |   6 +
 examples/java/.gitignore                        |   7 +
 examples/java/collectl/README                   |  82 ++++++
 examples/java/collectl/pom.xml                  |  72 +++++
 .../examples/collectl/KuduCollectlExample.java  | 199 +++++++++++++
 examples/java/insert-loadgen/README             |  17 ++
 examples/java/insert-loadgen/pom.xml            |  72 +++++
 .../kududb/examples/loadgen/InsertLoadgen.java  | 110 +++++++
 examples/java/java-sample/README                |  15 +
 examples/java/java-sample/pom.xml               |  72 +++++
 .../java/org/kududb/examples/sample/Sample.java |  77 +++++
 examples/python/dstat-kudu/README.md            |  69 +++++
 examples/python/dstat-kudu/kudu_dstat.py        |  93 ++++++
 examples/python/graphite-kudu/kudu/__init__.py  |   3 +
 .../python/graphite-kudu/kudu/kudu_graphite.py  | 287 +++++++++++++++++++
 examples/python/graphite-kudu/setup.cfg         |   2 +
 examples/python/graphite-kudu/setup.py          |  26 ++
 17 files changed, 1209 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/README.md
----------------------------------------------------------------------
diff --cc examples/README.md
index 0000000,0000000..96f119f
new file mode 100644
--- /dev/null
+++ b/examples/README.md
@@@ -1,0 -1,0 +1,6 @@@
++# Kudu examples
++
++This directory holds example code and tutorials for Kudu.
++
++It was imported from https://github.com/cloudera/kudu-examples at commit
++7545deccb8e12effa17a955ab5b841bdcc5afe85.

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/.gitignore
----------------------------------------------------------------------
diff --cc examples/java/.gitignore
index 0000000,0000000..b2dce6e
new file mode 100644
--- /dev/null
+++ b/examples/java/.gitignore
@@@ -1,0 -1,0 +1,7 @@@
++dependency-reduced-pom.xml
++target/
++.classpath
++.project
++.settings
++.idea
++*.iml

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/collectl/README
----------------------------------------------------------------------
diff --cc examples/java/collectl/README
index 0000000,0000000..74a2fd7
new file mode 100644
--- /dev/null
+++ b/examples/java/collectl/README
@@@ -1,0 -1,0 +1,82 @@@
++This example implements a simple Java application which listens on a
++TCP socket for time series data corresponding to the Collectl wire protocol.
++The commonly-available 'collectl' tool can be used to send example data
++to the server.
++
++This tutorial assumes that you are running a Kudu master on 'quickstart.cloudera'.
++Otherwise, you can pass another host using '-DkuduMaster=host:port'.
++
++To start the example server:
++
++$ mvn package
++$ java -jar target/kudu-collectl-example-1.0-SNAPSHOT.jar
++
++To start collecting data, run the following command on one or more machines:
++
++$ collectl --export=graphite,127.0.0.1,p=/
++
++(substituting '127.0.0.1' with the IP address of whichever server is running the
++example program).
++
++----
++
++Exploring the data with Impala
++========
++
++First, we need to map the table into Impala:
++
++    CREATE EXTERNAL TABLE `metrics` (
++    `host` STRING,
++    `metric` STRING,
++    `timestamp` INT,
++    `value` DOUBLE
++    )
++    TBLPROPERTIES(
++      'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
++      'kudu.table_name' = 'metrics',
++      'kudu.master_addresses' = 'quickstart.cloudera:7051',
++      'kudu.key_columns' = 'host, metric, timestamp'
++    );
++
++Then, we can run some queries:
++
++    [quickstart.cloudera:21000] > select count(distinct metric) from metrics;
++    Query: select count(distinct metric) from metrics
++    +------------------------+
++    | count(distinct metric) |
++    +------------------------+
++    | 23                     |
++    +------------------------+
++    Fetched 1 row(s) in 0.19s
++
++
++Exploring the data with Spark
++========
++
++NOTE: if you are using the Quickstart VM, Spark is not installed by default.
++You can install it by running:
++
++    sudo yum -y install spark-core
++
++Download the Kudu MR jar and run Spark with it on the classpath:
++
++    wget https://repository.cloudera.com/artifactory/cloudera-repos/org/apache/kudu/kudu-spark_2.10/0.10.0/kudu-spark_2.10-0.10.0.jar
++    spark-shell --jars kudu-spark*jar
++
++You can then paste this example script:
++
++    import org.apache.kudu.spark.kudu._
++
++    val df = sqlContext.read.options(Map(
++      "kudu.master" -> "quickstart.cloudera",
++      "kudu.table" -> "metrics")).kudu
++    df.registerTempTable("metrics")
++
++    // Print the first five values
++    sqlContext.sql("select * from metrics limit 5").show()
++    
++    // Calculate the average value of every host/metric pair
++    sqlContext.sql("select host, metric, avg(value) from metrics group by host, metric").show()
++    
++Note that if you are still running the 'collectl' command above, you can see
++the data changing in real time by re-running the queries.

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/collectl/pom.xml
----------------------------------------------------------------------
diff --cc examples/java/collectl/pom.xml
index 0000000,0000000..3727201
new file mode 100644
--- /dev/null
+++ b/examples/java/collectl/pom.xml
@@@ -1,0 -1,0 +1,72 @@@
++<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
++  <modelVersion>4.0.0</modelVersion>
++  <groupId>kudu-collectl-example</groupId>
++  <artifactId>kudu-collectl-example</artifactId>
++  <packaging>jar</packaging>
++  <version>1.0-SNAPSHOT</version>
++  <name>kudu-collectl-example</name>
++
++  <build>
++    <plugins>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-compiler-plugin</artifactId>
++        <version>2.3.1</version>
++        <configuration>
++          <source>1.7</source>
++          <target>1.7</target>
++        </configuration>
++      </plugin>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-shade-plugin</artifactId>
++        <version>2.4</version>
++        <executions>
++          <execution>
++            <phase>package</phase>
++            <goals>
++              <goal>shade</goal>
++            </goals>
++            <configuration>
++              <transformers>
++                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
++                  <mainClass>org.kududb.examples.collectl.KuduCollectlExample</mainClass>
++                </transformer>
++              </transformers>
++            </configuration>
++          </execution>
++        </executions>
++      </plugin>
++    </plugins>
++  </build>
++
++  <repositories>
++    <repository>
++      <id>cdh.repo</id>
++      <name>Cloudera Repositories</name>
++      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
++      <snapshots>
++        <enabled>false</enabled>
++      </snapshots>
++    </repository>
++  </repositories>
++
++  <dependencies>
++
++    <dependency>
++      <groupId>org.apache.kudu</groupId>
++      <artifactId>kudu-client</artifactId>
++      <version>1.1.0</version>
++    </dependency>
++
++    <!-- for logging messages -->
++    <dependency>
++      <groupId>org.slf4j</groupId>
++      <artifactId>slf4j-simple</artifactId>
++      <version>1.7.12</version>
++    </dependency>
++
++  </dependencies>
++
++</project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
----------------------------------------------------------------------
diff --cc examples/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
index 0000000,0000000..f7c7d1c
new file mode 100644
--- /dev/null
+++ b/examples/java/collectl/src/main/java/org/kududb/examples/collectl/KuduCollectlExample.java
@@@ -1,0 -1,0 +1,199 @@@
++package org.kududb.examples.collectl;
++
++import java.io.BufferedReader;
++import java.io.InputStreamReader;
++import java.net.ServerSocket;
++import java.net.Socket;
++import java.util.ArrayList;
++import java.util.Collections;
++import java.util.List;
++import java.util.Set;
++import java.util.concurrent.ConcurrentHashMap;
++
++import org.apache.kudu.ColumnSchema;
++import org.apache.kudu.ColumnSchema.ColumnSchemaBuilder;
++import org.apache.kudu.Schema;
++import org.apache.kudu.Type;
++import org.apache.kudu.client.CreateTableOptions;
++import org.apache.kudu.client.Insert;
++import org.apache.kudu.client.KuduClient;
++import org.apache.kudu.client.KuduSession;
++import org.apache.kudu.client.KuduTable;
++import org.apache.kudu.client.OperationResponse;
++import org.apache.kudu.client.RowError;
++import org.apache.kudu.client.SessionConfiguration.FlushMode;
++
++
++public class KuduCollectlExample {
++  private static final int GRAPHITE_PORT = 2003;
++  private static final String TABLE_NAME = "metrics";
++  private static final String ID_TABLE_NAME = "metric_ids";
++
++  private static final String KUDU_MASTER =
++      System.getProperty("kuduMaster", "quickstart.cloudera");
++
++  private KuduClient client;
++  private KuduTable table;
++  private KuduTable idTable;
++
++  private Set<String> existingMetrics = Collections.newSetFromMap(
++    new ConcurrentHashMap<String, Boolean>());
++
++  public static void main(String[] args) throws Exception {
++    new KuduCollectlExample().run();
++  }
++
++  KuduCollectlExample() {
++    this.client = new KuduClient.KuduClientBuilder(KUDU_MASTER).build();
++  }
++  
++  public void run() throws Exception {
++    createTableIfNecessary();
++    createIdTableIfNecessary();
++    this.table = client.openTable(TABLE_NAME);
++    this.idTable = client.openTable(ID_TABLE_NAME);
++    try (ServerSocket listener = new ServerSocket(GRAPHITE_PORT)) {
++      while (true) {
++        Socket s = listener.accept();
++        new HandlerThread(s).start();
++      }
++    }
++  }
++  
++  private void createTableIfNecessary() throws Exception {
++    if (client.tableExists(TABLE_NAME)) {
++      return;
++    }
++    
++    List<ColumnSchema> cols = new ArrayList<>();
++    cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).encoding(
++        ColumnSchema.Encoding.DICT_ENCODING).build());
++    cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).encoding(
++        ColumnSchema.Encoding.DICT_ENCODING).build());
++    cols.add(new ColumnSchemaBuilder("timestamp", Type.INT32).key(true).encoding(
++        ColumnSchema.Encoding.BIT_SHUFFLE).build());
++    cols.add(new ColumnSchemaBuilder("value", Type.DOUBLE)
++        .encoding(ColumnSchema.Encoding.BIT_SHUFFLE).build());
++
++    // Need to set this up since we're not pre-partitioning.
++    List<String> rangeKeys = new ArrayList<>();
++    rangeKeys.add("host");
++    rangeKeys.add("metric");
++    rangeKeys.add("timestamp");
++
++    client.createTable(TABLE_NAME, new Schema(cols),
++                       new CreateTableOptions().setRangePartitionColumns(rangeKeys));
++  }
++  
++  private void createIdTableIfNecessary() throws Exception {
++    if (client.tableExists(ID_TABLE_NAME)) {
++      return;
++    }
++    
++    ArrayList<ColumnSchema> cols = new ArrayList<>();
++    cols.add(new ColumnSchemaBuilder("host", Type.STRING).key(true).build());
++    cols.add(new ColumnSchemaBuilder("metric", Type.STRING).key(true).build());
++
++    // Need to set this up since we're not pre-partitioning.
++    List<String> rangeKeys = new ArrayList<>();
++    rangeKeys.add("host");
++    rangeKeys.add("metric");
++
++    client.createTable(ID_TABLE_NAME, new Schema(cols),
++                       new CreateTableOptions().setRangePartitionColumns(rangeKeys));
++  }
++
++  class HandlerThread extends Thread {
++    private Socket socket;
++    private KuduSession session;
++
++    HandlerThread(Socket s) {
++      this.socket = s;
++      this.session = client.newSession();
++      // TODO: AUTO_FLUSH_BACKGROUND would be better for this kind of usecase, but
++      // it seems like it's buffering data too long, and only flushing based on size.
++      // Perhaps we should support a time-based buffering as well?
++      session.setFlushMode(FlushMode.MANUAL_FLUSH);
++      
++      // Increase the number of mutations that we can buffer
++      session.setMutationBufferSpace(10000);
++    }
++    
++    @Override
++    public void run() {
++      try {
++        doRun();
++      } catch (Exception e) {
++        System.err.println("exception handling connection from " + socket);
++        e.printStackTrace();
++      }
++    }
++
++    private void insertIdIfNecessary(String host, String metric) throws Exception {
++      String id = host + "/" + metric;
++      if (existingMetrics.contains(id)) {
++        return;
++      }
++      Insert ins = idTable.newInsert();
++      ins.getRow().addString("host", host);
++      ins.getRow().addString("metric", metric);
++      session.apply(ins);
++      session.flush();
++      // TODO: error handling!
++      //System.err.println("registered new metric " + id);
++      existingMetrics.add(id);
++    }
++    
++    private void doRun() throws Exception {
++      BufferedReader br = new BufferedReader(new InputStreamReader(
++          socket.getInputStream()));
++      socket = null;
++      
++      // Read lines from collectd. Each line should look like:
++      // hostname.example.com/.cpuload.avg1 2.27 1435788059
++      String input;
++      while ((input = br.readLine()) != null) { 
++        String[] fields = input.split(" ");
++        if (fields.length != 3) {
++          throw new Exception("Invalid input: " + input);
++        }
++        String[] hostAndMetric = fields[0].split("/.");
++        if (hostAndMetric.length != 2) {
++          System.err.println("bad line: " + input);
++          throw new Exception("expected /. delimiter between host and metric name. " +
++              "Did you run collectl with --export=collectl,<hostname>,p=/ ?");
++        }
++        String host = hostAndMetric[0];
++        String metric = hostAndMetric[1];
++        insertIdIfNecessary(host, metric);
++        double val = Double.parseDouble(fields[1]);        
++        int ts = Integer.parseInt(fields[2]);
++        
++        Insert insert = table.newInsert();
++        insert.getRow().addString("host", hostAndMetric[0]);
++        insert.getRow().addString("metric", hostAndMetric[1]);
++        insert.getRow().addInt("timestamp", ts);
++        insert.getRow().addDouble("value", val);
++        session.apply(insert);
++        
++        // If there's more data to read, don't flush yet -- better to accumulate
++        // a larger batch.
++        if (!br.ready()) {
++          List<OperationResponse> responses = session.flush();
++          for (OperationResponse r : responses) {
++            if (r.hasRowError()) {
++              RowError e = r.getRowError();
++              // TODO: the client should offer an enum for different row errors, instead
++              // of string comparison!
++              if ("ALREADY_PRESENT".equals(e.getStatus())) {
++                continue;
++              }
++              System.err.println("Error inserting " + e.getOperation().toString()
++                  + ": " + e.toString());
++            }
++          }
++        }
++      }
++    }
++  }
++}

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/insert-loadgen/README
----------------------------------------------------------------------
diff --cc examples/java/insert-loadgen/README
index 0000000,0000000..7c0628e
new file mode 100644
--- /dev/null
+++ b/examples/java/insert-loadgen/README
@@@ -1,0 -1,0 +1,17 @@@
++Random insert load generator. This will insert as fast as it can using
++AUTO_BACKGROUND_FLUSH with the specified number of threads. All fields are
++randomized, and insert failures (including errors from collisions) are ignored.
++
++To build and run, do the following:
++
++$ mvn package
++$ java -jar target/kudu-insert-loadgen-0.1-SNAPSHOT.jar kudu_master_host kudu_table_name num_threads
++
++For example, if you are running the Quickstart VM with the host name
++"quickstart.cloudera", then you can use:
++
++$ java -jar target/kudu-insert-loadgen-0.1-SNAPSHOT.jar quickstart.cloudera test_table 16
++
++Note: This program will not create the "test_table" table. You must do that
++via other means, such as through impala-shell or using the create-demo-table
++program included in the Kudu source tree.

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/insert-loadgen/pom.xml
----------------------------------------------------------------------
diff --cc examples/java/insert-loadgen/pom.xml
index 0000000,0000000..09bc0d1
new file mode 100644
--- /dev/null
+++ b/examples/java/insert-loadgen/pom.xml
@@@ -1,0 -1,0 +1,72 @@@
++<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
++  <modelVersion>4.0.0</modelVersion>
++  <groupId>kudu-examples</groupId>
++  <artifactId>kudu-insert-loadgen</artifactId>
++  <packaging>jar</packaging>
++  <version>0.1-SNAPSHOT</version>
++  <name>Random Insert Load Generator for Kudu</name>
++
++  <build>
++    <plugins>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-compiler-plugin</artifactId>
++        <version>2.3.1</version>
++        <configuration>
++          <source>1.7</source>
++          <target>1.7</target>
++        </configuration>
++      </plugin>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-shade-plugin</artifactId>
++        <version>2.4</version>
++        <executions>
++          <execution>
++            <phase>package</phase>
++            <goals>
++              <goal>shade</goal>
++            </goals>
++            <configuration>
++              <transformers>
++                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
++                  <mainClass>org.kududb.examples.loadgen.InsertLoadgen</mainClass>
++                </transformer>
++              </transformers>
++            </configuration>
++          </execution>
++        </executions>
++      </plugin>
++    </plugins>
++  </build>
++
++  <repositories>
++    <repository>
++      <id>cdh.repo</id>
++      <name>Cloudera Repositories</name>
++      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
++      <snapshots>
++        <enabled>false</enabled>
++      </snapshots>
++    </repository>
++  </repositories>
++
++  <dependencies>
++
++    <dependency>
++      <groupId>org.apache.kudu</groupId>
++      <artifactId>kudu-client</artifactId>
++      <version>1.1.0</version>
++    </dependency>
++
++    <!-- for logging messages -->
++    <dependency>
++      <groupId>org.slf4j</groupId>
++      <artifactId>slf4j-simple</artifactId>
++      <version>1.7.12</version>
++    </dependency>
++
++  </dependencies>
++
++</project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
----------------------------------------------------------------------
diff --cc examples/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
index 0000000,0000000..4b76c34
new file mode 100644
--- /dev/null
+++ b/examples/java/insert-loadgen/src/main/java/org/kududb/examples/loadgen/InsertLoadgen.java
@@@ -1,0 -1,0 +1,110 @@@
++package org.kududb.examples.loadgen;
++
++import java.util.ArrayList;
++import java.util.List;
++import java.util.Random;
++import java.util.UUID;
++
++import org.apache.kudu.Schema;
++import org.apache.kudu.Type;
++import org.apache.kudu.client.Insert;
++import org.apache.kudu.client.KuduClient;
++import org.apache.kudu.client.KuduSession;
++import org.apache.kudu.client.KuduTable;
++import org.apache.kudu.client.PartialRow;
++import org.apache.kudu.client.SessionConfiguration;
++
++public class InsertLoadgen {
++  private static class RandomDataGenerator {
++    private final Random rng;
++    private final int index;
++    private final Type type;
++
++    /**
++     * Instantiate a random data generator for a specific field.
++     * @param index The numerical index of the column in the row schema
++     * @param type The type of the data at index {@code index}
++     */
++    public RandomDataGenerator(int index, Type type) {
++      this.rng = new Random();
++      this.index = index;
++      this.type = type;
++    }
++
++    /**
++     * Add random data to the given row for the column at index {@code index}
++     * of type {@code type}
++     * @param row The row to add the field to
++     */
++    void generateColumnData(PartialRow row) {
++      switch (type) {
++        case INT8:
++          row.addByte(index, (byte) rng.nextInt(Byte.MAX_VALUE));
++          return;
++        case INT16:
++          row.addShort(index, (short)rng.nextInt(Short.MAX_VALUE));
++          return;
++        case INT32:
++          row.addInt(index, rng.nextInt(Integer.MAX_VALUE));
++          return;
++        case INT64:
++        case UNIXTIME_MICROS:
++          row.addLong(index, rng.nextLong());
++          return;
++        case BINARY:
++          byte bytes[] = new byte[16];
++          rng.nextBytes(bytes);
++          row.addBinary(index, bytes);
++          return;
++        case STRING:
++          row.addString(index, UUID.randomUUID().toString());
++          return;
++        case BOOL:
++          row.addBoolean(index, rng.nextBoolean());
++          return;
++        case FLOAT:
++          row.addFloat(index, rng.nextFloat());
++          return;
++        case DOUBLE:
++          row.addDouble(index, rng.nextDouble());
++          return;
++        default:
++          throw new UnsupportedOperationException("Unknown type " + type);
++      }
++    }
++  }
++
++  public static void main(String[] args) throws Exception {
++    if (args.length != 2) {
++      System.err.println("Usage: InsertLoadgen kudu_master_host kudu_table");
++      System.exit(1);
++    }
++
++    String masterHost = args[0];
++    String tableName = args[1];
++
++    try (KuduClient client = new KuduClient.KuduClientBuilder(masterHost).build()) {
++      KuduTable table = client.openTable(tableName);
++      Schema schema = table.getSchema();
++      List<RandomDataGenerator> generators = new ArrayList<>(schema.getColumnCount());
++      for (int i = 0; i < schema.getColumnCount(); i++) {
++        generators.add(new RandomDataGenerator(i, schema.getColumnByIndex(i).getType()));
++      }
++
++      KuduSession session = client.newSession();
++      session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
++      for (int insertCount = 0; ; insertCount++) {
++        Insert insert = table.newInsert();
++        PartialRow row = insert.getRow();
++        for (int i = 0; i < schema.getColumnCount(); i++) {
++          generators.get(i).generateColumnData(row);
++        }
++        session.apply(insert);
++
++        if (insertCount % 1000 == 0 && session.countPendingErrors() > 0) {
++          throw new RuntimeException(session.getPendingErrors().getRowErrors()[0].toString());
++        }
++      }
++    }
++  }
++}

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/java-sample/README
----------------------------------------------------------------------
diff --cc examples/java/java-sample/README
index 0000000,0000000..71cd034
new file mode 100644
--- /dev/null
+++ b/examples/java/java-sample/README
@@@ -1,0 -1,0 +1,15 @@@
++Here's a Java client sample that creates a table, writes some data, scans it, and then deletes
++its table.
++
++
++To build and run, do the following:
++
++$ mvn package
++$ java -jar target/kudu-java-sample-1.0-SNAPSHOT.jar
++
++This example assumes that you are running the Quickstart VM with the host name
++"quickstart.cloudera". If you are running against a different cluster, pass the
++host name of the Kudu Master using a Java property:
++
++$ java -DkuduMaster=a1216.halxg.cloudera.com -jar target/kudu-java-sample-1.0-SNAPSHOT.jar
++

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/java-sample/pom.xml
----------------------------------------------------------------------
diff --cc examples/java/java-sample/pom.xml
index 0000000,0000000..b078b04
new file mode 100644
--- /dev/null
+++ b/examples/java/java-sample/pom.xml
@@@ -1,0 -1,0 +1,72 @@@
++<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
++  <modelVersion>4.0.0</modelVersion>
++  <groupId>kudu-java-sample</groupId>
++  <artifactId>kudu-java-sample</artifactId>
++  <packaging>jar</packaging>
++  <version>1.0-SNAPSHOT</version>
++  <name>kudu-java-sample</name>
++
++  <build>
++    <plugins>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-compiler-plugin</artifactId>
++        <version>2.3.1</version>
++        <configuration>
++          <source>1.7</source>
++          <target>1.7</target>
++        </configuration>
++      </plugin>
++      <plugin>
++        <groupId>org.apache.maven.plugins</groupId>
++        <artifactId>maven-shade-plugin</artifactId>
++        <version>2.4</version>
++        <executions>
++          <execution>
++            <phase>package</phase>
++            <goals>
++              <goal>shade</goal>
++            </goals>
++            <configuration>
++              <transformers>
++                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
++                  <mainClass>org.kududb.examples.sample.Sample</mainClass>
++                </transformer>
++              </transformers>
++            </configuration>
++          </execution>
++        </executions>
++      </plugin>
++    </plugins>
++  </build>
++
++  <repositories>
++    <repository>
++      <id>cdh.repo</id>
++      <name>Cloudera Repositories</name>
++      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
++      <snapshots>
++        <enabled>false</enabled>
++      </snapshots>
++    </repository>
++  </repositories>
++
++  <dependencies>
++
++    <dependency>
++      <groupId>org.apache.kudu</groupId>
++      <artifactId>kudu-client</artifactId>
++      <version>1.1.0</version>
++    </dependency>
++
++    <!-- for logging messages -->
++    <dependency>
++      <groupId>org.slf4j</groupId>
++      <artifactId>slf4j-simple</artifactId>
++      <version>1.7.12</version>
++    </dependency>
++
++  </dependencies>
++
++</project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
----------------------------------------------------------------------
diff --cc examples/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
index 0000000,0000000..5c5285f
new file mode 100644
--- /dev/null
+++ b/examples/java/java-sample/src/main/java/org/kududb/examples/sample/Sample.java
@@@ -1,0 -1,0 +1,77 @@@
++package org.kududb.examples.sample;
++
++import org.apache.kudu.ColumnSchema;
++import org.apache.kudu.Schema;
++import org.apache.kudu.Type;
++import org.apache.kudu.client.*;
++
++import java.util.ArrayList;
++import java.util.List;
++
++public class Sample {
++
++  private static final String KUDU_MASTER = System.getProperty(
++      "kuduMaster", "quickstart.cloudera");
++
++  public static void main(String[] args) {
++    System.out.println("-----------------------------------------------");
++    System.out.println("Will try to connect to Kudu master at " + KUDU_MASTER);
++    System.out.println("Run with -DkuduMaster=myHost:port to override.");
++    System.out.println("-----------------------------------------------");
++    String tableName = "java_sample-" + System.currentTimeMillis();
++    KuduClient client = new KuduClient.KuduClientBuilder(KUDU_MASTER).build();
++
++    try {
++      List<ColumnSchema> columns = new ArrayList(2);
++      columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32)
++          .key(true)
++          .build());
++      columns.add(new ColumnSchema.ColumnSchemaBuilder("value", Type.STRING)
++          .build());
++      List<String> rangeKeys = new ArrayList<>();
++      rangeKeys.add("key");
++
++      Schema schema = new Schema(columns);
++      client.createTable(tableName, schema,
++                         new CreateTableOptions().setRangePartitionColumns(rangeKeys));
++
++      KuduTable table = client.openTable(tableName);
++      KuduSession session = client.newSession();
++      for (int i = 0; i < 3; i++) {
++        Insert insert = table.newInsert();
++        PartialRow row = insert.getRow();
++        row.addInt(0, i);
++        row.addString(1, "value " + i);
++        session.apply(insert);
++      }
++
++      List<String> projectColumns = new ArrayList<>(1);
++      projectColumns.add("value");
++      KuduScanner scanner = client.newScannerBuilder(table)
++          .setProjectedColumnNames(projectColumns)
++          .build();
++      while (scanner.hasMoreRows()) {
++        RowResultIterator results = scanner.nextRows();
++        while (results.hasNext()) {
++          RowResult result = results.next();
++          System.out.println(result.getString(0));
++        }
++      }
++    } catch (Exception e) {
++      e.printStackTrace();
++    } finally {
++      try {
++        client.deleteTable(tableName);
++      } catch (Exception e) {
++        e.printStackTrace();
++      } finally {
++        try {
++          client.shutdown();
++        } catch (Exception e) {
++          e.printStackTrace();
++        }
++      }
++    }
++  }
++}
++

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/dstat-kudu/README.md
----------------------------------------------------------------------
diff --cc examples/python/dstat-kudu/README.md
index 0000000,0000000..a4f443c
new file mode 100644
--- /dev/null
+++ b/examples/python/dstat-kudu/README.md
@@@ -1,0 -1,0 +1,69 @@@
++# Kudu + dstat + Impala
++
++This is an example program that shows how to use the Kudu API in Python to load data into
++a new / existing Kudu table generated by an external program.
++
++## Prerequisites
++
++Make sure you have the Kudu client library installed and the kudu Python bindings are
++available. If you have the Kudu client library and Python bindings in a special place,
++you'll need to set the environment variables:
++
++   LD_LIBRARY_PATH
++   PYTHONPATH
++
++To the according directories. In addition you'll need the dstat program, it should be
++available from your typical package repository.
++
++## Usage
++
++In this case the `dstat` program is used to generate data about the system load and pipe
++this data into a named pipe that is then read and pipe to the python program.
++
++To execute this script simply run:
++
++    python kudu_dstat.py
++
++This will create a table assuming that you have a kudu-master running locally. You can use
++the Web UI to access some information about the table using the following link:
++http://localhost:8051. The program will run until it is terminated via C-c.
++
++To drop the table in Kudu and start fresh start the program with:
++
++    python kudu_dstat.py drop
++
++To query the data via Impala, create a new Kudu table in Impala using the
++following command in the impala-shell.
++
++    CREATE EXTERNAL TABLE dstat (
++    `ts` BIGINT,
++    `usr` FLOAT,
++    `sys` FLOAT,
++    `idl` FLOAT,
++    `wai` FLOAT,
++    `hiq` FLOAT,
++    `siq` FLOAT,
++    `read` FLOAT,
++    `writ` FLOAT,
++    `recv` FLOAT,
++    `send` FLOAT,
++    `in` FLOAT,
++    `out` FLOAT,
++    `int` FLOAT,
++    `csw` FLOAT
++    )
++    TBLPROPERTIES(
++      'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
++      'kudu.table_name' = 'dstat',
++      'kudu.master_addresses' = '127.0.0.1:7051',
++      'kudu.key_columns' = 'ts'
++    );
++
++Now you can query your local system's load using:
++
++
++    -- How many rows are stored right now?
++    select count(*) from dstat;
++
++    -- Average load in 10s windows
++    select (ts - ts % 10 ) as mod_ts, avg(usr), avg(sys), avg(idl) from dstat group by mod_ts order by mod_ts

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/dstat-kudu/kudu_dstat.py
----------------------------------------------------------------------
diff --cc examples/python/dstat-kudu/kudu_dstat.py
index 0000000,0000000..f1f5bb2
new file mode 100644
--- /dev/null
+++ b/examples/python/dstat-kudu/kudu_dstat.py
@@@ -1,0 -1,0 +1,93 @@@
++import kudu
++import os
++import subprocess
++import sys
++import tempfile
++import time
++from kudu.client import Partitioning
++
++DSTAT_COL_NAMES = ["usr", "sys", "idl", "wai", "hiq", "siq", "read", "writ", "recv", "send",
++                  "in","out","int","csw"]
++
++
++def open_or_create_table(client, table, drop=False):
++  """Based on the default dstat column names create a new table indexed by a timstamp col"""
++  exists = False
++  if client.table_exists(table):
++    exists = True
++    if drop:
++      client.delete_table(table)
++      exists = False
++
++  if not exists:
++    # Create the schema for the table, basically all float cols
++    builder = kudu.schema_builder()
++    builder.add_column("ts", kudu.int64, nullable=False, primary_key=True)
++    for col in DSTAT_COL_NAMES:
++      builder.add_column(col, kudu.float_)
++    schema = builder.build()
++
++    # Create hash partitioning buckets
++    partitioning = Partitioning().add_hash_partitions('ts', 2)
++
++    client.create_table(table, schema, partitioning)
++
++  return client.table(table)
++
++def append_row(table, line):
++  """The line is the raw string read from stdin, that is then splitted by , and prepended
++  with the current timestamp."""
++  data = [float(x.strip()) for x in line.split(",")]
++
++  op = table.new_insert()
++  # Convert to microseconds
++  op["ts"] = int(time.time() * 1000000)
++  for c, v in zip(DSTAT_COL_NAMES, data):
++    op[c] = v
++  return op
++
++def start_dstat():
++  tmpdir = tempfile.mkdtemp()
++  path = os.path.join(tmpdir, "dstat.pipe")
++  os.mkfifo(path)
++  proc = subprocess.Popen(["dstat", "-cdngy", "--output", "{0}".format(path)])
++  return proc.pid, path
++
++if __name__ == "__main__":
++
++  drop = False
++
++  if len(sys.argv) > 1:
++    operation = sys.argv[1]
++    if operation in ["drop"]:
++      drop = True
++
++  client = kudu.connect("127.0.0.1", 7051)
++  table = open_or_create_table(client, "dstat", drop)
++
++  # Start dstat
++  dstat_id, pipe_path = start_dstat()
++
++  try:
++    # Create file handle to read from pipe
++    fid = open(pipe_path, "r")
++
++    # Create session object
++    session = client.new_session()
++    counter = 0
++
++    # The dstat output first prints uninteresting lines, skip until we find the header
++    skip = True
++    while True:
++      line  = fid.readline()
++      if line.startswith("\"usr\""):
++        skip = False
++        continue
++      if not skip:
++        session.apply(append_row(table, line))
++        counter += 1
++        if counter % 10 == 0:
++          session.flush()
++  except KeyboardInterrupt:
++    if os.path.exists(pipe_path):
++      os.remove(pipe_path)

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/graphite-kudu/kudu/__init__.py
----------------------------------------------------------------------
diff --cc examples/python/graphite-kudu/kudu/__init__.py
index 0000000,0000000..34da70a
new file mode 100644
--- /dev/null
+++ b/examples/python/graphite-kudu/kudu/__init__.py
@@@ -1,0 -1,0 +1,3 @@@
++from pkgutil import extend_path
++__path__ = extend_path(__path__, __name__)
++

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/graphite-kudu/kudu/kudu_graphite.py
----------------------------------------------------------------------
diff --cc examples/python/graphite-kudu/kudu/kudu_graphite.py
index 0000000,0000000..86a142e
new file mode 100644
--- /dev/null
+++ b/examples/python/graphite-kudu/kudu/kudu_graphite.py
@@@ -1,0 -1,0 +1,287 @@@
++import sys, os
++	
++import re
++import time
++import math
++import kudu
++
++from multiprocessing.pool import ThreadPool
++from django.conf import settings
++
++import graphite
++from graphite.intervals import Interval, IntervalSet
++from graphite.node import LeafNode, BranchNode
++from graphite.readers import FetchInProgress
++from graphite.logger import log
++
++import json
++
++KUDU_MAX_REQUESTS = 10
++KUDU_REQUEST_POOL = ThreadPool(KUDU_MAX_REQUESTS)
++
++class KuduNode(object):
++    def __init__(self):
++        self.child_nodes = []
++    
++    #Node is leaf, if it has no child nodes.
++    def isLeaf(self):
++        return len(self.child_nodes) == 0
++    
++    #Add child node to node.
++    def addChildNode(self, node):
++        self.child_nodes.append(node)
++    
++    #Get child node with specified name
++    def getChild(self, name):
++        for node in self.child_nodes:
++            if node.name == name:
++                return node
++        return None
++    
++    def getChildren(self):
++        return self.child_nodes
++
++    
++class KuduTree(KuduNode):
++    pass
++            
++
++class KuduRegularNode(KuduNode):
++    def __init__(self, name):
++        KuduNode.__init__(self)
++        self.name = name
++    
++    def getName(self):
++        return self.name
++ 
++                
++class KuduReader(object):
++    __slots__ = ('kudu_table', 'metric_name')
++    supported = True
++
++    def __init__(self, kudu_table, metric_name):
++        self.kudu_table = kudu_table
++        self.metric_name = metric_name
++
++    def get_intervals(self):
++        return IntervalSet([Interval(0, time.time())])
++
++    def fetch(self, startTime, endTime):
++        def get_data(startTime, endTime):
++            log.info("time range %d-%d" % (startTime, endTime))
++            host, metric = self.metric_name.split("com.")
++            host += "com"
++            s = self.kudu_table.scanner()
++            s.add_predicate(s.range_predicate(0, host, host))
++            s.add_predicate(s.range_predicate(1, metric, metric))
++            s.add_predicate(s.range_predicate(2, startTime, endTime))
++            s.open()
++            values = []
++            while s.has_more_rows():
++              t = s.next_batch().as_tuples()
++              log.info("metric batch: %d" % len(t))
++              values.extend([(time, value) for (_, _, time, value) in t])
++            # TODO: project just the time and value, not host/metric!
++            values.sort()
++            values_length = len(values)
++            
++            if values_length == 0:
++                time_info = (startTime, endTime, 1)
++                datapoints = []
++                return (time_info, datapoints)
++
++            startTime = min(t[0] for t in values)
++            endTime = max(t[0] for t in values)
++            if values_length == 1:
++                time_info = (startTime, endTime, 1)
++                datapoints = [values[0][1]]
++                return (time_info, datapoints)
++            log.info("data: %s" % repr(values))
++                    
++            # 1. Calculate step (in seconds)
++            #    Step will be lowest time delta between values or 1 (in case if delta is smaller)
++            step = 1
++            minDelta = None
++            
++            for i in range(0, values_length - 2):
++                (timeI, valueI) = values[i]
++                (timeIplus1, valueIplus1) = values[i + 1]
++                delta = timeIplus1 - timeI
++                
++                if (minDelta == None or delta < minDelta):
++                    minDelta = delta
++            
++            if minDelta > step:
++                step = minDelta
++            
++            # 2. Fill time info table    
++            time_info = (startTime, endTime, step)
++            
++            # 3. Create array of output points
++            number_points = int(math.ceil((endTime - startTime) / step))
++            datapoints = [None for i in range(number_points)]
++            
++            # 4. Fill array of output points
++            cur_index = 0
++            cur_value = None
++            cur_time_stamp = None
++            cur_value_used = None
++            
++            for i in range(0, number_points - 1):
++                
++                data_point_time_stamp = startTime + i * step
++                
++                (cur_time_stamp, cur_value) = values[cur_index]
++                cur_time_stamp = cur_time_stamp
++                
++                while (cur_index + 1 < values_length):
++                    (next_time_stamp, next_value) = values[cur_index + 1]
++                    if next_time_stamp > data_point_time_stamp:
++                        break;
++                    (cur_value, cur_time_stamp, cur_value_used) = (next_value, next_time_stamp, False)
++                    cur_index = cur_index + 1
++                    
++                data_point_value = None
++                if(not cur_value_used and cur_time_stamp <= data_point_time_stamp):
++                    cur_value_used = True
++                    data_point_value = cur_value
++                
++                datapoints[i] =  data_point_value
++     
++            log.info("data: %s" % repr(datapoints))
++            return (time_info, datapoints)
++
++        job = KUDU_REQUEST_POOL.apply_async(get_data, [startTime, endTime])
++        return FetchInProgress(job.get)
++    
++    
++class KuduFinder(object):
++    def __init__(self, kudu_table=None):
++        self.client = kudu.Client(settings.KUDU_MASTER)
++        self.kudu_table = self.client.open_table(settings.KUDU_TABLE)
++        
++    # Fills tree of metrics out from flat list
++    # of metrics names, separated by dot value
++    def _fill_kudu_tree(self, metric_names):
++        tree = KuduTree()
++        
++        for metric_name in metric_names:
++            name_parts = re.split("[./]", metric_name)
++            
++            cur_parent_node = tree
++            cur_node = None
++            
++            for name_part in name_parts:
++                cur_node = cur_parent_node.getChild(name_part)
++                if cur_node == None:
++                    cur_node = KuduRegularNode(name_part)
++                    cur_parent_node.addChildNode(cur_node)
++                cur_parent_node = cur_node
++        
++        return tree
++    
++    
++    def _find_nodes_from_pattern(self, kudu_table, pattern):
++        query_parts = []
++        for part in pattern.split('.'):
++            part = part.replace('*', '.*')
++            part = re.sub(
++                r'{([^{]*)}',
++                lambda x: "(%s)" % x.groups()[0].replace(',', '|'),
++                part,
++            )
++            query_parts.append(part)
++          
++        #Request for metrics
++        t = self.client.open_table("metric_ids")
++        s = t.scanner()
++
++        # Handle a prefix pattern
++        if re.match(".+\\*", pattern):
++          prefix_match = pattern[:-1]
++          if '.com.' in prefix_match:
++            host_prefix, metric_prefix = prefix_match.split(".com.")
++            host_prefix += ".com"
++            s.add_predicate(s.range_predicate(1, metric_prefix, metric_prefix + "\xff"))
++          else:
++            host_prefix = prefix_match
++
++          s.add_predicate(s.range_predicate(0, host_prefix, host_prefix + "\xff"))
++        elif not "*" in pattern:
++          # equality match
++          host, metric = pattern.split(".com.")
++          host += ".com"
++          s.add_predicate(s.range_predicate(0, host, host))
++          s.add_predicate(s.range_predicate(1, metric, metric))
++        s.open()
++
++        metrics = []
++        while s.has_more_rows():
++          t = s.next_batch().as_tuples()
++          log.info("batch: %d" % len(t))
++          metrics.extend(t)
++        metric_names = ["%s/%s" % (host, metric) for (host, metric) in metrics]
++        #Form tree out of them
++        metrics_tree = self._fill_kudu_tree(metric_names)    
++        
++        for node in self._find_kudu_nodes(kudu_table, query_parts, metrics_tree):
++            yield node
++    
++    def _find_kudu_nodes(self, kudu_table, query_parts, current_branch, path=''):
++        query_regex = re.compile(query_parts[0])
++        for node, node_data, node_name, node_path in self._get_branch_nodes(kudu_table, current_branch, path):
++            dot_count = node_name.count('.') + node_name.count('/')
++    
++            if dot_count:
++                node_query_regex = re.compile(r'\.'.join(query_parts[:dot_count+1]))
++            else:
++                node_query_regex = query_regex
++    
++            if node_query_regex.match(node_name):
++                if len(query_parts) == 1:
++                    yield node
++                elif not node.is_leaf:
++                    for inner_node in self._find_kudu_nodes(
++                        kudu_table,
++                        query_parts[dot_count+1:],
++                        node_data,
++                        node_path,
++                    ):
++                        yield inner_node
++    
++    
++    def _get_branch_nodes(self, kudu_table, input_branch, path):
++        results = input_branch.getChildren()
++        if results:
++            if path:
++                path += '.'
++                
++            branches = [];
++            leaves = [];
++            
++            for item in results:
++                if item.isLeaf():
++                    leaves.append(item)
++                else:
++                    branches.append(item)
++            
++            if (len(branches) != 0):
++                for branch in branches:
++                    node_name = branch.getName()
++                    node_path = path + node_name
++                    yield BranchNode(node_path), branch, node_name, node_path
++            if (len(leaves) != 0):
++                for leaf in leaves:
++                    node_name = leaf.getName()
++                    node_path = path + node_name
++                    reader = KuduReader(self.kudu_table, node_path)
++                    yield LeafNode(node_path, reader), leaf, node_name, node_path
++
++    def find_nodes(self, query):
++        log.info("q:" + repr(query))
++        try:
++          for node in self._find_nodes_from_pattern(self.kudu_table, query.pattern):
++              yield node
++        except Exception, e:
++          log.exception(e)
++          raise

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/graphite-kudu/setup.cfg
----------------------------------------------------------------------
diff --cc examples/python/graphite-kudu/setup.cfg
index 0000000,0000000..5e40900
new file mode 100644
--- /dev/null
+++ b/examples/python/graphite-kudu/setup.cfg
@@@ -1,0 -1,0 +1,2 @@@
++[wheel]
++universal = 1

http://git-wip-us.apache.org/repos/asf/kudu/blob/c83f6eb3/examples/python/graphite-kudu/setup.py
----------------------------------------------------------------------
diff --cc examples/python/graphite-kudu/setup.py
index 0000000,0000000..386edeb
new file mode 100644
--- /dev/null
+++ b/examples/python/graphite-kudu/setup.py
@@@ -1,0 -1,0 +1,26 @@@
++# coding: utf-8
++from setuptools import setup
++
++setup(
++    name='graphite-kudu',
++    version='0.0.1',
++    license='BSD',
++    author=u'Dmitry Gryzunov',
++    description=('A plugin for using graphite-web with Kudu as a backend'),
++    py_modules=('kudu.kudu_graphite',),
++    zip_safe=False,
++    include_package_data=True,
++    platforms='any',
++    classifiers=(
++        'Intended Audience :: Developers',
++        'Intended Audience :: System Administrators',
++        'License :: OSI Approved :: BSD License',
++        'Operating System :: OS Independent',
++        'Programming Language :: Python',
++        'Programming Language :: Python :: 2',
++        'Topic :: System :: Monitoring',
++    ),
++    install_requires=(
++        'python-kudu',
++    ),
++)