Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ADD get_lock into xtrabackup
*** storage/innobase/xtrabackup/src/backup_mysql.cc.orig 2017-02-27 16:47:06.000000000 +0900
--- storage/innobase/xtrabackup/src/backup_mysql.cc 2017-04-13 14:44:07.149003517 +0900
***************
*** 162,167 ****
--- 162,169 ----
xb_mysql_query(connection, "SET SESSION wait_timeout=2147483",
false, true);
+ xb_mysql_query(connection, "SELECT get_lock('xtrabackup', @@wait_timeout)",
+ false, true);
return(connection);
}
***************
*** 1697,1702 ****
--- 1699,1706 ----
free(uuid);
free(server_version);
+ xb_mysql_query(connection, "SELECT release_lock('xtrabackup')",
+ false, false);
return(true);
}
Owner

yoku0825 commented Apr 13, 2017

mysql57> SELECT is_used_lock('xtrabackup');
+----------------------------+
| is_used_lock('xtrabackup') |
+----------------------------+
|                         22 |
+----------------------------+
1 row in set (0.00 sec)

mysql57> show processlist;
+----+------+-----------+------+---------+------+----------+------------------+
| Id | User | Host      | db   | Command | Time | State    | Info             |
+----+------+-----------+------+---------+------+----------+------------------+
| 22 | root | localhost | NULL | Sleep   |   63 |          | NULL             |
| 23 | root | localhost | NULL | Query   |    0 | starting | show processlist |
+----+------+-----------+------+---------+------+----------+------------------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment