All pages
Powered by GitBook
1 of 1

Loading...

MASTER_POS_WAIT

Wait for a replica to reach a log position. This function blocks until the replica has read and applied updates up to a specified position in the master's binary log.

Syntax

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

Description

This function is useful in replication for controlling primary/replica synchronization. It blocks until the replica has read and applied all updates up to the specified position (log_name,log_pos) in the primary 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 primary 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 whileMASTER_POS_WAIT() is waiting, the function returns NULL. If the replica 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 . If you don't specify it, it's set to the value of the system variable.

Statements using the MASTER_POS_WAIT() function are not .

This page is licensed: GPLv2, originally from

multi-source-replication
default_master_connection
safe for statement-based replication
fill_help_tables.sql