Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-19950

Hive ACID NOT LOCK LockComponent Correctly

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Blocker
    • Resolution: Unresolved
    • 2.3.2
    • None
    • Transactions
    • None

    Description

      Hi,

          When using Streaming Mutation recently, I found LockComponents were not locked correctly by current transaction.  Below is my test case:

      Step1: Begin a transaction with transactionId 126, and the transaction locks a table. Then hangs the transaction. The lock information were correctly restored in mariaDB.

      MariaDB [hive]> select HL_LOCK_EXT_ID,HL_LOCK_INT_ID,HL_TXNID,HL_DB,HL_TABLE,HL_PARTITION,HL_LOCK_STATE,HL_LOCK_TYPE,HL_ACQUIRED_AT,HL_BLOCKEDBY_EXT_ID,HL_BLOCKEDBY_INT_ID from HIVE_LOCKS;
      
      HL_LOCK_EXT_ID HL_LOCK_INT_ID HL_TXNID HL_DB HL_TABLE HL_PARTITION HL_LOCK_STATE HL_LOCK_TYPE HL_ACQUIRED_AT HL_BLOCKEDBY_EXT_ID HL_BLOCKEDBY_INT_ID
      384 1 126 test_acid acid_test NULL a w 1529512857000 NULL NULL

       

      Step2: Begin the other transaction with a transactionId 127 before previous transaction 126 finished. Transaction 127 tries to lock the same table too, but failed at first attempt. The lock information were correctly restored in mariaDB, Lock 385 was blocked by Lock 384. 

      MariaDB [hive]> select HL_LOCK_EXT_ID,HL_LOCK_INT_ID,HL_TXNID,HL_DB,HL_TABLE,HL_PARTITION,HL_LOCK_STATE,HL_LOCK_TYPE,HL_ACQUIRED_AT,HL_BLOCKEDBY_EXT_ID,HL_BLOCKEDBY_INT_ID from HIVE_LOCKS;
      HL_LOCK_EXT_ID HL_LOCK_INT_ID HL_TXNID HL_DB HL_TABLE HL_PARTITION HL_LOCK_STATE HL_LOCK_TYPE HL_ACQUIRED_AT HL_BLOCKEDBY_EXT_ID HL_BLOCKEDBY_INT_ID
      384 1 126 test_acid acid_test NULL a w 1529512857000 NULL NULL
      385 1 127 test_acid acid_test NULL w w NULL 384 1

      Step3: Then transaction 127 tries to lock the table for a second retry after 30s with another lockId: 386, this time it successfully locked the table,  whereas transaction 126 is still holding the lock. Lock informations in MetaStore DB:

      MariaDB [hive]> select HL_LOCK_EXT_ID,HL_LOCK_INT_ID,HL_TXNID,HL_DB,HL_TABLE,HL_PARTITION,HL_LOCK_STATE,HL_LOCK_TYPE,HL_ACQUIRED_AT,HL_BLOCKEDBY_EXT_ID,HL_BLOCKEDBY_INT_ID from HIVE_LOCKS; 
      HL_LOCK_EXT_ID HL_LOCK_INT_ID HL_TXNID HL_DB HL_TABLE HL_PARTITION HL_LOCK_STATE HL_LOCK_TYPE HL_ACQUIRED_AT HL_BLOCKEDBY_EXT_ID HL_BLOCKEDBY_INT_ID
      384 1 126 test_acid acid_test NULL a w 1529512857000 NULL NULL
      385 1 127 test_acid acid_test NULL w w NULL 384 1
      386 1 127 test_acid acid_test NULL a w 1529513069000 NULL NULL

       
          After going through the code.  I found it dosen't care about other transaction's lock on the LockComponents in second retry.

          I wonder if i use it in a wrong way, or misunderstand sth about ACID in hive.

                                                                                                                                         Thanks

      Attachments

        1. patch.patch
          3 kB
          nickSoul

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned Assign to me
            nickSoul nickSoul

            Dates

              Created:
              Updated:

              Slack

                Issue deployment