mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Added syntax and implementation for BACKUP STAGE's
Part of MDEV-5336 Implement LOCK FOR BACKUP - Changed check of Global_only_lock to also include BACKUP lock. - We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able to downgrade lock during copy_data_between_tables()
This commit is contained in:
@ -38,15 +38,14 @@
|
||||
#include "thr_timer.h"
|
||||
#include "thr_malloc.h"
|
||||
#include "log_slow.h" /* LOG_SLOW_DISABLE_... */
|
||||
|
||||
#include "sql_digest_stream.h" // sql_digest_state
|
||||
|
||||
#include <mysql/psi/mysql_stage.h>
|
||||
#include <mysql/psi/mysql_statement.h>
|
||||
#include <mysql/psi/mysql_idle.h>
|
||||
#include <mysql/psi/mysql_table.h>
|
||||
#include <mysql_com_server.h>
|
||||
#include "session_tracker.h"
|
||||
#include "backup.h"
|
||||
|
||||
extern "C"
|
||||
void set_thd_stage_info(void *thd,
|
||||
@ -1958,19 +1957,6 @@ public:
|
||||
|
||||
bool lock_global_read_lock(THD *thd);
|
||||
void unlock_global_read_lock(THD *thd);
|
||||
/**
|
||||
Check if this connection can acquire protection against GRL and
|
||||
emit error if otherwise.
|
||||
*/
|
||||
bool can_acquire_protection() const
|
||||
{
|
||||
if (m_state)
|
||||
{
|
||||
my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
bool make_global_read_lock_block_commit(THD *thd);
|
||||
bool is_acquired() const { return m_state != GRL_NONE; }
|
||||
void set_explicit_lock_duration(THD *thd);
|
||||
@ -2193,6 +2179,7 @@ public:
|
||||
rpl_io_thread_info *rpl_io_info;
|
||||
rpl_sql_thread_info *rpl_sql_info;
|
||||
} system_thread_info;
|
||||
MDL_ticket *mdl_backup_ticket;
|
||||
|
||||
void reset_for_next_command(bool do_clear_errors= 1);
|
||||
/*
|
||||
@ -2978,6 +2965,7 @@ public:
|
||||
uint tmp_table, global_disable_checkpoint;
|
||||
uint server_status,open_options;
|
||||
enum enum_thread_type system_thread;
|
||||
enum backup_stages current_backup_stage;
|
||||
/*
|
||||
Current or next transaction isolation level.
|
||||
When a connection is established, the value is taken from
|
||||
@ -3615,6 +3603,15 @@ public:
|
||||
{
|
||||
return server_status & SERVER_STATUS_IN_TRANS;
|
||||
}
|
||||
void give_protection_error();
|
||||
inline bool has_read_only_protection()
|
||||
{
|
||||
if (current_backup_stage == BACKUP_FINISHED &&
|
||||
!global_read_lock.is_acquired())
|
||||
return FALSE;
|
||||
give_protection_error();
|
||||
return TRUE;
|
||||
}
|
||||
inline bool fill_derived_tables()
|
||||
{
|
||||
return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();
|
||||
|
Reference in New Issue
Block a user