summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-12-05 18:04:23 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-12-05 18:04:23 +0200
commite55397a46d38c008d877a1b04a88d07b21a555b6 (patch)
treef0ddcde58c82c2869c30926efbe50d43491c7e8a /sql
parent0a7d85c97f6dd68f78ecb3e7074043ff2d4c24fc (diff)
parentdd20a43c6cb59a2ba69124cf51e22e08ca16f858 (diff)
downloadmariadb-git-e55397a46d38c008d877a1b04a88d07b21a555b6.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/slave.cc6
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_delete.cc4
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/table.cc1
-rw-r--r--sql/wsrep_mysqld.cc16
-rw-r--r--sql/wsrep_mysqld.h1
-rw-r--r--sql/wsrep_thd.cc3
-rw-r--r--sql/wsrep_var.cc9
10 files changed, 38 insertions, 10 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 14c228cc353..9f37061594c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4534,7 +4534,7 @@ void handler::print_error(int error, myf errflag)
break;
case HA_ERR_AUTOINC_ERANGE:
textno= error;
- my_error(textno, errflag, table->next_number_field->field_name.str,
+ my_error(textno, errflag, table->found_next_number_field->field_name.str,
table->in_use->get_stmt_da()->current_row_for_warning());
DBUG_VOID_RETURN;
break;
diff --git a/sql/slave.cc b/sql/slave.cc
index 4312ed2487e..289441d9cab 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -7342,9 +7342,9 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
mi->ssl_ca[0]?mi->ssl_ca:0,
mi->ssl_capath[0]?mi->ssl_capath:0,
mi->ssl_cipher[0]?mi->ssl_cipher:0);
- mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
- &mi->ssl_verify_server_cert);
- mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH,
+ mysql_options(mysql, MYSQL_OPT_SSL_CRL,
+ mi->ssl_crl[0] ? mi->ssl_crl : 0);
+ mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH,
mi->ssl_crlpath[0] ? mi->ssl_crlpath : 0);
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&mi->ssl_verify_server_cert);
diff --git a/sql/sql_const.h b/sql/sql_const.h
index bcc556e61f9..490b870d768 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -29,7 +29,7 @@
/* extra 4+4 bytes for slave tmp tables */
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
#define MAX_ALIAS_NAME 256
-#define MAX_FIELD_NAME 34 /* Max colum name length +2 */
+#define MAX_FIELD_NAME (NAME_LEN+1) /* Max colum name length +1 */
#define MAX_SYS_VAR_LENGTH 32
#define MAX_KEY MAX_INDEXES /* Max used keys */
#define MAX_REF_PARTS 32 /* Max parts used as ref */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 2bbf9c7aca7..4c679267456 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -704,6 +704,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
table->use_all_columns();
table->rpl_write_set= table->write_set;
+ // Initialize autoinc.
+ // We don't set next_number_field here, as it is handled manually.
+ if (table->found_next_number_field)
+ table->file->info(HA_STATUS_AUTO);
}
else
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0572fb980fe..39b364e475d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1138,7 +1138,7 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false;
}
- return true;
+ return tables != NULL;
}
static bool wsrep_command_no_result(char command)
@@ -3689,6 +3689,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) &&
lex->sql_command != SQLCOM_SET_OPTION &&
+ lex->sql_command != SQLCOM_CHANGE_DB &&
+ !(lex->sql_command == SQLCOM_SELECT && !all_tables) &&
!wsrep_is_show_query(lex->sql_command))
{
my_message(ER_UNKNOWN_COM_ERROR,
diff --git a/sql/table.cc b/sql/table.cc
index 526d7462f3b..40113bf2569 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -8995,6 +8995,7 @@ int TABLE::update_generated_fields()
res= found_next_number_field->set_default();
if (likely(!res))
res= file->update_auto_increment();
+ next_number_field= NULL;
}
if (likely(!res) && vfield)
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index f1494773ffc..7d684cef35d 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -129,6 +129,7 @@ ulong wsrep_trx_fragment_unit= WSREP_FRAG_BYTES;
ulong wsrep_SR_store_type= WSREP_SR_STORE_TABLE;
uint wsrep_ignore_apply_errors= 0;
+std::atomic <bool> wsrep_thread_create_failed;
/*
* End configuration options
@@ -3480,7 +3481,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
void* start_wsrep_THD(void *arg)
{
- THD *thd;
+ THD *thd= NULL;
Wsrep_thd_args* thd_args= (Wsrep_thd_args*) arg;
@@ -3511,6 +3512,7 @@ void* start_wsrep_THD(void *arg)
mysql_thread_set_psi_id(thd->thread_id);
thd->thr_create_utime= microsecond_interval_timer();
+ DBUG_EXECUTE_IF("wsrep_simulate_failed_connection_1", goto error; );
// </5.1.17>
/*
handle_one_connection() is normally the only way a thread would
@@ -3617,6 +3619,18 @@ void* start_wsrep_THD(void *arg)
error:
WSREP_ERROR("Failed to create/initialize system thread");
+ if (thd)
+ {
+ close_connection(thd, ER_OUT_OF_RESOURCES);
+ statistic_increment(aborted_connects, &LOCK_status);
+ server_threads.erase(thd);
+ delete thd;
+ my_thread_end();
+ }
+ delete thd_args;
+ // This will signal error to wsrep_slave_threads_update
+ wsrep_thread_create_failed.store(true, std::memory_order_relaxed);
+
/* Abort if its the first applier/rollbacker thread. */
if (!mysqld_server_initialized)
unireg_abort(1);
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index c18746b379a..6f9a2d127b4 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -89,6 +89,7 @@ extern ulong wsrep_running_rollbacker_threads;
extern bool wsrep_new_cluster;
extern bool wsrep_gtid_mode;
extern uint32 wsrep_gtid_domain_id;
+extern std::atomic <bool > wsrep_thread_create_failed;
extern ulonglong wsrep_mode;
extern my_bool wsrep_strict_ddl;
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 770c4657e65..e610d3a6c2b 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -23,8 +23,7 @@
#include "rpl_rli.h"
#include "log_event.h"
#include "sql_parse.h"
-#include "mysqld.h" // start_wsrep_THD();
-#include "wsrep_applier.h" // start_wsrep_THD();
+#include "wsrep_mysqld.h" // start_wsrep_THD();
#include "mysql/service_wsrep.h"
#include "debug_sync.h"
#include "slave.h"
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 26853b34dc0..5ec32d63626 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -789,18 +789,25 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
if (wsrep_slave_count_change > 0)
{
WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads);
+ wsrep_thread_create_failed.store(false, std::memory_order_relaxed);
res= wsrep_create_appliers(wsrep_slave_count_change, true);
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
// Thread creation and execution is asyncronous, therefore we need
// wait them to be started or error produced
- while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads)
+ while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads &&
+ !wsrep_thread_create_failed.load(std::memory_order_relaxed))
{
my_sleep(1000);
}
mysql_mutex_lock(&LOCK_global_system_variables);
+ if (wsrep_thread_create_failed.load(std::memory_order_relaxed)) {
+ wsrep_slave_threads= wsrep_running_applier_threads;
+ return true;
+ }
+
WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads);
wsrep_slave_count_change = 0;
}