From eec6417e05f6b5f76758e619a44fbdb00860258a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 24 Jul 2017 16:14:27 +0300 Subject: [PATCH] Apply galera patches to XtraDB storage engine and remove one debug output. --- storage/innobase/handler/ha_innodb.cc | 2 -- storage/xtradb/handler/ha_innodb.cc | 22 +++++++++++++++------- storage/xtradb/row/row0ins.c | 25 +++++++++++++++---------- storage/xtradb/row/row0upd.c | 4 +++- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 094d6f76d17..1991850e6cd 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6000,8 +6000,6 @@ report_error: prebuilt->table->flags, user_thd); #ifdef WITH_WSREP - fprintf(stderr, "JAN: split %d load %d\n", wsrep_load_data_splitting, - sql_command == SQLCOM_LOAD); if (!error_result && wsrep_on(user_thd) && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 805b28d9d21..d1f40905184 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -7025,13 +7025,21 @@ report_error: prebuilt->table->flags, user_thd); #ifdef WITH_WSREP - if (!error_result && - wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && - wsrep_on(user_thd) && - !wsrep_consistency_check(user_thd)) - { - if (wsrep_append_keys(user_thd, false, record, NULL)) - { + if (!error_result + && wsrep_on(user_thd) + && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE + && !wsrep_consistency_check(user_thd) + && (sql_command != SQLCOM_CREATE_TABLE)) { + /* This change part of commit + a4bc8db216b4dd61ca0b1cb5a8b7806437416dc7 + MW-322 - CTAS fix will cause regression on galera.partition + test case. Commented until galeracluster developers have + looked the issue. + && (sql_command != SQLCOM_LOAD || + thd_binlog_format(user_thd) == + BINLOG_FORMAT_ROW)) { + */ + if (wsrep_append_keys(user_thd, false, record, NULL)) { DBUG_PRINT("wsrep", ("row key failed")); error_result = HA_ERR_INTERNAL_ERROR; goto wsrep_error; diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c index a4309612377..52495c7ec60 100644 --- a/storage/xtradb/row/row0ins.c +++ b/storage/xtradb/row/row0ins.c @@ -761,7 +761,7 @@ row_ins_invalidate_query_cache( mem_free(buf); } #ifdef WITH_WSREP -ulint wsrep_append_foreign_key(trx_t *trx, +ulint wsrep_append_foreign_key(trx_t *trx, dict_foreign_t* foreign, const rec_t* clust_rec, dict_index_t* clust_index, @@ -1083,13 +1083,14 @@ row_ins_foreign_check_on_constraint( #ifdef WITH_WSREP err = wsrep_append_foreign_key( - thr_get_trx(thr), - foreign, - clust_rec, - clust_index, - FALSE, FALSE); + thr_get_trx(thr), + foreign, + clust_rec, + clust_index, + FALSE, + (node) ? TRUE : FALSE); if (err != DB_SUCCESS) { - fprintf(stderr, + fprintf(stderr, "WSREP: foreign key append failed: %lu\n", err); } else #endif @@ -1248,6 +1249,9 @@ row_ins_check_foreign_constraint( ulint* offsets = offsets_; rec_offs_init(offsets_); +#ifdef WITH_WSREP + upd_node= NULL; +#endif /* WITH_WSREP */ run_again: #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_SHARED)); @@ -1436,9 +1440,10 @@ run_again: err = wsrep_append_foreign_key( thr_get_trx(thr), foreign, - rec, - check_index, - check_ref, TRUE); + rec, + check_index, + check_ref, + (upd_node) ? TRUE : FALSE); #endif /* WITH_WSREP */ goto end_scan; } else if (foreign->type != 0) { diff --git a/storage/xtradb/row/row0upd.c b/storage/xtradb/row/row0upd.c index a2eabc347d6..d75100c91e8 100644 --- a/storage/xtradb/row/row0upd.c +++ b/storage/xtradb/row/row0upd.c @@ -1842,7 +1842,9 @@ row_upd_sec_index_entry( index, offsets, thr, &mtr); } #ifdef WITH_WSREP - if (err == DB_SUCCESS && !referenced && + if (wsrep_on(trx->mysql_thd) && + !wsrep_thd_is_BF(trx->mysql_thd, FALSE) && + err == DB_SUCCESS && !referenced && !(parent && que_node_get_type(parent) == QUE_NODE_UPDATE && ((upd_node_t*)parent)->cascade_node == node) &&