Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Last active April 13, 2017 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoku0825/cf407f2d10ff27a04ff2f50fe16ddfa7 to your computer and use it in GitHub Desktop.
Save yoku0825/cf407f2d10ff27a04ff2f50fe16ddfa7 to your computer and use it in GitHub Desktop.
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);
}
@yoku0825
Copy link
Author

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