[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14909977#comment-14909977
 ] 

Raul Gutierrez Segales commented on ZOOKEEPER-2211:
---------------------------------------------------

Thanks for the patch [~arshad.mohammad]!

A few nits:

In:

{code}
+        String countOption = "";
+        if (args.length == 3) {
+            countOption = args[1];
+            num = Integer.parseInt(args[2]);
+        } else {
+            snapDir = new File(args[1]);
+            countOption = args[2];
+            num = Integer.parseInt(args[3]);
+        }
{code}

you should catch NumberFormatException for each parseInt called (and show usage 
and exit).

Also, testPurgeTxnLogWithDataDir() and testPurgeTxnLogWithoutDataDir are almost 
the same except for String [] args and the assert calls. I think you can 
extract that into a helper method and call that from both tests (with the 
needed params).

Thanks!

> PurgeTxnLog does not correctly purge when snapshots and logs are at different 
> locations
> ---------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2211
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2211
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 3.4.6, 3.5.0
>         Environment: Ubuntu 12.04, Java 1.7.
>            Reporter: Wesley Chow
>            Assignee: Arshad Mohammad
>             Fix For: 3.4.7, 3.5.2, 3.6.0
>
>         Attachments: ZOOKEEPER-2211-02.patch, ZOOKEEPER-2211-03.patch, 
> ZOOKEEPER-2211.patch
>
>
> PurgeTxnLog does not work when snapshots and transaction logs are at 
> different file paths. The argument handling is buggy and only works when both 
> snap and datalog dirs are given, and datalog dir contains both logs and snaps 
> (snap is ignored).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to