diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index bad789479b2..592ef9ae3d4 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -26,6 +26,7 @@ #include <hash.h> #include <time.h> #include <ft_global.h> +#include "slave.h" // for wait_for_master_pos /* return TRUE if item is a constant */ @@ -1388,6 +1389,28 @@ void item_user_lock_release(ULL *ull) } /* + Wait until we are at or past the given position in the master binlog + on the slave + */ + +longlong Item_master_pos_wait::val_int() +{ + THD* thd = current_thd; + String *log_name = args[0]->val_str(&value); + int event_count; + + if(thd->slave_thread || !log_name || !log_name->length()) + { + null_value = 1; + return 0; + } + ulong pos = (ulong)args[1]->val_int(); + if((event_count = glob_mi.wait_for_pos(thd, log_name, pos)) == -1) + null_value = 1;; + return event_count; +} + +/* Get a user level lock. If the thread has an old lock this is first released. Returns 1: Got lock Returns 0: Timeout |