revision-id: d0aa55c85d119d2107c80636ccae0217fe0b1bae (mariadb-10.3.6-209-gd0aa55c85d1)
parent(s): 8465b21f1eb7df4ed4b2c73d7ac8e0e72b829818
author: Jan Lindström
committer: Jan Lindström
timestamp: 2018-11-29 08:49:13 +0200
message:
Reduce unnecessary diff caused by Galera 4 merge.
Phase 1.
---
extra/mariabackup/wsrep.cc | 2 +-
storage/innobase/handler/ha_innodb.cc | 76 ++++++++++++++---------------------
storage/innobase/lock/lock0lock.cc | 8 ++--
storage/innobase/lock/lock0wait.cc | 8 ++--
storage/innobase/row/row0upd.cc | 16 +++-----
storage/innobase/srv/srv0conc.cc | 2 +-
storage/innobase/srv/srv0srv.cc | 2 -
storage/innobase/trx/trx0roll.cc | 2 +-
8 files changed, 45 insertions(+), 71 deletions(-)
diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc
index 099d3c4f216..c3ad1b53a21 100644
--- a/extra/mariabackup/wsrep.cc
+++ b/extra/mariabackup/wsrep.cc
@@ -83,7 +83,7 @@ xb_write_galera_info(bool incremental_prepare)
}
wsrep_uuid_t uuid;
- memcpy(&uuid, wsrep_xid_uuid(&xid), sizeof(uuid));
+ memcpy(uuid.data, wsrep_xid_uuid(&xid), sizeof(uuid.data));
if (wsrep_uuid_print(&uuid, uuid_str,
sizeof(uuid_str)) < 0) {
return;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 1878df48427..82892cbe206 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4168,10 +4168,10 @@ static int innodb_init(void* p)
| HTON_NATIVE_SYS_VERSIONING;
#ifdef WITH_WSREP
- innobase_hton->abort_transaction=wsrep_abort_transaction;
- innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
- innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
- innobase_hton->fake_trx_id=NULL;
+ innobase_hton->abort_transaction=wsrep_abort_transaction;
+ innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
+ innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
+ innobase_hton->fake_trx_id=NULL;
#endif /* WITH_WSREP */
innobase_hton->tablefile_extensions = ha_innobase_exts;
@@ -4638,16 +4638,6 @@ innobase_commit(
this one, to allow then to group commit with us. */
thd_wakeup_subsequent_commits(thd, 0);
-#ifdef WITH_WSREP
- /* Serialisation history has been written, so the
- commit is now ordered.
- This seems to be problematic with load data splitting.
- Commented out for now. */
- // if (trx->mysql_thd) {
- // (void)wsrep_ordered_commit_if_no_binlog(trx->mysql_thd);
- // }
-#endif /* WITH_WSREP */
-
/* Now do a write + flush of logs. */
trx_commit_complete_for_mysql(trx);
@@ -5140,20 +5130,20 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels)
if (trx_t* trx = thd_to_trx(thd)) {
#ifdef WITH_WSREP
- bool locked= trx->lock.was_chosen_as_deadlock_victim;
- if (locked) {
- lock_mutex_exit();
- trx_mutex_exit(trx);
- }
+ bool locked= trx->lock.was_chosen_as_deadlock_victim;
+ if (locked) {
+ lock_mutex_exit();
+ trx_mutex_exit(trx);
+ }
#endif /* WITH_WSREP */
ut_ad(trx->mysql_thd == thd);
/* Cancel a pending lock request if there are any */
lock_trx_handle_wait(trx);
#ifdef WITH_WSREP
- if (locked) {
- lock_mutex_enter();
- trx_mutex_enter(trx);
- }
+ if (locked) {
+ lock_mutex_enter();
+ trx_mutex_enter(trx);
+ }
#endif /* WITH_WSREP */
}
@@ -6973,8 +6963,7 @@ wsrep_store_key_val_for_row(
{
KEY* key_info = table->key_info + keynr;
KEY_PART_INFO* key_part = key_info->key_part;
- KEY_PART_INFO* end =
- key_part + key_info->user_defined_key_parts;
+ KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
char* buff_start = buff;
enum_field_types mysql_type;
Field* field;
@@ -8204,11 +8193,13 @@ ha_innobase::write_row(
error, m_prebuilt->table->flags, m_user_thd);
#ifdef WITH_WSREP
- if (!error_result && wsrep_thd_is_local(m_user_thd) &&
- wsrep_on(m_user_thd) && !wsrep_consistency_check(m_user_thd) &&
- (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE) &&
- (thd_sql_command(m_user_thd) != SQLCOM_LOAD ||
- thd_binlog_format(m_user_thd) == BINLOG_FORMAT_ROW)) {
+ if (!error_result
+ && wsrep_on(m_user_thd)
+ && wsrep_thd_is_local(m_user_thd)
+ && !wsrep_consistency_check(m_user_thd)
+ && (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE)
+ && (thd_sql_command(m_user_thd) != SQLCOM_LOAD ||
+ thd_binlog_format(m_user_thd) == BINLOG_FORMAT_ROW)) {
if (wsrep_append_keys(m_user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
@@ -8905,8 +8896,9 @@ ha_innobase::update_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS && wsrep_thd_is_local(m_user_thd) &&
- wsrep_on(m_user_thd)) {
+ if (error == DB_SUCCESS
+ && wsrep_on(m_user_thd)
+ && wsrep_thd_is_local(m_user_thd)) {
DBUG_PRINT("wsrep", ("update row key"));
@@ -8971,9 +8963,10 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS && wsrep_thd_is_local(m_user_thd) &&
- wsrep_on(m_user_thd) &&
- !wsrep_thd_ignore_table(m_user_thd)) {
+ if (error == DB_SUCCESS
+ && wsrep_on(m_user_thd)
+ && wsrep_thd_is_local(m_user_thd)
+ && !wsrep_thd_ignore_table(m_user_thd)) {
if (wsrep_append_keys(m_user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
@@ -10525,8 +10518,8 @@ ha_innobase::wsrep_append_keys(
if (rcode) DBUG_RETURN(rcode);
- if (key_info->flags & HA_NOSAME ||
- key_type == WSREP_KEY_SHARED)
+ if (key_info->flags & HA_NOSAME
+ || key_type == WSREP_KEY_SHARED)
key_appended = true;
} else {
WSREP_DEBUG("NULL key skipped: %s",
@@ -18656,15 +18649,6 @@ innobase_wsrep_get_checkpoint(
trx_rseg_read_wsrep_checkpoint(*xid);
return 0;
}
-#if UNUSED /* 2b27ac8282ed (Marko Mäkelä 2018-05-01) */
-static void wsrep_fake_trx_id(handlerton *, THD *thd)
-{
- trx_id_t trx_id = trx_sys.get_new_trx_id();
- WSREP_DEBUG("innodb fake trx id: " TRX_ID_FMT " thd: %s",
- trx_id, wsrep_thd_query(thd));
- wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id);
-}
-#endif /* UNUSED */
#endif /* WITH_WSREP */
/* plugin options */
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index b465ec30592..6363bd8e310 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1425,11 +1425,9 @@ lock_rec_create_low(
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
- while (hash &&
- wsrep_thd_is_BF(((lock_t *)hash)->trx->mysql_thd, TRUE) &&
- wsrep_thd_order_before(
- ((lock_t *)hash)->trx->mysql_thd,
- trx->mysql_thd)) {
+ while (hash && wsrep_thd_is_BF(((lock_t *)hash)->trx->mysql_thd, TRUE)
+ && wsrep_thd_order_before(((lock_t *)hash)->trx->mysql_thd,
+ trx->mysql_thd)) {
prev = hash;
hash = (lock_t *)hash->hash;
}
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index fb2b4e688f5..e86410965f7 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -197,8 +197,8 @@ wsrep_is_BF_lock_timeout(
if (wsrep_on_trx(trx)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)
&& trx->error_state != DB_DEADLOCK) {
- ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id)
- << " query: " << wsrep_thd_query(trx->mysql_thd);
+ ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id)
+ << " query: " << wsrep_thd_query(trx->mysql_thd);
if (!locked) {
lock_mutex_enter();
}
@@ -216,9 +216,7 @@ wsrep_is_BF_lock_timeout(
os_event_set(srv_monitor_event);
return true;
}
-
-
- return false;
+ return false;
}
#endif /* WITH_WSREP */
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 67006295067..be27348683a 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2448,11 +2448,9 @@ row_upd_sec_index_entry(
}
#ifdef WITH_WSREP
if (!referenced && foreign
- && wsrep_on(trx->mysql_thd)
- && !wsrep_thd_is_BF(trx->mysql_thd, FALSE)
- && (!parent || que_node_get_type(parent) != QUE_NODE_UPDATE ||
- !parent->cascade_node)
- ) {
+ && wsrep_must_process_fk(node, trx)
+ && !wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
+
ulint* offsets = rec_get_offsets(
rec, index, NULL, true,
@@ -2772,9 +2770,8 @@ row_upd_clust_rec_by_insert(
if (err != DB_SUCCESS) {
goto err_exit;
}
- }
#ifdef WITH_WSREP
- else if (foreign && wsrep_must_process_fk(node, trx)) {
+ } else if (foreign && wsrep_must_process_fk(node, trx)) {
err = wsrep_row_upd_check_foreign_constraints(
node, pcur, table, index, offsets, thr, mtr);
@@ -2796,8 +2793,8 @@ row_upd_clust_rec_by_insert(
<< " table " << index->table->name;
goto err_exit;
}
- }
#endif /* WITH_WSREP */
+ }
}
mtr_commit(mtr);
@@ -3003,8 +3000,7 @@ row_upd_del_mark_clust_rec(
err = row_upd_check_references_constraints(
node, pcur, index->table, index, offsets, thr, mtr);
#ifdef WITH_WSREP
- } else if (trx && wsrep_on(trx->mysql_thd) && err == DB_SUCCESS
- && wsrep_must_process_fk(node, trx)) {
+ } else if (foreign && wsrep_must_process_fk(node, trx)) {
err = wsrep_row_upd_check_foreign_constraints(
node, pcur, index->table, index, offsets, thr, mtr);
diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc
index 514586b6af6..3042040ba1b 100644
--- a/storage/innobase/srv/srv0conc.cc
+++ b/storage/innobase/srv/srv0conc.cc
@@ -120,7 +120,7 @@ srv_conc_enter_innodb_with_atomics(
for (;;) {
ulint sleep_in_us;
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
+ if (wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_aborting(trx->mysql_thd)) {
if (wsrep_debug)
ib::info() <<
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 4bf9e6b4925..504e7df339f 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -2424,8 +2424,6 @@ static bool srv_purge_should_exit()
"InnoDB: to purge " ULINTPF " transactions",
history_size);
}
-#else
- (void)history_size; /* unused variable warning */
#endif
return false;
}
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 221cf3b78d1..3a331ebdf30 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -179,7 +179,7 @@ trx_rollback_to_savepoint(
complete rollback */
{
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) && savept == NULL) {
+ if (savept == NULL && wsrep_on(trx->mysql_thd)) {
wsrep_handle_SR_rollback(NULL, trx->mysql_thd);
}
#endif /* WITH_WSREP */