zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject zookeeper git commit: ZOOKEEPER-1703: Added instructions on how to run the example code
Date Fri, 13 Oct 2017 23:19:21 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.5 cc2ab038d -> c0c0878af


ZOOKEEPER-1703: Added instructions on how to run the example code

Author: Andor Molnar <andor@cloudera.com>

Reviewers: Patrick Hunt <phunt@apache.org>

Closes #400 from dolphy17/master and squashes the following commits:

16e26f92 [Andor Molnar] ZOOKEEPER-1703: Set classpath the way that the book suggests
45ff9816 [Andor Molnar] ZOOKEEPER-1703: Added instructions on how to run the example code

Change-Id: I08467785ae3cdd75fd38c1e6d82439e4718d83fe
(cherry picked from commit 98ff4f9dd9b67503ffa3f5852df499a46efd6241)
Signed-off-by: Patrick Hunt <phunt@apache.org>


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

Branch: refs/heads/branch-3.5
Commit: c0c0878af0aa0bb71fd3b5a61e0646e2f529ac20
Parents: cc2ab03
Author: Andor Molnar <andor@cloudera.com>
Authored: Fri Oct 13 16:12:59 2017 -0700
Committer: Patrick Hunt <phunt@apache.org>
Committed: Fri Oct 13 16:17:31 2017 -0700

----------------------------------------------------------------------
 docs/index.pdf                                  | Bin 12657 -> 12657 bytes
 docs/javaExample.pdf                            | Bin 33818 -> 33818 bytes
 docs/linkmap.pdf                                | Bin 10826 -> 10826 bytes
 docs/recipes.pdf                                | Bin 33856 -> 33856 bytes
 docs/zookeeperAdmin.html                        |  49 +++++++++++++--
 docs/zookeeperAdmin.pdf                         | Bin 95592 -> 96641 bytes
 docs/zookeeperHierarchicalQuorums.pdf           | Bin 6654 -> 6654 bytes
 docs/zookeeperInternals.pdf                     | Bin 48811 -> 48811 bytes
 docs/zookeeperJMX.pdf                           | Bin 16475 -> 16475 bytes
 docs/zookeeperObservers.pdf                     | Bin 12868 -> 12868 bytes
 docs/zookeeperOver.pdf                          | Bin 302467 -> 302467 bytes
 docs/zookeeperProgrammers.pdf                   | Bin 143745 -> 143745 bytes
 docs/zookeeperQuotas.pdf                        | Bin 11184 -> 11184 bytes
 docs/zookeeperReconfig.pdf                      | Bin 62362 -> 62416 bytes
 docs/zookeeperStarted.pdf                       | Bin 28078 -> 28078 bytes
 docs/zookeeperTutorial.html                     |  59 ++++++++++++++++---
 docs/zookeeperTutorial.pdf                      | Bin 30478 -> 34212 bytes
 .../content/xdocs/zookeeperTutorial.xml         |  53 ++++++++++++++---
 18 files changed, 139 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/index.pdf
----------------------------------------------------------------------
diff --git a/docs/index.pdf b/docs/index.pdf
index 6d2c0c8..270df1a 100644
Binary files a/docs/index.pdf and b/docs/index.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/javaExample.pdf
----------------------------------------------------------------------
diff --git a/docs/javaExample.pdf b/docs/javaExample.pdf
index e9a16ae..e45b210 100644
Binary files a/docs/javaExample.pdf and b/docs/javaExample.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/linkmap.pdf
----------------------------------------------------------------------
diff --git a/docs/linkmap.pdf b/docs/linkmap.pdf
index 26fb06a..2e70a13 100644
Binary files a/docs/linkmap.pdf and b/docs/linkmap.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/recipes.pdf
----------------------------------------------------------------------
diff --git a/docs/recipes.pdf b/docs/recipes.pdf
index 99f5a20..ec2f44f 100644
Binary files a/docs/recipes.pdf and b/docs/recipes.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperAdmin.html
----------------------------------------------------------------------
diff --git a/docs/zookeeperAdmin.html b/docs/zookeeperAdmin.html
index a65681e..a457cc7 100644
--- a/docs/zookeeperAdmin.html
+++ b/docs/zookeeperAdmin.html
@@ -1199,11 +1199,15 @@ server.3=zoo3:2888:3888</pre>
 </dt>
 <dd>
 <p>(Java system property: <strong>zookeeper.snapCount</strong>)</p>
-<p>ZooKeeper logs transactions to a transaction
-              log. After snapCount transactions are written to a log
-              file a snapshot is started and a new transaction log
-              file is created. The default snapCount is
-              100,000.</p>
+<p>ZooKeeper records its transactions using snapshots and
+              a transaction log (think write-ahead log).The number of
+              transactions recorded in the transaction log before a snapshot
+              can be taken (and the transaction log rolled) is determined
+              by snapCount. In order to prevent all of the machines in the quorum
+              from taking a snapshot at the same time, each ZooKeeper server
+              will take a snapshot when the number of transactions in the transaction log
+              reaches a runtime generated random value in the [snapCount/2+1, snapCount]

+              range.The default snapCount is 100,000.</p>
 </dd>
 
           
@@ -1555,6 +1559,27 @@ server.3=zoo3:2888:3888</pre>
               </pre>
 </dd>
 
+          
+<dt>
+<term>tcpKeepAlive</term>
+</dt>
+<dd>
+<p>(Java system property: <strong>zookeeper.tcpKeepAlive</strong>)</p>
+<p>
+<strong>New in 3.5.4:</strong>
+                Setting this to true sets the TCP keepAlive flag on the
+                sockets used by quorum members to perform elections.
+                This will allow for connections between quorum members to
+                remain up when there is network infrastructure that may
+                otherwise break them. Some NATs and firewalls may terminate
+                or lose state for long running or idle connections.</p>
+<p> Enabling this option relies on OS level settings to work
+                properly, check your operating system's options regarding TCP
+                keepalive for more information.  Defaults to
+                <strong>false</strong>.
+              </p>
+</dd>
+
         
 </dl>
 <p></p>
@@ -1606,6 +1631,18 @@ server.3=zoo3:2888:3888</pre>
 
           
 <dt>
+<term>zookeeper.superUser</term>
+</dt>
+<dd>
+<p>(Java system property: <strong>zookeeper.superUser</strong>)</p>
+<p>Similar to <strong>zookeeper.X509AuthenticationProvider.superUser</strong>
+              but is generic for SASL based logins. It stores the name of 
+              a user that can access the znode hierarchy as a "super" user.
+              </p>
+</dd>
+
+          
+<dt>
 <term>ssl.keyStore.location and ssl.keyStore.password</term>
 </dt>
 <dd>
@@ -2438,7 +2475,7 @@ server.3=zoo3:2888:3888</pre>
 
         
 <dt>
-<term>incorrect placement of transasction log</term>
+<term>incorrect placement of transaction log</term>
 </dt>
 <dd>
 <p>The most performance critical part of ZooKeeper is the

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperAdmin.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperAdmin.pdf b/docs/zookeeperAdmin.pdf
index 7e6586d..7f63f98 100644
Binary files a/docs/zookeeperAdmin.pdf and b/docs/zookeeperAdmin.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperHierarchicalQuorums.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperHierarchicalQuorums.pdf b/docs/zookeeperHierarchicalQuorums.pdf
index c9b5213..37e4e51 100644
Binary files a/docs/zookeeperHierarchicalQuorums.pdf and b/docs/zookeeperHierarchicalQuorums.pdf
differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperInternals.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperInternals.pdf b/docs/zookeeperInternals.pdf
index afaa29d..edd416c 100644
Binary files a/docs/zookeeperInternals.pdf and b/docs/zookeeperInternals.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperJMX.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperJMX.pdf b/docs/zookeeperJMX.pdf
index d072de7..61384b1 100644
Binary files a/docs/zookeeperJMX.pdf and b/docs/zookeeperJMX.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperObservers.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperObservers.pdf b/docs/zookeeperObservers.pdf
index d9440c8..2706e1f 100644
Binary files a/docs/zookeeperObservers.pdf and b/docs/zookeeperObservers.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperOver.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperOver.pdf b/docs/zookeeperOver.pdf
index b7cb7c1..63e7713 100644
Binary files a/docs/zookeeperOver.pdf and b/docs/zookeeperOver.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperProgrammers.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperProgrammers.pdf b/docs/zookeeperProgrammers.pdf
index 1b7b625..e0f1311 100644
Binary files a/docs/zookeeperProgrammers.pdf and b/docs/zookeeperProgrammers.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperQuotas.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperQuotas.pdf b/docs/zookeeperQuotas.pdf
index 9ec9231..afd4836 100644
Binary files a/docs/zookeeperQuotas.pdf and b/docs/zookeeperQuotas.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperReconfig.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperReconfig.pdf b/docs/zookeeperReconfig.pdf
index 6906890..c449e54 100644
Binary files a/docs/zookeeperReconfig.pdf and b/docs/zookeeperReconfig.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperStarted.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperStarted.pdf b/docs/zookeeperStarted.pdf
index 98fc185..562e8f9 100644
Binary files a/docs/zookeeperStarted.pdf and b/docs/zookeeperStarted.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperTutorial.html
----------------------------------------------------------------------
diff --git a/docs/zookeeperTutorial.html b/docs/zookeeperTutorial.html
index 472d8f4..39bf10e 100644
--- a/docs/zookeeperTutorial.html
+++ b/docs/zookeeperTutorial.html
@@ -204,7 +204,18 @@ document.write("Last Published: " + document.lastModified);
 <a href="#sc_producerConsumerQueues">Producer-Consumer Queues</a>
 </li>
 <li>
-<a href="#sc_sourceListing">Complete Source Listing</a>
+<a href="#Complete+example">Complete example</a>
+<ul class="minitoc">
+<li>
+<a href="#Queue+test">Queue test</a>
+</li>
+<li>
+<a href="#Barrier+test">Barrier test</a>
+</li>
+<li>
+<a href="#sc_sourceListing">Source Listing</a>
+</li>
+</ul>
 </li>
 </ul>
 </div>
@@ -534,9 +545,37 @@ from each one.</p>
 </pre>
 </div>
 
-<a name="sc_sourceListing"></a>
-<h2 class="h3">Complete Source Listing</h2>
+
+<a name="Complete+example"></a>
+<h2 class="h3">Complete example</h2>
 <div class="section">
+<p>
+In the following section you can find a complete command line application to demonstrate
the above mentioned
+recipes. Use the following command to run it.
+</p>
+<pre class="code">
+ZOOBINDIR="[path_to_distro]/bin"
+. "$ZOOBINDIR"/zkEnv.sh
+java SyncPrimitive [Test Type] [ZK server] [No of elements] [Client type]
+</pre>
+<a name="Queue+test"></a>
+<h3 class="h4">Queue test</h3>
+<p>Start a producer to create 100 elements</p>
+<pre class="code">
+java SyncPrimitive qTest localhost 100 p
+</pre>
+<p>Start a consumer to consume 100 elements</p>
+<pre class="code">
+java SyncPrimitive qTest localhost 100 c
+</pre>
+<a name="Barrier+test"></a>
+<h3 class="h4">Barrier test</h3>
+<p>Start a barrier with 2 participants (start as many times as many participants you'd
like to enter)</p>
+<pre class="code">
+java SyncPrimitive bTest localhost 2
+</pre>
+<a name="sc_sourceListing"></a>
+<h3 class="h4">Source Listing</h3>
 <div class="note example">
 <div class="label">SyncPrimitive.Java</div>
 <div class="content">
@@ -753,15 +792,19 @@ public class SyncPrimitive implements Watcher {
                         mutex.wait();
                     } else {
                         Integer min = new Integer(list.get(0).substring(7));
+                        String minNode = list.get(0);
                         for(String s : list){
                             Integer tempValue = new Integer(s.substring(7));
                             //System.out.println("Temporary value: " + tempValue);
-                            if(tempValue &lt; min) min = tempValue;
+                            if(tempValue &lt; min) {
+                                min = tempValue;
+                                minNode = s;
+                            }
                         }
-                        System.out.println("Temporary value: " + root + "/element" + min);
-                        byte[] b = zk.getData(root + "/element" + min,
-                                    false, stat);
-                        zk.delete(root + "/element" + min, 0);
+                        System.out.println("Temporary value: " + root + "/" + minNode);
+                        byte[] b = zk.getData(root + "/" + minNode,
+                        false, stat);
+                        zk.delete(root + "/" + minNode, 0);
                         ByteBuffer buffer = ByteBuffer.wrap(b);
                         retvalue = buffer.getInt();
 

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/docs/zookeeperTutorial.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperTutorial.pdf b/docs/zookeeperTutorial.pdf
index 352e55e..173d0b6 100644
Binary files a/docs/zookeeperTutorial.pdf and b/docs/zookeeperTutorial.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/c0c0878a/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml b/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
index 0cae91e..e320ed6 100644
--- a/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
+++ b/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
@@ -361,7 +361,41 @@ from each one.</para>
 </programlisting>
  
 </section>
-<section id="sc_sourceListing"><title>Complete Source Listing</title>
+
+<section>
+<title>Complete example</title>
+<para>
+In the following section you can find a complete command line application to demonstrate
the above mentioned
+recipes. Use the following command to run it.
+</para>
+<programlisting>
+ZOOBINDIR="[path_to_distro]/bin"
+. "$ZOOBINDIR"/zkEnv.sh
+java SyncPrimitive [Test Type] [ZK server] [No of elements] [Client type]
+</programlisting>
+
+<section>
+<title>Queue test</title>
+<para>Start a producer to create 100 elements</para>
+<programlisting>
+java SyncPrimitive qTest localhost 100 p
+</programlisting>
+
+<para>Start a consumer to consume 100 elements</para>
+<programlisting>
+java SyncPrimitive qTest localhost 100 c
+</programlisting>
+</section>
+
+<section>
+<title>Barrier test</title>
+<para>Start a barrier with 2 participants (start as many times as many participants
you'd like to enter)</para>
+<programlisting>
+java SyncPrimitive bTest localhost 2
+</programlisting>
+</section>
+
+<section id="sc_sourceListing"><title>Source Listing</title>
 <example id="eg_SyncPrimitive_java">
 <title>SyncPrimitive.Java</title>
 <programlisting>
@@ -574,15 +608,19 @@ public class SyncPrimitive implements Watcher {
                         mutex.wait();
                     } else {
                         Integer min = new Integer(list.get(0).substring(7));
+                        String minNode = list.get(0);
                         for(String s : list){
                             Integer tempValue = new Integer(s.substring(7));
                             //System.out.println("Temporary value: " + tempValue);
-                            if(tempValue &lt; min) min = tempValue;
+                            if(tempValue &lt; min) {
+                                min = tempValue;
+                                minNode = s;
+                            }
                         }
-                        System.out.println("Temporary value: " + root + "/element" + min);
-                        byte[] b = zk.getData(root + "/element" + min,
-                                    false, stat);
-                        zk.delete(root + "/element" + min, 0);
+                        System.out.println("Temporary value: " + root + "/" + minNode);
+                        byte[] b = zk.getData(root + "/" + minNode,
+                        false, stat);
+                        zk.delete(root + "/" + minNode, 0);
                         ByteBuffer buffer = ByteBuffer.wrap(b);
                         retvalue = buffer.getInt();
 
@@ -669,7 +707,6 @@ public class SyncPrimitive implements Watcher {
 }
 </programlisting></example>
 </section>
+</section>
 
 </article>
-
-        


Mime
View raw message