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:21:38 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 541d74b35 -> 0975d211c


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/0975d211
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/0975d211
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/0975d211

Branch: refs/heads/branch-3.4
Commit: 0975d211c6c918515cbdc5dbff820b131b189962
Parents: 541d74b
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:20:40 2017 -0700

----------------------------------------------------------------------
 docs/bookkeeperConfig.pdf                       | Bin 13797 -> 13797 bytes
 docs/bookkeeperOverview.pdf                     | Bin 147558 -> 147558 bytes
 docs/bookkeeperProgrammer.pdf                   | Bin 24949 -> 24949 bytes
 docs/bookkeeperStarted.pdf                      | Bin 17107 -> 17107 bytes
 docs/bookkeeperStream.pdf                       | Bin 13192 -> 13192 bytes
 docs/index.pdf                                  | Bin 13515 -> 13515 bytes
 docs/javaExample.pdf                            | Bin 33767 -> 33767 bytes
 docs/linkmap.pdf                                | Bin 12459 -> 12459 bytes
 docs/recipes.pdf                                | Bin 31021 -> 31021 bytes
 docs/zookeeperAdmin.html                        |  54 +++++++++++++----
 docs/zookeeperAdmin.pdf                         | Bin 80536 -> 81092 bytes
 docs/zookeeperHierarchicalQuorums.pdf           | Bin 6654 -> 6654 bytes
 docs/zookeeperInternals.pdf                     | Bin 48810 -> 48810 bytes
 docs/zookeeperJMX.pdf                           | Bin 16475 -> 16475 bytes
 docs/zookeeperObservers.pdf                     | Bin 12871 -> 12871 bytes
 docs/zookeeperOver.pdf                          | Bin 302472 -> 302472 bytes
 docs/zookeeperProgrammers.pdf                   | Bin 134099 -> 134099 bytes
 docs/zookeeperQuotas.pdf                        | Bin 11184 -> 11184 bytes
 docs/zookeeperReconfig.pdf                      | Bin 0 -> 62192 bytes
 docs/zookeeperStarted.pdf                       | Bin 28073 -> 28073 bytes
 docs/zookeeperTutorial.html                     |  59 ++++++++++++++++---
 docs/zookeeperTutorial.pdf                      | Bin 30478 -> 34212 bytes
 .../content/xdocs/zookeeperTutorial.xml         |  53 ++++++++++++++---
 23 files changed, 137 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/bookkeeperConfig.pdf
----------------------------------------------------------------------
diff --git a/docs/bookkeeperConfig.pdf b/docs/bookkeeperConfig.pdf
index 319148f..e8eb350 100644
Binary files a/docs/bookkeeperConfig.pdf and b/docs/bookkeeperConfig.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/bookkeeperOverview.pdf
----------------------------------------------------------------------
diff --git a/docs/bookkeeperOverview.pdf b/docs/bookkeeperOverview.pdf
index 75889c5..0b80fc8 100644
Binary files a/docs/bookkeeperOverview.pdf and b/docs/bookkeeperOverview.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/bookkeeperProgrammer.pdf
----------------------------------------------------------------------
diff --git a/docs/bookkeeperProgrammer.pdf b/docs/bookkeeperProgrammer.pdf
index 2bac529..516c44a 100644
Binary files a/docs/bookkeeperProgrammer.pdf and b/docs/bookkeeperProgrammer.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/bookkeeperStarted.pdf
----------------------------------------------------------------------
diff --git a/docs/bookkeeperStarted.pdf b/docs/bookkeeperStarted.pdf
index d10e58d..546e71e 100644
Binary files a/docs/bookkeeperStarted.pdf and b/docs/bookkeeperStarted.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/bookkeeperStream.pdf
----------------------------------------------------------------------
diff --git a/docs/bookkeeperStream.pdf b/docs/bookkeeperStream.pdf
index cd201f3..6939a99 100644
Binary files a/docs/bookkeeperStream.pdf and b/docs/bookkeeperStream.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/index.pdf
----------------------------------------------------------------------
diff --git a/docs/index.pdf b/docs/index.pdf
index 17b474c..78db924 100644
Binary files a/docs/index.pdf and b/docs/index.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/javaExample.pdf
----------------------------------------------------------------------
diff --git a/docs/javaExample.pdf b/docs/javaExample.pdf
index f7100e3..e5d45a4 100644
Binary files a/docs/javaExample.pdf and b/docs/javaExample.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/linkmap.pdf
----------------------------------------------------------------------
diff --git a/docs/linkmap.pdf b/docs/linkmap.pdf
index 865510e..5c8c5fb 100644
Binary files a/docs/linkmap.pdf and b/docs/linkmap.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/recipes.pdf
----------------------------------------------------------------------
diff --git a/docs/recipes.pdf b/docs/recipes.pdf
index b062473..350e677 100644
Binary files a/docs/recipes.pdf and b/docs/recipes.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperAdmin.html
----------------------------------------------------------------------
diff --git a/docs/zookeeperAdmin.html b/docs/zookeeperAdmin.html
index f074a35..8171503 100644
--- a/docs/zookeeperAdmin.html
+++ b/docs/zookeeperAdmin.html
@@ -1145,11 +1145,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>
 
           
@@ -1446,6 +1450,25 @@ server.3=zoo3:2888:3888</pre>
               </pre>
 </dd>
 
+          
+<dt>
+<term>ipReachableTimeout</term>
+</dt>
+<dd>
+<p>(Java system property: <strong>zookeeper.ipReachableTimeout</strong>)</p>
+<p>
+<strong>New in 3.4.11:</strong>
+                Set this timeout value for IP addresses reachable checking when hostname
is resolved, as mesured in
+                milliseconds.
+                By default, ZooKeeper will use the first IP address of the hostname(without
any reachable checking).
+                When zookeeper.ipReachableTimeout is set(larger than 0), ZooKeeper will will
try to pick up the first 
+                IP address which is reachable. This is done by calling Java API InetAddress.isReachable(long
timeout)
+                function, in which this timeout value is used. If none of such reachable
IP address can be found, the
+                first IP address of the hostname will be used anyway.
+              </p>
+</dd>
+
+          
 <dt>
 <term>tcpKeepAlive</term>
 </dt>
@@ -1453,15 +1476,20 @@ server.3=zoo3:2888:3888</pre>
 <p>(Java system property: <strong>zookeeper.tcpKeepAlive</strong>)</p>
 <p>
 <strong>New in 3.4.11:</strong>
-              Sets the 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 terminate them. Some NATs and firewalls
may
-              terminate or lose state for long running or idle connections. </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>
+                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>
 <a name="sc_authOptions"></a>
@@ -2045,7 +2073,7 @@ imok
 
         
 <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/0975d211/docs/zookeeperAdmin.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperAdmin.pdf b/docs/zookeeperAdmin.pdf
index 4d1ebaf..9c314b6 100644
Binary files a/docs/zookeeperAdmin.pdf and b/docs/zookeeperAdmin.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperHierarchicalQuorums.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperHierarchicalQuorums.pdf b/docs/zookeeperHierarchicalQuorums.pdf
index 86c4e78..4e1214f 100644
Binary files a/docs/zookeeperHierarchicalQuorums.pdf and b/docs/zookeeperHierarchicalQuorums.pdf
differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperInternals.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperInternals.pdf b/docs/zookeeperInternals.pdf
index f0b697b..f33b0b3 100644
Binary files a/docs/zookeeperInternals.pdf and b/docs/zookeeperInternals.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperJMX.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperJMX.pdf b/docs/zookeeperJMX.pdf
index 3d8ca22..a713485 100644
Binary files a/docs/zookeeperJMX.pdf and b/docs/zookeeperJMX.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperObservers.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperObservers.pdf b/docs/zookeeperObservers.pdf
index 5f270e3..d85af6a 100644
Binary files a/docs/zookeeperObservers.pdf and b/docs/zookeeperObservers.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperOver.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperOver.pdf b/docs/zookeeperOver.pdf
index 7bfe8cf..0a9d86a 100644
Binary files a/docs/zookeeperOver.pdf and b/docs/zookeeperOver.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperProgrammers.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperProgrammers.pdf b/docs/zookeeperProgrammers.pdf
index d52ec89..78aac51 100644
Binary files a/docs/zookeeperProgrammers.pdf and b/docs/zookeeperProgrammers.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperQuotas.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperQuotas.pdf b/docs/zookeeperQuotas.pdf
index 03fe2aa..fcee913 100644
Binary files a/docs/zookeeperQuotas.pdf and b/docs/zookeeperQuotas.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperReconfig.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperReconfig.pdf b/docs/zookeeperReconfig.pdf
new file mode 100644
index 0000000..fbf2237
Binary files /dev/null and b/docs/zookeeperReconfig.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperStarted.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperStarted.pdf b/docs/zookeeperStarted.pdf
index 602ea59..b11d0cc 100644
Binary files a/docs/zookeeperStarted.pdf and b/docs/zookeeperStarted.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/docs/zookeeperTutorial.html
----------------------------------------------------------------------
diff --git a/docs/zookeeperTutorial.html b/docs/zookeeperTutorial.html
index 6b83b9d..e9c0646 100644
--- a/docs/zookeeperTutorial.html
+++ b/docs/zookeeperTutorial.html
@@ -216,7 +216,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>
@@ -546,9 +557,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">
@@ -765,15 +804,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/0975d211/docs/zookeeperTutorial.pdf
----------------------------------------------------------------------
diff --git a/docs/zookeeperTutorial.pdf b/docs/zookeeperTutorial.pdf
index 667d11b..22450cf 100644
Binary files a/docs/zookeeperTutorial.pdf and b/docs/zookeeperTutorial.pdf differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/0975d211/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 10b3606..77cca8f 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