summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-29 09:05:15 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-29 09:05:15 +0300
commit0632b8034b08c88176dc7db12ba53df04edd9300 (patch)
tree5047cc21a5cab2318bd8421f85f56b3e201ddd4a /extra
parent503fd2115bdc79f0b005917e058855411fdeb691 (diff)
parent1fbdcada73c1861b85080eede95140296d6a3c20 (diff)
downloadmariadb-git-0632b8034b08c88176dc7db12ba53df04edd9300.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_mysql.cc88
1 files changed, 50 insertions, 38 deletions
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index 0e51068c372..e008b2352a7 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -884,54 +884,66 @@ Function acquires either a backup tables lock, if supported
by the server, or a global read lock (FLUSH TABLES WITH READ LOCK)
otherwise.
@returns true if lock acquired */
-bool
-lock_tables(MYSQL *connection)
+bool lock_tables(MYSQL *connection)
{
- if (have_lock_wait_timeout) {
- /* Set the maximum supported session value for
- lock_wait_timeout to prevent unnecessary timeouts when the
- global value is changed from the default */
- xb_mysql_query(connection,
- "SET SESSION lock_wait_timeout=31536000", false);
- }
-
- if (have_backup_locks) {
- msg("Executing LOCK TABLES FOR BACKUP...");
- xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
- return(true);
- }
+ if (have_lock_wait_timeout || opt_lock_wait_timeout)
+ {
+ char buf[FN_REFLEN];
+ /* Set the maximum supported session value for
+ lock_wait_timeout if opt_lock_wait_timeout is not set to prevent
+ unnecessary timeouts when the global value is changed from the default */
+ snprintf(buf, sizeof(buf), "SET SESSION lock_wait_timeout=%u",
+ opt_lock_wait_timeout ? opt_lock_wait_timeout : 31536000);
+ xb_mysql_query(connection, buf, false);
+ }
- if (opt_lock_wait_timeout) {
- if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
- opt_lock_wait_threshold)) {
- return(false);
- }
- }
+ if (have_backup_locks)
+ {
+ msg("Executing LOCK TABLES FOR BACKUP...");
+ xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
+ return (true);
+ }
- msg("Acquiring BACKUP LOCKS...");
+ if (opt_lock_wait_timeout)
+ {
+ if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
+ opt_lock_wait_threshold))
+ {
+ return (false);
+ }
+ }
- if (opt_kill_long_queries_timeout) {
- start_query_killer();
- }
+ msg("Acquiring BACKUP LOCKS...");
- if (have_galera_enabled) {
- xb_mysql_query(connection,
- "SET SESSION wsrep_causal_reads=0", false);
- }
+ if (opt_kill_long_queries_timeout)
+ {
+ start_query_killer();
+ }
- xb_mysql_query(connection, "BACKUP STAGE START", true);
- //xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
- //xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
- xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
+ if (have_galera_enabled)
+ {
+ xb_mysql_query(connection, "SET SESSION wsrep_causal_reads=0", false);
+ }
- if (opt_kill_long_queries_timeout) {
- stop_query_killer();
- }
+ xb_mysql_query(connection, "BACKUP STAGE START", true);
+ // xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
+ // xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
+ xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
+ /* Set the maximum supported session value for
+ lock_wait_timeout to prevent unnecessary timeouts when the
+ global value is changed from the default */
+ if (opt_lock_wait_timeout)
+ xb_mysql_query(connection, "SET SESSION lock_wait_timeout=31536000",
+ false);
+
+ if (opt_kill_long_queries_timeout)
+ {
+ stop_query_killer();
+ }
- return(true);
+ return (true);
}
-
/*********************************************************************//**
If backup locks are used, execute LOCK BINLOG FOR BACKUP provided that we are
not in the --no-lock mode and the lock has not been acquired already.