gokceni commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r428379405



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
##########
@@ -320,9 +363,52 @@ public CommandLine parseOptions(String[] args) {
         if (splitIndex && cmdLine.hasOption(PARTIAL_REBUILD_OPTION.getOpt())) {
             throw new IllegalStateException("Cannot split index for a partial 
rebuild, as the index table is dropped");
         }
+        if (loggingDisabledMismatchesVerifyOption(cmdLine)){
+            throw new IllegalStateException("Can't disable index verification 
logging when no " +
+                "index verification or the wrong kind of index verification 
has been requested. " +
+                "VerifyType: [" + 
cmdLine.getOptionValue(VERIFY_OPTION.getOpt()) + "] and " +
+                "DisableLoggingType: ["
+                + cmdLine.getOptionValue(DISABLE_LOGGING_OPTION.getOpt()) + 
"]");
+        }
         return cmdLine;
     }
 
+    private boolean loggingDisabledMismatchesVerifyOption(CommandLine cmdLine) 
{
+        boolean loggingDisabled = 
cmdLine.hasOption(DISABLE_LOGGING_OPTION.getOpt());
+        if (!loggingDisabled) {
+            return false;
+        }
+        boolean hasVerifyOption =
+            cmdLine.hasOption(VERIFY_OPTION.getOpt());
+        if (!hasVerifyOption) {
+            return true;
+        }
+        String loggingDisableValue = 
cmdLine.getOptionValue(DISABLE_LOGGING_OPTION.getOpt());
+        String verifyValue = cmdLine.getOptionValue(VERIFY_OPTION.getOpt());
+        IndexDisableLoggingType loggingDisableType = 
IndexDisableLoggingType.fromValue(loggingDisableValue);
+        if (loggingDisableType != IndexDisableLoggingType.BEFORE &&
+            loggingDisableType != IndexDisableLoggingType.AFTER &&
+        loggingDisableType != IndexDisableLoggingType.BOTH) {

Review comment:
       nit:spacing is off




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to