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

ALTER INDEX REBUILD removes all rows from already valid/consistent index

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.14.1, 4.14.2, 4.14.3
    • None
    • None
    • None

    Description

      Create Table & Indexes:

      CREATE TABLE DEMO2.PEOPLE (FNAME VARCHAR NOT NULL, LNAME VARCHAR, AGE TINYINT, ZIP INTEGER, CONSTRAINT pk PRIMARY KEY (FNAME, LNAME));
      CREATE INDEX PEOPLE_BY_ZIP ON DEMO2.PEOPLE(ZIP);
      CREATE INDEX PEOPLE_BY_AGE ON DEMO2.PEOPLE(AGE);

      Populate Data:

      UPSERT INTO DEMO2.PEOPLE VALUES ('Audi', 'Q5', 15, 65000);
      UPSERT INTO DEMO2.PEOPLE VALUES ('Volkswagon', 'Beetle', 10, 43130);
      UPSERT INTO DEMO2.PEOPLE VALUES ('BMW', 'X3', 4, 15030);

      Query Index:

      SELECT * FROM DEMO2.PEOPLE_BY_AGE;

      <3 rows show up>

      Rebuild Index:

      alter index people_by_age on DEMO2.people rebuild;

      Query Index Again:

      SELECT * FROM DEMO2.PEOPLE_BY_AGE;

      <No rows show up>

       

      It seems that if the index is already consistent, then the rebuild command removes all the index rows. Above is the simpler repro, but I have noticed similar behavior where rebuild command does the right thing first time on an inconsistent index (caused by truncation of table using hbase shell), but second run of rebuild command removes all the rows.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            priyankporwal Priyank Porwal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

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