summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-01-30 21:04:48 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-01-30 21:04:48 +0200
commit33714d20658fcc8535c737fd02c64c7070adbac0 (patch)
treeef60145ce081e6d96909a4b84008e2ac0e33dd8c /sql
parent926adcfeeaf23f4414822e3da712fb5e2560f5cb (diff)
parent6d390bab4a0695fedeead35e78111e1033f7b3df (diff)
downloadmariadb-git-33714d20658fcc8535c737fd02c64c7070adbac0.tar.gz
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/set_var.cc8
-rw-r--r--sql/sql_plugin.cc22
-rw-r--r--sql/sql_show.cc4
-rw-r--r--sql/wsrep_hton.cc8
6 files changed, 25 insertions, 25 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 29b12934550..e870f7afec6 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -779,7 +779,7 @@ mysql_mutex_t LOCK_prepared_stmt_count;
mysql_mutex_t LOCK_des_key_file;
#endif
mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
-mysql_rwlock_t LOCK_system_variables_hash;
+mysql_prlock_t LOCK_system_variables_hash;
mysql_cond_t COND_thread_count, COND_start_thread;
pthread_t signal_thread;
pthread_attr_t connection_attrib;
@@ -2384,7 +2384,7 @@ static void clean_up_mutexes()
mysql_rwlock_destroy(&LOCK_sys_init_connect);
mysql_rwlock_destroy(&LOCK_sys_init_slave);
mysql_mutex_destroy(&LOCK_global_system_variables);
- mysql_rwlock_destroy(&LOCK_system_variables_hash);
+ mysql_prlock_destroy(&LOCK_system_variables_hash);
mysql_mutex_destroy(&LOCK_short_uuid_generator);
mysql_mutex_destroy(&LOCK_prepared_stmt_count);
mysql_mutex_destroy(&LOCK_error_messages);
@@ -4742,7 +4742,7 @@ static int init_thread_environment()
&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
mysql_mutex_record_order(&LOCK_active_mi, &LOCK_global_system_variables);
mysql_mutex_record_order(&LOCK_status, &LOCK_thread_count);
- mysql_rwlock_init(key_rwlock_LOCK_system_variables_hash,
+ mysql_prlock_init(key_rwlock_LOCK_system_variables_hash,
&LOCK_system_variables_hash);
mysql_mutex_init(key_LOCK_prepared_stmt_count,
&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
diff --git a/sql/mysqld.h b/sql/mysqld.h
index dd84adfdff3..6114c77af6f 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -627,7 +627,7 @@ extern mysql_mutex_t LOCK_des_key_file;
extern mysql_mutex_t LOCK_server_started;
extern mysql_cond_t COND_server_started;
extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
-extern mysql_rwlock_t LOCK_system_variables_hash;
+extern mysql_prlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count, COND_start_thread;
extern mysql_cond_t COND_manager;
extern mysql_cond_t COND_slave_background;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 097124a0b3a..3a6b73d574e 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -597,10 +597,10 @@ int mysql_del_sys_var_chain(sys_var *first)
{
int result= 0;
- mysql_rwlock_wrlock(&LOCK_system_variables_hash);
+ mysql_prlock_wrlock(&LOCK_system_variables_hash);
for (sys_var *var= first; var; var= var->next)
result|= my_hash_delete(&system_variable_hash, (uchar*) var);
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
return result;
}
@@ -1082,7 +1082,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
cond= make_cond_for_info_schema(thd, cond, tables);
thd->count_cuted_fields= CHECK_FIELD_WARN;
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
for (uint i= 0; i < system_variable_hash.records; i++)
{
@@ -1245,7 +1245,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
}
res= 0;
end:
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
thd->count_cuted_fields= save_count_cuted_fields;
return res;
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 462829a255b..0429a2ad6c2 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1430,10 +1430,10 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin,
mysql_mutex_unlock(&LOCK_plugin);
- mysql_rwlock_wrlock(&LOCK_system_variables_hash);
+ mysql_prlock_wrlock(&LOCK_system_variables_hash);
if (test_plugin_options(tmp_root, plugin, argc, argv))
state= PLUGIN_IS_DISABLED;
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
if (options_only || state == PLUGIN_IS_DISABLED)
{
@@ -2842,11 +2842,11 @@ sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
if (!locked)
mysql_mutex_lock(&LOCK_plugin);
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
if ((var= intern_find_sys_var(str, length)) &&
(pi= var->cast_pluginvar()))
{
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
LEX *lex= thd ? thd->lex : 0;
if (!(plugin= intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
var= NULL; /* failed to lock it, it must be uninstalling */
@@ -2859,7 +2859,7 @@ sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
}
}
else
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
if (!locked)
mysql_mutex_unlock(&LOCK_plugin);
@@ -3089,9 +3089,9 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
if (!thd->variables.dynamic_variables_ptr ||
(uint)offset > thd->variables.dynamic_variables_head)
{
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
sync_dynamic_session_variables(thd, global_lock);
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
}
DBUG_RETURN((uchar*)thd->variables.dynamic_variables_ptr + offset);
}
@@ -3206,7 +3206,7 @@ static void cleanup_variables(struct system_variables *vars)
st_bookmark *v;
uint idx;
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
for (idx= 0; idx < bookmark_hash.records; idx++)
{
v= (st_bookmark*) my_hash_element(&bookmark_hash, idx);
@@ -3225,7 +3225,7 @@ static void cleanup_variables(struct system_variables *vars)
*ptr= NULL;
}
}
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
DBUG_ASSERT(vars->table_plugin == NULL);
DBUG_ASSERT(vars->tmp_table_plugin == NULL);
@@ -4280,10 +4280,10 @@ int thd_key_create(MYSQL_THD_KEY_T *key)
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT;
char namebuf[256];
snprintf(namebuf, sizeof(namebuf), "%u", thd_key_no++);
- mysql_rwlock_wrlock(&LOCK_system_variables_hash);
+ mysql_prlock_wrlock(&LOCK_system_variables_hash);
// non-letters in the name as an extra safety
st_bookmark *bookmark= register_var("\a\v\a\t\a\r", namebuf, flags);
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
if (bookmark)
{
*key= bookmark->offset;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3fc0568d2a9..19053d6c311 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7699,7 +7699,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
/*
Avoid recursive LOCK_system_variables_hash acquisition in
@@ -7714,7 +7714,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
scope, NULL, "", tables->table,
upper_case_names, partial_cond);
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res);
}
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 35a0020ef44..837996bbd5d 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -122,7 +122,7 @@ void wsrep_post_commit(THD* thd, bool all)
case LOCAL_COMMIT:
{
DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
- if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
+ if (wsrep && wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
{
DBUG_PRINT("wsrep", ("set committed fail"));
WSREP_WARN("set committed fail: %llu %d",
@@ -254,7 +254,7 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
(thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY))
{
- if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
+ if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
{
DBUG_PRINT("wsrep", ("setting rollback fail"));
WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
@@ -296,7 +296,7 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all)
possible changes to clean state.
*/
if (WSREP_PROVIDER_EXISTS) {
- if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
+ if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
{
DBUG_PRINT("wsrep", ("setting rollback fail"));
WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
@@ -473,7 +473,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
}
else if (!rcode)
{
- if (WSREP_OK == rcode)
+ if (WSREP_OK == rcode && wsrep)
rcode = wsrep->pre_commit(wsrep,
(wsrep_conn_id_t)thd->thread_id,
&thd->wsrep_ws_handle,