-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-11675 fixup: MDEV-35474 Start Alter GTID Error Message Can Use Wrong Server_Id #3662
base: 10.11
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -626,8 +626,9 @@ bool write_bin_log_start_alter(THD *thd, bool& partial_alter, | |
start_alter_info *info= thd->rgi_slave->sa_info; | ||
bool is_shutdown= false; | ||
|
||
info->sa_seq_no= start_alter_id; | ||
info->domain_id= thd->variables.gtid_domain_id; | ||
info->gtid.domain_id= thd->variables.gtid_domain_id; | ||
info->gtid.server_id= thd->variables.server_id; | ||
info->gtid.seq_no= start_alter_id; | ||
Comment on lines
+629
to
+631
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps the replica-checking logic should be split away from |
||
mysql_mutex_lock(&mi->start_alter_list_lock); | ||
// possible stop-slave's marking of the whole alter state list is checked | ||
is_shutdown= mi->is_shutdown; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1682,8 +1682,9 @@ static start_alter_info *get_new_start_alter_info(THD *thd) | |
sql_print_error("Failed to allocate memory for ddl log free list"); | ||
return 0; | ||
} | ||
info->sa_seq_no= 0; | ||
info->domain_id= 0; | ||
info->gtid.domain_id= 0; | ||
info->gtid.server_id= 0; | ||
info->gtid.seq_no= 0; | ||
info->direct_commit_alter= false; | ||
info->state= start_alter_state::INVALID; | ||
mysql_cond_init(0, &info->start_alter_cond, NULL); | ||
|
@@ -1769,8 +1770,8 @@ int Query_log_event::handle_split_alter_query_log_event(rpl_group_info *rgi, | |
List_iterator<start_alter_info> info_iterator(mi->start_alter_list); | ||
while ((info= info_iterator++)) | ||
{ | ||
if(info->sa_seq_no == rgi->gtid_ev_sa_seq_no && | ||
info->domain_id == rgi->current_gtid.domain_id) | ||
if(info->gtid.seq_no == rgi->gtid_ev_sa_seq_no && | ||
info->gtid.domain_id == rgi->current_gtid.domain_id) | ||
{ | ||
info_iterator.remove(); | ||
break; | ||
|
@@ -2705,10 +2706,9 @@ static void check_and_remove_stale_alter(Relay_log_info *rli) | |
{ | ||
DBUG_ASSERT(info->state == start_alter_state::REGISTERED); | ||
|
||
sql_print_warning("ALTER query started at %u-%lu-%llu could not " | ||
sql_print_warning("ALTER query started at %u-%u-%llu could not " | ||
"be completed because of unexpected master server " | ||
"or its binlog change", info->domain_id, | ||
mi->master_id, info->sa_seq_no); | ||
"or its binlog change", PARAM_GTID(info->gtid)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe real reason I swapped to a nested struct is so I can write this |
||
info_iterator.remove(); | ||
mysql_mutex_lock(&mi->start_alter_lock); | ||
info->state= start_alter_state::ROLLBACK_ALTER; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -654,8 +654,7 @@ struct start_alter_info | |
/* | ||
ALTER id is defined as a pair of GTID's seq_no and domain_id. | ||
*/ | ||
decltype(rpl_gtid::seq_no) sa_seq_no; // key for searching (SA's id) | ||
uint32 domain_id; | ||
rpl_gtid gtid; // rpl_gtid::seq_no is the key for searching (SA's id) | ||
bool direct_commit_alter; // when true CA thread executes the whole query | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This (as opposed to I’m not sure about this “key” designation in the comments, though – I didn’t encounter any “keying” while migrating affected code. |
||
/* | ||
0 prepared and not error from commit and rollback | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test obfuscates GTIDs. Checking GTIDs would make the test more assertive.
I checked locally and confirm that entries are
0-11-x
before the primary crashes and0-1-x
after it restarts.