W3cubDocs

/MariaDB

MASTER_POS_WAIT

MariaDB starting with 10.0.9

MASTER_POS_WAIT was introduced in MariaDB 10.0.9.

Syntax

MASTER_POS_WAIT(log_name,log_pos[,timeout,["connection_name"]])

Description

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

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 connection_name is used when you are using multi-source-replication. If you don't specify it, it's set to the value of the default_master_connection system variable.

Statements using the MASTER_POS_WAIT() function are not safe for replication.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/master_pos_wait/