> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java, line 110
> > <https://reviews.apache.org/r/8094/diff/1/?file=190885#file190885line110>
> >
> >     Can you expand the TODO to be clearer about what you want to happen? It 
> > might not be you that fixes it, such is open source.

I fixed it :)


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/WatchManager.java, line 176
> > <https://reviews.apache.org/r/8094/diff/1/?file=190882#file190882line176>
> >
> >     I'm not a huge fan of calling these 'dump' - that always implies 
> > writing to a string or to stderr or similar.  How about just 'getWatches' 
> > etc.?


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/WatchManager.java, line 179
> > <https://reviews.apache.org/r/8094/diff/1/?file=190882#file190882line179>
> >
> >     Nit: You're boxing the long every time you do a get or a put, you might 
> > as well make this a Long id instead.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/WatchManager.java, line 182
> > <https://reviews.apache.org/r/8094/diff/1/?file=190882#file190882line182>
> >
> >     Nit: avoid the repeated lookup by id and make the HashSet a local 
> > variable, then do id2paths.put after the for loop.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/CommandBase.java, line 35
> > <https://reviews.apache.org/r/8094/diff/1/?file=190889#file190889line35>
> >
> >     Why String[]? Prefer List<String> pretty much everywhere. You can use 
> > Arrays.asList("name1", "name2") etc. to pass in names.

No good reason, I like using arrays where I would use tuples in python :) Fixed.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 57
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line57>
> >
> >     You don't need this blank line


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 61
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line61>
> >
> >     final static variables usually have capitalised names, so COMMANDS 
> > here, and PRIMARY_NAMES below.

I removed the final modifier because I didn't want to capitalize the variable 
names :) I generally use capitals to denote _immutable_ static final variables 
(or at least variables that should be treated as immutable). commands and 
primaryNames are modified when you register a Command so I think it'd be 
confusing to have them in all caps. Personally I like marking variables as 
final when possible so the compiler reminds you to initialize them, even if 
they're mutable, but it's not necessary.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 111
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line111>
> >
> >     Not sure we need this


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 159
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line159>
> >
> >     New line for second }


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java, line 58
> > <https://reviews.apache.org/r/8094/diff/1/?file=190892#file190892line58>
> >
> >     printStackTrace is bad because it doesn't use the logging setup. Use 
> > LOG.warn("...", e) in all cases.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/test/org/apache/zookeeper/server/PrepRequestProcessorTest.java, 
> > line 128
> > <https://reviews.apache.org/r/8094/diff/1/?file=190894#file190894line128>
> >
> >     Remove this line (and the one above). Shouldn't this return an empty 
> > Map instead of null, in case this ever gets used?


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 175
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line175>
> >
> >     You can't lock on factory.getConnections(), since getConnections is 
> > entitled to return different objects on different invocations (e.g. what if 
> > it copied the cnxns object and returned the copy?) 
> >     
> >     My suggestion: move this logic into ServerCnxnFactory and make it a 
> > public method that returns the List<Map<String, Object>>. Same with the 
> > other places you follow a similar pattern.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/DataTree.java, line 1184
> > <https://reviews.apache.org/r/8094/diff/1/?file=190874#file190874line1184>
> >
> >     Good time to add some Javadoc to some of these public methods.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/AdminServer.java, line 70
> > <https://reviews.apache.org/r/8094/diff/1/?file=190887#file190887line70>
> >
> >     I prefer starting servers in a separate method outside of the 
> > constructor. That way you can always initialise variables of type 
> > AdminServer in their usual place without having to wait until you know 
> > you're ok with starting the server before you construct one.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/Commands.java, line 130
> > <https://reviews.apache.org/r/8094/diff/1/?file=190891#file190891line130>
> >
> >     These guys all need a short comment to explain what they do.

Added comments that give a short description and go over what's returned by the 
command (i.e., what keys the returned Map will have). Commands also have a 
String doc field, but I'm thinking of getting rid of it because I'm not sure 
where/how to use it. I think it will be better to put each Command's API in the 
ZK docs somewhere.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/ZooTrace.java, line 59
> > <https://reviews.apache.org/r/8094/diff/1/?file=190886#file190886line59>
> >
> >     *If* this is used from multiple threads (is it?), it should be 
> > synchronized on the class lock, otherwise there's no guarantee that changes 
> > to traceMask are visible on other threads.

Added synchronization, a bunch of threads call the functions accessing 
traceMask.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/AdminServer.java, line 72
> > <https://reviews.apache.org/r/8094/diff/1/?file=190887#file190887line72>
> >
> >     LOG.warn("Problem starting AdminServer", e);
> >     
> >     Why don't you want to throw the exception? How can clients know if this 
> > worked or not?

I created an AdminServerException, which is thrown instead of catching the 
Exception.


> On Nov. 28, 2012, 7:32 p.m., Henry Robinson wrote:
> > src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java, line 
> > 30
> > <https://reviews.apache.org/r/8094/diff/1/?file=190890#file190890line30>
> >
> >     Outputter is a bit clumsy - would Writer work better?

CommandWriter sounds like it should be a subclass of Writer (a la PrintWriter, 
StringWriter, etc.). Maybe CommandPrinter?


- Skye


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/8094/#review13826
-----------------------------------------------------------


On Nov. 30, 2012, 9:01 p.m., Skye Wanderman-Milne wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/8094/
> -----------------------------------------------------------
> 
> (Updated Nov. 30, 2012, 9:01 p.m.)
> 
> 
> Review request for zookeeper, Patrick Hunt, Camille Fournier, and Henry 
> Robinson.
> 
> 
> Description
> -------
> 
> See my comment in ZOOKEEPER-1346.
> 
> 
> This addresses bug ZOOKEEPER-1346.
>     https://issues.apache.org/jira/browse/ZOOKEEPER-1346
> 
> 
> Diffs
> -----
> 
>   ivy.xml fadf4f4 
>   src/java/main/org/apache/zookeeper/server/DataTree.java 0bb2317 
>   src/java/main/org/apache/zookeeper/server/NIOServerCnxnFactory.java 8b4c46b 
>   src/java/main/org/apache/zookeeper/server/NettyServerCnxnFactory.java 
> eec2f2a 
>   src/java/main/org/apache/zookeeper/server/ServerCnxn.java 6dd509b 
>   src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java e5c6565 
>   src/java/main/org/apache/zookeeper/server/ServerStats.java aa0d93f 
>   src/java/main/org/apache/zookeeper/server/SessionTracker.java 3535e1b 
>   src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java 31f2785 
>   src/java/main/org/apache/zookeeper/server/WatchManager.java 0e7c815 
>   src/java/main/org/apache/zookeeper/server/ZKDatabase.java d6c0c05 
>   src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java 7bb7b2f 
>   src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java 369e621 
>   src/java/main/org/apache/zookeeper/server/ZooTrace.java ac14fe2 
>   src/java/main/org/apache/zookeeper/server/admin/AdminServer.java 
> PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/admin/Command.java PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/admin/CommandBase.java 
> PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java 
> PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/admin/Commands.java PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java 
> PRE-CREATION 
>   src/java/main/org/apache/zookeeper/server/quorum/Leader.java 4d09b43 
>   src/java/main/org/apache/zookeeper/server/quorum/Learner.java e8d548b 
>   src/java/main/org/apache/zookeeper/server/quorum/LearnerSessionTracker.java 
> 3182419 
>   src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java 4e3a87d 
>   src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java 
> deae926 
>   
> src/java/main/org/apache/zookeeper/server/quorum/ReadOnlyZooKeeperServer.java 
> d3f1492 
>   src/java/test/org/apache/zookeeper/server/PrepRequestProcessorTest.java 
> 8665bac 
>   src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java 42207e1 
> 
> Diff: https://reviews.apache.org/r/8094/diff/
> 
> 
> Testing
> -------
> 
> unit tests
> 
> Ran in standalone mode (only option right now) and manually tried out all the 
> commands/links
> 
> 
> Thanks,
> 
> Skye Wanderman-Milne
> 
>

Reply via email to