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

ACID: Concurrent MERGE INSERT operations produce duplicates

Log workAgile BoardRank to TopRank to BottomVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Transactions
    • Labels:
      None

      Description

      2 concurrent MERGE INSERT operations generate duplicates due to lack of locking.
      MERGE INSERT is treated as regular INSERT, it acquires SHARED_READ lock that doesn't prevent other INSERTs. We should use EXCLUSIVE lock here or EXCL_WRITE if hive.txn.write.xlock=false;

      create table target (a int, b int) stored as orc TBLPROPERTIES ('transactional'='true')");
      insert into target values (1,2), (3,4)
      create table source (a int, b int)
      

      execute in parallel:

      insert into source values (5,6), (7,8)
      

        Attachments

        1. HIVE-23349.6.patch
          12 kB
          Denys Kuzmenko
        2. HIVE-23349.5.patch
          12 kB
          Denys Kuzmenko
        3. HIVE-23349.4.patch
          12 kB
          Denys Kuzmenko
        4. HIVE-23349.3.patch
          12 kB
          Denys Kuzmenko
        5. HIVE-23349.2.patch
          12 kB
          Denys Kuzmenko
        6. HIVE-23349.1.patch
          12 kB
          Denys Kuzmenko

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              dkuzmenko Denys Kuzmenko Assign to me
              Reporter:
              dkuzmenko Denys Kuzmenko

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment