summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-03-04 13:48:28 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-03-04 13:49:37 +0100
commit95d72088596c9c58c30ab87781061094309b4460 (patch)
tree52cbad4ea5bbe4c01c5e88a9efde3a05edd37107 /sql/sql_repl.cc
parentf4f37533a09b9776e8d5ac3f3a27957f553c9043 (diff)
parent78c74dbe30d3a22feec5d069c7424d5a8a86ea4c (diff)
downloadmariadb-git-95d72088596c9c58c30ab87781061094309b4460.tar.gz
Merge MDEV-6589 and MDEV-6403 into 10.1.
Conflicts: sql/log.cc sql/rpl_rli.cc sql/sql_repl.cc
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index b44bd943f89..8e18d218d37 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2320,6 +2320,30 @@ static int send_format_descriptor_event(binlog_send_info *info,
info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
fix_checksum(packet, ev_offset);
}
+ else if (info->using_gtid_state)
+ {
+ /*
+ If this event has the field `created' set, then it will cause the
+ slave to delete all active temporary tables. This must not happen
+ if the slave received any later GTIDs in a previous connect, as
+ those GTIDs might have created new temporary tables that are still
+ needed.
+
+ So here, we check if the starting GTID position was already
+ reached before this format description event. If not, we clear the
+ `created' flag to preserve temporary tables on the slave. (If the
+ slave connects at a position past this event, it means that it
+ already received and handled it in a previous connect).
+ */
+ if (!info.gtid_state.is_pos_reached())
+ {
+ int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
+ ST_CREATED_OFFSET+ev_offset, (ulong) 0);
+ if (info.current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ info.current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ fix_checksum(packet, ev_offset);
+ }
+ }
/* send it */
if (my_net_write(info->net, (uchar*) packet->ptr(), packet->length()))