Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3280

Automatic attempt to rebuild all disabled index

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.9.0, 4.8.1
    • None
    • None

    Description

      Instead of only attempting to rebuild the first disabled index, we should attempt to build each of them. Otherwise, a failure of the first one would block the building of the others. This is follow up work for PHOENIX-3237 and further improvements are identified in PHOENIX-3277.

      Attachments

        1. PHOENIX-3280.patch
          19 kB
          James R. Taylor
        2. PHOENIX-3280_v2.patch
          18 kB
          James R. Taylor

        Activity

          Please review, ankit@apache.org.

          jamestaylor James R. Taylor added a comment - Please review, ankit@apache.org .
          hadoopqa Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12828565/PHOENIX-3280.patch
          against master branch at commit 2c2b552cd7c611c63677b0be075065504d579469.
          ATTACHMENT ID: 12828565

          +1 @author. The patch does not contain any @author tags.

          -1 tests included. The patch doesn't appear to include any new or modified tests.
          Please justify why no new tests are needed for this patch.
          Also please list what manual steps were performed to verify this patch.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          -1 javadoc. The javadoc tool appears to have generated 35 warning messages.

          -1 release audit. The applied patch generated 1 release audit warnings (more than the master's current 0 warnings).

          -1 lineLengths. The patch introduces the following lines longer than 100:
          + if ((dataTable == null || dataTable.length == 0) || (indexState == null || indexState.length == 0)) {
          + if (Bytes.compareTo(PIndexState.DISABLE.getSerializedBytes(), indexState) == 0) {
          + List<PTable> indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes()
          + List<PTable> oldIndexesToPartiallyRebuild = dataTableToIndexesMap.put(dataPTable,
          + QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME);
          + LOG.info("Starting to build " + dataPTable + " indexes " + indexesToPartiallyRebuild
          + try (HTableInterface dataHTable = conn.getQueryServices().getTable(physicalTableName)) {
          + try (ResultScanner dataTableScanner = dataHTable.getScanner(dataTableScan)) {
          + List<Mutation> mutations = Lists.newArrayListWithExpectedSize(batchSize);
          + ImmutableBytesWritable indexMetaDataPtr = new ImmutableBytesWritable(

          -1 core tests. The patch failed these unit tests:
          ./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.rpc.UpdateCacheWithScnIT

          Test results: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//testReport/
          Release audit warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//artifact/patchprocess/patchReleaseAuditWarnings.txt
          Javadoc warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//artifact/patchprocess/patchJavadocWarnings.txt
          Console output: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//console

          This message is automatically generated.

          hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12828565/PHOENIX-3280.patch against master branch at commit 2c2b552cd7c611c63677b0be075065504d579469. ATTACHMENT ID: 12828565 +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. -1 javadoc . The javadoc tool appears to have generated 35 warning messages. -1 release audit . The applied patch generated 1 release audit warnings (more than the master's current 0 warnings). -1 lineLengths . The patch introduces the following lines longer than 100: + if ((dataTable == null || dataTable.length == 0) || (indexState == null || indexState.length == 0)) { + if (Bytes.compareTo(PIndexState.DISABLE.getSerializedBytes(), indexState) == 0) { + List<PTable> indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes() + List<PTable> oldIndexesToPartiallyRebuild = dataTableToIndexesMap.put(dataPTable, + QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME); + LOG.info("Starting to build " + dataPTable + " indexes " + indexesToPartiallyRebuild + try (HTableInterface dataHTable = conn.getQueryServices().getTable(physicalTableName)) { + try (ResultScanner dataTableScanner = dataHTable.getScanner(dataTableScan)) { + List<Mutation> mutations = Lists.newArrayListWithExpectedSize(batchSize); + ImmutableBytesWritable indexMetaDataPtr = new ImmutableBytesWritable( -1 core tests . The patch failed these unit tests: ./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.rpc.UpdateCacheWithScnIT Test results: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//testReport/ Release audit warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//artifact/patchprocess/patchReleaseAuditWarnings.txt Javadoc warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//artifact/patchprocess/patchJavadocWarnings.txt Console output: https://builds.apache.org/job/PreCommit-PHOENIX-Build/576//console This message is automatically generated.
          ankit@apache.org Ankit Singhal added a comment -

          Thanks giacomotaylor , it looks good but have some minor comments.

          Instead, Existing PhoenixRuntime#getTableNoCache() can be used.

          +
          +    /**
          +     * Get the latest table from the server, bypassing the client cache
          +     * 
          +     * @param conn
          +     * @param name
          +     * @return
          +     * @throws SQLException
          +     */
          +    public static PTable forceGetTable(Connection conn, String name) throws SQLException {
          

          Could be a existing bug, Shouldn't we clear mutations after executing them.

          +                                        if (mutations.size() == batchSize) {
          +                                            dataHTable.batch(mutations);
          +                                            uuidValue = ServerCacheClient.generateId();
                                                   }
          

          Is the second version more optimized and can be used?

          +                    List<PTable> indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes()
          +                            .size());
          +                    List<PTable> oldIndexesToPartiallyRebuild = dataTableToIndexesMap.put(dataPTable,
          +                            indexesToPartiallyRebuild);
          +                    // If there already were indexes, then combine them with the new ones
          +                    if (oldIndexesToPartiallyRebuild != null) {
          +                        indexesToPartiallyRebuild.addAll(oldIndexesToPartiallyRebuild);
          +                    }
                               indexesToPartiallyRebuild.add(indexPTable);
          
          +                    
          +                    List<PTable> oldIndexesToPartiallyRebuild= dataTableToIndexesMap.get(dataPTable);                    
          +                    if (oldIndexesToPartiallyRebuild == null) {
          +						oldIndexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes()
          +                            .size());
          +						dataTableToIndexesMap.put(dataPTable,indexesToPartiallyRebuild);
          +                    }
                               oldIndexesToPartiallyRebuild.add(indexPTable);
           

          please remove the comment as it is not valid now.

                                   // we need to build indexes of same data table. so skip other indexes for this task.
                                   continue;
          
          ankit@apache.org Ankit Singhal added a comment - Thanks giacomotaylor , it looks good but have some minor comments. Instead, Existing PhoenixRuntime#getTableNoCache() can be used. + + /** + * Get the latest table from the server, bypassing the client cache + * + * @param conn + * @param name + * @ return + * @ throws SQLException + */ + public static PTable forceGetTable(Connection conn, String name) throws SQLException { Could be a existing bug, Shouldn't we clear mutations after executing them. + if (mutations.size() == batchSize) { + dataHTable.batch(mutations); + uuidValue = ServerCacheClient.generateId(); } Is the second version more optimized and can be used? + List<PTable> indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes() + .size()); + List<PTable> oldIndexesToPartiallyRebuild = dataTableToIndexesMap.put(dataPTable, + indexesToPartiallyRebuild); + // If there already were indexes, then combine them with the new ones + if (oldIndexesToPartiallyRebuild != null ) { + indexesToPartiallyRebuild.addAll(oldIndexesToPartiallyRebuild); + } indexesToPartiallyRebuild.add(indexPTable); + + List<PTable> oldIndexesToPartiallyRebuild= dataTableToIndexesMap.get(dataPTable); + if (oldIndexesToPartiallyRebuild == null ) { + oldIndexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes() + .size()); + dataTableToIndexesMap.put(dataPTable,indexesToPartiallyRebuild); + } oldIndexesToPartiallyRebuild.add(indexPTable); please remove the comment as it is not valid now. // we need to build indexes of same data table. so skip other indexes for this task. continue ;

          Thanks, ankit@apache.org. Great feedback and great catch on the missing mutations.clear() call. Here's a v2 with a couple of sanity checks added too.

          jamestaylor James R. Taylor added a comment - Thanks, ankit@apache.org . Great feedback and great catch on the missing mutations.clear() call. Here's a v2 with a couple of sanity checks added too.
          ankit@apache.org Ankit Singhal added a comment -

          +1 , Thanks jamestaylor

          ankit@apache.org Ankit Singhal added a comment - +1 , Thanks jamestaylor
          hadoopqa Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12828598/PHOENIX-3280_v2.patch
          against master branch at commit 27697b364511f8557a87d4007bff1a560e4b8490.
          ATTACHMENT ID: 12828598

          +1 @author. The patch does not contain any @author tags.

          -1 tests included. The patch doesn't appear to include any new or modified tests.
          Please justify why no new tests are needed for this patch.
          Also please list what manual steps were performed to verify this patch.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          -1 javadoc. The javadoc tool appears to have generated 34 warning messages.

          -1 release audit. The applied patch generated 1 release audit warnings (more than the master's current 0 warnings).

          -1 lineLengths. The patch introduces the following lines longer than 100:
          + if ((dataTable == null || dataTable.length == 0) || (indexState == null || indexState.length == 0)) {
          + if (Bytes.compareTo(PIndexState.DISABLE.getSerializedBytes(), indexState) == 0) {
          + indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes().size());
          + QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME);
          + LOG.info("Starting to build " + dataPTable + " indexes " + indexesToPartiallyRebuild
          + try (HTableInterface dataHTable = conn.getQueryServices().getTable(physicalTableName)) {
          + try (ResultScanner dataTableScanner = dataHTable.getScanner(dataTableScan)) {
          + List<Mutation> mutations = Lists.newArrayListWithExpectedSize(batchSize);
          + ImmutableBytesWritable indexMetaDataPtr = new ImmutableBytesWritable(
          + IndexMaintainer.serializeAdditional(dataPTable, indexMetaDataPtr,

          -1 core tests. The patch failed these unit tests:

          Test results: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//testReport/
          Release audit warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//artifact/patchprocess/patchReleaseAuditWarnings.txt
          Javadoc warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//artifact/patchprocess/patchJavadocWarnings.txt
          Console output: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//console

          This message is automatically generated.

          hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12828598/PHOENIX-3280_v2.patch against master branch at commit 27697b364511f8557a87d4007bff1a560e4b8490. ATTACHMENT ID: 12828598 +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. -1 javadoc . The javadoc tool appears to have generated 34 warning messages. -1 release audit . The applied patch generated 1 release audit warnings (more than the master's current 0 warnings). -1 lineLengths . The patch introduces the following lines longer than 100: + if ((dataTable == null || dataTable.length == 0) || (indexState == null || indexState.length == 0)) { + if (Bytes.compareTo(PIndexState.DISABLE.getSerializedBytes(), indexState) == 0) { + indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(dataPTable.getIndexes().size()); + QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME); + LOG.info("Starting to build " + dataPTable + " indexes " + indexesToPartiallyRebuild + try (HTableInterface dataHTable = conn.getQueryServices().getTable(physicalTableName)) { + try (ResultScanner dataTableScanner = dataHTable.getScanner(dataTableScan)) { + List<Mutation> mutations = Lists.newArrayListWithExpectedSize(batchSize); + ImmutableBytesWritable indexMetaDataPtr = new ImmutableBytesWritable( + IndexMaintainer.serializeAdditional(dataPTable, indexMetaDataPtr, -1 core tests . The patch failed these unit tests: Test results: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//testReport/ Release audit warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//artifact/patchprocess/patchReleaseAuditWarnings.txt Javadoc warnings: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//artifact/patchprocess/patchJavadocWarnings.txt Console output: https://builds.apache.org/job/PreCommit-PHOENIX-Build/577//console This message is automatically generated.
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Phoenix-4.8-HBase-1.2 #24 (See https://builds.apache.org/job/Phoenix-4.8-HBase-1.2/24/)
          PHOENIX-3280 Automatic attempt to rebuild all disabled index (jamestaylor: rev 496872c6e85e8e2cfe792035f9635b0817b78135)

          • (edit) phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Phoenix-4.8-HBase-1.2 #24 (See https://builds.apache.org/job/Phoenix-4.8-HBase-1.2/24/ ) PHOENIX-3280 Automatic attempt to rebuild all disabled index (jamestaylor: rev 496872c6e85e8e2cfe792035f9635b0817b78135) (edit) phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
          hudson Hudson added a comment -

          FAILURE: Integrated in Jenkins build Phoenix-master #1403 (See https://builds.apache.org/job/Phoenix-master/1403/)
          PHOENIX-3280 Automatic attempt to rebuild all disabled index (jamestaylor: rev 2a223adfbeb32f598308da1dc6d3251ee0980d79)

          • (edit) phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
          hudson Hudson added a comment - FAILURE: Integrated in Jenkins build Phoenix-master #1403 (See https://builds.apache.org/job/Phoenix-master/1403/ ) PHOENIX-3280 Automatic attempt to rebuild all disabled index (jamestaylor: rev 2a223adfbeb32f598308da1dc6d3251ee0980d79) (edit) phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java

          People

            jamestaylor James R. Taylor
            jamestaylor James R. Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: