Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.1.0
    • None
    • None

    Description

      When we drop local index then automatically index data should be deleted from local index table.
      Currently delete index data not supported even for view index drop.
      Same fix helps in both the cases.

      Attachments

        1. PHOENIX-1004_v2.patch
          8 kB
          rajeshbabu
        2. PHOENIX-1004.patch
          10 kB
          rajeshbabu

        Activity

          rajesh23 rajeshbabu added a comment -

          jamestaylor
          Here is the patch to delete index data on drop index.
          Please review.

          rajesh23 rajeshbabu added a comment - jamestaylor Here is the patch to delete index data on drop index. Please review.

          This code should not be necessary, as MetaDataClient.dropIndex() calls dropTable() which in turn makes the following call (line 1414):

                                      MutationPlan plan = new PostDDLCompiler(connection).compile(tableRefs, null, null, Collections.<PColumn>emptyList(), ts);
                                      return connection.getQueryServices().updateData(plan);
          

          I suspect the problem is that the boolean dropMetaData is true, but in this case (for indexes on views and local indexes), we want it to be false. In that case, it should do the right thing.
          Try just changing line 1383 like this (and moving it into the if statement after the declaration of the table local variable):

                              boolean dropMetaData = table.getViewIndexId() == null && connection.getQueryServices().getProps().getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA);
          
          jamestaylor James R. Taylor added a comment - This code should not be necessary, as MetaDataClient.dropIndex() calls dropTable() which in turn makes the following call (line 1414): MutationPlan plan = new PostDDLCompiler(connection).compile(tableRefs, null , null , Collections.<PColumn>emptyList(), ts); return connection.getQueryServices().updateData(plan); I suspect the problem is that the boolean dropMetaData is true, but in this case (for indexes on views and local indexes), we want it to be false. In that case, it should do the right thing. Try just changing line 1383 like this (and moving it into the if statement after the declaration of the table local variable): boolean dropMetaData = table.getViewIndexId() == null && connection.getQueryServices().getProps().getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA);
          rajesh23 rajeshbabu added a comment -

          I suspect the problem is that the boolean dropMetaData is true, but in this case (for indexes on views and local indexes), we want it to be false. In that case, it should do the right thing.

          Yes James. you are correct. With the small changes itself it's working fine. Thanks.

          Here is the updated patch. Remaining changes in required to build only newly created index, otherwise we are rewriting all indexes data again to local index table which is not correct. Please review.

          rajesh23 rajeshbabu added a comment - I suspect the problem is that the boolean dropMetaData is true, but in this case (for indexes on views and local indexes), we want it to be false. In that case, it should do the right thing. Yes James. you are correct. With the small changes itself it's working fine. Thanks. Here is the updated patch. Remaining changes in required to build only newly created index, otherwise we are rewriting all indexes data again to local index table which is not correct. Please review.

          +1. I'll pull this in tomorrow. Good catch, rajesh23.

          jamestaylor James R. Taylor added a comment - +1. I'll pull this in tomorrow. Good catch, rajesh23 .

          Pulled in the patch. Thanks for the excellent work, rajesh23!

          jamestaylor James R. Taylor added a comment - Pulled in the patch. Thanks for the excellent work, rajesh23 !
          enis Enis Soztutar added a comment -

          Bulk close of all issues that has been resolved in a released version.

          enis Enis Soztutar added a comment - Bulk close of all issues that has been resolved in a released version.

          People

            rajesh23 rajeshbabu
            rajesh23 rajeshbabu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: