summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2018-10-07 18:59:52 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2018-10-07 18:59:52 +0200
commit2f4a0c5be2c5d5153c4253a49ba8820ab333a9a0 (patch)
tree5aacf74f8fc10978fed9f039b3f1170583ed5dcf /sql/log_event.cc
parent1fc5a6f30c3a9c047dcf9a36b00026d98f286f6b (diff)
downloadmariadb-git-2f4a0c5be2c5d5153c4253a49ba8820ab333a9a0.tar.gz
Fix accumulation of old rows in mysql.gtid_slave_pos
This would happen especially in optimistic parallel replication, where there is a good chance that a transaction will be rolled back (due to conflicts) after it has executed record_gtid(). If the transaction did any deletions of old rows as part of record_gtid(), those deletions will be undone as well. And the code did not properly ensure that the deletions would be re-tried. This patch makes record_gtid() remember the list of deletions done as part of a transaction. Then in rpl_slave_state::update() when the changes have been committed, we discard the list. However, in case of error and rollback, in cleanup_context() we will instead put the list back into rpl_global_gtid_slave_state so that the deletions will be re-tried later. Probably fixes part of the cause of MDEV-12147 as well. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index e1912ad4620..e07b7002398 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -4429,7 +4429,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
gtid= rgi->current_gtid;
if (rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id,
- true, false))
+ rgi, false))
{
int errcode= thd->get_stmt_da()->sql_errno();
if (!is_parallel_retry_error(rgi, errcode))
@@ -7132,7 +7132,7 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
{
if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i],
sub_id_list[i],
- false, false)))
+ NULL, false)))
return ret;
rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i],
NULL);
@@ -7639,7 +7639,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
rgi->gtid_pending= false;
gtid= rgi->current_gtid;
- err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, true,
+ err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, rgi,
false);
if (err)
{