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

[PATCH] mysqldump --dump-slave=2 --master-data=2 doesn't record both

Details

    Description

      from

      /usr/bin/mysqldump -u backup  --all-databases --extended-insert --dump-slave=2 --master-data=2 --include-master-host-port --single-transaction --no-data

      only the following replication position was recorded.

      -- CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=4041, MASTER_LOG_FILE='mariadb-bin.000047', MASTER_LOG_POS=31738774;

      Its useful too have both since in a backup scenario its unknown whether the dump is going to be use used to replace the master or configured as the new slave.

      Attachments

        Issue Links

          Activity

            danblack Daniel Black created issue -
            danblack Daniel Black made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            Labels replication replication upstream

            Hi Daniel,

            I agree, nothing in documentation suggests that these options are mutually exclusive, and comments in the code also don't explain why it's done this way, they only mention preserving master logs, but it's irrelevant to master_data:

            /* We don't delete master logs if slave data option */
            if (opt_slave_data)

            { opt_lock_all_tables= !opt_single_transaction; opt_master_data= 0; opt_delete_master_logs= 0; }

            if (opt_master_data)

            { opt_lock_all_tables= !opt_single_transaction; opt_slave_data= 0; }

            The fix is primitive unless there is a secret reason why it was done this way:

            === modified file 'client/mysqldump.c'
            — client/mysqldump.c 2013-04-12 08:48:21 +0000
            +++ client/mysqldump.c 2013-07-30 11:17:22 +0000
            @@ -950,7 +950,6 @@
            if (opt_slave_data)

            { opt_lock_all_tables= !opt_single_transaction; - opt_master_data= 0; opt_delete_master_logs= 0; }

            @@ -966,7 +965,6 @@
            if (opt_master_data)

            { opt_lock_all_tables= !opt_single_transaction; - opt_slave_data= 0; }

            if (opt_single_transaction || opt_lock_all_tables)
            lock_tables= 0;

            However, since it comes from upstream, it would be good to (try to) get it fixed there. Are you willing to file a bug at bugs.mysql.com? I can do it on your behalf, but yours might have a better chance, besides it will be easier for you to track.

            elenst Elena Stepanova added a comment - Hi Daniel, I agree, nothing in documentation suggests that these options are mutually exclusive, and comments in the code also don't explain why it's done this way, they only mention preserving master logs, but it's irrelevant to master_data: /* We don't delete master logs if slave data option */ if (opt_slave_data) { opt_lock_all_tables= !opt_single_transaction; opt_master_data= 0; opt_delete_master_logs= 0; } if (opt_master_data) { opt_lock_all_tables= !opt_single_transaction; opt_slave_data= 0; } The fix is primitive unless there is a secret reason why it was done this way: === modified file 'client/mysqldump.c' — client/mysqldump.c 2013-04-12 08:48:21 +0000 +++ client/mysqldump.c 2013-07-30 11:17:22 +0000 @@ -950,7 +950,6 @@ if (opt_slave_data) { opt_lock_all_tables= !opt_single_transaction; - opt_master_data= 0; opt_delete_master_logs= 0; } @@ -966,7 +965,6 @@ if (opt_master_data) { opt_lock_all_tables= !opt_single_transaction; - opt_slave_data= 0; } if (opt_single_transaction || opt_lock_all_tables) lock_tables= 0; However, since it comes from upstream, it would be good to (try to) get it fixed there. Are you willing to file a bug at bugs.mysql.com? I can do it on your behalf, but yours might have a better chance, besides it will be easier for you to track.
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ]
            danblack Daniel Black added a comment -

            ok. Thanks for the analysis - logged http://bugs.mysql.com/bug.php?id=69875

            danblack Daniel Black added a comment - ok. Thanks for the analysis - logged http://bugs.mysql.com/bug.php?id=69875
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ]
            serg Sergei Golubchik made changes -
            Description from /usr/bin/mysqldump -u backup --all-databases --extended-insert --dump-slave=2 --master-data=2 --include-master-host-port --single-transaction --no-data

             only the following replication position was recorded.

            -- CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=4041, MASTER_LOG_FILE='mariadb-bin.000047', MASTER_LOG_POS=31738774;

            Its useful too have both since in a backup scenario its unknown whether the dump is going to be use used to replace the master or configured as the new slave.
            from
            {noformat}
            /usr/bin/mysqldump -u backup --all-databases --extended-insert --dump-slave=2 --master-data=2 --include-master-host-port --single-transaction --no-data
            {noformat}
             only the following replication position was recorded.
            {noformat}
            -- CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=4041, MASTER_LOG_FILE='mariadb-bin.000047', MASTER_LOG_POS=31738774;
            {noformat}
            Its useful too have both since in a backup scenario its unknown whether the dump is going to be use used to replace the master or configured as the new slave.
            serg Sergei Golubchik made changes -
            Workflow defaullt [ 28305 ] MariaDB v2 [ 43967 ]
            danblack Daniel Black made changes -
            Summary mysqldump --dump-slave=2 --master-data=2 doesn't record both [PATCH] mysqldump --dump-slave=2 --master-data=2 doesn't record both
            elenst Elena Stepanova made changes -
            Component/s OTHER [ 10125 ]
            Fix Version/s 10.0 [ 16000 ]
            Affects Version/s 5.5 [ 15800 ]
            Labels replication upstream replication upstream verified
            elenst Elena Stepanova made changes -
            Labels replication upstream verified patch replication upstream verified
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 43967 ] MariaDB v3 [ 62044 ]
            danblack Daniel Black made changes -
            Labels patch replication upstream verified beginner-friendly patch replication upstream verified
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 62044 ] MariaDB v4 [ 139526 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.0 [ 16000 ]
            Kurt Ding kurt.ding added a comment - - edited

            Ok, I check the mysql code in branch 8.0 , but slave data and master data is still exclusive. So this suggested patch is not included.

            Kurt Ding kurt.ding added a comment - - edited Ok, I check the mysql code in branch 8.0 , but slave data and master data is still exclusive. So this suggested patch is not included.
            Kurt Ding kurt.ding added a comment -

            In my opinion , when a user uses mysqldump, he need to know which role the machine is basiclly . And he still can manually STOP SLAVE SQL_THREAD or STOP SLAVE;

            Kurt Ding kurt.ding added a comment - In my opinion , when a user uses mysqldump, he need to know which role the machine is basiclly . And he still can manually STOP SLAVE SQL_THREAD or STOP SLAVE;
            danblack Daniel Black made changes -
            Fix Version/s 10.4 [ 22408 ]
            danblack Daniel Black made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            danblack Daniel Black made changes -
            Assignee Daniel Black [ danblack ]
            danblack Daniel Black added a comment -

            Can I get a review on https://github.com/MariaDB/server/pull/2701 please?

            danblack Daniel Black added a comment - Can I get a review on https://github.com/MariaDB/server/pull/2701 please?
            danblack Daniel Black made changes -
            Assignee Daniel Black [ danblack ] Brandon Nesterenko [ JIRAUSER48702 ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            anel Anel Husakovic made changes -

            Hi Daniel! I left a comment on the PR for your consideration.

            bnestere Brandon Nesterenko added a comment - Hi Daniel! I left a comment on the PR for your consideration.
            bnestere Brandon Nesterenko made changes -
            Assignee Brandon Nesterenko [ JIRAUSER48702 ] Daniel Black [ danblack ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            danblack Daniel Black made changes -
            Assignee Daniel Black [ danblack ] Anel Husakovic [ anel ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            anel Anel Husakovic made changes -
            Assignee Anel Husakovic [ anel ] Daniel Black [ danblack ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            danblack Daniel Black made changes -
            issue.field.resolutiondate 2024-02-08 04:47:43.0 2024-02-08 04:47:43.462
            danblack Daniel Black made changes -
            Component/s Scripts & Clients [ 11002 ]
            Component/s OTHER [ 10125 ]
            Fix Version/s 10.5.25 [ 29626 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.6.18 [ 29627 ]
            Fix Version/s 10.11.8 [ 29630 ]
            Fix Version/s 11.0.6 [ 29628 ]
            Fix Version/s 11.1.5 [ 29629 ]
            Fix Version/s 11.2.4 [ 29631 ]
            Fix Version/s 11.3.3 [ 29632 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.3.3 [ 29632 ]

            People

              danblack Daniel Black
              danblack Daniel Black
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.