MariaDB GTID current_pos vs slave_pos





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















In a standard master-slave setup using MariaDB (10.3 at this time) and GTID (Global Transaction ID), it is unclear wether to use current_pos or slave_pos.



Reminder from the documentation:





  • Using the value current_pos causes the slave to set its position based on the gtid_current_pos system variable. The slave takes the position given to it by the master server.

  • Using the value slave_pos causes the slave to instead use the gtid_slave_pos system variable. With this method, the slave takes into account transactions present in its own Binary Log.




I think I understand the difference but what is the recommended option?



To the extent that both exist, one might be better for one use case and the other for another use case but the documentation does not clearly state which one should be used in which case...



Which of these options would you use for a very common case of master-slave replication?



EDIT 2019-01-18: Context



The context that led me to ask myself whether I should use current_pos or slave_pos:



I recently upgraded some MariaDB clusters (master-slave setups) from MariaDB 10.1 or 10.2 to MariaDB 10.3 on Debian Stretch, using APT.



In practice, I always proceed like this:




  1. Upgrade slave(s) to 10.3 (using an apt dist-upgrade)

  2. Run mysql_upgrade

  3. Switchover master (using Signal18 Replication-manager)

  4. Upgrade the old master (that became a slave at the previous step)

  5. Switchover master again to return to the original configuration


However, during recent updates, I encountered some failures at Slave Start after running a mysql_upgrade command. It did not found binlogs using GTID current position.



This happens, I believe, when there has be No transaction on the master since the last master switchover. In this case, switching GTID mode from current_pos to slave_pos fix the problem...



Then, should I definitely use slave_pos? However, even in this case, Replication-Manager forces GTID mode to current_pos after a switchover...










share|improve this question




















  • 1





    What is the context of deciding between these?

    – Rick James
    Jan 14 at 17:25


















0















In a standard master-slave setup using MariaDB (10.3 at this time) and GTID (Global Transaction ID), it is unclear wether to use current_pos or slave_pos.



Reminder from the documentation:





  • Using the value current_pos causes the slave to set its position based on the gtid_current_pos system variable. The slave takes the position given to it by the master server.

  • Using the value slave_pos causes the slave to instead use the gtid_slave_pos system variable. With this method, the slave takes into account transactions present in its own Binary Log.




I think I understand the difference but what is the recommended option?



To the extent that both exist, one might be better for one use case and the other for another use case but the documentation does not clearly state which one should be used in which case...



Which of these options would you use for a very common case of master-slave replication?



EDIT 2019-01-18: Context



The context that led me to ask myself whether I should use current_pos or slave_pos:



I recently upgraded some MariaDB clusters (master-slave setups) from MariaDB 10.1 or 10.2 to MariaDB 10.3 on Debian Stretch, using APT.



In practice, I always proceed like this:




  1. Upgrade slave(s) to 10.3 (using an apt dist-upgrade)

  2. Run mysql_upgrade

  3. Switchover master (using Signal18 Replication-manager)

  4. Upgrade the old master (that became a slave at the previous step)

  5. Switchover master again to return to the original configuration


However, during recent updates, I encountered some failures at Slave Start after running a mysql_upgrade command. It did not found binlogs using GTID current position.



This happens, I believe, when there has be No transaction on the master since the last master switchover. In this case, switching GTID mode from current_pos to slave_pos fix the problem...



Then, should I definitely use slave_pos? However, even in this case, Replication-Manager forces GTID mode to current_pos after a switchover...










share|improve this question




















  • 1





    What is the context of deciding between these?

    – Rick James
    Jan 14 at 17:25














0












0








0








In a standard master-slave setup using MariaDB (10.3 at this time) and GTID (Global Transaction ID), it is unclear wether to use current_pos or slave_pos.



Reminder from the documentation:





  • Using the value current_pos causes the slave to set its position based on the gtid_current_pos system variable. The slave takes the position given to it by the master server.

  • Using the value slave_pos causes the slave to instead use the gtid_slave_pos system variable. With this method, the slave takes into account transactions present in its own Binary Log.




I think I understand the difference but what is the recommended option?



To the extent that both exist, one might be better for one use case and the other for another use case but the documentation does not clearly state which one should be used in which case...



Which of these options would you use for a very common case of master-slave replication?



EDIT 2019-01-18: Context



The context that led me to ask myself whether I should use current_pos or slave_pos:



I recently upgraded some MariaDB clusters (master-slave setups) from MariaDB 10.1 or 10.2 to MariaDB 10.3 on Debian Stretch, using APT.



In practice, I always proceed like this:




  1. Upgrade slave(s) to 10.3 (using an apt dist-upgrade)

  2. Run mysql_upgrade

  3. Switchover master (using Signal18 Replication-manager)

  4. Upgrade the old master (that became a slave at the previous step)

  5. Switchover master again to return to the original configuration


However, during recent updates, I encountered some failures at Slave Start after running a mysql_upgrade command. It did not found binlogs using GTID current position.



This happens, I believe, when there has be No transaction on the master since the last master switchover. In this case, switching GTID mode from current_pos to slave_pos fix the problem...



Then, should I definitely use slave_pos? However, even in this case, Replication-Manager forces GTID mode to current_pos after a switchover...










share|improve this question
















In a standard master-slave setup using MariaDB (10.3 at this time) and GTID (Global Transaction ID), it is unclear wether to use current_pos or slave_pos.



Reminder from the documentation:





  • Using the value current_pos causes the slave to set its position based on the gtid_current_pos system variable. The slave takes the position given to it by the master server.

  • Using the value slave_pos causes the slave to instead use the gtid_slave_pos system variable. With this method, the slave takes into account transactions present in its own Binary Log.




I think I understand the difference but what is the recommended option?



To the extent that both exist, one might be better for one use case and the other for another use case but the documentation does not clearly state which one should be used in which case...



Which of these options would you use for a very common case of master-slave replication?



EDIT 2019-01-18: Context



The context that led me to ask myself whether I should use current_pos or slave_pos:



I recently upgraded some MariaDB clusters (master-slave setups) from MariaDB 10.1 or 10.2 to MariaDB 10.3 on Debian Stretch, using APT.



In practice, I always proceed like this:




  1. Upgrade slave(s) to 10.3 (using an apt dist-upgrade)

  2. Run mysql_upgrade

  3. Switchover master (using Signal18 Replication-manager)

  4. Upgrade the old master (that became a slave at the previous step)

  5. Switchover master again to return to the original configuration


However, during recent updates, I encountered some failures at Slave Start after running a mysql_upgrade command. It did not found binlogs using GTID current position.



This happens, I believe, when there has be No transaction on the master since the last master switchover. In this case, switching GTID mode from current_pos to slave_pos fix the problem...



Then, should I definitely use slave_pos? However, even in this case, Replication-Manager forces GTID mode to current_pos after a switchover...







replication mariadb gtid






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 16:06







Nicolas Payart

















asked Jan 14 at 10:52









Nicolas PayartNicolas Payart

80031228




80031228








  • 1





    What is the context of deciding between these?

    – Rick James
    Jan 14 at 17:25














  • 1





    What is the context of deciding between these?

    – Rick James
    Jan 14 at 17:25








1




1





What is the context of deciding between these?

– Rick James
Jan 14 at 17:25





What is the context of deciding between these?

– Rick James
Jan 14 at 17:25










1 Answer
1






active

oldest

votes


















0














Use current_pos to switchover master.
Use slave_pos for a regular replication
current_pos - last change in GTID domain
slave_pos - last replicated change applied by SQL thread or parallel workers on the replica.
So, imagine your ordinary replica (node2) switched to a master. slave_pos not incrementing, because changes are applied directly without any replication. Then you need to reconfigure cluster and make the new master become replica again.
What you will see on node2



SHOW global variables like '%pos%'?



you will see, that
slave_pos stopped incrementing on the moment of switchover
current_pos incrementing correctly
In order node2 to become replica you must use current_pos, after the workload switched to a new master.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "182"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f227078%2fmariadb-gtid-current-pos-vs-slave-pos%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use current_pos to switchover master.
    Use slave_pos for a regular replication
    current_pos - last change in GTID domain
    slave_pos - last replicated change applied by SQL thread or parallel workers on the replica.
    So, imagine your ordinary replica (node2) switched to a master. slave_pos not incrementing, because changes are applied directly without any replication. Then you need to reconfigure cluster and make the new master become replica again.
    What you will see on node2



    SHOW global variables like '%pos%'?



    you will see, that
    slave_pos stopped incrementing on the moment of switchover
    current_pos incrementing correctly
    In order node2 to become replica you must use current_pos, after the workload switched to a new master.






    share|improve this answer




























      0














      Use current_pos to switchover master.
      Use slave_pos for a regular replication
      current_pos - last change in GTID domain
      slave_pos - last replicated change applied by SQL thread or parallel workers on the replica.
      So, imagine your ordinary replica (node2) switched to a master. slave_pos not incrementing, because changes are applied directly without any replication. Then you need to reconfigure cluster and make the new master become replica again.
      What you will see on node2



      SHOW global variables like '%pos%'?



      you will see, that
      slave_pos stopped incrementing on the moment of switchover
      current_pos incrementing correctly
      In order node2 to become replica you must use current_pos, after the workload switched to a new master.






      share|improve this answer


























        0












        0








        0







        Use current_pos to switchover master.
        Use slave_pos for a regular replication
        current_pos - last change in GTID domain
        slave_pos - last replicated change applied by SQL thread or parallel workers on the replica.
        So, imagine your ordinary replica (node2) switched to a master. slave_pos not incrementing, because changes are applied directly without any replication. Then you need to reconfigure cluster and make the new master become replica again.
        What you will see on node2



        SHOW global variables like '%pos%'?



        you will see, that
        slave_pos stopped incrementing on the moment of switchover
        current_pos incrementing correctly
        In order node2 to become replica you must use current_pos, after the workload switched to a new master.






        share|improve this answer













        Use current_pos to switchover master.
        Use slave_pos for a regular replication
        current_pos - last change in GTID domain
        slave_pos - last replicated change applied by SQL thread or parallel workers on the replica.
        So, imagine your ordinary replica (node2) switched to a master. slave_pos not incrementing, because changes are applied directly without any replication. Then you need to reconfigure cluster and make the new master become replica again.
        What you will see on node2



        SHOW global variables like '%pos%'?



        you will see, that
        slave_pos stopped incrementing on the moment of switchover
        current_pos incrementing correctly
        In order node2 to become replica you must use current_pos, after the workload switched to a new master.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 28 mins ago









        Ilshat KarazbayevIlshat Karazbayev

        662




        662






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Database Administrators Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f227078%2fmariadb-gtid-current-pos-vs-slave-pos%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL Server 17 - Attemping to backup to remote NAS but Access is denied

            Always On Availability groups resolving state after failover - Remote harden of transaction...

            Restoring from pg_dump with foreign key constraints