@@ -8811,19 +8811,15 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
88118811 }
88128812 else
88138813 {
8814- MDL_request mdl_request;
8815-
8816- MDL_REQUEST_INIT (&mdl_request, MDL_key::BACKUP, " " , " " , MDL_BACKUP_COMMIT,
8817- MDL_EXPLICIT);
8818- if (thd->mdl_context .acquire_lock (&mdl_request,
8819- thd->variables .lock_wait_timeout ))
8814+ if (!(thd->backup_commit_lock = thd->mdl_context .MDL_ACQUIRE_LOCK (
8815+ MDL_key::BACKUP, " " , " " , MDL_BACKUP_COMMIT,
8816+ MDL_EXPLICIT, thd->variables .lock_wait_timeout )))
88208817 DBUG_RETURN (1 );
8821- thd->backup_commit_lock = &mdl_request;
88228818
88238819 if ((res= thd->wait_for_prior_commit ()))
88248820 {
8825- if (mdl_request. ticket )
8826- thd->mdl_context .release_lock (mdl_request. ticket );
8821+ if (thd-> backup_commit_lock )
8822+ thd->mdl_context .release_lock (thd-> backup_commit_lock );
88278823 thd->backup_commit_lock = 0 ;
88288824 DBUG_RETURN (res);
88298825 }
@@ -8833,8 +8829,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
88338829 prev_binlog_id= current_binlog_id;
88348830 res= write_gtid_event (thd, nullptr , true , using_trans, commit_id,
88358831 false , false , false );
8836- if (mdl_request. ticket )
8837- thd->mdl_context .release_lock (mdl_request. ticket );
8832+ if (thd-> backup_commit_lock )
8833+ thd->mdl_context .release_lock (thd-> backup_commit_lock );
88388834 thd->backup_commit_lock = 0 ;
88398835 if (res)
88408836 goto err;
@@ -8944,7 +8940,6 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
89448940 &cache_data->engine_binlog_info ;
89458941 engine_context->gtid_offset = my_b_tell (file);
89468942 my_off_t binlog_total_bytes;
8947- MDL_request mdl_request;
89488943 int res;
89498944
89508945 if (engine_context->out_of_band_offset )
@@ -8957,17 +8952,15 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
89578952 goto engine_fail;
89588953 }
89598954
8960- MDL_REQUEST_INIT (&mdl_request, MDL_key::BACKUP, " " , " " , MDL_BACKUP_COMMIT,
8961- MDL_EXPLICIT);
8962- if (thd->mdl_context .acquire_lock (&mdl_request,
8963- thd->variables .lock_wait_timeout ))
8955+ if (!(thd->backup_commit_lock = thd->mdl_context .MDL_ACQUIRE_LOCK (
8956+ MDL_key::BACKUP, " " , " " , MDL_BACKUP_COMMIT,
8957+ MDL_EXPLICIT, thd->variables .lock_wait_timeout )))
89648958 goto engine_fail;
8965- thd->backup_commit_lock = &mdl_request;
89668959
89678960 if (thd->wait_for_prior_commit ())
89688961 {
8969- if (mdl_request. ticket )
8970- thd->mdl_context .release_lock (mdl_request. ticket );
8962+ if (thd-> backup_commit_lock )
8963+ thd->mdl_context .release_lock (thd-> backup_commit_lock );
89718964 thd->backup_commit_lock = 0 ;
89728965 goto engine_fail;
89738966 }
@@ -8985,8 +8978,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
89858978 mysql_mutex_lock (&LOCK_log);
89868979 res= write_gtid_event (thd, cache_data, true , using_trans, commit_id,
89878980 false , false , false );
8988- if (mdl_request. ticket )
8989- thd->mdl_context .release_lock (mdl_request. ticket );
8981+ if (thd-> backup_commit_lock )
8982+ thd->mdl_context .release_lock (thd-> backup_commit_lock );
89908983 thd->backup_commit_lock = 0 ;
89918984 if (res)
89928985 {
@@ -10258,12 +10251,12 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
1025810251 yet have the MDL_BACKUP_COMMIT_LOCK) and any threads using
1025910252 BACKUP LOCK BLOCK_COMMIT.
1026010253 */
10261- if (thd->backup_commit_lock && thd-> backup_commit_lock -> ticket &&
10254+ if (thd->backup_commit_lock &&
1026210255 !backup_lock_released)
1026310256 {
1026410257 backup_lock_released= 1 ;
10265- thd->mdl_context .release_lock (thd->backup_commit_lock -> ticket );
10266- thd->backup_commit_lock -> ticket = 0 ;
10258+ thd->mdl_context .release_lock (thd->backup_commit_lock );
10259+ thd->backup_commit_lock = 0 ;
1026710260 }
1026810261
1026910262 /*
@@ -10527,8 +10520,9 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
1052710520
1052810521end:
1052910522 if (backup_lock_released)
10530- thd->mdl_context .acquire_lock (thd->backup_commit_lock ,
10531- thd->variables .lock_wait_timeout );
10523+ thd->backup_commit_lock = thd->mdl_context .MDL_ACQUIRE_LOCK (
10524+ MDL_key::BACKUP, " " , " " , MDL_BACKUP_COMMIT,
10525+ MDL_EXPLICIT, thd->variables .lock_wait_timeout );
1053210526 DBUG_RETURN (result);
1053310527}
1053410528
0 commit comments