summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.h
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/rpl_rli.h
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/rpl_rli.h')
-rw-r--r--sql/rpl_rli.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 74d5b6fe416..b40a34a54e6 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -676,6 +676,11 @@ struct rpl_group_info
/* Needs room for "Gtid D-S-N\x00". */
char gtid_info_buf[5+10+1+10+1+20+1];
+ /* List of not yet committed deletions in mysql.gtid_slave_pos. */
+ rpl_slave_state::list_element *pending_gtid_delete_list;
+ /* Domain associated with pending_gtid_delete_list. */
+ uint32 pending_gtid_delete_list_domain;
+
/*
The timestamp, from the master, of the commit event.
Used to do delayed update of rli->last_master_timestamp, for getting
@@ -817,6 +822,12 @@ struct rpl_group_info
char *gtid_info();
void unmark_start_commit();
+ static void pending_gtid_deletes_free(rpl_slave_state::list_element *list);
+ void pending_gtid_deletes_save(uint32 domain_id,
+ rpl_slave_state::list_element *list);
+ void pending_gtid_deletes_put_back();
+ void pending_gtid_deletes_clear();
+
time_t get_row_stmt_start_timestamp()
{
return row_stmt_start_timestamp;