Skip to content

Commit 7dd74fa

Browse files
author
Nirbhay Choubey
committed
MDEV-6481: Yum Upgrade on CentOS 6.5 causes instant
crash of MariaDB/Galera mysqld crashes during startup when its started with --wsrep-recover (mysqld_safe.sh). The problem was that during server startup "wsrep" handle is not initialized for --wsrep-recover and since the condition to register wsrep hton depended only on 'wsrep_on' global/session variables (WSREP(thd) macro), it can eventually get registered and calls to wsrep handle's functions (commit, rollback, etc.) can be made (SIGSEGV!). Fixed by adding a check for "wsrep" pointer in WSREP(thd) macro (added by lp:1367173). Additionally, a check for WSREP(thd) (instead of checking the availability of wsrep provider) has been added before invoking wsrep handle's commit & rollback functions.
1 parent b197066 commit 7dd74fa

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

sql/wsrep_hton.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
210210
}
211211

212212
if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
213-
(thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY))
213+
thd->wsrep_conflict_state != MUST_REPLAY)
214214
{
215-
if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
215+
if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
216216
{
217217
DBUG_PRINT("wsrep", ("setting rollback fail"));
218218
WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s",
@@ -252,13 +252,11 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all)
252252
Transaction didn't go through wsrep->pre_commit() so just roll back
253253
possible changes to clean state.
254254
*/
255-
if (WSREP_PROVIDER_EXISTS) {
256-
if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
257-
{
258-
DBUG_PRINT("wsrep", ("setting rollback fail"));
259-
WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s",
260-
(long long)thd->real_id, thd->query());
261-
}
255+
if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
256+
{
257+
DBUG_PRINT("wsrep", ("setting rollback fail"));
258+
WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s",
259+
(long long)thd->real_id, thd->query());
262260
}
263261
wsrep_cleanup_transaction(thd);
264262
}

0 commit comments

Comments
 (0)