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

Dropping a base table with cascade with an older client does not clear all child view metadata

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.15.0, 5.1.0
    • 4.15.0, 5.1.0
    • None
    • None

    Description

      1) Start the HBase server with 4.15.0 Phoenix
      2) Connect with a 4.14 client
      3) Create a base table and a view on top of the base table:

      CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, HOST VARCHAR(10), FLAG BOOLEAN);
      
      CREATE VIEW Z_VIEW1 (col1 INTEGER, col2 INTEGER, col3 INTEGER, col4 INTEGER, col5 INTEGER) AS SELECT * FROM Z_BASE_TABLE WHERE ID>10;
      

      4) Drop the base table with the cascade option:

      DROP TABLE Z_BASE_TABLE CASCADE;
      

      5) Metadata for Z_VIEW1 is still there in SYSTEM.CATALOG and should be removed when trying to recreate the same base table:

      CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, HOST VARCHAR(10), FLAG BOOLEAN);
      

      6) This should remove the metadata for Z_VIEW1, but it does not. In fact, you can now query Z_VIEW1 as if it was a valid view created on top of the new Z_BASE_TABLE, however there is no parent->child link i.e.:

      SELECT * FROM SYSTEM.CATALOG WHERE LINK_TYPE=4;
      

      --> Returns no results.

      Effectively, Z_VIEW1 is sort of an "orphan" view with child->parent links but no parent->child links. This is dangerous if a user wants to drop and recreate a base table, but views from the previous lifetime of the base table can still be used to interact with the new base table.

      Attachments

        1. PHOENIX-5544-4.x-HBase-1.3-v1.patch
          17 kB
          Chinmay Kulkarni

        Issue Links

          Activity

            People

              ckulkarni Chinmay Kulkarni
              ckulkarni Chinmay Kulkarni
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h