Syntax:
MASTER_POS_WAIT(log_name,log_pos[,timeout][,channel])

This function is useful for control of source/replica synchronization.
It blocks until the replica has read and applied all updates up to the
specified position in the source log. The return value is the number of
log events the replica had to wait for to advance to the specified
position. The function returns NULL if the replica SQL thread is not
started, the replica's source information is not initialized, the
arguments are incorrect, or an error occurs. It returns -1 if the
timeout has been exceeded. If the replica SQL thread stops while
MASTER_POS_WAIT() is waiting, the function returns NULL. If the replica
is past the specified position, the function returns immediately.

On a multithreaded replica, the function waits until expiry of the
limit set by the slave_checkpoint_group or slave_checkpoint_period
system variable, when the checkpoint operation is called to update the
status of the replica. Depending on the setting for the system
variables, the function might therefore return some time after the
specified position was reached.

If a timeout value is specified, MASTER_POS_WAIT() stops waiting when
timeout seconds have elapsed. timeout must be greater than 0; a zero or
negative timeout means no timeout.

The optional channel value enables you to name which replication
channel the function applies to. See
https://dev.mysql.com/doc/refman/5.7/en/replication-channels.html for
more information.

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

