You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/05/19 00:13:29 UTC

[GitHub] [phoenix] gjacoby126 opened a new pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

gjacoby126 opened a new pull request #782:
URL: https://github.com/apache/phoenix/pull/782


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] swaroopak commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
swaroopak commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r427614110



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
##########
@@ -88,6 +88,8 @@
     public static final String INDEX_REBUILD_PAGING = "_IndexRebuildPaging";
     // Index verification type done by the index tool
     public static final String INDEX_REBUILD_VERIFY_TYPE = "_IndexRebuildVerifyType";
+    public static final String INDEX_REBUILD_DISABLE_LOGGING_VERIFY_TYPE =

Review comment:
       You would need to rebase with latest 4.x I suppose.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #782:
URL: https://github.com/apache/phoenix/pull/782#issuecomment-632841695


   A few test flappers and minicluster crashes happened on the Pre-Commit job. Reran them manually locally and they passed, so I'm going to commit this. 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] priyankporwal commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
priyankporwal commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r427540520



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
##########
@@ -235,6 +272,11 @@ public static IndexVerifyType fromValue(byte[] value) {
     private static final Option END_TIME_OPTION = new Option("et", "endtime",
             true, "End time for indextool rebuild or verify");
 
+    private static final Option DISABLE_LOGGING_OPTION = new Option("dl",
+        "disable-logging", true
+        , "Disable logging of failed verification rows for BEFORE, " +

Review comment:
       So, we cannot disable logging for ONLY mode?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r428815584



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
##########
@@ -88,6 +88,8 @@
     public static final String INDEX_REBUILD_PAGING = "_IndexRebuildPaging";
     // Index verification type done by the index tool
     public static final String INDEX_REBUILD_VERIFY_TYPE = "_IndexRebuildVerifyType";
+    public static final String INDEX_REBUILD_DISABLE_LOGGING_VERIFY_TYPE =

Review comment:
       Done.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r427556930



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
##########
@@ -235,6 +272,11 @@ public static IndexVerifyType fromValue(byte[] value) {
     private static final Option END_TIME_OPTION = new Option("et", "endtime",
             true, "End time for indextool rebuild or verify");
 
+    private static final Option DISABLE_LOGGING_OPTION = new Option("dl",
+        "disable-logging", true
+        , "Disable logging of failed verification rows for BEFORE, " +

Review comment:
       @priyankporwal ONLY counts as BEFORE. 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 merged pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
gjacoby126 merged pull request #782:
URL: https://github.com/apache/phoenix/pull/782


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gokceni commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
gokceni commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r428378817



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
##########
@@ -617,6 +618,125 @@ public void testSplitIndex() throws Exception {
         }
     }
 
+    @Test
+    public void testDisableOutputLogging() throws Exception {
+        if (!mutable || transactional || useSnapshot || localIndex) {
+            return;
+        }
+
+        String schemaName = generateUniqueName();
+        String dataTableName = generateUniqueName();
+        String dataTableFullName = SchemaUtil.getTableName(schemaName, dataTableName);
+        String indexTableName = generateUniqueName();
+        String indexTableFullName = SchemaUtil.getTableName(schemaName, indexTableName);
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+
+        try(Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            String stmString1 =
+                "CREATE TABLE " + dataTableFullName
+                    + " (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, ZIP INTEGER) "
+                    + tableDDLOptions;
+            conn.createStatement().execute(stmString1);
+            String upsertQuery = String.format("UPSERT INTO %s VALUES(?, ?, ?)", dataTableFullName);
+            PreparedStatement stmt1 = conn.prepareStatement(upsertQuery);
+
+            // insert two rows
+            upsertRow(stmt1, 1);
+            upsertRow(stmt1, 2);
+            conn.commit();
+
+            //create ASYNC
+            String stmtString2 =
+                String.format(
+                    "CREATE INDEX %s ON %s (LPAD(UPPER(NAME, 'en_US'),8,'x')||'_xyz') ASYNC ",
+                    indexTableName, dataTableFullName);
+            conn.createStatement().execute(stmtString2);
+            conn.commit();
+
+            // run the index MR job as ONLY so the index doesn't get rebuilt. Should be 2 missing
+            //rows. We pass in --disable-logging BEFORE to silence the output logging to
+            // PHOENIX_INDEX_TOOL, since ONLY logs BEFORE the (non-existent in this case)
+            // rebuild
+           assertDisableLogging(conn, 0, IndexTool.IndexVerifyType.ONLY,
+               IndexTool.IndexDisableLoggingType.BEFORE, null, schemaName, dataTableName, indexTableName,
+               indexTableFullName, 0);
+
+            //now check that disabling logging AFTER leaves only the BEFORE logs on a BOTH run
+            assertDisableLogging(conn, 2, IndexTool.IndexVerifyType.BOTH,
+                IndexTool.IndexDisableLoggingType.AFTER,
+                IndexVerificationOutputRepository.PHASE_BEFORE_VALUE, schemaName,
+                dataTableName, indexTableName,
+                indexTableFullName, 0);
+
+            truncateTable(conn,
+                TableName.valueOf(IndexVerificationOutputRepository.OUTPUT_TABLE_NAME));
+            truncateTable(conn, TableName.valueOf(indexTableFullName));
+
+            //now check that disabling logging BEFORE creates only the AFTER logs on a BOTH run
+            //the index tool run fails validation at the end because we suppressed the BEFORE logs
+            //which prevented the rebuild from working properly, but that's ok for this test.
+            assertDisableLogging(conn, 2, IndexTool.IndexVerifyType.BOTH,
+                IndexTool.IndexDisableLoggingType.BEFORE,
+                IndexVerificationOutputRepository.PHASE_AFTER_VALUE, schemaName,
+                dataTableName, indexTableName,
+                indexTableFullName, -1);
+
+            truncateTable(conn, TableName.valueOf(IndexVerificationOutputRepository.OUTPUT_TABLE_NAME));
+            truncateTable(conn, TableName.valueOf(indexTableFullName));
+
+            //now check that disabling logging BOTH creates no logs on a BOTH run
+            assertDisableLogging(conn, 0, IndexTool.IndexVerifyType.BOTH,
+                IndexTool.IndexDisableLoggingType.BOTH,
+                IndexVerificationOutputRepository.PHASE_AFTER_VALUE, schemaName,
+                dataTableName, indexTableName,
+                indexTableFullName, -1);
+
+        }
+    }
+
+    public void truncateTable(Connection conn, TableName tableName) throws SQLException,

Review comment:
       Do you want to rename this as deleteAll? It doesn't call truncate as this name suggests




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] kadirozde commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
kadirozde commented on a change in pull request #782:
URL: https://github.com/apache/phoenix/pull/782#discussion_r427486122



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
##########
@@ -617,6 +618,125 @@ public void testSplitIndex() throws Exception {
         }
     }
 
+    @Test

Review comment:
       These tests should move into IndexToolForNonTxGlobalIndexIT after the recent restructuring of IndexToolIT




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gokceni commented on a change in pull request #782: PHOENIX-5875 - Optional logging for IndexTool verification

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org