Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-4843

Add relay_master_log_file and exec_master_log_position channel properties to the p_s.log_status

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 8.0.x, Not 5.6.x, Not 5.7.x
    • Fix Version/s: 8.0.12-2rc1
    • Component/s: None
    • Labels:
      None

      Description

      Why

      Consistent state of the MySQL binary log and storage engines can be obtained by querying the p_s.log_status table. It provides the following information:

      • InnoDB's current LSN
      • current binary log filename and position along with the executed GTID set
      • replication info for each channel:
        • channel name
        • relay log name
        • relay log position

      This information is sufficient to provision new slave from the backup taken from the master.

      There are cases when we need to provision the new slave from the backup taken from another slave.

      When GTID mode is ON and the slave is using auto-positioning, all we need to do is to set gtid_purged (executed GTID set from log_status), point the new slave to the same master, and enable auto-positioning.

      When GTID mode is OFF or auto-positioning is disabled, we need to save the current master binary log file and the position in it to which the SQL thread has read and executed.

      With PS 5.7 xtrabackup did the following:

      1. LOCK BINLOG FOR BACKUP
      2. if -slave-info is specified run SHOW SLAVE STATUS, save Relay_Master_Log_File, Exec_Master_Log_Pos for each replication channel
      3. run SHOW MASTER STATUS, save current binary log file name, position and executed GTID set
      4. stop InnoDB log copying
      5. UNLOCK BINLOG

      With PS 8.0 xtrabackup will:

      1. query p_s.log_status, save current binary log file name, position, executed GTID set and LSN
      2. stop InnoDB log copying at LSN taken at previous step

      However p_s.log_status lacks Relay_Master_Log_File and Exec_Master_Log_Pos and xtrabackup will have to fallback to FTWRL when -slave-info is specified.

      This feature will be useful. It seems easy to implement as well. By briefly looking at the log_resource.cc and comparing it with the show_slave_status_send_data in the rpl_slave.cc I found that we just need to take additional lock (mi->rli->data_lock) and serialize mi->rli->get_group_master_log_pos() and mi->rli->get_group_master_log_name() into JSON.

      High level description:

      REPLICATION field of the p_s.log_status is a JSON array which looks like following:

      {
        "channels": [
          {
            "channel_name": "",
            "relay_log_file": "mysql-relay-bin.000003",
            "relay_log_position": 2523
          }
        ]
      }
      

      relay_master_log_file and exec_master_log_position properties will be added to each channel and it will look like:

      {
        "channels": [
          {
            "channel_name": "",
            "relay_log_file": "mysql-relay-bin.000003",
            "relay_log_position": 2523
            "relay_master_log_file": "mysql-bin.000002",
            "exec_master_log_position": 2346
          }
        ]
      }
      

      These properties will have the same meaning as the Relay_Master_Log_File and Exec_Master_Log_Pos fields of the SHOW SLAVE STATUS.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sergei.glushchenko Sergei Glushchenko (Inactive)
              Reporter:
              sergei.glushchenko Sergei Glushchenko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day
                  1d

                    Smart Checklist