diff --git a/sql/handler.cc b/sql/handler.cc index a6e5043a636..979e9315571 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2158,11 +2158,14 @@ int ha_rollback_trans(THD *thd, bool all) my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; #ifdef WITH_WSREP - WSREP_WARN("handlerton rollback failed, thd %lld %lld " - "conf %d wsrep_err %s SQL %s", - thd->thread_id, thd->query_id, thd->wsrep_trx().state(), - wsrep::to_c_string(thd->wsrep_cs().current_error()), - thd->query()); + if (WSREP(thd)) + { + WSREP_WARN("handlerton rollback failed, thd %lld %lld " + "conf %d wsrep_err %s SQL %s", + thd->thread_id, thd->query_id, thd->wsrep_trx().state(), + wsrep::to_c_string(thd->wsrep_cs().current_error()), + thd->query()); + } #endif /* WITH_WSREP */ } status_var_increment(thd->status_var.ha_rollback_count);