summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-10-14 15:28:16 +0200
committerunknown <knielsen@knielsen-hq.org>2013-10-14 15:28:16 +0200
commit2842f6b5dc254c82aa3dc976cd5bd3645dc82a60 (patch)
treeadefb3cd2b2e5e1f41652d12cc597929f55f80d0 /sql/log.cc
parent2e100cc5a493b6a0f6f907e0483a734c7fee2087 (diff)
downloadmariadb-git-2842f6b5dc254c82aa3dc976cd5bd3645dc82a60.tar.gz
MDEV-4506: Parallel replication: error handling.
Add an error code to the wait_for_commit facility. Now, when a transaction fails, it can signal the error to any subsequent transaction that is waiting for it to commit. The waiting transactions then receive the error code back from wait_for_prior_commit() and can handle the error appropriately. Also fix one race that could cause crash if @@slave_parallel_threads were changed several times quickly in succession.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/log.cc b/sql/log.cc
index dd6eeb3678c..95091875d83 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -6743,7 +6743,7 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
cur->wakeup_subsequent_commits_running= true;
mysql_mutex_unlock(&cur->LOCK_wait_commit);
}
- waiter->wakeup();
+ waiter->wakeup(0);
}
waiter= next;
}
@@ -6849,7 +6849,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry)
field.
*/
if (next->queued_by_other)
- next->thd->wait_for_commit_ptr->wakeup();
+ next->thd->wait_for_commit_ptr->wakeup(entry->error);
else
next->thd->signal_wakeup_ready();
}
@@ -7145,7 +7145,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
if (current != leader) // Don't wake up ourself
{
if (current->queued_by_other)
- current->thd->wait_for_commit_ptr->wakeup();
+ current->thd->wait_for_commit_ptr->wakeup(current->error);
else
current->thd->signal_wakeup_ready();
}
@@ -7844,7 +7844,8 @@ int TC_LOG_MMAP::log_and_order(THD *thd, my_xid xid, bool all,
mysql_mutex_unlock(&LOCK_prepare_ordered);
}
- thd->wait_for_prior_commit();
+ if (thd->wait_for_prior_commit())
+ return 0;
cookie= 0;
if (xid)