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

UPSERT during ALTER-TABLE results in 'Duplicate entry' error for alter

Details

    Description

      I have a master that very frequently executes INSERT ON DUPLICATE KEY UPDATE. On a slave I executed ALTER TABLE xx row_format=COMPRESSED;, however this resulted in an error (the specific key is a UNIQUE) from the ALTER statement, which did not succeed:

      ERROR 1062 (23000): Duplicate entry 'xxx-xxx' for key 'xxx'

      I assume this is because it received an UPSERT while it was altering the table. I think this shouldn't happen as the alter-table should have a lock on the table.

      Attachments

        Issue Links

          Activity

            thiru, I hope that you can complete my prototype. I believe that fixing this may simplify the MDEV-26294 fix in the case that row_log_apply() completed but the ALTER TABLE operation was not committed yet (because the SQL layer is waiting for MDL_EXCLUSIVE, which is blocked by concurrent DML transactions).

            marko Marko Mäkelä added a comment - thiru , I hope that you can complete my prototype. I believe that fixing this may simplify the MDEV-26294 fix in the case that row_log_apply() completed but the ALTER TABLE operation was not committed yet (because the SQL layer is waiting for MDL_EXCLUSIVE , which is blocked by concurrent DML transactions).

            I posted the first batch of review comments. I did not yet thoroughly check all the new code in trx_t::apply_log(), especially the trx_undo_rec_info. Some source code comments would be very helpful in that area.

            marko Marko Mäkelä added a comment - I posted the first batch of review comments . I did not yet thoroughly check all the new code in trx_t::apply_log() , especially the trx_undo_rec_info . Some source code comments would be very helpful in that area.
            • Addressed all review comments.
            thiru Thirunarayanan Balathandayuthapani added a comment - Addressed all review comments.

            Code coverage analysis looks better now. This is OK to push after a final round of testing by mleich.

            marko Marko Mäkelä added a comment - Code coverage analysis looks better now. This is OK to push after a final round of testing by mleich .

            origin/bb-10.6-MDEV-15250 f9c152c9f6b770961cdd8467ce05548347812ed8 2022-04-22T18:15:48+05:30
            behaved well in RQG testing. The bad effects observed are known and in the main trees too.

            mleich Matthias Leich added a comment - origin/bb-10.6- MDEV-15250 f9c152c9f6b770961cdd8467ce05548347812ed8 2022-04-22T18:15:48+05:30 behaved well in RQG testing. The bad effects observed are known and in the main trees too.

            People

              thiru Thirunarayanan Balathandayuthapani
              sjon sjon
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.