Skip to content

Commit

Permalink
MDEV-14875: galera_new_cluster crashes mysqld when existing server co…
Browse files Browse the repository at this point in the history
…ntains databases

Fortify wsrep_hton so that wsrep calls are not done to NULL-pointers.
  • Loading branch information
Jan Lindström committed Jan 30, 2018
1 parent cea431e commit 446b3d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sql/wsrep_hton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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",
Expand Down Expand Up @@ -252,7 +252,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",
Expand Down Expand Up @@ -294,7 +294,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",
Expand Down Expand Up @@ -471,7 +471,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,
Expand Down

0 comments on commit 446b3d3

Please sign in to comment.