-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-39050: Improve error message for missing table share in GetTableShare() #5466
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
Open
chhsch
wants to merge
1
commit into
MariaDB:10.11
Choose a base branch
from
chhsch:MDEV-39050
base: 10.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+72
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # | ||
| # MDEV-39050 ConnectSE: improve table discovery error message when local database doesn't exist | ||
| # | ||
| DROP DATABASE IF EXISTS unknown_connect_db; | ||
| Warnings: | ||
| Note 1008 Can't drop database 'unknown_connect_db'; database doesn't exist | ||
| CREATE TABLE t1 (id INT NOT NULL, name VARCHAR(32)); | ||
| INSERT INTO t1 VALUES (1, 'foo'), (2, 'bar'); | ||
| # | ||
| # TABLE_TYPE=PROXY with DBNAME pointing to a non-existent database | ||
| # should produce "Unknown database" instead of a generic discovery error | ||
| # | ||
| CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='t1' DBNAME='unknown_connect_db'; | ||
| ERROR HY000: Unknown database 'unknown_connect_db' | ||
| # | ||
| # Once the database and source table exist, discovery should succeed | ||
| # | ||
| CREATE DATABASE unknown_connect_db; | ||
| CREATE TABLE unknown_connect_db.t1 (id INT NOT NULL, name VARCHAR(32)); | ||
| INSERT INTO unknown_connect_db.t1 VALUES (3, 'baz'); | ||
| CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='t1' DBNAME='unknown_connect_db'; | ||
| SELECT * FROM t2 ORDER BY id; | ||
| id name | ||
| 3 baz | ||
| DROP TABLE t2; | ||
| DROP TABLE t1; | ||
| DROP TABLE unknown_connect_db.t1; | ||
| DROP DATABASE unknown_connect_db; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --source include/not_embedded.inc | ||
|
|
||
| --echo # | ||
| --echo # MDEV-39050 ConnectSE: improve table discovery error message when local database doesn't exist | ||
| --echo # | ||
|
|
||
| # Ensure the test database does not exist | ||
| DROP DATABASE IF EXISTS unknown_connect_db; | ||
|
|
||
| # Create a source table to proxy | ||
| CREATE TABLE t1 (id INT NOT NULL, name VARCHAR(32)); | ||
| INSERT INTO t1 VALUES (1, 'foo'), (2, 'bar'); | ||
|
|
||
| --echo # | ||
| --echo # TABLE_TYPE=PROXY with DBNAME pointing to a non-existent database | ||
| --echo # should produce "Unknown database" instead of a generic discovery error | ||
| --echo # | ||
|
|
||
| --error ER_UNKNOWN_ERROR | ||
| CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='t1' DBNAME='unknown_connect_db'; | ||
|
|
||
| --echo # | ||
| --echo # Once the database and source table exist, discovery should succeed | ||
| --echo # | ||
|
|
||
| CREATE DATABASE unknown_connect_db; | ||
| CREATE TABLE unknown_connect_db.t1 (id INT NOT NULL, name VARCHAR(32)); | ||
| INSERT INTO unknown_connect_db.t1 VALUES (3, 'baz'); | ||
|
|
||
| CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='t1' DBNAME='unknown_connect_db'; | ||
| SELECT * FROM t2 ORDER BY id; | ||
|
|
||
| # Cleanup | ||
| DROP TABLE t2; | ||
| DROP TABLE t1; | ||
| DROP TABLE unknown_connect_db.t1; | ||
| DROP DATABASE unknown_connect_db; |
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
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.
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.
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.