Skip to content

Commit 87ff4ba

Browse files
committed
Merge 10.4 into 10.5
2 parents bd3eb52 + dc6bc85 commit 87ff4ba

14 files changed

+90
-49
lines changed

mysql-test/suite/galera/r/galera_split_brain.result

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ connection node_1;
77
connection node_2;
88
Killing server ...
99
connection node_1;
10+
SET SESSION lock_wait_timeout= 3;
1011
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
11-
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
12+
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1213
connection node_2;
1314
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
1415
disconnect node_2;

mysql-test/suite/galera/t/galera_split_brain.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ call mtr.add_suppression("WSREP: TO isolation failed for: ");
2222
--source include/kill_galera.inc
2323

2424
--connection node_1
25-
--error ER_LOCK_DEADLOCK
25+
SET SESSION lock_wait_timeout= 3;
26+
--error ER_LOCK_WAIT_TIMEOUT
2627
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
2728

2829
# Reset the master and restart the slave so that post-test checks can run

plugin/auth_pam/CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,10 @@ IF(HAVE_PAM_APPL_H AND HAVE_GETGROUPLIST)
3838
IF (TARGET auth_pam)
3939
MYSQL_ADD_EXECUTABLE(auth_pam_tool auth_pam_tool.c DESTINATION ${INSTALL_PLUGINDIR}/auth_pam_tool_dir COMPONENT Server)
4040
TARGET_LINK_LIBRARIES(auth_pam_tool pam)
41-
INSTALL(CODE "EXECUTE_PROCESS(
42-
COMMAND chmod u=rwx,g=,o= auth_pam_tool_dir
43-
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
44-
COMPONENT Server)
45-
INSTALL(CODE "EXECUTE_PROCESS(
46-
COMMAND chmod u=rwxs,g=rx,o=rx auth_pam_tool_dir/auth_pam_tool
47-
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
48-
COMPONENT Server)
41+
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST}
42+
"%attr(700, -, -) ${INSTALL_PLUGINDIRABS}/auth_pam_tool_dir"
43+
"%attr(4755, -, -) ${INSTALL_PLUGINDIRABS}/auth_pam_tool_dir/auth_pam_tool")
44+
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST} PARENT_SCOPE)
4945
ENDIF()
5046
IF(TARGET auth_pam OR TARGET auth_pam_v1)
5147
ADD_SUBDIRECTORY(testing)
@@ -55,7 +51,7 @@ IF(HAVE_PAM_APPL_H AND HAVE_GETGROUPLIST)
5551
IF(INSTALL_PAMDIR)
5652
INSTALL(TARGETS pam_user_map DESTINATION ${INSTALL_PAMDIR} COMPONENT Server)
5753
INSTALL(FILES mapper/user_map.conf DESTINATION ${INSTALL_PAMDATADIR} COMPONENT Server)
58-
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST} "%config(noreplace) ${INSTALL_PAMDATADIR}/*" PARENT_SCOPE)
54+
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST} "%config(noreplace) ${INSTALL_PAMDATADIRABS}/*" PARENT_SCOPE)
5955
ENDIF()
6056
ENDIF()
6157
ENDIF()

sql/handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ int ha_rollback_trans(THD *thd, bool all)
20882088
if (thd->is_error())
20892089
{
20902090
WSREP_DEBUG("ha_rollback_trans(%lld, %s) rolled back: %s: %s; is_real %d",
2091-
thd->thread_id, all?"TRUE":"FALSE", WSREP_QUERY(thd),
2091+
thd->thread_id, all?"TRUE":"FALSE", wsrep_thd_query(thd),
20922092
thd->get_stmt_da()->message(), is_real_trans);
20932093
}
20942094
(void) wsrep_after_rollback(thd, all);

sql/sql_insert.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
3-
Copyright (c) 2010, 2019, MariaDB Corporation
3+
Copyright (c) 2010, 2021, MariaDB Corporation
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -5009,7 +5009,7 @@ bool select_create::send_eof()
50095009
{
50105010
WSREP_DEBUG("select_create commit failed, thd: %llu err: %s %s",
50115011
thd->thread_id,
5012-
wsrep_thd_transaction_state_str(thd), WSREP_QUERY(thd));
5012+
wsrep_thd_transaction_state_str(thd), wsrep_thd_query(thd));
50135013
mysql_mutex_unlock(&thd->LOCK_thd_data);
50145014
abort_result_set();
50155015
DBUG_RETURN(true);

sql/sql_parse.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7949,7 +7949,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
79497949
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
79507950
});
79517951
WSREP_DEBUG("wsrep retrying AC query: %lu %s",
7952-
thd->wsrep_retry_counter, WSREP_QUERY(thd));
7952+
thd->wsrep_retry_counter, wsrep_thd_query(thd));
79537953
wsrep_prepare_for_autocommit_retry(thd, rawbuf, length, parser_state);
79547954
if (thd->lex->explain)
79557955
delete_explain_query(thd->lex);
@@ -7963,7 +7963,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
79637963
is_autocommit,
79647964
thd->wsrep_retry_counter,
79657965
thd->variables.wsrep_retry_autocommit,
7966-
WSREP_QUERY(thd));
7966+
wsrep_thd_query(thd));
79677967
my_error(ER_LOCK_DEADLOCK, MYF(0));
79687968
thd->reset_kill_query();
79697969
thd->wsrep_retry_counter= 0; // reset

sql/wsrep_client_service.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2018 Codership Oy <info@codership.com>
1+
/* Copyright 2018-2021 Codership Oy <info@codership.com>
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -108,14 +108,14 @@ int Wsrep_client_service::prepare_data_for_replication()
108108
"affected rows: %llu, "
109109
"changed tables: %d, "
110110
"sql_log_bin: %d",
111-
WSREP_QUERY(m_thd),
111+
wsrep_thd_query(m_thd),
112112
m_thd->get_stmt_da()->affected_rows(),
113113
stmt_has_updated_trans_table(m_thd),
114114
m_thd->variables.sql_log_bin);
115115
}
116116
else
117117
{
118-
WSREP_DEBUG("empty rbr buffer, query: %s", WSREP_QUERY(m_thd));
118+
WSREP_DEBUG("empty rbr buffer, query: %s", wsrep_thd_query(m_thd));
119119
}
120120
}
121121
DBUG_RETURN(0);

sql/wsrep_high_priority_service.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2018 Codership Oy <info@codership.com>
1+
/* Copyright 2018-2021 Codership Oy <info@codership.com>
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -403,6 +403,16 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
403403
WSREP_DEBUG("Wsrep_high_priority_service::apply_toi: %lld",
404404
client_state.toi_meta().seqno().get());
405405

406+
DBUG_EXECUTE_IF("sync.wsrep_apply_toi",
407+
{
408+
const char act[]=
409+
"now "
410+
"SIGNAL sync.wsrep_apply_toi_reached "
411+
"WAIT_FOR signal.wsrep_apply_toi";
412+
DBUG_ASSERT(!debug_sync_set_action(thd,
413+
STRING_WITH_LEN(act)));
414+
};);
415+
406416
int ret= apply_events(thd, m_rli, data, err);
407417
wsrep_thd_set_ignored_error(thd, false);
408418
trans_commit(thd);
@@ -447,6 +457,15 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_
447457
DBUG_PRINT("info",
448458
("Wsrep_high_priority_service::log_dummy_write_set: seqno=%lld",
449459
ws_meta.seqno().get()));
460+
DBUG_EXECUTE_IF("sync.wsrep_log_dummy_write_set",
461+
{
462+
const char act[]=
463+
"now "
464+
"SIGNAL sync.wsrep_log_dummy_write_set_reached ";
465+
DBUG_ASSERT(!debug_sync_set_action(m_thd,
466+
STRING_WITH_LEN(act)));
467+
};);
468+
450469
if (ws_meta.ordered())
451470
{
452471
wsrep::client_state& cs(m_thd->wsrep_cs());
@@ -680,7 +699,7 @@ Wsrep_replayer_service::~Wsrep_replayer_service()
680699
DBUG_ASSERT(0);
681700
WSREP_ERROR("trx_replay failed for: %d, schema: %s, query: %s",
682701
m_replay_status,
683-
orig_thd->db.str, WSREP_QUERY(orig_thd));
702+
orig_thd->db.str, wsrep_thd_query(orig_thd));
684703
unireg_abort(1);
685704
}
686705
}

sql/wsrep_mysqld.cc

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
1+
/* Copyright 2008-2021 Codership Oy <http://www.codership.com>
22
Copyright (c) 2020, 2021, MariaDB
33
44
This program is free software; you can redistribute it and/or modify
@@ -2255,12 +2255,29 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
22552255
wsrep_thd_query(thd));
22562256
my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED);
22572257
break;
2258+
case wsrep::e_deadlock_error:
2259+
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
2260+
"Deadlock error.",
2261+
ret,
2262+
(thd->db.str ? thd->db.str : "(null)"),
2263+
wsrep_thd_query(thd));
2264+
my_error(ER_LOCK_DEADLOCK, MYF(0));
2265+
break;
2266+
case wsrep::e_timeout_error:
2267+
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
2268+
"Operation timed out.",
2269+
ret,
2270+
(thd->db.str ? thd->db.str : "(null)"),
2271+
wsrep_thd_query(thd));
2272+
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
2273+
break;
22582274
default:
22592275
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
2260-
"Check wsrep connection state and retry the query.",
2276+
"Check your wsrep connection state and retry the query.",
22612277
ret,
22622278
(thd->db.str ? thd->db.str : "(null)"),
22632279
wsrep_thd_query(thd));
2280+
22642281
if (!thd->is_error())
22652282
{
22662283
my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check "
@@ -2418,13 +2435,6 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
24182435
thd->variables.auto_increment_increment= 1;
24192436
}
24202437

2421-
/*
2422-
TOI operations will ignore provided lock_wait_timeout and restore it
2423-
after operation is done.
2424-
*/
2425-
thd->variables.saved_lock_wait_timeout= thd->variables.lock_wait_timeout;
2426-
thd->variables.lock_wait_timeout= LONG_TIMEOUT;
2427-
24282438
if (thd->variables.wsrep_on && wsrep_thd_is_local(thd))
24292439
{
24302440
switch (wsrep_OSU_method_get(thd)) {
@@ -2441,8 +2451,19 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
24412451
ret= -1;
24422452
break;
24432453
}
2454+
24442455
switch (ret) {
2445-
case 0: /* wsrep_TOI_begin should set toi mode */ break;
2456+
case 0: /* wsrep_TOI_begin should set toi mode */
2457+
if (thd->variables.wsrep_OSU_method == WSREP_OSU_TOI)
2458+
{
2459+
/*
2460+
TOI operations ignore the provided lock_wait_timeout once replicated,
2461+
and restore it after operation is done.
2462+
*/
2463+
thd->variables.saved_lock_wait_timeout= thd->variables.lock_wait_timeout;
2464+
thd->variables.lock_wait_timeout= LONG_TIMEOUT;
2465+
}
2466+
break;
24462467
case 1:
24472468
/* TOI replication skipped, treat as success */
24482469
ret= 0;
@@ -2461,10 +2482,9 @@ void wsrep_to_isolation_end(THD *thd)
24612482
DBUG_ASSERT(wsrep_thd_is_local_toi(thd) ||
24622483
wsrep_thd_is_in_rsu(thd));
24632484

2464-
thd->variables.lock_wait_timeout= thd->variables.saved_lock_wait_timeout;
2465-
24662485
if (wsrep_thd_is_local_toi(thd))
24672486
{
2487+
thd->variables.lock_wait_timeout= thd->variables.saved_lock_wait_timeout;
24682488
DBUG_ASSERT(wsrep_OSU_method_get(thd) == WSREP_OSU_TOI);
24692489
wsrep_TOI_end(thd);
24702490
}

sql/wsrep_mysqld.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2008-2017 Codership Oy <http://www.codership.com>
1+
/* Copyright 2008-2021 Codership Oy <http://www.codership.com>
22
Copyright (c) 2020, 2021, MariaDB
33
44
This program is free software; you can redistribute it and/or modify
@@ -294,8 +294,6 @@ static inline bool wsrep_cluster_address_exists()
294294
return wsrep_cluster_address && wsrep_cluster_address[0];
295295
}
296296

297-
#define WSREP_QUERY(thd) (thd->query())
298-
299297
extern my_bool wsrep_ready_get();
300298
extern void wsrep_ready_wait();
301299

0 commit comments

Comments
 (0)