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

Ensure that creation and usage of temporary tables in replication is predictable

Details

    Description

      In some context, temporary tables on the master and slave can become inconsistent.
      One example if a temporary table is updated with the value of a non deterministic function
      like UUID(), in which the change is never sent to the slave.
      In some other context while using MIXED mode, all changes will be logged in ROW mode while the user has any active temporary tables even if the temporary tables is not used
      in the query. This depends on in which format some previous independent commands where logged.

      There are many other pitfalls with logging temporary table to the slave, which is why
      we are changing that, by default, temporary tables are only created on the slave if the master is using binlog_format=STATEMENT.

      The new deterministic rules for logging of temporary tables are:

      • STATEMENT binlog format is used. If it is binlogged, 1 is stored in
        TABLE_SHARE->table_creation_was_logged. The user can change this
        behavior by setting create_temporary_table_binlog_formats to
        MIXED,STATEMENT in which case the create is logged in statement
        format also in MIXED mode (as before).
      • Changes to temporary tables are only binlogged if and only if
        the CREATE was logged. The logging happens under STATEMENT or MIXED.
        If binlog_format=ROW, temporary table changes are not binlogged. A
        temporary table that are changed under ROW are marked as 'not up to
        date in binlog' and no future row changes are logged. Any usage of
        this temporary table will force row logging of other tables in any
        future statements using the temporary table to be row logged.
      • DROP TEMPORARY is binlogged only of the CREATE was binlogged.

      Attachments

        Issue Links

          Activity

            knielsen Kristian Nielsen added a comment - Reviewed here: https://lists.mariadb.org/hyperkitty/list/developers@lists.mariadb.org/thread/FYUBPO3CD3SGKKJATAHOJTZ2EB3GAHUV/

            Hi susil.behera,

            This is ready to be tested; I'm hoping we can work on it together. I've begun writing a test plan (link), that I'm hoping you can take to completion, and then we can divvy out the test cases each of us will be responsible for.

            bnestere Brandon Nesterenko added a comment - Hi susil.behera , This is ready to be tested; I'm hoping we can work on it together. I've begun writing a test plan ( link ), that I'm hoping you can take to completion, and then we can divvy out the test cases each of us will be responsible for.

            People

              susil.behera Susil Behera
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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