Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24853

Duplicate key may be generated during cluster configuration change

Details

    Description

      The fix for MENT-1023 needs to be migrated to the CS version:
      -------------
      Incorrect processing of an auto-incrementing field during applying transactions results in a duplicate key being created. This is due to the fact that at the beginning of the write_row() and update_row() functions, the values ​​of the auto-increment parameters are used, which are read from the parameters of the current thread, but further along the code other values are used, which are read from global variables (when applying a transaction). This can happen when the cluster configuration has changed while applying a transaction (in high_priority_service mode for Galera 4). Further during IST processing duplicating key is detected, and processing of the DB_DUPLICATE_KEY return code (inside innodb, in the write_row() handler) results in a call to wsrep_thd_self_abort().

      Attachments

        Activity

          Please request a new review once all tests pass. A quick peek at a few results suggests that the test innodb.innodb-autoinc is failing with a result difference on all platforms.

          I think that we must be very conservative regarding auto_increment value generation and that this must be extensively tested with all values of innodb_autoinc_lock_mode. I did not see any added test case.

          marko Marko Mäkelä added a comment - Please request a new review once all tests pass. A quick peek at a few results suggests that the test innodb.innodb-autoinc is failing with a result difference on all platforms. I think that we must be very conservative regarding auto_increment value generation and that this must be extensively tested with all values of innodb_autoinc_lock_mode . I did not see any added test case.

          The InnoDB change looks fine to me. Other than that, this seems to just be removing some Galera-specific AUTO_INCREMENT handling. I ran the mtr tests for the change on 10.2, 10.3 and 10.6. The result change in innodb.innodb-autoinc looks acceptable.

          I would suggest to test how a Galera cluster behaves when the cluster is partly running this fix, on both Galera 3 (10.2 or 10.3) and Galera 4 (10.4 or later).

          marko Marko Mäkelä added a comment - The InnoDB change looks fine to me. Other than that, this seems to just be removing some Galera-specific AUTO_INCREMENT handling. I ran the mtr tests for the change on 10.2, 10.3 and 10.6. The result change in innodb.innodb-autoinc looks acceptable. I would suggest to test how a Galera cluster behaves when the cluster is partly running this fix, on both Galera 3 (10.2 or 10.3) and Galera 4 (10.4 or later).
          sysprg Julius Goryavsky added a comment - Fixed, commit for 10.2 branch: https://github.com/MariaDB/server/commit/7345d37141899ad0575814465a1b90d87aa4f363 Reference commit for merging with 10.4-10.6 branches: https://github.com/MariaDB/server/commit/151ed4bce4f39f21bf7c36afff74e6ddecc071b4

          People

            sysprg Julius Goryavsky
            sysprg Julius Goryavsky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.