svn commit: r919706 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c
Author: mahadev Date: Sat Mar 6 05:33:29 2010 New Revision: 919706 URL: http://svn.apache.org/viewvc?rev=919706view=rev Log: ZOOKEEPER-622. Test for pending watches in send_set_watches should be moved (ben and steven via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/c/src/zookeeper.c Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919706r1=919705r2=919706view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Sat Mar 6 05:33:29 2010 @@ -243,6 +243,9 @@ ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev) ZOOKEEPER-681. Minor doc issue re unset maxClientCnxns (phunt via mahadev) + + ZOOKEEPER-622. Test for pending watches in send_set_watches should be moved + (ben and steven via mahadev) IMPROVEMENTS: ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=919706r1=919705r2=919706view=diff == --- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Sat Mar 6 05:33:29 2010 @@ -1189,17 +1189,22 @@ struct SetWatches req; int rc; +req.relativeZxid = zh-last_zxid; +req.dataWatches.data = collect_keys(zh-active_node_watchers, req.dataWatches.count); +req.existWatches.data = collect_keys(zh-active_exist_watchers, req.existWatches.count); +req.childWatches.data = collect_keys(zh-active_child_watchers, req.childWatches.count); + // return if there are no pending watches if (!req.dataWatches.count !req.existWatches.count !req.childWatches.count) { +free_key_list(req.dataWatches.data, req.dataWatches.count); +free_key_list(req.existWatches.data, req.existWatches.count); +free_key_list(req.childWatches.data, req.childWatches.count); return ZOK; } + oa = create_buffer_oarchive(); -req.relativeZxid = zh-last_zxid; -req.dataWatches.data = collect_keys(zh-active_node_watchers, req.dataWatches.count); -req.existWatches.data = collect_keys(zh-active_exist_watchers, req.existWatches.count); -req.childWatches.data = collect_keys(zh-active_child_watchers, req.childWatches.count); rc = serialize_RequestHeader(oa, header, h); rc = rc 0 ? rc : serialize_SetWatches(oa, req, req); /* add this buffer to the head of the send queue */
svn commit: r920616 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml
Author: mahadev Date: Tue Mar 9 01:50:39 2010 New Revision: 920616 URL: http://svn.apache.org/viewvc?rev=920616view=rev Log: ZOOKEEPER-689. release build broken - ivysettings.xml not copied during package (phunt via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/build.xml Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=920616r1=920615r2=920616view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Tue Mar 9 01:50:39 2010 @@ -246,7 +246,10 @@ BUGFIXES: ZOOKEEPER-622. Test for pending watches in send_set_watches should be moved (ben and steven via mahadev) - + + ZOOKEEPER-689. release build broken - ivysettings.xml not copied during + package (phunt via mahadev) + IMPROVEMENTS: ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to socket reuse and failure to close client (phunt via mahadev) Modified: hadoop/zookeeper/trunk/build.xml URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=920616r1=920615r2=920616view=diff == --- hadoop/zookeeper/trunk/build.xml (original) +++ hadoop/zookeeper/trunk/build.xml Tue Mar 9 01:50:39 2010 @@ -621,6 +621,7 @@ /fileset fileset file=build.xml/ fileset file=ivy.xml/ +fileset file=ivysettings.xml/ /copy copy todir=${dist.dir}/src includeEmptyDirs=true
svn commit: r922377 - in /hadoop/zookeeper/trunk: ./ src/docs/src/documentation/content/xdocs/ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/tes
Author: mahadev Date: Fri Mar 12 18:26:45 2010 New Revision: 922377 URL: http://svn.apache.org/viewvc?rev=922377view=rev Log: ZOOKEEPER-601. allow configuration of session timeout min/max bounds (phunt via mahadev) Added: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerBean.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMXBean.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LearnerZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LocalPeerBean.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LocalPeerMXBean.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ObserverZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FourLetterWordsQuorumTest.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FourLetterWordsTest.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=922377r1=922376r2=922377view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar 12 18:26:45 2010 @@ -355,6 +355,9 @@ IMPROVEMENTS: ZOOKEEPER-692. upgrade junit to latest version (4.8.1) (phunt via mahadev) + ZOOKEEPER-601. allow configuration of session timeout min/max bounds (phunt + via mahadev) + NEW FEATURES: ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml?rev=922377r1=922376r2=922377view=diff == --- hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml (original) +++ hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml Fri Mar 12 18:26:45 2010 @@ -162,7 +162,7 @@ paraCreate a configuration file. This file can be called anything. Use the following settings as a starting point:/para - paracomputeroutput + programlisting tickTime=2000 dataDir=/var/zookeeper/ clientPort=2181 @@ -170,7 +170,7 @@ initLimit=5 syncLimit=2 server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 -server.3=zoo3:2888:3888/computeroutput/para +server.3=zoo3:2888:3888/programlisting paraYou can find the meanings of these and other configuration settings in the section xref linkend=sc_configuration /. A word @@ -185,7 +185,9 @@ server.3=zoo3:2888:3888/computeroutput server id to each machine by creating a file named filenamemyid/filename, one for each server, which resides in that server's data directory, as specified by the configuration file - parameter emphasis role=bolddataDir/emphasis. The myid file + parameter emphasis role=bolddataDir/emphasis./para/listitem + + listitemparaThe myid file consists of a single line containing only the text of that machine's id. So filenamemyid/filename of server 1 would contain the text 1 and nothing else. The id must be unique within the @@ -738,7 +740,7 @@ server.3=zoo3:2888:3888/computeroutput termclientPortBindAddress/term listitem - paraemphasis role=boldNew in 3.3:/emphasis the + paraemphasis role=boldNew in 3.3.0:/emphasis the address (ipv4, ipv6 or hostname) to listen
svn commit: r941521 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/recipes.html docs/recipes.pdf src/docs/src/documentation/content/xdocs/recipes.xml
Author: mahadev Date: Wed May 5 22:41:14 2010 New Revision: 941521 URL: http://svn.apache.org/viewvc?rev=941521view=rev Log: ZOOKEEPER-766. forrest recipes docs don't mention the lock/queue recipe implementations available in the release (phunt via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/docs/recipes.html hadoop/zookeeper/trunk/docs/recipes.pdf hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/recipes.xml Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=941521r1=941520r2=941521view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Wed May 5 22:41:14 2010 @@ -56,6 +56,9 @@ IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) + ZOOKEEPER-766. forrest recipes docs don't mention the lock/queue recipe + implementations available in the release (phunt via mahadev) + NEW FEATURES: ZOOKEEPER-729. Java client API to recursively delete a subtree. (Kay Kay via henry) Modified: hadoop/zookeeper/trunk/docs/recipes.html URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/recipes.html?rev=941521r1=941520r2=941521view=diff == --- hadoop/zookeeper/trunk/docs/recipes.html (original) +++ hadoop/zookeeper/trunk/docs/recipes.html Wed May 5 22:41:14 2010 @@ -517,7 +517,18 @@ document.write(Last Published: + docu the list obtained from the first stronggetChildren( )/strong call. If there are are no children in the queue node, the reader waits for a watch notification to check the queue again./p -a name=N10138/aa name=sc_recipes_priorityQueues/a +div class=note +div class=labelNote/div +div class=content + +pThere now exists a Queue implementation in ZooKeeper + recipes directory. This is distributed with the release -- + src/recipes/queue directory of the release artifact. + /p + +/div +/div +a name=N1013E/aa name=sc_recipes_priorityQueues/a h4Priority Queues/h4 pTo implement a priority queue, you need only make two simple changes to the generic a href=#sc_recipes_Queuesqueue @@ -527,12 +538,23 @@ document.write(Last Published: + docu from the queue, a client uses an up-to-date children list meaning that the client will invalidate previously obtained children lists if a watch notification triggers for the queue node./p -a name=N10147/aa name=sc_recipes_Locks/a +a name=N1014D/aa name=sc_recipes_Locks/a h3 class=h4Locks/h3 pFully distributed locks that are globally synchronous, meaning at any snapshot in time no two clients think they hold the same lock. These can be implemented using ZooKeeeper. As with priority queues, first define a lock node./p +div class=note +div class=labelNote/div +div class=content + +pThere now exists a Lock implementation in ZooKeeper + recipes directory. This is distributed with the release -- + src/recipes/lock directory of the release artifact. + /p + +/div +/div pClients wishing to obtain a lock do the following:/p ol @@ -615,7 +637,7 @@ document.write(Last Published: + docu /li /ul -a name=N101B3/aa name=Shared+Locks/a +a name=N101BF/aa name=Shared+Locks/a h4Shared Locks/h4 pYou can implement shared locks by with a few changes to the lock protocol:/p @@ -777,7 +799,7 @@ document.write(Last Published: + docu /div /div -a name=N1027F/aa name=sc_recoverableSharedLocks/a +a name=N1028B/aa name=sc_recoverableSharedLocks/a h4Recoverable Shared Locks/h4 pWith minor modifications to the Shared Lock protocol, you make shared locks revocable by modifying the shared lock protocol:/p @@ -799,7 +821,7 @@ document.write(Last Published: + docu Laser Beams/em by stipulating in your protocol that the revoker is allowed to delete the lock node if after some length of time the lock isn't deleted by the lock holder./p -a name=N102AB/aa name=sc_recipes_twoPhasedCommit/a +a name=N102B7/aa name=sc_recipes_twoPhasedCommit/a h3 class=h4Two-phased Commit/h3 pA two-phase commit protocol is an algorithm that lets all clients in a distributed system agree either to commit a transaction or abort./p @@ -831,7 +853,7 @@ document.write(Last Published: + docu pTo address the second problem, you can have the coordinator propagate the transaction to the sites, and have each site creating its own ephemeral node./p -a name=N102C4/aa name=sc_leaderElection/a +a name=N102D0/aa name=sc_leaderElection/a h3 class=h4Leader Election/h3 pA simple way of doing leader election with ZooKeeper is to use the strongSEQUENCE|EPHEMERAL/strong flags when creating Modified: hadoop/zookeeper/trunk/docs/recipes.pdf URL: http
svn commit: r941525 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt docs/recipes.html docs/recipes.pdf src/docs/src/documentation/content/xdocs/recipes.xml
Author: mahadev Date: Wed May 5 22:49:45 2010 New Revision: 941525 URL: http://svn.apache.org/viewvc?rev=941525view=rev Log: ZOOKEEPER-766. forrest recipes docs don't mention the lock/queue recipe implementations available in the release (phunt via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/docs/recipes.html hadoop/zookeeper/branches/branch-3.3/docs/recipes.pdf hadoop/zookeeper/branches/branch-3.3/src/docs/src/documentation/content/xdocs/recipes.xml Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=941525r1=941524r2=941525view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Wed May 5 22:49:45 2010 @@ -44,6 +44,8 @@ BUGFIXES: ZOOKEEPER-764. Observer elected leader due to inconsistent voting view (henry via mahadev) + ZOOKEEPER-766. forrest recipes docs don't mention the lock/queue recipe + implementations available in the release (phunt via mahadev) Release 3.3.0 - 2010-03-24 Non-backward compatible changes: Modified: hadoop/zookeeper/branches/branch-3.3/docs/recipes.html URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/docs/recipes.html?rev=941525r1=941524r2=941525view=diff == --- hadoop/zookeeper/branches/branch-3.3/docs/recipes.html (original) +++ hadoop/zookeeper/branches/branch-3.3/docs/recipes.html Wed May 5 22:49:45 2010 @@ -517,7 +517,18 @@ document.write(Last Published: + docu the list obtained from the first stronggetChildren( )/strong call. If there are are no children in the queue node, the reader waits for a watch notification to check the queue again./p -a name=N10138/aa name=sc_recipes_priorityQueues/a +div class=note +div class=labelNote/div +div class=content + +pThere now exists a Queue implementation in ZooKeeper + recipes directory. This is distributed with the release -- + src/recipes/queue directory of the release artifact. + /p + +/div +/div +a name=N1013E/aa name=sc_recipes_priorityQueues/a h4Priority Queues/h4 pTo implement a priority queue, you need only make two simple changes to the generic a href=#sc_recipes_Queuesqueue @@ -527,12 +538,23 @@ document.write(Last Published: + docu from the queue, a client uses an up-to-date children list meaning that the client will invalidate previously obtained children lists if a watch notification triggers for the queue node./p -a name=N10147/aa name=sc_recipes_Locks/a +a name=N1014D/aa name=sc_recipes_Locks/a h3 class=h4Locks/h3 pFully distributed locks that are globally synchronous, meaning at any snapshot in time no two clients think they hold the same lock. These can be implemented using ZooKeeeper. As with priority queues, first define a lock node./p +div class=note +div class=labelNote/div +div class=content + +pThere now exists a Lock implementation in ZooKeeper + recipes directory. This is distributed with the release -- + src/recipes/lock directory of the release artifact. + /p + +/div +/div pClients wishing to obtain a lock do the following:/p ol @@ -615,7 +637,7 @@ document.write(Last Published: + docu /li /ul -a name=N101B3/aa name=Shared+Locks/a +a name=N101BF/aa name=Shared+Locks/a h4Shared Locks/h4 pYou can implement shared locks by with a few changes to the lock protocol:/p @@ -777,7 +799,7 @@ document.write(Last Published: + docu /div /div -a name=N1027F/aa name=sc_recoverableSharedLocks/a +a name=N1028B/aa name=sc_recoverableSharedLocks/a h4Recoverable Shared Locks/h4 pWith minor modifications to the Shared Lock protocol, you make shared locks revocable by modifying the shared lock protocol:/p @@ -799,7 +821,7 @@ document.write(Last Published: + docu Laser Beams/em by stipulating in your protocol that the revoker is allowed to delete the lock node if after some length of time the lock isn't deleted by the lock holder./p -a name=N102AB/aa name=sc_recipes_twoPhasedCommit/a +a name=N102B7/aa name=sc_recipes_twoPhasedCommit/a h3 class=h4Two-phased Commit/h3 pA two-phase commit protocol is an algorithm that lets all clients in a distributed system agree either to commit a transaction or abort./p @@ -831,7 +853,7 @@ document.write(Last Published: + docu pTo address the second problem, you can have the coordinator propagate the transaction to the sites, and have each site creating its own ephemeral node./p -a name=N102C4/aa name=sc_leaderElection/a +a name=N102D0/aa name=sc_leaderElection/a h3 class=h4Leader Election/h3 pA simple way of doing leader election with ZooKeeper is to use
svn commit: r979474 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/java/main/org/apache/zookeeper/server/ZKDatabase.java
Author: mahadev Date: Mon Jul 26 22:27:11 2010 New Revision: 979474 URL: http://svn.apache.org/viewvc?rev=979474view=rev Log: ZOOKEEPER-783. committedLog in ZKDatabase is not properly synchronized (henry via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/ZKDatabase.java Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=979474r1=979473r2=979474view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Mon Jul 26 22:27:11 2010 @@ -3,6 +3,8 @@ Branch 3.3 Backward compatible changes: BUGFIXES: + ZOOKEEPER-783. committedLog in ZKDatabase is not properly synchronized + (henry via mahadev) IMPROVEMENTS: Modified: hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/ZKDatabase.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/ZKDatabase.java?rev=979474r1=979473r2=979474view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/ZKDatabase.java (original) +++ hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/ZKDatabase.java Mon Jul 26 22:27:11 2010 @@ -104,7 +104,9 @@ public class ZKDatabase { */ dataTree = new DataTree(); sessionsWithTimeouts.clear(); -committedLog.clear(); +synchronized (committedLog) { +committedLog.clear(); +} initialized = false; } @@ -136,7 +138,9 @@ public class ZKDatabase { } public LinkedListProposal getCommittedLog() { -return this.committedLog; +synchronized (this.committedLog) { +return new LinkedListProposal(this.committedLog); +} } /**
svn commit: r979480 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/ZKDatabase.java
Author: mahadev Date: Mon Jul 26 22:44:12 2010 New Revision: 979480 URL: http://svn.apache.org/viewvc?rev=979480view=rev Log: ZOOKEEPER-783. committedLog in ZKDatabase is not properly synchronized (henry via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZKDatabase.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=979480r1=979479r2=979480view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jul 26 22:44:12 2010 @@ -69,6 +69,9 @@ BUGFIXES: ZOOKEEPER-814. monitoring scripts are missing apache license headers (andrei savu via mahadev) + ZOOKEEPER-783. committedLog in ZKDatabase is not properly synchronized + (henry via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZKDatabase.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZKDatabase.java?rev=979480r1=979479r2=979480view=diff == --- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZKDatabase.java (original) +++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZKDatabase.java Mon Jul 26 22:44:12 2010 @@ -104,7 +104,9 @@ public class ZKDatabase { */ dataTree = new DataTree(); sessionsWithTimeouts.clear(); -committedLog.clear(); +synchronized (committedLog) { +committedLog.clear(); +} initialized = false; } @@ -136,7 +138,9 @@ public class ZKDatabase { } public LinkedListProposal getCommittedLog() { -return this.committedLog; +synchronized (this.committedLog) { +return new LinkedListProposal(this.committedLog); +} } /**
svn commit: r979742 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkpython/src/examples/ src/contrib/zkpython/src/examples/README src/contrib/zkpython/src/examples/watch_znode_for_changes.py
Author: mahadev Date: Tue Jul 27 15:11:04 2010 New Revision: 979742 URL: http://svn.apache.org/viewvc?rev=979742view=rev Log: ZOOKEEPER-765. Add python example script (Travis and Andrei via mahadev) Added: hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/ hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/README hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/watch_znode_for_changes.py Modified: hadoop/zookeeper/trunk/CHANGES.txt Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=979742r1=979741r2=979742view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Tue Jul 27 15:11:04 2010 @@ -97,6 +97,8 @@ IMPROVEMENTS: ZOOKEEPER-821. Add ZooKeeper version information to zkpython (Rich Schumacher via mahadev) + ZOOKEEPER-765. Add python example script (Travis and Andrei via mahadev) + NEW FEATURES: ZOOKEEPER-729. Java client API to recursively delete a subtree. (Kay Kay via henry) Added: hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/README URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/README?rev=979742view=auto == --- hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/README (added) +++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/README Tue Jul 27 15:11:04 2010 @@ -0,0 +1,8 @@ + +This folder contains sample showing how you can use ZooKeeper from Python. + +You should also check the following projects: + +* http://github.com/phunt/zk-smoketest +* http://github.com/henryr/pyzk-recipes + Added: hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/watch_znode_for_changes.py URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/watch_znode_for_changes.py?rev=979742view=auto == --- hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/watch_znode_for_changes.py (added) +++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/examples/watch_znode_for_changes.py Tue Jul 27 15:11:04 2010 @@ -0,0 +1,202 @@ +#!/usr/bin/env python2.6 +# 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. + ZNode Change Watcher Skeleton Script + +This script shows you how to write a python program that watches a specific +znode for changes and reacts to them. + +Steps to understand how this script works: + +1. start a standalone ZooKeeper server (by default it listens on localhost:2181) + +Did you know you can deploy local clusters by using zkconf[1]? +[1] http://github.com/phunt/zkconf + +2. enter the command line console + +3. create the test node: +[zk: (CONNECTED) 1] create /watch-test dummy-data +Created /watch-test + +4. in another shell start this script in verbose mode +$ python watch_znode_for_changes.py -v + +# you should see a lot of log messages. have a look over them because +# you can easily understand how zookeeper works + +5. update the node data: + +[zk: (CONNECTED) 2] set /watch-test new-data +cZxid = 0xa001a +ctime = Fri Jul 09 19:14:45 EEST 2010 +mZxid = 0xa001e +mtime = Fri Jul 09 19:18:18 EEST 2010 +pZxid = 0xa001a +cversion = 0 +dataVersion = 1 +aclVersion = 0 +ephemeralOwner = 0x0 +dataLength = 8 +numChildren = 0 + +... and you should see similar log messages: + +2010-07-09 19:18:18,537:11542(0xb6ea5b70):zoo_de...@process_completions@1765: Calling a watcher for node [/watch-test], type = -1 event=ZOO_CHANGED_EVENT +2010-07-09 19:18:18,537 watch_znode_for_changes.py:83 - Running watcher: zh=0 event=3 state=3 path=/watch-test +2010-07-09 19:18:18,537:11542(0xb6ea5b70):zoo_de...@zoo_awget@2400: Sending request xid=0x4c374b33 for path [/watch-test] to 127.0.0.1:2181 +2010-07-09 19:18:18,545:11542(0xb76a6b70):zoo_de...@zookeeper_process@1980: Queueing asynchronous response +2010-07-09 19:18:18,545:11542(0xb6ea5b70):zoo_de...@process_completions@1772: Calling
svn commit: r980576 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/
Author: mahadev Date: Thu Jul 29 21:10:36 2010 New Revision: 980576 URL: http://svn.apache.org/viewvc?rev=980576view=rev Log: ZOOKEEPER-790. Last processed zxid set prematurely while establishing leadership (flavio via mahadev) Added: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumUtil.java Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=980576r1=980575r2=980576view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jul 29 21:10:36 2010 @@ -72,6 +72,9 @@ BUGFIXES: ZOOKEEPER-783. committedLog in ZKDatabase is not properly synchronized (henry via mahadev) + ZOOKEEPER-790. Last processed zxid set prematurely while establishing + leadership (flavio via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=980576r1=980575r2=980576view=diff == --- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java (original) +++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java Thu Jul 29 21:10:36 2010 @@ -163,6 +163,7 @@ public class NIOServerCnxn implements Wa public void startup(ZooKeeperServer zks) throws IOException, InterruptedException { start(); +zks.startdata(); zks.startup(); setZooKeeperServer(zks); } Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java?rev=980576r1=980575r2=980576view=diff == --- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java (original) +++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java Thu Jul 29 21:10:36 2010 @@ -357,14 +357,18 @@ public class ZooKeeperServer implements } } -public void startup() throws IOException, InterruptedException { +public void startdata() +throws IOException, InterruptedException { //check to see if zkDb is not null if (zkDb == null) { zkDb = new ZKDatabase(this.txnLogFactory); -} +} if (!zkDb.isInitialized()) { loadData(); } +} + +public void startup() { createSessionTracker(); setupRequestProcessors(); Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java?rev=980576r1=980575r2=980576view=diff == --- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java (original) +++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java Thu Jul 29 21:10:36 2010 @@ -327,12 +327,6 @@ public class Leader { self.tick++; } -if(LOG.isInfoEnabled()){ -LOG.info(Have quorum of supporters; starting up and setting last processed zxid: + zk.getZxid()); -} -zk.startup(); -zk.getZKDatabase().setlastProcessedZxid(zk.getZxid()); - if (!System.getProperty(zookeeper.leaderServes, yes).equals(no)) { self.cnxnFactory.setZooKeeperServer(zk); } @@ -499,6 +493,11 @@ public class Leader { return; } else { lastCommitted = zxid; +if(LOG.isInfoEnabled()){ +LOG.info(Have quorum of supporters; starting up and setting last processed zxid: + zk.getZxid()); +} +zk.startup(); +zk.getZKDatabase().setlastProcessedZxid
svn commit: r982485 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ClientCnxn.java src/java/test/org/apache/zookeeper/test/SessionTest.java
Author: mahadev Date: Thu Aug 5 07:09:02 2010 New Revision: 982485 URL: http://svn.apache.org/viewvc?rev=982485view=rev Log: ZOOKEEPER-795. eventThread isn't shutdown after a connection session expired event coming (Sergey Doroshenko and Ben via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=982485r1=982484r2=982485view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Aug 5 07:09:02 2010 @@ -75,6 +75,9 @@ BUGFIXES: ZOOKEEPER-790. Last processed zxid set prematurely while establishing leadership (flavio via mahadev) + ZOOKEEPER-795. eventThread isn't shutdown after a connection + session expired event coming (Sergey Doroshenko and Ben via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java?rev=982485r1=982484r2=982485view=diff == --- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java (original) +++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java Thu Aug 5 07:09:02 2010 @@ -430,6 +430,17 @@ public class ClientCnxn { } } +/** + * Guard against creating -EventThread-EventThread-EventThread-... thread + * names when ZooKeeper object is being created from within a watcher. + * See ZOOKEEPER-795 for details. + */ +private static String makeThreadName(String suffix) { +String name = Thread.currentThread().getName(). +replaceAll(-EventThread, ); +return name + suffix; +} + class EventThread extends Thread { private final LinkedBlockingQueueObject waitingEvents = new LinkedBlockingQueueObject(); @@ -441,7 +452,7 @@ public class ClientCnxn { private volatile KeeperState sessionState = KeeperState.Disconnected; EventThread() { -super(currentThread().getName() + -EventThread); +super(makeThreadName(-EventThread)); setUncaughtExceptionHandler(uncaughtExceptionHandler); setDaemon(true); } @@ -689,6 +700,7 @@ public class ClientCnxn { eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.Expired, null)); +eventThread.queueEventOfDeath(); throw new SessionExpiredException( Unable to reconnect to ZooKeeper service, session 0x + Long.toHexString(sessionId) + has expired); @@ -898,7 +910,7 @@ public class ClientCnxn { } SendThread() { -super(currentThread().getName() + -SendThread()); +super(makeThreadName(-SendThread())); zooKeeper.state = States.CONNECTING; setUncaughtExceptionHandler(uncaughtExceptionHandler); setDaemon(true); Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java?rev=982485r1=982484r2=982485view=diff == --- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java (original) +++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java Thu Aug 5 07:09:02 2010 @@ -23,7 +23,9 @@ import static org.apache.zookeeper.test. import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; +import java.util.ArrayList; import java.util.LinkedList; +import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -194,18 +196,55 @@ public class SessionTest extends ZKTestC zk.close(); } +private ListThread findThreads(String name) { +int threadCount = Thread.activeCount(); +Thread threads[] = new Thread[threadCount*2]; +threadCount = Thread.enumerate(threads); +ArrayListThread list = new ArrayListThread(); +for(int i = 0; i threadCount; i++) { +if (threads[i].getName().indexOf(name) != -1) { +list.add(threads[i]); +} +} +return list; +} + /** * Make sure ephemerals get cleaned up
svn commit: r984518 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/contrib/zkpython/src/c/zookeeper.c src/contrib/zkpython/src/test/get_set_test.py
Author: mahadev Date: Wed Aug 11 18:30:23 2010 New Revision: 984518 URL: http://svn.apache.org/viewvc?rev=984518view=rev Log: ZOOKEEPER-772. zkpython segfaults when watcher from async get children is invoked. (henry robinson via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/test/get_set_test.py Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=984518r1=984517r2=984518view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Wed Aug 11 18:30:23 2010 @@ -9,6 +9,9 @@ BUGFIXES: ZOOKEEPER-790. Last processed zxid set prematurely while establishing leadership (flavio via mahadev) + ZOOKEEPER-772. zkpython segfaults when watcher from async get children + is invoked. (henry robinson via mahadev) + IMPROVEMENTS: ZOOKEEPER-789. Improve FLE log messages (flavio via phunt) Modified: hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c?rev=984518r1=984517r2=984518view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c (original) +++ hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c Wed Aug 11 18:30:23 2010 @@ -842,7 +842,7 @@ PyObject *pyzoo_aget_children(PyObject * int err = zoo_awget_children( zhandles[zkhid], path, get_watch != Py_None ? watcher_dispatch : NULL, -pyw, +get_pyw, strings_completion_dispatch, pyw); if (err != ZOK) { Modified: hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/test/get_set_test.py URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/test/get_set_test.py?rev=984518r1=984517r2=984518view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/test/get_set_test.py (original) +++ hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/test/get_set_test.py Wed Aug 11 18:30:23 2010 @@ -155,5 +155,34 @@ class GetSetTest(zktestbase.TestBase): self.assertEqual(len(self.children), 1, Expected to find 1 child, got + str(len(self.children))) +def test_async_getchildren_with_watcher(self): +self.ensureCreated(/zk-python-getchildrentest, flags=0) +self.ensureCreated(/zk-python-getchildrentest/child) + +watched = [] + +def watcher(*args): +self.cv.acquire() +watched.append(args) +self.cv.notify() +self.cv.release() + +def children_callback(*args): +self.cv.acquire() +self.cv.notify() +self.cv.release() + +zookeeper.aget_children( +self.handle, /zk-python-getchildrentest, watcher, children_callback) + +self.cv.acquire() +self.cv.wait() +self.cv.release() + +self.cv.acquire() +self.ensureCreated(/zk-python-getchildrentest/child2) +self.cv.wait(15) +self.assertTrue(watched) + if __name__ == '__main__': unittest.main()
svn commit: r1004844 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c
Author: mahadev Date: Tue Oct 5 22:45:46 2010 New Revision: 1004844 URL: http://svn.apache.org/viewvc?rev=1004844view=rev Log: ZOOKEEPER-804. c unit tests failing due to assertion cptr failed (michi mutsuzaki via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/c/src/zookeeper.c Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=1004844r1=1004843r2=1004844view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Tue Oct 5 22:45:46 2010 @@ -100,6 +100,9 @@ BUGFIXES: ZOOKEEPER-846. zookeeper client doesn't shut down cleanly on the close call (phunt) + + ZOOKEEPER-804. c unit tests failing due to assertion cptr failed (michi + mutsuzaki via mahadev) IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=1004844r1=1004843r2=1004844view=diff == --- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Tue Oct 5 22:45:46 2010 @@ -1949,6 +1949,15 @@ int zookeeper_process(zhandle_t *zh, int int rc = hdr.err; /* Find the request corresponding to the response */ completion_list_t *cptr = dequeue_completion(zh-sent_requests); + +/* [ZOOKEEPER-804] Don't assert if zookeeper_close has been called. */ +if (zh-close_requested == 1) { +if (cptr) { +destroy_completion_entry(cptr); +cptr = NULL; +} +return ZINVALIDSTATE; +} assert(cptr); /* The requests are going to come back in order */ if (cptr-xid != hdr.xid) {
svn commit: r1004845 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/c/src/zookeeper.c
Author: mahadev Date: Tue Oct 5 22:47:36 2010 New Revision: 1004845 URL: http://svn.apache.org/viewvc?rev=1004845view=rev Log: ZOOKEEPER-804. c unit tests failing due to assertion cptr failed (michi mutsuzaki via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1004845r1=1004844r2=1004845view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Tue Oct 5 22:47:36 2010 @@ -25,6 +25,9 @@ BUGFIXES: ZOOKEEPER-846. zookeeper client doesn't shut down cleanly on the close call (phunt) + + ZOOKEEPER-804. c unit tests failing due to assertion cptr failed (michi + mutsuzaki via mahadev) IMPROVEMENTS: Modified: hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c?rev=1004845r1=1004844r2=1004845view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Tue Oct 5 22:47:36 2010 @@ -1947,6 +1947,15 @@ int zookeeper_process(zhandle_t *zh, int int rc = hdr.err; /* Find the request corresponding to the response */ completion_list_t *cptr = dequeue_completion(zh-sent_requests); + +/* [ZOOKEEPER-804] Don't assert if zookeeper_close has been called. */ +if (zh-close_requested == 1) { +if (cptr) { +destroy_completion_entry(cptr); +cptr = NULL; +} +return ZINVALIDSTATE; +} assert(cptr); /* The requests are going to come back in order */ if (cptr-xid != hdr.xid) {
svn commit: r1026159 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c src/c/tests/TestClient.cc
Author: mahadev Date: Thu Oct 21 22:12:50 2010 New Revision: 1026159 URL: http://svn.apache.org/viewvc?rev=1026159view=rev Log: ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE (michi mutsuzaki via mahadev konar) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/c/src/zookeeper.c hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=1026159r1=1026158r2=1026159view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Oct 21 22:12:50 2010 @@ -134,6 +134,9 @@ BUGFIXES: ZOOKEEPER-794. Callbacks are not invoked when the client is closed (Alexis Midon via phunt) + ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in + ZOO_CLOSED_STATE (michi mutsuzaki via mahadev konar) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=1026159r1=1026158r2=1026159view=diff == --- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Thu Oct 21 22:12:50 2010 @@ -2934,6 +2934,12 @@ int zoo_add_auth(zhandle_t *zh,const cha if (is_unrecoverable(zh)) return ZINVALIDSTATE; +// [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if +// the connection is closed. +if (zoo_state(zh) == 0) { +return ZINVALIDSTATE; +} + if(cert!=NULL certLen!=0){ auth.buff=calloc(1,certLen); if(auth.buff==0) { Modified: hadoop/zookeeper/trunk/src/c/tests/TestClient.cc URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClient.cc?rev=1026159r1=1026158r2=1026159view=diff == --- hadoop/zookeeper/trunk/src/c/tests/TestClient.cc (original) +++ hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Thu Oct 21 22:12:50 2010 @@ -591,6 +591,15 @@ public: rc = zoo_set_acl(zk, /, -1, ZOO_OPEN_ACL_UNSAFE); CPPUNIT_ASSERT_EQUAL((int) ZOK, rc); + +// [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if +// the connection is closed. +zhandle_t *zk2 = zookeeper_init(hostPorts, NULL, 1, 0, NULL, 0); +sleep(1); +CPPUNIT_ASSERT_EQUAL((int) ZOK, zookeeper_close(zk2)); +CPPUNIT_ASSERT_EQUAL(0, zoo_state(zk2)); // 0 == ZOO_CLOSED_STATE +rc = zoo_add_auth(zk2, digest, pat:passwd, 10, voidCompletion, (void*)ZOK); +CPPUNIT_ASSERT_EQUAL((int) ZINVALIDSTATE, rc); } void testGetChildren2() {
svn commit: r1026172 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/c/src/zookeeper.c src/c/tests/TestClient.cc
Author: mahadev Date: Thu Oct 21 22:50:52 2010 New Revision: 1026172 URL: http://svn.apache.org/viewvc?rev=1026172view=rev Log: ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE (michi mutsuzaki via mahadev konar) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c hadoop/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1026172r1=1026171r2=1026172view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Thu Oct 21 22:50:52 2010 @@ -53,6 +53,9 @@ BUGFIXES: ZOOKEEPER-794. Callbacks are not invoked when the client is closed (Alexis Midon via phunt) + ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in + ZOO_CLOSED_STATE (Michi Mutsuzaki via mahadev konar) + IMPROVEMENTS: ZOOKEEPER-789. Improve FLE log messages (flavio via phunt) Modified: hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c?rev=1026172r1=1026171r2=1026172view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Thu Oct 21 22:50:52 2010 @@ -2932,6 +2932,12 @@ int zoo_add_auth(zhandle_t *zh,const cha if (is_unrecoverable(zh)) return ZINVALIDSTATE; +// [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if +// the connection is closed. +if (zoo_state(zh) == 0) { +return ZINVALIDSTATE; +} + if(cert!=NULL certLen!=0){ auth.buff=calloc(1,certLen); if(auth.buff==0) { Modified: hadoop/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc?rev=1026172r1=1026171r2=1026172view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc (original) +++ hadoop/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc Thu Oct 21 22:50:52 2010 @@ -591,6 +591,15 @@ public: rc = zoo_set_acl(zk, /, -1, ZOO_OPEN_ACL_UNSAFE); CPPUNIT_ASSERT_EQUAL((int) ZOK, rc); + +// [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if +// the connection is closed. +zhandle_t *zk2 = zookeeper_init(hostPorts, NULL, 1, 0, NULL, 0); +sleep(1); +CPPUNIT_ASSERT_EQUAL((int) ZOK, zookeeper_close(zk2)); +CPPUNIT_ASSERT_EQUAL(0, zoo_state(zk2)); // 0 == ZOO_CLOSED_STATE +rc = zoo_add_auth(zk2, digest, pat:passwd, 10, voidCompletion, (void*)ZOK); +CPPUNIT_ASSERT_EQUAL((int) ZINVALIDSTATE, rc); } void testGetChildren2() {
svn commit: r1027758 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java src/java/test/org/apache/zookeeper/test/AuthTest.java
Author: mahadev Date: Tue Oct 26 22:05:58 2010 New Revision: 1027758 URL: http://svn.apache.org/viewvc?rev=1027758view=rev Log: ZOOKEEPER-904. super digest is not actually acting as a full superuser (Camille Fournier via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java hadoop/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/AuthTest.java Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1027758r1=1027757r2=1027758view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Tue Oct 26 22:05:58 2010 @@ -56,6 +56,9 @@ BUGFIXES: ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE (Michi Mutsuzaki via mahadev konar) + ZOOKEEPER-904. super digest is not actually acting as a full superuser + (Camille Fournier via mahadev) + IMPROVEMENTS: ZOOKEEPER-789. Improve FLE log messages (flavio via phunt) Modified: hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=1027758r1=1027757r2=1027758view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java (original) +++ hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java Tue Oct 26 22:05:58 2010 @@ -167,6 +167,11 @@ public class PrepRequestProcessor extend if (acl == null || acl.size() == 0) { return; } +for (Id authId : ids) { +if (authId.getScheme().equals(super)) { +return; +} +} for (ACL a : acl) { Id id = a.getId(); if ((a.getPerms() perm) != 0) { @@ -177,10 +182,7 @@ public class PrepRequestProcessor extend AuthenticationProvider ap = ProviderRegistry.getProvider(id .getScheme()); if (ap != null) { -for (Id authId : ids) { -if (authId.getScheme().equals(super)) { -return; -} +for (Id authId : ids) { if (authId.getScheme().equals(id.getScheme()) ap.matches(authId.getId(), id.getId())) { return; Modified: hadoop/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/AuthTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/AuthTest.java?rev=1027758r1=1027757r2=1027758view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/AuthTest.java (original) +++ hadoop/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/AuthTest.java Tue Oct 26 22:05:58 2010 @@ -122,4 +122,28 @@ public class AuthTest extends ClientBase zk.close(); } } + +@Test +public void testSuperACL() throws Exception { +ZooKeeper zk = createClient(); + try { +zk.addAuthInfo(digest, pat:pass.getBytes()); + zk.create(/path1, null, Ids.CREATOR_ALL_ACL, + CreateMode.PERSISTENT); + zk.close(); + // verify super can do anything and ignores ACLs +zk = createClient(); + zk.addAuthInfo(digest, super:test.getBytes()); + zk.getData(/path1, false, null); + + zk.setACL(/path1, Ids.READ_ACL_UNSAFE, -1); + + zk.create(/path1/foo, null, Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT); + + zk.setACL(/path1, Ids.OPEN_ACL_UNSAFE, -1); + + } finally { + zk.close(); + } +} } \ No newline at end of file
svn commit: r1028373 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c
Author: mahadev Date: Thu Oct 28 16:19:52 2010 New Revision: 1028373 URL: http://svn.apache.org/viewvc?rev=1028373view=rev Log: ZOOKEEPER-897. C Client seg faults during close (jared cantwell via mahadev) Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/c/src/zookeeper.c Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=1028373r1=1028372r2=1028373view=diff == --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Oct 28 16:19:52 2010 @@ -140,6 +140,8 @@ BUGFIXES: ZOOKEEPER-904. super digest is not actually acting as a full superuser (Camille Fournier via mahadev) + ZOOKEEPER-897. C Client seg faults during close (jared cantwell via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=1028373r1=1028372r2=1028373view=diff == --- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Thu Oct 28 16:19:52 2010 @@ -2290,7 +2290,11 @@ int zookeeper_close(zhandle_t *zh) zh-close_requested=1; if (inc_ref_counter(zh,0)!=0) { -cleanup_bufs(zh, 1, ZCLOSING); + /* Signal any syncronous completions before joining the threads */ +enter_critical(zh); +free_completions(zh,1,ZCLOSING); +leave_critical(zh); + adaptor_finish(zh); return ZOK; }
svn commit: r1028375 - in /hadoop/zookeeper/branches/branch-3.3: CHANGES.txt src/c/src/zookeeper.c
Author: mahadev Date: Thu Oct 28 16:24:42 2010 New Revision: 1028375 URL: http://svn.apache.org/viewvc?rev=1028375view=rev Log: ZOOKEEPER-897. C Client seg faults during close (jared cantwell via mahadev) Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1028375r1=1028374r2=1028375view=diff == --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Thu Oct 28 16:24:42 2010 @@ -59,6 +59,8 @@ BUGFIXES: ZOOKEEPER-904. super digest is not actually acting as a full superuser (Camille Fournier via mahadev) + ZOOKEEPER-897. C Client seg faults during close (jared cantwell via mahadev) + IMPROVEMENTS: ZOOKEEPER-789. Improve FLE log messages (flavio via phunt) Modified: hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c?rev=1028375r1=1028374r2=1028375view=diff == --- hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Thu Oct 28 16:24:42 2010 @@ -2288,7 +2288,11 @@ int zookeeper_close(zhandle_t *zh) zh-close_requested=1; if (inc_ref_counter(zh,0)!=0) { -cleanup_bufs(zh, 1, ZCLOSING); + /* Signal any syncronous completions before joining the threads */ +enter_critical(zh); +free_completions(zh,1,ZCLOSING); +leave_critical(zh); + adaptor_finish(zh); return ZOK; }