diff options
author | He Zhenxing <hezx@mysql.com> | 2008-09-28 15:34:25 +0800 |
---|---|---|
committer | He Zhenxing <hezx@mysql.com> | 2008-09-28 15:34:25 +0800 |
commit | bd35cfe22ea396cafd332a79ca5dd810c1b6c769 (patch) | |
tree | 0d4f8b334d9ff48090bce768035078349e9f98f2 /sql/sql_repl.cc | |
parent | 6b9e2b9a1a9089cdc925e86e9a0bf030c69beceb (diff) | |
download | mariadb-git-bd35cfe22ea396cafd332a79ca5dd810c1b6c769.tar.gz |
BUG#38734 rpl_server_id2 sync_with_master failed
Rotate event is automatically generated and written when rotating binary
log or relay log. Rotate events for relay logs are usually ignored by slave
SQL thread becuase they have the same server id as that of the slave.
However, if --replicate-same-server-id is enabled, rotate event
for relay log would be treated as if it's a rotate event from master, and
would be executed by slave to update the rli->group_master_log_name and
rli->group_master_log_pos to a wrong value and cause the MASTER_POS_WAIT
function to fail and return NULL.
This patch fixed this problem by setting a flag bit (LOG_EVENT_RELAY_LOG_F)
in the event to tell the SQL thread to ignore these Rotate events generated
for relay logs.
This patch also added another binlog event flag bit (LOG_EVENT_ARTIFICIAL_F)
to distinquish faked events, the method used before this was by checking if
log_pos was zero.
sql/log.h:
Add a member to MYSQL_BIN_LOG to distinguish binary log from relay log.
sql/log_event.cc:
Change artificial_event member to LOG_EVENT_ARTIFICIAL_F flag
If LOG_EVENT_RELAY_LOG_F is set in the event flags for a rotate event, ignore it when updating position
Refactored the code in Rotate_log_event::do_update_pos
sql/log_event.h:
Add LOG_EVENT_RELAY_LOG_F flag to Log_event flags
Add RELAY_LOG flag to Rotate_log_event flags
sql/sql_repl.cc:
Set LOG_EVENT_ARTIFICIAL_F for fake rotate events
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 932b7a67b4d..7aa54d3208f 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -63,7 +63,7 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, ulong event_len = ident_len + LOG_EVENT_HEADER_LEN + ROTATE_HEADER_LEN; int4store(header + SERVER_ID_OFFSET, server_id); int4store(header + EVENT_LEN_OFFSET, event_len); - int2store(header + FLAGS_OFFSET, 0); + int2store(header + FLAGS_OFFSET, LOG_EVENT_ARTIFICIAL_F); // TODO: check what problems this may cause and fix them int4store(header + LOG_POS_OFFSET, 0); |