mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge fixes
mysql-test/mysql-test-run.sh: Auto merged ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged sql/sql_table.cc: Auto merged sql/ha_ndbcluster.cc: Merge: ndb_discover_tables should no longer be called when server is starting
This commit is contained in:
@ -520,6 +520,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
||||
CHARSETSDIR="$BASEDIR/sql/share/charsets"
|
||||
INSTALL_DB="./install_test_db"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
|
||||
NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
|
||||
else
|
||||
if test -x "$BASEDIR/libexec/mysqld"
|
||||
then
|
||||
@ -539,6 +540,7 @@ else
|
||||
MYSQL="$CLIENT_BINDIR/mysql"
|
||||
INSTALL_DB="./install_test_db --bin"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
|
||||
NDB_TOOLS_DIR="$CLIENT_BINDIR"
|
||||
if test -d "$BASEDIR/share/mysql/english"
|
||||
then
|
||||
LANGUAGE="$BASEDIR/share/mysql/english/"
|
||||
@ -585,7 +587,8 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=
|
||||
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
|
||||
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
|
||||
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
|
||||
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
|
||||
export NDB_TOOLS_DIR
|
||||
|
||||
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
|
||||
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
|
||||
@ -1595,10 +1598,13 @@ then
|
||||
fi
|
||||
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT $NDBCLUSTER_OPTS --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
|
||||
USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"host=localhost:$NDBCLUSTER_PORT\""
|
||||
NDB_CONNECTSTRING="localhost:$NDBCLUSTER_PORT"
|
||||
else
|
||||
USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$USE_RUNNING_NDBCLUSTER\""
|
||||
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
|
||||
echo "Using ndbcluster at $USE_NDBCLUSTER"
|
||||
fi
|
||||
export NDB_CONNECTSTRING
|
||||
fi
|
||||
|
||||
start_manager
|
||||
|
@ -1,4 +1,4 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t9;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
flush status;
|
||||
create table t1(
|
||||
id int not null primary key,
|
||||
@ -94,8 +94,6 @@ ERROR 42S01: Table 't3' already exists
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
SHOW TABLES FROM test;
|
||||
Tables_in_test
|
||||
create table IF NOT EXISTS t3(
|
||||
id int not null primary key,
|
||||
id2 int not null,
|
||||
@ -119,6 +117,162 @@ Variable_name Value
|
||||
Handler_discover 2
|
||||
drop table t3;
|
||||
flush status;
|
||||
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
|
||||
t7 ndbcluster 9 Fixed 1 0 # # # 0 NULL # # NULL # NULL
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
drop table t6, t7;
|
||||
flush status;
|
||||
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;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t9;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
|
||||
################################################
|
||||
@ -122,7 +122,6 @@ create table t3(
|
||||
# IF NOT EXISTS wasn't specified
|
||||
|
||||
show status like 'handler_discover%';
|
||||
SHOW TABLES FROM test;
|
||||
|
||||
# now it should be discovered
|
||||
create table IF NOT EXISTS t3(
|
||||
@ -145,38 +144,226 @@ show status like 'handler_discover%';
|
||||
|
||||
drop table t3;
|
||||
|
||||
#######################################################
|
||||
# Test that a table that already exists as frm file
|
||||
# but not in NDB can be deleted from disk.
|
||||
##################################################
|
||||
# Test that a table that already exists in NDB
|
||||
# is discovered when SHOW TABLES
|
||||
# is used
|
||||
#
|
||||
|
||||
# Manual test
|
||||
#flush status;
|
||||
#
|
||||
#create table t4(
|
||||
# id int not null primary key,
|
||||
# name char(27)
|
||||
#) engine=ndb;
|
||||
#insert into t4 values (1, "Automatic");
|
||||
#select * from t4;
|
||||
flush status;
|
||||
|
||||
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;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Remove the frm file from disk
|
||||
flush tables;
|
||||
system rm var/master-data/test/t7.frm ;
|
||||
|
||||
show tables from test;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Remove the frm file from disk again
|
||||
flush tables;
|
||||
system rm var/master-data/test/t7.frm ;
|
||||
|
||||
--replace_column 7 # 8 # 9 # 12 # 13 # 15 #
|
||||
show table status;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t6, t7;
|
||||
|
||||
|
||||
#######################################################
|
||||
# Test that a table that has been dropped from NDB
|
||||
# but still exists on disk, get a consistent error message
|
||||
# saying "No such table existed"
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, "Automatic");
|
||||
select * from t4;
|
||||
|
||||
# Remove the table from NDB
|
||||
#system drop_tab -c "$NDB_CONNECTSTRING2" -d test t4 > /dev/null ;
|
||||
#system drop_tab -c "host=localhost:2200;nodeid=5" -d test t4 > /dev/null ;
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
|
||||
|
||||
#
|
||||
#--error 1296
|
||||
#select * from t4;
|
||||
# Test that correct error is returned
|
||||
--error 1146
|
||||
select * from t4;
|
||||
--error 1146
|
||||
select * from t4;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
drop table t4;
|
||||
|
||||
|
||||
#######################################################
|
||||
# Test that a table that has been dropped from NDB
|
||||
# but still exists on disk is deleted from disk
|
||||
# when SHOW TABLES is called
|
||||
#
|
||||
#flush table t4;
|
||||
#--error 1016
|
||||
#select * from 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;
|
||||
flush tables;
|
||||
|
||||
# Remove the table from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
|
||||
|
||||
SHOW TABLES;
|
||||
|
||||
--error 1146
|
||||
select * from t4;
|
||||
|
||||
#######################################################
|
||||
# Test SHOW TABLES ability to detect new and delete old
|
||||
# tables. Test all at once using many tables
|
||||
#
|
||||
#show status like 'handler_discover%';
|
||||
#drop table t4;
|
||||
#flush tables;
|
||||
#show tables;
|
||||
#--error 1146
|
||||
#select * from t4;
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
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;
|
||||
|
||||
# Populate tables
|
||||
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);
|
||||
|
||||
# Remove t3, t5 from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
|
||||
# Remove t6, t7 from disk
|
||||
system rm var/master-data/test/t6.frm > /dev/null ;
|
||||
system rm var/master-data/test/t7.frm > /dev/null ;
|
||||
|
||||
SHOW TABLES;
|
||||
|
||||
select * from t6;
|
||||
select * from t7;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
|
||||
#######################################################
|
||||
# Test SHOW TABLES LIKE ability to detect new and delete old
|
||||
# tables. Test all at once using many tables.
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
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;
|
||||
|
||||
# Populate tables
|
||||
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);
|
||||
|
||||
# Remove t3, t5 from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
|
||||
# Remove t6, t7 from disk
|
||||
system rm var/master-data/test/t6.frm > /dev/null ;
|
||||
system rm var/master-data/test/t7.frm > /dev/null ;
|
||||
|
||||
|
||||
SHOW TABLES LIKE 't6';
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Check that t3 or t5 can't be created
|
||||
# frm files for these tables is stilll on disk
|
||||
--error 1050
|
||||
create table t3(a int);
|
||||
--error 1050
|
||||
create table t5(a int);
|
||||
|
||||
SHOW TABLES LIKE 't%';
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
|
||||
|
||||
|
||||
######################################################
|
||||
# Test that several tables can be discovered when
|
||||
# one statement access several table at once.
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
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;
|
||||
|
||||
# Populate tables
|
||||
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);
|
||||
|
||||
# Remove t1, t2, t3 from disk
|
||||
system rm var/master-data/test/t1.frm > /dev/null ;
|
||||
system rm var/master-data/test/t2.frm > /dev/null ;
|
||||
system rm var/master-data/test/t3.frm > /dev/null ;
|
||||
flush tables;
|
||||
|
||||
# Select from the table which only exists in NDB.
|
||||
select * from t1, t2, t3, t4;
|
||||
|
||||
# 3 table should have been discovered
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t3, t4;
|
||||
|
||||
|
||||
#########################################################
|
||||
@ -241,7 +428,6 @@ show status like 'handler_discover%';
|
||||
drop table t6;
|
||||
|
||||
######################################################
|
||||
# Simple test to show use of discover on startup
|
||||
# Note! This should always be the last step in this
|
||||
# file, the table t9 will be used and dropped
|
||||
# by ndb_autodiscover2
|
||||
@ -259,9 +445,7 @@ system rm var/master-data/test/t9.frm ;
|
||||
|
||||
# Now leave test case, when ndb_autodiscover2 will run, this
|
||||
# MySQL Server will have been restarted because it has a
|
||||
# ndb_autodiscover2-master.opt file. And thus the table should
|
||||
# have been discovered by the "discover on startup" function.
|
||||
# ndb_autodiscover2-master.opt file.
|
||||
|
||||
|
||||
|
||||
#TODO
|
||||
#SLECT * FROM t1, t2, t4;
|
||||
#handler discover 3;
|
||||
|
@ -1,14 +1,16 @@
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
#
|
||||
# Simple test to show use of discover on startup
|
||||
# Simple test to show use of discover when the server has been restarted
|
||||
# The previous step has simply removed the frm file
|
||||
# from disk, but left the table in NDB
|
||||
#
|
||||
--sleep 3;
|
||||
select * from t9 order by a;
|
||||
|
||||
# handler_discover should be zero
|
||||
# handler_discover should be 1
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t9;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user