MDEV-39050: Improve error message for missing table share in GetTableShare() - #5466
Open
chhsch wants to merge 1 commit into
Open
MDEV-39050: Improve error message for missing table share in GetTableShare()#5466chhsch wants to merge 1 commit into
chhsch wants to merge 1 commit into
Conversation
…Share() Handle the case in tabutil.cpp where GetTableShare() must report an error after open_table_def() has already failed. open_table_def() stores the underlying system error in s->open_errno before returning, so if opening the .frm file fails with ENOENT, that information is preserved on the share. We use these recorded values to determine the most appropriate error message: 1. s->error == OPEN_FRM_OPEN_ERROR indicates the table definition file failed to open. 2. s->open_errno == ENOENT indicates the failure was due to a "not found" condition. 3. check_db_dir_existence(db) then distinguishes whether the missing path corresponds to an unknown database, versus a generic open/share error.
gkodinov
requested changes
Aug 5, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
| if (thd->is_error()) | ||
| thd->clear_error(); // Avoid stopping info commands | ||
|
|
||
| snprintf(g->Message, sizeof(g->Message), "Error %d opening share", s->error); |
Member
There was a problem hiding this comment.
I wonder if there's a more concrete error into the THD itself before it gets cleaned by clear_error() up above. It would make sense to print these errors first IMHO, if present.
And I'd also try to make sure there are errors if something goes wrong too.
The call to check_db_dir_existence() is a nice touch. But I do not believe it's done for normal tables on open. It's mostly done on db change (e.g. USE) and on DDL statements. I'd say stick to that pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle the case in tabutil.cpp where GetTableShare() must report an error after open_table_def() has already failed.
open_table_def() stores the underlying system error in s->open_errno before returning, so if opening the .frm file fails with ENOENT, that information is preserved on the share. We use these recorded values to determine the most appropriate error message: