BinShi-SecularBird commented on a change in pull request #430: PHOENIX-5091 Add 
new features to UpdateStatisticsTool
URL: https://github.com/apache/phoenix/pull/430#discussion_r252090642
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/schema/stats/UpdateStatisticsTool.java
 ##########
 @@ -77,49 +82,104 @@
             "Restore Directory for HBase snapshot");
     private static final Option RUN_FOREGROUND_OPTION =
             new Option("runfg", "run-foreground", false,
-                    "If specified, runs UpdateStatisticsTool in Foreground. 
Default - Runs the build in background.");
+                    "If specified, runs UpdateStatisticsTool in Foreground. 
Default - Runs the build in background");
+    private static final Option MANAGE_SNAPSHOT_OPTION =
+            new Option("ms", "manage-snapshot", false,
+                    "Creates a new snapshot, runs the tool and deletes it");
+
     private static final Option HELP_OPTION = new Option("h", "help", false, 
"Help");
 
-    private Configuration conf;
     private String tableName;
     private String snapshotName;
     private Path restoreDir;
+    private boolean manageSnapshot;
     private boolean isForeground;
 
+    private Job job;
+
     @Override
     public int run(String[] args) throws Exception {
         parseArgs(args);
-        Job job = configureJob(conf, tableName, snapshotName, restoreDir);
+        preJobTask();
+        configureJob();
         TableMapReduceUtil.initCredentials(job);
-        return runJob(job, isForeground);
+        int ret = runJob();
+        postJobTask();
 
 Review comment:
   In my understanding, postJobTask and any other cleanup should be put into 
final { ... } to make sure there are always being called after resource being 
allocated (like snapshot created.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to