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

View indexes with different owners but of the same base table can be assigned same ViewIndexId

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 5.0.0, 4.14.1
    • 4.15.0, 5.1.0, 5.0.1
    • None
    • None

    Description

      All indexes on views for a particular base table are stored in the same physical HBase table. Phoenix distinguishes them by prepending each row key with an encoded short or long integer called a ViewIndexId.

      The ViewIndexId is generated by using a sequence to guarantee that each view index id is unique. Unfortunately, the sequence used follows a convention of [SaltByte, Tenant, Schema, BaseTable] for its key, which means that there's a separate sequence for each tenant that owns an index in the view index table. (See MetaDataUtil.getViewIndexSequenceKey) Since all the sequences start at the same value, collisions are not only possible but likely.

      I've written a test that confirms the ViewIndexId collision. This means it's very likely that query results using one view index could mistakenly include rows from another index, but I haven't confirmed this.

      All view indexes for a base table, regardless of whether globally or tenant-owned, should use the same sequence.

      Attachments

        1. PHOENIX-5132-4.x-HBase-1.4.patch
          8 kB
          Geoffrey Jacoby
        2. PHOENIX-5132-4.x-HBase-1.4.v2.patch
          18 kB
          Geoffrey Jacoby
        3. PHOENIX-5132-repro.patch
          5 kB
          Geoffrey Jacoby

        Activity

          People

            gjacoby Geoffrey Jacoby
            gjacoby Geoffrey Jacoby
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: