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

Split mutations batches probably affects correctness of index data

    XMLWordPrintableJSON

Details

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

    Description

      In order to get more performance, we split the list of mutations into multiple batches in MutationSate.  For one upsert SQL with some null values that will produce two type KeyValues(Put and DeleteColumn),  These KeyValues should have the same timestamp so that keep on an atomic operation for corresponding the row key.

      ConcurrentTest.java produced some random upsert/delete SQL and concurrently executed, some SQL snippets as follows:

      1149:UPSERT INTO ConcurrentReadWritTest(A,C,E,F,G) VALUES ('3826','2563','3052','3170','3767');
      
      1864:UPSERT INTO ConcurrentReadWritTest(A,B,C,D,E,F,G) VALUES ('2563','4926','3526','678',null,null,'1617');
      
      2332:UPSERT INTO ConcurrentReadWritTest(A,B,C,D,E,F,G) VALUES ('1052','2563','1120','2314','1456',null,null);
      
      2846:UPSERT INTO ConcurrentReadWritTest(A,B,C,D,G) VALUES ('1922','146',null,'469','2563');
      
      2847:DELETE FROM ConcurrentReadWritTest WHERE A = '2563’;
      
      

      Found incorrect indexed data for the index tables by sqlline.

      Debugged the mutations of batches on the server side. the DeleteColumns and Puts were splitted into the different batches for the once upsert,  the DeleteFaimly also was executed by another thread.  due to DeleteColumns's timestamp is larger than DeleteFaimly under multiple threads.

       

      Running the following:

      conn.createStatement().executeUpdate( "CREATE TABLE " + tableName + " (" + "A VARCHAR NOT NULL PRIMARY KEY," + "B VARCHAR," + "C VARCHAR," + "D VARCHAR) COLUMN_ENCODED_BYTES = 0"); 
      
      conn.createStatement().executeUpdate("CREATE INDEX " + indexName + " on " + tableName + " (C) INCLUDE(D)"); 
      
      conn.createStatement().executeUpdate("UPSERT INTO " + tableName + "(A,B,C,D) VALUES ('A2','B2','C2','D2')"); 
      conn.createStatement().executeUpdate("UPSERT INTO " + tableName + "(A,B,C,D) VALUES ('A3','B3', 'C3', null)");
      

      dump IndexMemStore:

      hbase.index.covered.data.IndexMemStore(117): Inserting:\x01A3/0:D/1542190446218/DeleteColumn/vlen=0/seqid=0/value= phoenix.hbase.index.covered.data.IndexMemStore(133): Current kv state: phoenix.hbase.index.covered.data.IndexMemStore(135): KV: \x01A3/0:B/1542190446167/Put/vlen=2/seqid=5/value=B3 phoenix.hbase.index.covered.data.IndexMemStore(135): KV: \x01A3/0:C/1542190446167/Put/vlen=2/seqid=5/value=C3 phoenix.hbase.index.covered.data.IndexMemStore(135): KV: \x01A3/0:D/1542190446218/DeleteColumn/vlen=0/seqid=0/value= phoenix.hbase.index.covered.data.IndexMemStore(135): KV: \x01A3/0:_0/1542190446167/Put/vlen=1/seqid=5/value=x phoenix.hbase.index.covered.data.IndexMemStore(137): ========== END MemStore Dump ==================
      

       

      The DeleteColumn's timestamp larger than other mutations.

       

      Attachments

        1. image-2019-07-15-19-14-30-179.png
          10 kB
          cuizhaohua
        2. image-2019-07-15-17-29-04-496.png
          10 kB
          cuizhaohua
        3. image-2019-07-15-17-28-42-430.png
          15 kB
          cuizhaohua
        4. image-2019-07-15-17-23-57-992.png
          18 kB
          cuizhaohua
        5. image-2019-07-15-17-21-51-557.png
          18 kB
          cuizhaohua
        6. image-2019-07-15-17-21-03-956.png
          10 kB
          cuizhaohua
        7. PHOENIX-5055-4.x-HBase-1.4-v4.patch
          12 kB
          Jaanai Zhang
        8. PHOENIX-5055-4.x-HBase-1.4-v3.patch
          11 kB
          Jaanai Zhang
        9. PHOENIX-5055-4.x-HBase-1.4-v2.patch
          11 kB
          Jaanai Zhang
        10. PHOENIX-5055-v4.x-HBase-1.4.patch
          11 kB
          Jaanai Zhang
        11. ConcurrentTest.java
          15 kB
          Jaanai Zhang

        Activity

          People

            jaanai Jaanai Zhang
            jaanai Jaanai Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: