Skip to content

Rework MDL enum constants values#4912

Open
pranavktiwari wants to merge 2 commits into12.3from
12.3-MDEV-39184
Open

Rework MDL enum constants values#4912
pranavktiwari wants to merge 2 commits into12.3from
12.3-MDEV-39184

Conversation

@pranavktiwari
Copy link
Copy Markdown

@pranavktiwari pranavktiwari commented Apr 7, 2026

fixes MDEV-39184

Problem:

MDL constants values of 0 assign some default values (MDL_INTENTION_EXCLUSIVE, BACKUP) before MDL_REQUEST_INIT(). That does not make sense if MDL_REQUEST_INIT() was not called. Please rework the values of 0 into (MDL_NOT_INITIALIZED, NOT_INITIALIZED). Described by these comments in the code:

Fix

1- Increment all values in enum_mdl_type by 1.
2- Add a 0 at the start of the incompatibility arrays so the enum indices continue to match their corresponding bitmasks.
3- Update the MDL_BIT macro from (1U << A) to (1U << ((A) - 1)) to account for the enum shift.

This ensures that uninitialized MDL constants are correctly handled while preserving existing bitmask mappings.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 7, 2026

CLA assistant check
All committers have signed the CLA.

@midenok
Copy link
Copy Markdown
Contributor

midenok commented Apr 8, 2026

Hi @pranavktiwari,

Thank you for the patch! Now I see that change for MDL_BIT has negative effect on performance which is unwanted. I'd better tell in the description that it is investigation task and should be evaluated for push. Nonetheless, if we rework enum_mdl_type into bitmask values we would not need MDL_BIT() at all. What other problems occur if we try that?

It seems that I cannot recognize the changes for the second part of the ticket (about enum_mdl_namespace). Is it feasible to do these changes? Can you try to do it on the minimal set of code, without plugins and minor storage engines?

@FooBarrior FooBarrior requested a review from svoj April 8, 2026 09:47
We have 16 bits and we have enums till 15 (0 to 15) even after increment. So if I leave MDL_BIT unchanged (do not subtract 1), it will work as bit masking is supported and in the range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants