BUG#22708 - Error message doesn't refer to storage engine unsupported
When openning a table with unsupported (disabled or not compiled) storage engine, confusing error message is returned. Return better error message when we're attempting to open a table that uses unsupported engine. sql/table.cc: Return better error message when we're attempting to open a table that uses unsupported engine.
This commit is contained in:
parent
ff67f76d05
commit
647fe5b3a1
35
mysql-test/r/bdb_notembedded.result
Normal file
35
mysql-test/r/bdb_notembedded.result
Normal file
@ -0,0 +1,35 @@
|
||||
set autocommit=1;
|
||||
reset master;
|
||||
create table bug16206 (a int);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
||||
f n Query 1 n use `test`; create table bug16206 (a int)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
||||
drop table bug16206;
|
||||
reset master;
|
||||
create table bug16206 (a int) engine= bdb;
|
||||
insert into bug16206 values(0);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
insert into bug16206 values(3);
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
||||
f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
|
||||
f n Query 1 n use `test`; insert into bug16206 values(0)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
||||
f n Query 1 n use `test`; BEGIN
|
||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
||||
f n Query 1 n use `test`; COMMIT
|
||||
f n Query 1 n use `test`; insert into bug16206 values(3)
|
||||
drop table bug16206;
|
||||
set autocommit=0;
|
||||
End of 5.0 tests
|
38
mysql-test/t/bdb_notembedded.test
Normal file
38
mysql-test/t/bdb_notembedded.test
Normal file
@ -0,0 +1,38 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_bdb.inc
|
||||
|
||||
#
|
||||
# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
|
||||
#
|
||||
set autocommit=1;
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
reset master;
|
||||
create table bug16206 (a int);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 1 f 2 n 5 n
|
||||
show binlog events;
|
||||
drop table bug16206;
|
||||
|
||||
reset master;
|
||||
create table bug16206 (a int) engine= bdb;
|
||||
insert into bug16206 values(0);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
insert into bug16206 values(3);
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 1 f 2 n 5 n
|
||||
show binlog events;
|
||||
drop table bug16206;
|
||||
|
||||
set autocommit=0;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
41
sql/table.cc
41
sql/table.cc
@ -886,26 +886,31 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
||||
ha_legacy_type(share->db_type())));
|
||||
}
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
else
|
||||
else if (str_db_type_length == 9 &&
|
||||
!strncmp((char *) next_chunk + 2, "partition", 9))
|
||||
{
|
||||
LEX_STRING pname= { C_STRING_WITH_LEN( "partition" ) };
|
||||
if (str_db_type_length == pname.length &&
|
||||
!strncmp((char *) next_chunk + 2, pname.str, pname.length))
|
||||
{
|
||||
/*
|
||||
Use partition handler
|
||||
tmp_plugin is locked with a local lock.
|
||||
we unlock the old value of share->db_plugin before
|
||||
replacing it with a globally locked version of tmp_plugin
|
||||
*/
|
||||
plugin_unlock(NULL, share->db_plugin);
|
||||
share->db_plugin= ha_lock_engine(NULL, partition_hton);
|
||||
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
|
||||
str_db_type_length, next_chunk + 2,
|
||||
ha_legacy_type(share->db_type())));
|
||||
}
|
||||
/*
|
||||
Use partition handler
|
||||
tmp_plugin is locked with a local lock.
|
||||
we unlock the old value of share->db_plugin before
|
||||
replacing it with a globally locked version of tmp_plugin
|
||||
*/
|
||||
plugin_unlock(NULL, share->db_plugin);
|
||||
share->db_plugin= ha_lock_engine(NULL, partition_hton);
|
||||
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
|
||||
str_db_type_length, next_chunk + 2,
|
||||
ha_legacy_type(share->db_type())));
|
||||
}
|
||||
#endif
|
||||
else if (!tmp_plugin)
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
error= 8;
|
||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
|
||||
my_free(buff, MYF(0));
|
||||
goto err;
|
||||
/* purecov: end */
|
||||
}
|
||||
next_chunk+= str_db_type_length + 2;
|
||||
}
|
||||
if (next_chunk + 5 < buff_end)
|
||||
@ -2188,6 +2193,8 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
|
||||
"of MySQL and cannot be read",
|
||||
MYF(0), buff);
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
default: /* Better wrong error than none */
|
||||
case 4:
|
||||
strxmov(buff, share->normalized_path.str, reg_ext, NullS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user