Syntax:
WAIT_FOR_EXECUTED_GTID_SET(gtid_set[, timeout])

Wait until the server has applied all of the transactions whose global
transaction identifiers are contained in gtid_set; that is, until the
condition GTID_SUBSET(gtid_subset, @@GLOBAL.gtid_executed) holds. See
https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html
for a definition of GTID sets.

If a timeout is specified, and timeout seconds elapse before all of the
transactions in the GTID set have been applied, the function stops
waiting. timeout is optional, and the default timeout is 0 seconds, in
which case the function always waits until all of the transactions in
the GTID set have been applied.

WAIT_FOR_EXECUTED_GTID_SET() monitors all the GTIDs that are applied on
the server, including transactions that arrive from all replication
channels and user clients. It does not take into account whether
replication channels have been started or stopped.

For more information, see
https://dev.mysql.com/doc/refman/5.7/en/replication-gtids.html.

URL: https://dev.mysql.com/doc/refman/5.7/en/gtid-functions.html

