2004-11-08 11:06:36 +01:00
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
2004-05-17 09:53:13 +02:00
|
|
|
flush status;
|
|
|
|
create table t1(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t1 values(1, "Autodiscover");
|
|
|
|
flush tables;
|
|
|
|
select * from t1;
|
|
|
|
id name
|
|
|
|
1 Autodiscover
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 1
|
|
|
|
flush tables;
|
|
|
|
insert into t1 values (2, "Auto 2");
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 2
|
|
|
|
insert into t1 values (3, "Discover 3");
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 2
|
|
|
|
flush tables;
|
2004-05-26 14:22:49 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
id name
|
2004-05-26 14:22:49 +02:00
|
|
|
1 Autodiscover
|
2004-05-17 09:53:13 +02:00
|
|
|
2 Auto 2
|
|
|
|
3 Discover 3
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 3
|
|
|
|
flush tables;
|
|
|
|
update t1 set name="Autodiscover" where id = 2;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 4
|
2004-08-27 14:15:47 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
id name
|
|
|
|
1 Autodiscover
|
2004-08-27 14:15:47 +02:00
|
|
|
2 Autodiscover
|
2004-05-17 09:53:13 +02:00
|
|
|
3 Discover 3
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 4
|
|
|
|
flush tables;
|
|
|
|
delete from t1 where id = 3;
|
2004-05-26 14:34:40 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
id name
|
|
|
|
1 Autodiscover
|
2004-05-26 14:34:40 +02:00
|
|
|
2 Autodiscover
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 5
|
|
|
|
drop table t1;
|
|
|
|
flush status;
|
|
|
|
create table t2(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(22)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t2 values (1, "Discoverer");
|
|
|
|
select * from t2;
|
|
|
|
id name
|
|
|
|
1 Discoverer
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
flush tables;
|
|
|
|
select * from t2;
|
|
|
|
id name
|
|
|
|
1 Discoverer
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 1
|
|
|
|
drop table t2;
|
|
|
|
flush status;
|
|
|
|
create table t3(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t3 values (1, "Explorer");
|
|
|
|
select * from t3;
|
|
|
|
id name
|
|
|
|
1 Explorer
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
flush tables;
|
|
|
|
create table t3(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20), a int, b float, c char(24)
|
|
|
|
) engine=ndb;
|
|
|
|
ERROR 42S01: Table 't3' already exists
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
Handler_discover 0
|
2004-05-17 09:53:13 +02:00
|
|
|
create table IF NOT EXISTS t3(
|
|
|
|
id int not null primary key,
|
|
|
|
id2 int not null,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
2005-09-12 21:45:03 +02:00
|
|
|
Warnings:
|
|
|
|
Note 1050 Table 't3' already exists
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
Handler_discover 0
|
2004-05-17 09:53:13 +02:00
|
|
|
SHOW CREATE TABLE t3;
|
|
|
|
Table Create Table
|
|
|
|
t3 CREATE TABLE `t3` (
|
|
|
|
`id` int(11) NOT NULL default '0',
|
|
|
|
`name` char(255) default NULL,
|
|
|
|
PRIMARY KEY (`id`)
|
|
|
|
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
|
|
|
select * from t3;
|
|
|
|
id name
|
|
|
|
1 Explorer
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
Handler_discover 1
|
2004-05-17 09:53:13 +02:00
|
|
|
drop table t3;
|
|
|
|
flush status;
|
2004-09-13 14:46:38 +02:00
|
|
|
create table t7(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=ndb;
|
|
|
|
create table t6(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=MyISAM;
|
|
|
|
insert into t7 values (1, "Explorer");
|
|
|
|
insert into t6 values (2, "MyISAM table");
|
|
|
|
select * from t7;
|
|
|
|
id name
|
|
|
|
1 Explorer
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
flush tables;
|
|
|
|
show tables from test;
|
|
|
|
Tables_in_test
|
|
|
|
t6
|
|
|
|
t7
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 1
|
|
|
|
flush tables;
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
|
|
|
t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
|
2004-09-21 12:13:58 +02:00
|
|
|
t7 ndbcluster 9 Fixed 1 0 # # # 0 NULL # # NULL # NULL
|
2004-09-13 14:46:38 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 2
|
|
|
|
drop table t6, t7;
|
|
|
|
flush status;
|
2004-09-30 14:20:14 +02:00
|
|
|
create table t4(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(27)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t4 values (1, "Automatic");
|
|
|
|
select * from t4;
|
|
|
|
id name
|
|
|
|
1 Automatic
|
|
|
|
select * from t4;
|
|
|
|
ERROR 42S02: Table 'test.t4' doesn't exist
|
|
|
|
select * from t4;
|
|
|
|
ERROR 42S02: Table 'test.t4' doesn't exist
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
drop table t4;
|
|
|
|
flush status;
|
|
|
|
create table t4(
|
|
|
|
id int not null primary key,
|
|
|
|
id2 int,
|
|
|
|
name char(27)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t4 values (1, 76, "Automatic2");
|
|
|
|
select * from t4;
|
|
|
|
id id2 name
|
|
|
|
1 76 Automatic2
|
|
|
|
flush tables;
|
|
|
|
SHOW TABLES;
|
|
|
|
Tables_in_test
|
|
|
|
select * from t4;
|
|
|
|
ERROR 42S02: Table 'test.t4' doesn't exist
|
|
|
|
flush status;
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=myisam;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
create table t5(id int, d char(56)) engine=ndbcluster;
|
|
|
|
create table t6(id int) engine=ndbcluster;
|
|
|
|
create table t7(id int) engine=ndbcluster;
|
|
|
|
create table t8(id int, e char(34)) engine=myisam;
|
|
|
|
create table t9(id int) engine=myisam;
|
|
|
|
insert into t2 values (2, "myisam table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t5 values (5, "ndb table 5");
|
|
|
|
insert into t6 values (6);
|
|
|
|
insert into t8 values (8, "myisam table 8");
|
|
|
|
insert into t9 values (9);
|
|
|
|
SHOW TABLES;
|
|
|
|
Tables_in_test
|
|
|
|
t1
|
|
|
|
t2
|
|
|
|
t4
|
|
|
|
t8
|
|
|
|
t9
|
|
|
|
t7
|
|
|
|
t6
|
|
|
|
select * from t6;
|
|
|
|
id
|
|
|
|
6
|
|
|
|
select * from t7;
|
|
|
|
id
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 2
|
|
|
|
drop table t1, t2, t4, t6, t7, t8, t9;
|
|
|
|
flush status;
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=myisam;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
create table t5(id int, d char(56)) engine=ndbcluster;
|
|
|
|
create table t6(id int) engine=ndbcluster;
|
|
|
|
create table t7(id int) engine=ndbcluster;
|
|
|
|
create table t8(id int, e char(34)) engine=myisam;
|
|
|
|
create table t9(id int) engine=myisam;
|
|
|
|
insert into t2 values (2, "myisam table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t5 values (5, "ndb table 5");
|
|
|
|
insert into t6 values (6);
|
|
|
|
insert into t8 values (8, "myisam table 8");
|
|
|
|
insert into t9 values (9);
|
|
|
|
SHOW TABLES LIKE 't6';
|
|
|
|
Tables_in_test (t6)
|
|
|
|
t6
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 1
|
|
|
|
create table t3(a int);
|
|
|
|
ERROR 42S01: Table 't3' already exists
|
|
|
|
create table t5(a int);
|
|
|
|
ERROR 42S01: Table 't5' already exists
|
|
|
|
SHOW TABLES LIKE 't%';
|
|
|
|
Tables_in_test (t%)
|
|
|
|
t1
|
|
|
|
t2
|
|
|
|
t4
|
|
|
|
t6
|
|
|
|
t8
|
|
|
|
t9
|
|
|
|
t7
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 2
|
|
|
|
drop table t1, t2, t4, t6, t7, t8, t9;
|
|
|
|
flush status;
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=ndbcluster;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
insert into t1 values (1);
|
|
|
|
insert into t2 values (2, "table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t4 values (4);
|
|
|
|
flush tables;
|
|
|
|
select * from t1, t2, t3, t4;
|
|
|
|
id id b id c id
|
|
|
|
1 2 table 2 3 ndb table 3 4
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 3
|
|
|
|
drop table t1, t2, t3, t4;
|
|
|
|
flush status;
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
create table t5(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(200)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t5 values (1, "Magnus");
|
|
|
|
select * from t5;
|
|
|
|
id name
|
|
|
|
1 Magnus
|
|
|
|
ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
|
|
|
|
select * from t5;
|
|
|
|
adress id name
|
|
|
|
NULL 1 Magnus
|
|
|
|
insert into t5 values
|
|
|
|
("Adress for record 2", 2, "Carl-Gustav"),
|
|
|
|
("Adress for record 3", 3, "Karl-Emil");
|
|
|
|
update t5 set name="Bertil" where id = 2;
|
|
|
|
select * from t5 order by id;
|
|
|
|
adress id name
|
|
|
|
NULL 1 Magnus
|
|
|
|
Adress for record 2 2 Bertil
|
|
|
|
Adress for record 3 3 Karl-Emil
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
drop table t5;
|
|
|
|
flush status;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
create table t6(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t6 values (1, "Magnus");
|
|
|
|
select * from t6;
|
|
|
|
id name
|
|
|
|
1 Magnus
|
|
|
|
ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
|
|
|
|
select * from t6;
|
|
|
|
adress id name
|
|
|
|
NULL 1 Magnus
|
|
|
|
insert into t6 values
|
|
|
|
("Adress for record 2", 2, "Carl-Gustav"),
|
|
|
|
("Adress for record 3", 3, "Karl-Emil");
|
|
|
|
update t6 set name="Bertil" where id = 2;
|
|
|
|
select * from t6 order by id;
|
|
|
|
adress id name
|
|
|
|
NULL 1 Magnus
|
|
|
|
Adress for record 2 2 Bertil
|
|
|
|
Adress for record 3 3 Karl-Emil
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_discover 0
|
|
|
|
drop table t6;
|
2004-10-08 13:37:13 +02:00
|
|
|
show tables;
|
|
|
|
Tables_in_test
|
2004-10-10 10:31:45 +02:00
|
|
|
create table t1 (a int,b longblob) engine=ndb;
|
2004-10-08 13:37:13 +02:00
|
|
|
show tables;
|
|
|
|
Tables_in_test
|
|
|
|
t1
|
|
|
|
create database test2;
|
|
|
|
use test2;
|
|
|
|
show tables;
|
|
|
|
Tables_in_test2
|
|
|
|
select * from t1;
|
|
|
|
ERROR 42S02: Table 'test2.t1' doesn't exist
|
2004-10-10 10:31:45 +02:00
|
|
|
create table t2 (b int,c longblob) engine=ndb;
|
2004-10-08 13:37:13 +02:00
|
|
|
use test;
|
|
|
|
select * from t1;
|
2004-10-10 10:31:45 +02:00
|
|
|
a b
|
2004-10-08 13:37:13 +02:00
|
|
|
show tables;
|
|
|
|
Tables_in_test
|
|
|
|
t1
|
|
|
|
drop table t1;
|
|
|
|
use test2;
|
|
|
|
drop table t2;
|
|
|
|
drop database test2;
|
|
|
|
show databases;
|
|
|
|
Database
|
|
|
|
mysql
|
|
|
|
test
|
|
|
|
use test;
|
2004-05-17 09:53:13 +02:00
|
|
|
CREATE TABLE t9 (
|
|
|
|
a int NOT NULL PRIMARY KEY,
|
|
|
|
b int
|
|
|
|
) engine=ndb;
|
|
|
|
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
|
2004-11-08 11:06:36 +01:00
|
|
|
create table t10 (
|
|
|
|
a int not null primary key,
|
|
|
|
b blob
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t10 values (1, 'kalle');
|