summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shulga <dmitry.shulga@mariadb.com>2021-04-09 08:52:18 +0700
committerDmitry Shulga <dmitry.shulga@mariadb.com>2021-04-09 08:52:18 +0700
commit07ebfe7cc759addde308e44699954f6329b2b7fe (patch)
tree35dde0441db630506281dff11001cd2dcf4861a5
parent035d7b4a692aa60e68eebd0b8ac26cce9dfdceba (diff)
downloadmariadb-git-bb-10.6-MDEV-16708-2.tar.gz
Reverted the commitbb-10.6-MDEV-16708-2
" commit 0cd2f1ebf8614c3a9bc7ec9f92d5fc05786a02d0 Author: Dmitry Shulga <dmitry.shulga@mariadb.com> Date: Tue Apr 6 12:32:51 2021 +0700 MDEV-25302 Fixed issue regarding to setting the variable gtid_slave_pos in PS mode "
-rw-r--r--sql/rpl_gtid.cc80
-rw-r--r--sql/rpl_gtid.h8
-rw-r--r--sql/set_var.cc3
-rw-r--r--sql/set_var.h1
-rw-r--r--sql/sys_vars.cc4
-rw-r--r--sql/sys_vars.ic2
6 files changed, 25 insertions, 73 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 1cb4e30fb77..bc06188af34 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -245,8 +245,7 @@ rpl_slave_state_free_element(void *arg)
rpl_slave_state::rpl_slave_state()
- : pending_gtid_count(0), last_sub_id(0), gtid_pos_tables(0), loaded(false),
- prepared(false)
+ : pending_gtid_count(0), last_sub_id(0), gtid_pos_tables(0), loaded(false)
{
mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state,
MY_MUTEX_INIT_SLOW);
@@ -418,69 +417,36 @@ end:
}
-bool
-rpl_slave_state::prepare(THD *thd)
+int
+rpl_slave_state::truncate_state_table(THD *thd)
{
- if (prepared)
- {
- tlist.reinit_before_use(thd);
- return false;
- }
+ TABLE_LIST tlist;
+ int err= 0;
tlist.init_one_table(&MYSQL_SCHEMA_NAME, &rpl_gtid_slave_state_table_name,
NULL, TL_WRITE);
tlist.mdl_request.set_type(MDL_EXCLUSIVE);
-
- unsigned int table_count= 0;
- TABLE_LIST *tables= &tlist;
- bool ret= open_tables(thd, &tables, &table_count, 0);
- if (!ret)
- prepared= true;
-
- return ret;
-}
-
-
-int
-rpl_slave_state::truncate_state_table(THD *thd)
-{
- int err;
-
- if (prepared)
- {
- tlist.reinit_before_use(thd);
- }
- else
+ if (!(err= open_and_lock_tables(thd, &tlist, FALSE,
+ MYSQL_OPEN_IGNORE_LOGGING_FORMAT)))
{
- tlist.init_one_table(&MYSQL_SCHEMA_NAME, &rpl_gtid_slave_state_table_name,
- NULL, TL_WRITE);
- tlist.mdl_request.set_type(MDL_EXCLUSIVE);
- }
-
- err= open_and_lock_tables(thd, &tlist, false,
- MYSQL_OPEN_IGNORE_LOGGING_FORMAT);
-
- if (err)
- return err;
-
- DBUG_ASSERT(!tlist.table->file->row_logging);
- tlist.table->s->tdc->flush(thd, false);
- err= tlist.table->file->ha_truncate();
+ DBUG_ASSERT(!tlist.table->file->row_logging);
+ tlist.table->s->tdc->flush(thd, true);
+ err= tlist.table->file->ha_truncate();
- if (err)
- {
- ha_rollback_trans(thd, false);
- close_thread_tables(thd);
- ha_rollback_trans(thd, true);
- }
- else
- {
- ha_commit_trans(thd, false);
- close_thread_tables(thd);
- ha_commit_trans(thd, true);
+ if (err)
+ {
+ ha_rollback_trans(thd, FALSE);
+ close_thread_tables(thd);
+ ha_rollback_trans(thd, TRUE);
+ }
+ else
+ {
+ ha_commit_trans(thd, FALSE);
+ close_thread_tables(thd);
+ ha_commit_trans(thd, TRUE);
+ }
+ thd->release_transactional_locks();
}
- thd->release_transactional_locks();
-
return err;
}
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index 7e6cb13f941..11541c8000c 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -48,9 +48,6 @@ enum enum_gtid_skip_type {
GTID_SKIP_NOT, GTID_SKIP_STANDALONE, GTID_SKIP_TRANSACTION
};
-#ifdef MYSQL_SERVER
-
-#include "table.h"
/*
Structure to keep track of threads waiting in MASTER_GTID_WAIT().
@@ -226,13 +223,11 @@ struct rpl_slave_state
std::atomic<gtid_pos_table*> gtid_pos_tables;
/* The default entry in gtid_pos_tables, mysql.gtid_slave_pos. */
std::atomic<gtid_pos_table*> default_gtid_pos_table;
- bool loaded, prepared;
- TABLE_LIST tlist;
+ bool loaded;
rpl_slave_state();
~rpl_slave_state();
- bool prepare(THD *thd);
void truncate_hash();
ulong count() const { return hash.records; }
int update(uint32 domain_id, uint32 server_id, uint64 sub_id,
@@ -385,6 +380,5 @@ extern bool rpl_slave_state_tostring_helper(String *dest, const rpl_gtid *gtid,
extern int gtid_check_rpl_slave_state_table(TABLE *table);
extern rpl_gtid *gtid_parse_string_to_list(const char *p, size_t len,
uint32 *out_len);
-#endif /* MYSQL_SERVER */
#endif /* RPL_GTID_H */
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 62fafc135d6..3ef2e1f580d 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -843,8 +843,7 @@ int set_var::light_check(THD *thd)
if (value && value->fix_fields_if_needed_for_scalar(thd, &value))
return -1;
-
- return var->light_check(thd);
+ return 0;
}
/**
diff --git a/sql/set_var.h b/sql/set_var.h
index ba9096b1757..18c4dbc664e 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -111,7 +111,6 @@ public:
*/
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
- virtual int light_check(THD *) { return 0; }
bool check(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, const LEX_CSTRING *base);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 940b8bf9d10..a120e6963ec 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1888,10 +1888,6 @@ Sys_var_gtid_current_pos::global_value_ptr(THD *thd, const LEX_CSTRING *base)
return (uchar *)p;
}
-int Sys_var_gtid_slave_pos::light_check(THD *thd)
-{
- return rpl_global_gtid_slave_state->prepare(thd);
-}
bool
Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var)
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index 6142c2286e7..2bd6ee6467d 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -2537,8 +2537,6 @@ public:
{
option.var_type|= GET_STR;
}
- int light_check(THD *thd);
-
bool do_check(THD *thd, set_var *var);
bool session_update(THD *thd, set_var *var)
{