maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #04899
Re: [Commits] Rev 3578: MDEV-495 backport --ignore-db-dir
Hi, Holyfoot!
On Sep 25, holyfoot@xxxxxxxxxxxx wrote:
> revno: 3578
> revision-id: holyfoot@xxxxxxxxxxxx-20120925094024-yv0wpbl6k7b6bgg8
> parent: sanja@xxxxxxxxxxxxxxxx-20120920094859-lcrxe8lr1mtg8h10
> committer: Alexey Botchkov <holyfoot@xxxxxxxxxxxx>
> branch nick: mdev495
> timestamp: Tue 2012-09-25 14:40:24 +0500
> message:
> MDEV-495 backport --ignore-db-dir.
> The feature was backported from MySQL 5.6.
> Some code was added to make commands as
> SELECT * FROM ignored_db.t1;
> CALL ignored_db.proc();
> USE ignored_db;
> to take that option into account.
Just a few comments:
1. add a test case for CREATE DATABASE,
CREATE DATABASE ignored_db should fail.
2. I'd prefer to get an error "db not found" instead of "incorrect db
name", is it difficult to do?
3. add a test for the following: lost+found is ignored, but
CREATE DATABASE `lost+found` should succeed!
(indeed, it creates a directory lost@002bfound, which is not
ignored), and later SELECT, CALL, USE, SHOW DATABASES,
should show that new db.
> === added file 'mysql-test/r/ignore_db_dirs_basic.result'
> --- a/mysql-test/r/ignore_db_dirs_basic.result 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/r/ignore_db_dirs_basic.result 2012-09-25 09:40:24 +0000
> @@ -0,0 +1,28 @@
> +select @@ignore_db_dirs;
> +@@ignore_db_dirs
> +e,lost+found,.mysqlgui,ignored_db
> +# Check that SHOW DATABASES ignores all directories from
> +# @@ignore_db_dirs and all directories with names starting
> +# with '.'
> +SHOW DATABASES;
> +Database
> +information_schema
> +#mysql50#.otherdir
> +mtr
> +mysql
> +test
> +USE ignored_db;
> +ERROR 42000: Incorrect database name 'ignored_db'
> +SELECT * FROM ignored_db.t1;
> +ERROR 42000: Incorrect database name 'ignored_db'
> +CALL ignored_db.p1();
> +ERROR 42000: Incorrect database name 'ignored_db'
> +SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='ignored_db';
> +COUNT(*)
> +1
> +SET @@global.ignore_db_dirs = 'aha';
> +ERROR HY000: Variable 'ignore_db_dirs' is a read only variable
> +SET @@local.ignore_db_dirs = 'aha';
> +ERROR HY000: Variable 'ignore_db_dirs' is a read only variable
> +SET @@ignore_db_dirs = 'aha';
> +ERROR HY000: Variable 'ignore_db_dirs' is a read only variable
When merging to 5.5 you'll need to move this test to sys_vars suite
(otherwise sys_vars.all_vars will fail)
> === modified file 'sql/sql_show.cc'
> --- a/sql/sql_show.cc 2012-08-24 13:39:34 +0000
> +++ b/sql/sql_show.cc 2012-09-25 09:40:24 +0000
> @@ -379,6 +379,239 @@ bool mysqld_show_privileges(THD *thd)
> }
>
>
> +/** Hash of LEX_STRINGs used to search for ignored db directories. */
> +static HASH ignore_db_dirs_hash;
> +
> +/**
> + An array of LEX_STRING pointers to collect the options at
> + option parsing time.
> +*/
> +static DYNAMIC_ARRAY ignore_db_dirs_array;
I don't think that sql_show.cc is where all this code really belongs,
but ok, as you like.
Regards,
Sergei