-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-39548 Cleanup MDL_request boilerplate with ACQUIRE_LOCK macro #5075
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
base: main
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 |
|---|---|---|
|
|
@@ -926,12 +926,11 @@ bool vers_create_partitions(THD *thd, TABLE_LIST* tl, uint num_parts) | |
| create_info.alter_info= &alter_info; | ||
| Alter_table_ctx alter_ctx(thd, tl, 1, &table->s->db, &table->s->table_name); | ||
|
|
||
| MDL_REQUEST_INIT(&tl->mdl_request, MDL_key::TABLE, tl->db.str, | ||
| tl->table_name.str, MDL_SHARED_NO_WRITE, MDL_TRANSACTION); | ||
| if (thd->mdl_context.acquire_lock(&tl->mdl_request, | ||
| thd->variables.lock_wait_timeout)) | ||
| if (!(table->mdl_ticket= thd->mdl_context.MDL_ACQUIRE_LOCK( | ||
| MDL_key::TABLE, tl->db.str, tl->table_name.str, | ||
| MDL_SHARED_NO_WRITE, MDL_TRANSACTION, | ||
| thd->variables.lock_wait_timeout))) | ||
| goto exit; | ||
| table->mdl_ticket= tl->mdl_request.ticket; | ||
|
Contributor
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. Dunno, I'd avoid this change as we can't trivially verify that subsequently executed code doesn't rely on initialized
Contributor
Author
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. Reverted — keeping the original MDL_REQUEST_INIT + acquire_lock pattern here since subsequent code may rely on tl->mdl_request being initialized. |
||
|
|
||
| create_info.db_type= table->s->db_type(); | ||
| create_info.options|= HA_VERSIONED_TABLE; | ||
|
|
||
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.
It looks like this whole lock is there just to satisfy assertion in
Table_triggers_list::change_table_name(), otherwise it is redundant. We could probably relax this assertion and remove the lock. Feel free to research this in a separate task/pr if you like.Otherwise this change looks alright, just remove unused
errorindeed.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.
Removed the unused error variable. We can have another task for investigating whether this lock can be removed entirely.