summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.h
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2014-04-23 16:06:06 +0200
committerunknown <knielsen@knielsen-hq.org>2014-04-23 16:06:06 +0200
commit010971a761c0dd0435d05d1e8b81ebeadadd9b3c (patch)
treee2c41992da192ba1cca740b5c0fb50c7aa8139a1 /sql/rpl_rli.h
parentf9e5f237f0091419c28d7d9d6ff3db5ed2ff5693 (diff)
downloadmariadb-git-010971a761c0dd0435d05d1e8b81ebeadadd9b3c.tar.gz
MDEV-6156: Parallel replication incorrectly caches charset between worker threads
Replication caches the character sets used in a query, to be able to quickly reuse them for the next query in the common case of them not having changed. In parallel replication, this caching needs to be per-worker-thread. The code was not modified to handle this correctly, so the caching in one worker could cause another worker to run a query using the wrong character set, causing replication corruption.
Diffstat (limited to 'sql/rpl_rli.h')
-rw-r--r--sql/rpl_rli.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 48193afce4d..bcb237b6ced 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -295,7 +295,6 @@ public:
/* Condition for UNTIL master_gtid_pos. */
slave_connection_state until_gtid_pos;
- char cached_charset[6];
/*
retried_trans is a cumulative counter: how many times the slave
has retried a transaction (any) since slave started.
@@ -371,15 +370,6 @@ public:
group_relay_log_pos);
}
- /*
- Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
- the thread save 3 get_charset() per Query_log_event if the charset is not
- changing from event to event (common situation).
- When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
- */
- void cached_charset_invalidate();
- bool cached_charset_compare(char *charset) const;
-
/**
Helper function to do after statement completion.
@@ -546,6 +536,8 @@ struct rpl_group_info
mysql_mutex_t sleep_lock;
mysql_cond_t sleep_cond;
+ char cached_charset[6];
+
/*
trans_retries varies between 0 to slave_transaction_retries and counts how
many times the slave has retried the present transaction; gets reset to 0
@@ -679,6 +671,15 @@ struct rpl_group_info
return false;
}
+ /*
+ Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
+ the thread save 3 get_charset() per Query_log_event if the charset is not
+ changing from event to event (common situation).
+ When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
+ */
+ void cached_charset_invalidate();
+ bool cached_charset_compare(char *charset) const;
+
void clear_tables_to_lock();
void cleanup_context(THD *, bool);
void slave_close_thread_tables(THD *);