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

slow master shutdown to ensure slaves have received all its event

Details

    Description

      When master server shuts down its slaves stop receiving events from it at random
      point in terms of replication event count (such as GTID), specifically it's not guaranteed
      that all the replication events have been sent to a slave. Therefore such slave can't
      be automatically promoted to master.

      It must be feasible how to defer critical shutdown operation until after all/some of the currently connected slaves have received the last event from the master binlog. When client connections are closed, so no more data are generated for replication, the fact of sending (even better - receiving) of the last event should release the final phase of shutdown.
      Such slow way stopped master is guaranteed to have an up-to-date slave that was fed with the last master binlog event.

      Attachments

        Issue Links

          Activity

            Hi Elkin,

            The server process isn't killed in the case that I'm talking about. It's shutdown gracefully by the system, similar to how it would be if someone rebooted their database server like this:

            shutdown -r now
            

            The server process would be gracefully shutdown with systemd.

            GeoffMontee Geoff Montee (Inactive) added a comment - Hi Elkin , The server process isn't killed in the case that I'm talking about. It's shutdown gracefully by the system, similar to how it would be if someone rebooted their database server like this: shutdown -r now The server process would be gracefully shutdown with systemd.
            Elkin Andrei Elkin added a comment -

            GeoffMontee does this specific container shutdown have any hook where mysqladmin could run?

            Elkin Andrei Elkin added a comment - GeoffMontee does this specific container shutdown have any hook where mysqladmin could run?

            Hi Elkin,

            He said that they can use kubernetes PreStop hook:

            https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/

            So he is OK with the non-safe shutdown being the default behavior.

            GeoffMontee Geoff Montee (Inactive) added a comment - Hi Elkin , He said that they can use kubernetes PreStop hook: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ So he is OK with the non-safe shutdown being the default behavior.
            Elkin Andrei Elkin added a comment -

            Pushed 3568427d11f to 10.4.4.

            Elkin Andrei Elkin added a comment - Pushed 3568427d11f to 10.4.4.
            GeoffMontee Geoff Montee (Inactive) added a comment - I just documented this behavior: https://mariadb.com/kb/en/library/replication-threads/#binary-log-dump-threads-and-the-shutdown-process

            People

              Elkin Andrei Elkin
              Elkin Andrei Elkin
              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.