In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
syntax
select master_pos_wait(file, pos[, timeout]).
File and pos are the corresponding master library values, which can be obtained by showing master status.
Timeout is the number of seconds to wait. 0, immediately returns the result. If the time is specified, but the position has been reached, it will return immediately. That is, wait for the event to take effect until the slave library does not reach the specified position.
This function is mainly used to check whether the slave library has been executed to the specified binlog position on the master library.
Master Library View
mysql> show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 51635123 |
+------------------+-----------+
1 row in set (0.00 sec)
Executing from Library:
mysql> SELECT MASTER_POS_WAIT(' mysql-bin.000001', 51635123,60);
+--------------------------------------------------+
| MASTER_POS_WAIT('mysql-bin.000001', 51635123,60) |
+--------------------------------------------------+
| 0 |
+--------------------------------------------------+
1 row in set (0.00 sec)
A return value of 0 indicates that the data at position mysql-bin.000001 51635123 has been applied from the library.
Add 1 to the pos value
mysql> SELECT MASTER_POS_WAIT('mysql-bin.000001', 51635124);
They wait and do not return results.
After the main library executes a transaction, pos must exceed 51635124, and the result 1 is returned after the application from the library, as follows:
+-----------------------------------------------+
| MASTER_POS_WAIT('mysql-bin.000001', 51635124) |
+-----------------------------------------------+
| 1 |
+-----------------------------------------------+
1 row in set (50.66 sec)
From library pos+1, this time the specified time is 5, 5 seconds later does not reach, return-1
mysql> SELECT MASTER_POS_WAIT('mysql-bin.000001', 51635390,5);
+-------------------------------------------------+
| MASTER_POS_WAIT('mysql-bin.000001', 51635390,5) |
+-------------------------------------------------+
| -1 |
+-------------------------------------------------+
1 row in set (5.00 sec)
Execute stop slave sql_thread from the library; returns null
mysql> SELECT MASTER_POS_WAIT('mysql-bin.000001', 51635390,60);
+--------------------------------------------------+
| MASTER_POS_WAIT('mysql-bin.000001', 51635390,60) |
+--------------------------------------------------+
| NULL |
+--------------------------------------------------+
1 row in set (2.32 sec)
Zhengzhou infertility hospital: jbk.39.net/yiyuanzaixian/zztjyy/
Action
Return
Whether or not a specified time is reached
0
within specified time
1
Not reached within specified time
-1
stop slave sql_thread;
NULL
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.