Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mysql-test/r/lock_backup_status.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SHOW GLOBAL STATUS LIKE 'Ongoing_instance_backup_lock';
Variable_name Value
Ongoing_instance_backup_lock 0
LOCK INSTANCE FOR BACKUP;
SHOW GLOBAL STATUS LIKE 'Ongoing_instance_backup_lock';
Variable_name Value
Ongoing_instance_backup_lock 1
10 changes: 10 additions & 0 deletions mysql-test/t/lock_backup_status.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--connect (con1, localhost, root,,)

--connection default
SHOW GLOBAL STATUS LIKE 'Ongoing_instance_backup_lock';

--connection con1
LOCK INSTANCE FOR BACKUP;

--connection default
SHOW GLOBAL STATUS LIKE 'Ongoing_instance_backup_lock';
13 changes: 13 additions & 0 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ The documentation is based on the source files such as:
#include "sql/dd/performance_schema/init.h" // performance_schema::init
#include "sql/dd/upgrade/upgrade.h" // dd::upgrade::in_progress
#include "sql/srv_session.h"
#include "sql/sql_backup_lock.h"

using std::max;
using std::min;
Expand Down Expand Up @@ -8271,6 +8272,16 @@ static int show_slave_open_temp_tables(THD *, SHOW_VAR *var, char *buf) {
return 0;
}

static int show_is_instance_backup_locked(THD *thd, SHOW_VAR *var, char *buf) {
var->type = SHOW_INT;
var->value = buf;
Is_instance_backup_locked_result *value =
reinterpret_cast<Is_instance_backup_locked_result *>(buf);
*value = static_cast<Is_instance_backup_locked_result>
(is_instance_backup_locked(thd));
return 0;
}

/*
Variables shown by SHOW STATUS in alphabetical order
*/
Expand Down Expand Up @@ -8426,6 +8437,8 @@ SHOW_VAR status_vars[] = {
SHOW_FUNC, SHOW_SCOPE_GLOBAL},
{"Not_flushed_delayed_rows", (char *)&delayed_rows_in_use,
SHOW_LONG_NOFLUSH, SHOW_SCOPE_GLOBAL},
{"Ongoing_instance_backup_lock", (char *)&show_is_instance_backup_locked,
SHOW_FUNC, SHOW_SCOPE_GLOBAL},
{"Open_files", (char *)&my_file_opened, SHOW_LONG_NOFLUSH,
SHOW_SCOPE_GLOBAL},
{"Open_streams", (char *)&my_stream_opened, SHOW_LONG_NOFLUSH,
Expand Down