server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-21322: report slave progress to the master

Open an3l opened this issue 2 years ago • 3 comments

  • We are trying to extend the command SHOW REPLICA HOSTS that is executed on master, with columns GTID_state_sent and GTID_state_ack. In order to achieve that we have to extend thd->slave_info struct with 2 new entries. This struct needs to be populated and must be accessable to primary.

  • The first column GTID_state_sent:

    • It is populated by the last event that primary has sent to replica (only for semi-sync slave connection, but without need to know that replica actually obtained request, like it is case in asynchronous replication).
    • Primary executes mysql_binlog that first starts the binlog_dump thread. That thread starts ack_receiver thread, that returns second column of interest (in first iteration we don't care about). After binlog_dump thread creating, file is sent with send_one_binlog_file() function. This function is sending event with send_events() function, during which send_event_to_slave() function is executed. On that place we are creating the thd->slave_info->gtid_state_sent struct.
  • The second column GTID_state_ack:

    • It is populated by the reply_packet_binlog (a.k.a. ack) that is called, only for semi-sync replication. It is called on 2 places: a) during binlog_dump creation, after thread is added to ack_reciver and after thread is added as semi-sync slave. This should be first ack received from replica to primary. b) constantly in running phase of ack_receiver thread run().
    • A the end of function reply_packet_binlog we are creating the struct GTID_state_ack
  • Closes PR#1427

an3l avatar Dec 14 '22 09:12 an3l

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 20 '23 10:01 CLAassistant

Hi @bnestere I have created first part of your review (wip patch)- busy replica and there are some questions/problems with tests. Tests are simulating busy replica and I have 2 problems (as stated in commit message, please see the results there).

  1. randomnes of events for test 7 (problem of corrupt_queue_event)
  2. cannot save the result (problem of corrupt_queue_event) Please let me know your opinion about :).

an3l avatar Mar 14 '23 16:03 an3l

Hi Anel!

There are a few comments that are still relevant.

  1. https://github.com/MariaDB/server/pull/2374/files#r1223168309 why did you resolve this?
  2. https://github.com/MariaDB/server/pull/2374/files#r1510014937
  3. https://github.com/MariaDB/server/pull/2374/files#r1195561416

Thank you. Review is addressed with commit https://github.com/MariaDB/server/pull/2374/commits/e53ff4d34486de68d4414e8e9763a9ae8bbf5b28

an3l avatar Mar 31 '24 11:03 an3l