Commit 03fb90f3 authored by unknown's avatar unknown

MDEV-4686: Temporary variable for sub_id is 32-bit, should be 64-bit

Fix wrong type for sub_id, which would cause overflow grief on
long-running server. Also some related renames for consistency.
parent 35360ec4
...@@ -462,9 +462,9 @@ end: ...@@ -462,9 +462,9 @@ end:
uint64 uint64
rpl_slave_state::next_subid(uint32 domain_id) rpl_slave_state::next_sub_id(uint32 domain_id)
{ {
uint32 sub_id= 0; uint64 sub_id= 0;
element *elem; element *elem;
lock(); lock();
...@@ -722,7 +722,7 @@ rpl_slave_state::load(THD *thd, char *state_from_master, size_t len, ...@@ -722,7 +722,7 @@ rpl_slave_state::load(THD *thd, char *state_from_master, size_t len,
uint64 sub_id; uint64 sub_id;
if (gtid_parser_helper(&state_from_master, end, &gtid) || if (gtid_parser_helper(&state_from_master, end, &gtid) ||
!(sub_id= next_subid(gtid.domain_id)) || !(sub_id= next_sub_id(gtid.domain_id)) ||
record_gtid(thd, &gtid, sub_id, false, in_statement) || record_gtid(thd, &gtid, sub_id, false, in_statement) ||
update(gtid.domain_id, gtid.server_id, sub_id, gtid.seq_no)) update(gtid.domain_id, gtid.server_id, sub_id, gtid.seq_no))
return 1; return 1;
......
...@@ -92,7 +92,7 @@ struct rpl_slave_state ...@@ -92,7 +92,7 @@ struct rpl_slave_state
int truncate_state_table(THD *thd); int truncate_state_table(THD *thd);
int record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, int record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
bool in_transaction, bool in_statement); bool in_transaction, bool in_statement);
uint64 next_subid(uint32 domain_id); uint64 next_sub_id(uint32 domain_id);
int iterate(int (*cb)(rpl_gtid *, void *), void *data, int iterate(int (*cb)(rpl_gtid *, void *), void *data,
rpl_gtid *extra_gtids, uint32 num_extra); rpl_gtid *extra_gtids, uint32 num_extra);
int tostring(String *dest, rpl_gtid *extra_gtids, uint32 num_extra); int tostring(String *dest, rpl_gtid *extra_gtids, uint32 num_extra);
......
...@@ -5823,7 +5823,7 @@ static Log_event* next_event(Relay_log_info* rli) ...@@ -5823,7 +5823,7 @@ static Log_event* next_event(Relay_log_info* rli)
if (ev->get_type_code() == GTID_EVENT) if (ev->get_type_code() == GTID_EVENT)
{ {
Gtid_log_event *gev= static_cast<Gtid_log_event *>(ev); Gtid_log_event *gev= static_cast<Gtid_log_event *>(ev);
uint64 sub_id= rpl_global_gtid_slave_state.next_subid(gev->domain_id); uint64 sub_id= rpl_global_gtid_slave_state.next_sub_id(gev->domain_id);
if (!sub_id) if (!sub_id)
{ {
errmsg = "slave SQL thread aborted because of out-of-memory error"; errmsg = "slave SQL thread aborted because of out-of-memory error";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment