Syntax:
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(gtid_set[, timeout][,channel])

WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() is similar to
WAIT_FOR_EXECUTED_GTID_SET() in that it waits until all of the
transactions whose global transaction identifiers are contained in
gtid_set have been applied, or until timeout seconds have elapsed,
whichever occurs first. However, WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()
applies to a specific replication channel, and stops only after the
transactions have been applied on the specified channel, for which the
applier must be running. In contrast, WAIT_FOR_EXECUTED_GTID_SET()
stops after the transactions have been applied, regardless of where
they were applied (on any replication channel or any user client), and
whether or not any replication channels are running.

The channel option names which replication channel the function applies
to. If no channel is named and no channels other than the default
replication channel exist, the function applies to the default
replication channel. If multiple replication channels exist, you must
specify a channel as otherwise it is not known which replication
channel the function applies to. See
https://dev.mysql.com/doc/refman/5.7/en/replication-channels.html for
more information on replication channels.

*Note*:

Because WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() applies to a specific
replication channel, if an expected transaction arrives on a different
replication channel or from a user client, for example in a failover or
manual recovery situation, the function can hang indefinitely if no
timeout is set. Use WAIT_FOR_EXECUTED_GTID_SET() instead to ensure
correct handling of transactions in these situations.

GTID sets used with WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() are represented
as strings and must be quoted in the same way as for
WAIT_FOR_EXECUTED_GTID_SET(). For WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(),
the return value for the function is an arbitrary positive number. If
GTID-based replication is not active (that is, if the value of the
gtid_mode variable is OFF), then this value is undefined and
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() returns NULL. If the replica is not
running then the function also returns NULL.

gtid_mode cannot be changed to OFF while any client is using this
function to wait for GTIDs to be applied.

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

