Commit 8a231241 authored by paul@snake-hub.snake.net's avatar paul@snake-hub.snake.net

Merge paul@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  snake-hub.snake.net:/src/extern/MySQL/bk/mysql-5.1
parents 0ffd92b9 9d9dcf81
......@@ -1613,3 +1613,4 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
scripts/mysql_upgrade
......@@ -59,5 +59,6 @@ enum options_client
OPT_MYSQL_PRESERVE_SCHEMA,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES
};
......@@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password = 0, opt_frm = 0;
tty_password = 0, opt_frm = 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
......@@ -48,7 +49,7 @@ static char *shared_memory_base_name=0;
static uint opt_protocol=0;
static CHARSET_INFO *charset_info= &my_charset_latin1;
enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE};
enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
static struct my_option my_long_options[] =
{
......@@ -78,6 +79,9 @@ static struct my_option my_long_options[] =
{"check-only-changed", 'C',
"Check only tables that have changed since last check or haven't been closed properly.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"check-upgrade", 'g',
"Check tables for version dependent changes.May be used with auto-repair to correct tables requiring version dependent updates.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
......@@ -98,6 +102,12 @@ static struct my_option my_long_options[] =
{"fast",'F', "Check only tables that haven't been closed properly.",
(gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.",
(gptr*) &opt_fix_db_names, (gptr*) &opt_fix_db_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.",
(gptr*) &opt_fix_table_names, (gptr*) &opt_fix_table_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
......@@ -171,6 +181,7 @@ static int process_all_databases();
static int process_databases(char **db_names);
static int process_selected_tables(char *db, char **table_names, int tables);
static int process_all_tables_in_db(char *database);
static int process_one_db(char *database);
static int use_db(char *database);
static int handle_request_for_tables(char *tables, uint length);
static int dbConnect(char *host, char *user,char *passwd);
......@@ -251,6 +262,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'o':
what_to_do = DO_OPTIMIZE;
break;
case OPT_FIX_DB_NAMES:
what_to_do= DO_UPGRADE;
default_charset= (char*) "utf8";
opt_databases= 1;
break;
case OPT_FIX_TABLE_NAMES:
what_to_do= DO_UPGRADE;
default_charset= (char*) "utf8";
break;
case 'p':
if (argument)
{
......@@ -268,6 +288,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'r':
what_to_do = DO_REPAIR;
break;
case 'g':
what_to_do= DO_CHECK;
opt_upgrade= 1;
break;
case 'W':
#ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE;
......@@ -369,7 +393,7 @@ static int process_all_databases()
}
while ((row = mysql_fetch_row(tableres)))
{
if (process_all_tables_in_db(row[0]))
if (process_one_db(row[0]))
result = 1;
}
return result;
......@@ -382,7 +406,7 @@ static int process_databases(char **db_names)
int result = 0;
for ( ; *db_names ; db_names++)
{
if (process_all_tables_in_db(*db_names))
if (process_one_db(*db_names))
result = 1;
}
return result;
......@@ -495,6 +519,43 @@ static int process_all_tables_in_db(char *database)
} /* process_all_tables_in_db */
static int fix_object_name(const char *obj, const char *name)
{
char qbuf[100 + NAME_LEN*4];
int rc= 0;
if (strncmp(name, "#mysql50#", 9))
return 1;
sprintf(qbuf, "RENAME %s `%s` TO `%s`", obj, name, name + 9);
if (mysql_query(sock, qbuf))
{
fprintf(stderr, "Failed to %s\n", qbuf);
fprintf(stderr, "Error: %s\n", mysql_error(sock));
rc= 1;
}
if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
return rc;
}
static int process_one_db(char *database)
{
if (what_to_do == DO_UPGRADE)
{
int rc= 0;
if (opt_fix_db_names && !strncmp(database,"#mysql50#", 9))
{
rc= fix_object_name("DATABASE", database);
database+= 9;
}
if (rc || !opt_fix_table_names)
return rc;
}
return process_all_tables_in_db(database);
}
static int use_db(char *database)
{
if (mysql_get_server_version(sock) >= 50003 &&
......@@ -525,6 +586,7 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */
if (opt_extended) end = strmov(end, " EXTENDED");
if (opt_check_only_changed) end = strmov(end, " CHANGED");
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break;
case DO_REPAIR:
op = "REPAIR";
......@@ -538,6 +600,8 @@ static int handle_request_for_tables(char *tables, uint length)
case DO_OPTIMIZE:
op = "OPTIMIZE";
break;
case DO_UPGRADE:
return fix_object_name("TABLE", tables);
}
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME))))
......
......@@ -370,9 +370,9 @@ enum ha_base_keytype {
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints
would lead to a duplicate key
error in some other table. */
#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */
#define HA_ERR_LAST 163 /* Copy last error no */
#define HA_ERR_LAST 164 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
......
......@@ -371,6 +371,7 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
*/
#define TT_USEFRM 1
#define TT_FOR_UPGRADE 2
#define O_NEW_INDEX 1 /* Bits set in out_flag */
#define O_NEW_DATA 2
......
#
# Test of auto_increment with offset
#
#####################################
# By: JBM
# Date: 2006-02-10
# Change: NDB does not support auto inc
# in this usage. Currently there is no
# plan to implment. Skipping test when
# NDB is default engine.
#####################################
-- source include/not_ndb_default.inc
-- source include/master-slave.inc
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
......
......@@ -36,7 +36,6 @@ drop table t1;
eval create table t1 (word char(20) not null)ENGINE=$engine_type;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
drop table t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
......@@ -68,8 +67,7 @@ flush logs;
# To make it predictable, we do a useless update now, but which has the
# interest of making the slave catch both rotate events.
eval create table t5 (a int)ENGINE=$engine_type;
drop table t5;
eval create table t3 (a int)ENGINE=$engine_type;
# Sync slave and force it to start on another binary log
......@@ -86,9 +84,8 @@ connection master;
# Create some entries for second log
eval create table t1 (n int)ENGINE=$engine_type;
insert into t1 values (1);
drop table t1;
eval create table t2 (n int)ENGINE=$engine_type;
insert into t2 values (1);
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
......@@ -125,3 +122,9 @@ show slave status;
--error 1220
show binlog events in 'slave-bin.000005' from 4;
# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
......@@ -30,7 +30,6 @@ data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
--echo
--echo **** Data Insert Validation Master Section test.t1 ****
......@@ -60,6 +59,9 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
# Sleep is needed for NDB to allow time for
# Injector thread to populate the bin log.
sleep 10;
save_master_pos;
connection slave;
sync_with_master;
......@@ -155,6 +157,9 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
# Sleep is needed for NDB to allow time for
# Injector thread to populate the bin log.
sleep 15;
save_master_pos;
connection slave;
sync_with_master;
......
......@@ -9,14 +9,14 @@ let $VERSION=`select version()`;
eval create table t1(a int not null primary key) engine=$engine_type;
insert delayed into t1 values (1),(2),(3);
flush tables;
select * from t1;
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
connection master;
--replace_result $VERSION VERSION
show binlog events;
sync_slave_with_master;
select * from t1;
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
sync_slave_with_master;
-- source include/master-slave.inc
##############################################################################
#
# Let's verify that multi-update with a subselect does not cause the slave to crash
# (BUG#10442)
#
--disable_query_log
SELECT '-------- Test for BUG#9361 --------' as "";
--enable_query_log
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
connection master;
drop table t1,t2;
##############################################################################
#
# Test for BUG#9361:
# Subselects should work inside multi-updates
#
--disable_query_log
SELECT '-------- Test 1 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 (
a1 char(30),
a2 int,
a3 int,
a4 char(30),
a5 char(30)
);
CREATE TABLE t2 (
b1 int,
b2 char(30)
);
# Insert one row per table
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
INSERT INTO t2 VALUES (1, 'baz');
# This should update the row in t1
UPDATE t1 a, t2
SET a.a1 = 'No'
WHERE a.a2 =
(SELECT b1
FROM t2
WHERE b2 = 'baz')
AND a.a3 IS NULL
AND a.a4 = 'foo'
AND a.a5 = 'bar';
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
SELECT * FROM t2;
connection master;
DROP TABLE t1, t2;
##############################################################################
#
# Second test for BUG#9361
#
--disable_query_log
SELECT '-------- Test 2 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (
i INT,
j INT,
x INT,
y INT,
z INT
);
CREATE TABLE t2 (
i INT,
k INT,
x INT,
y INT,
z INT
);
CREATE TABLE t3 (
j INT,
k INT,
x INT,
y INT,
z INT
);
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE t1 AS a
INNER JOIN t2 AS b
ON a.i = b.i
INNER JOIN t3 AS c
ON a.j = c.j AND b.k = c.k
SET a.x = b.x,
a.y = b.y,
a.z = (
SELECT sum(z)
FROM t3
WHERE y = 34
)
WHERE b.x = 23;
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
connection master;
DROP TABLE t1, t2, t3;
......@@ -46,7 +46,10 @@ CALL test.p2();
SELECT release_lock("test");
SELECT * FROM test.t1;
#show binlog events;
# Added sleep for use with NDB to ensure that
# the injector thread will populate log before
# we switch to the slave.
sleep 5;
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
......
......@@ -5,7 +5,10 @@
# TEST: Use after insert and before inset triggers and stored procdures to #
# Update and insert data #
#############################################################################
# Change Auth: JBM #
# Date: 2006-02-14 #
# Change: Added error, sleep and comments (ndb) #
####################################################
# Begin clean up test section
connection master;
......@@ -25,12 +28,16 @@ CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO t
delimiter ;//
INSERT INTO test.t2 VALUES (1, 0.0);
--error 0,1062
# Expect duplicate error 1022 == ndb
--error 1022,1062
INSERT INTO test.t2 VALUES (1, 0.0);
#show binlog events;
select * from test.t1;
select * from test.t2;
# Have to sleep for a few seconds to allow
# NDB injector thread to populate binlog
sleep 10;
sync_slave_with_master;
connection slave;
select * from test.t1;
......
######################################################
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
DROP TABLE test.backup_info;
######################################################
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
--require r/true.require
disable_query_log;
select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE";
enable_query_log;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t4;
DROP TABLE IF EXISTS test.t5;
DROP TABLE IF EXISTS test.t6;
**** Test 1 Simple DD backup and restore **** CREATE LOGFILE GROUP log_group1 ADD UNDOFILE './log_group1/undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE TABLESPACE table_space1
ADD DATAFILE './table_space1/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden 500 1
2 Sweden 499 1
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
DROP TABLE test.t1;
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden 500 1
2 Sweden 499 1
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
**** Test 2 Mixed Cluster Test backup and restore **** CREATE TABLE test.t2
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB; CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB; SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden 500 1
2 Sweden 499 1
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
SELECT COUNT(*) FROM test.t2;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden, Texas 500 0
2 Sweden, Texas 499 0
3 Sweden, Texas 498 0
4 Sweden, Texas 497 0
5 Sweden, Texas 496 0
SELECT COUNT(*) FROM test.t3;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
LENGTH(data)
16384
SELECT COUNT(*) FROM test.t4;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden 500 1
2 Sweden 499 1
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
SELECT COUNT(*) FROM test.t2;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
pk1 c2 c3 hex(c4)
1 Sweden, Texas 500 0
2 Sweden, Texas 499 0
3 Sweden, Texas 498 0
4 Sweden, Texas 497 0
5 Sweden, Texas 496 0
SELECT COUNT(*) FROM test.t3;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
LENGTH(data)
16384
SELECT COUNT(*) FROM test.t4;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
**** Test 3 Adding partition Test backup and restore **** CREATE TABLESPACE table_space2 ADD DATAFILE './table_space2/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4; CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2; CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720)); CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720)); SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT COUNT(*) FROM test.t1;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas 2 0
249 Sweden, Texas 4 0
248 Sweden, Texas 6 0
247 Sweden, Texas 8 0
246 Sweden, Texas 10 0
SELECT COUNT(*) FROM test.t2;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
SELECT COUNT(*) FROM test.t3;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
SELECT COUNT(*) FROM test.t4;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas 2 0
249 Sweden, Texas 4 0
248 Sweden, Texas 6 0
247 Sweden, Texas 8 0
246 Sweden, Texas 10 0
SELECT COUNT(*) FROM test.t5;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
SELECT COUNT(*) FROM test.t6;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; DROP TABLE test.t5; DROP TABLE test.t6; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE table_space2
DROP DATAFILE './table_space2/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP TABLESPACE table_space2
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
SELECT COUNT(*) FROM test.t1;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas 2 0
249 Sweden, Texas 4 0
248 Sweden, Texas 6 0
247 Sweden, Texas 8 0
246 Sweden, Texas 10 0
SELECT COUNT(*) FROM test.t2;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
SELECT COUNT(*) FROM test.t3;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
SELECT COUNT(*) FROM test.t4;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas 2 0
249 Sweden, Texas 4 0
248 Sweden, Texas 6 0
247 Sweden, Texas 8 0
246 Sweden, Texas 10 0
SELECT COUNT(*) FROM test.t5;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
SELECT COUNT(*) FROM test.t6;
COUNT(*)
250
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
pk1 c2 c3 hex(c4)
250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB; ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB; DROP TABLESPACE table_space1 ENGINE = NDB; DROP TABLESPACE table_space2 ENGINE = NDB; DROP LOGFILE GROUP log_group1 ENGINE = NDB;
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int);
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
......
......@@ -24,7 +24,7 @@ use mysqltest_to;
select * from a;
i
3
create table t1 (a int);
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=NDB;
INSERT INTO test.t1 VALUES(1,UUID(),UUID());
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,UUID(),UUID());
INSERT INTO test.t1 VALUES(3,UUID(),UUID());
end|
CALL test.p1();
create function test.fn1(x int)
returns int
begin
insert into t1 values (4+x,UUID(),UUID());
insert into t1 values (5+x,UUID(),UUID());
return 0;
end|
select fn1(0);
fn1(0)
0
create table t2 (a int);
insert into t2 values(fn1(2));
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`blob_column` longblob,
`vchar_column` varchar(100) default NULL,
PRIMARY KEY (`a`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
DROP PROCEDURE test.p1;
DROP FUNCTION test.fn1;
DROP TABLE test.t1;
DROP TABLE test.t2;
......@@ -4,116 +4,94 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
***************** Test 1 ************************
CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a b
12 1
22 2
32 3
select * from t1;
3 1
4 2
5 3
******* Select from Slave *************
select * from t1 ORDER BY a;
a b
12 1
22 2
32 3
3 1
4 2
5 3
drop table t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where b=4;
insert into t1 values (NULL,5),(NULL,6);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a b
1 1
2 2
3 3
22 5
32 6
select * from t1;
5 5
6 6
******* Select from Slave *************
select * from t1 ORDER BY a;
a b
1 1
2 2
3 3
22 5
32 6
5 5
6 6
drop table t1;
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
show variables like "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
a
5
10
110
250
310
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
a
5
10
110
250
310
400
410
1000
select * from t1;
a
5
10
110
250
310
400
410
1000
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a
1
5
10
110
6
250
310
251
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a
1
5
10
110
6
250
310
251
400
410
1000
select * from t1;
1001
******* Select from Slave *************
select * from t1 ORDER BY a;
a
1
5
10
110
6
250
310
251
400
410
1000
1001
drop table t1;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
select * from t1;
insert into t1 values (500),(NULL),(502),(NULL),(600);
******* Select from Master *************
select * from t1 ORDER BY a;
a
1
5
......@@ -123,13 +101,15 @@ a
501
502
503
504
600
set @@insert_id=600;
insert into t1 values(600),(NULL),(NULL);
ERROR 23000: Duplicate entry '600' for key 1
ERROR 23000: Can't write; duplicate key in table 't1'
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a
1
5
......@@ -139,11 +119,14 @@ a
501
502
503
504
600
603
604
610
611
select * from t1;
******* Select from Slave *************
select * from t1 ORDER BY a;
a
1
5
......@@ -153,33 +136,39 @@ a
501
502
503
504
600
603
604
610
611
drop table t1;
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
insert into t1 values(2),(12),(22),(32),(42);
insert into t1 values (NULL),(NULL);
insert into t1 values (3),(NULL),(NULL);
select * from t1;
******* Select from Master *************
select * from t1 ORDER BY a;
a
1
2
3
11
21
31
select * from t1;
4
5
******* Select from Slave *************
** Slave should have 2, 12, 22, 32, 42 **
** Master will have 2 but not 12, 22, 32, 42 **
select * from t1 ORDER BY a;
a
1
2
3
11
4
5
12
21
22
31
32
42
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
***** Table Create Section ****
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
**** Data Insert Section test.t1 *****
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
**** Data Insert Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Insert Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Update Section test.t1 ****
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
**** Data Update Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** Data Update Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** End Test Section test.t1 ****
**** Create Table test.t2 ****
CREATE TABLE test.t2 (
c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=#;
*** Setup Values For test.t2 ***
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
set @b1 = 'b1';
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@x0);
set @d1 = 'dd1';
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @b2 = 'b2';
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @d2 = 'dd2';
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
**** Data Insert Section test.t2 *****
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
**** Data Insert Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Insert Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Update Section test.t2 ****
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
**** Data Update Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
**** Data Update Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
create database mysqltest3;
--- --master--
show create database mysqltest2;
Database Create Database
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database mysqltest3;
Database Create Database
mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
--- --slave--
show create database mysqltest2;
Database Create Database
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database mysqltest3;
Database Create Database
mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
set @@collation_server=armscii8_bin;
drop database mysqltest3;
create database mysqltest3;
--- --master--
show create database mysqltest3;
Database Create Database
mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
--- --slave--
show create database mysqltest3;
Database Create Database
mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
use mysqltest2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
insert into t1 (b) values(@@character_set_client);
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--- --master--
select * from t1 order by a;
a b
1 armscii8
2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci
--- --slave--
select * from mysqltest2.t1 order by a;
a b
1 armscii8
2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci
select "--- --muller--" as "";
--- --muller--
set character_set_client=latin1, collation_connection=latin1_german1_ci;
truncate table t1;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Mller","Muffler"));
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Mller","Muffler"));
--- --master--
select * from t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 Mller
--- --slave--
select * from mysqltest2.t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 Mller
select "--- --INSERT--" as "";
--- --INSERT--
set @a= _cp850 'Mller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--- --master--
select * from t1 order by a;
a b
1 cp850_general_ci
--- --slave--
select * from mysqltest2.t1 order by a;
a b
1 cp850_general_ci
drop database mysqltest2;
drop database mysqltest3;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
master-bin.000001 # Query 1 # drop database if exists mysqltest3
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # drop database mysqltest3
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # mysqltest2.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # drop database mysqltest2
master-bin.000001 # Query 1 # drop database mysqltest3
select "--- --global--" as "";
--- --global--
set global character_set_server=latin2;
set global character_set_server=latin1;
set global character_set_server=latin2;
set global character_set_server=latin1;
select "--- --oneshot--" as "";
--- --oneshot--
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin1
set @@character_set_server=latin5;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin5
set one_shot max_join_size=10;
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
set character_set_client=9999999;
ERROR 42000: Unknown character set: '9999999'
set collation_server=9999998;
ERROR HY000: Unknown collation: '9999998'
select "--- --3943--" as "";
--- --3943--
use test;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET CHARACTER_SET_CLIENT=koi8r,
CHARACTER_SET_CONNECTION=cp1251,
CHARACTER_SET_RESULTS=koi8r;
INSERT INTO t1 (c1, c2) VALUES (', ',', ');
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
drop table t1;
select "--- --6676--" as "";
--- --6676--
create table `t1` (
`pk` varchar(10) not null default '',
primary key (`pk`)
) engine=NDB default charset=latin1;
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (a INT) ENGINE=NDB;
begin;
insert into t1 values(1);
flush tables with read lock;
commit;
unlock tables;
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET AUTOCOMMIT = 1;
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="NDB";
INSERT INTO mysqltest1.t1 SET f1= 0;
CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE="NDB";
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE="NDB";
INSERT INTO mysqltest1.t7 SET f1= 0;
CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE="NDB";
CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE="NDB";
CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
SET AUTOCOMMIT = 0;
use mysqltest1;
-------- switch to slave --------
SET AUTOCOMMIT = 0;
use mysqltest1;
-------- switch to master -------
######## COMMIT ########
-------- switch to master -------
INSERT INTO t1 SET f1= 0 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
0
-------- switch to master -------
COMMIT;
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
1
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## ROLLBACK ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
2
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
1
TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## SET AUTOCOMMIT=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
2
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
1
-------- switch to master -------
SET AUTOCOMMIT=1;
SELECT MAX(f1) FROM t1;
MAX(f1)
2
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
2
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
2
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
2
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SET AUTOCOMMIT=0;
######## START TRANSACTION ########
-------- switch to master -------
INSERT INTO t1 SET f1= 2 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
3
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
2
-------- switch to master -------
START TRANSACTION;
SELECT MAX(f1) FROM t1;
MAX(f1)
3
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
3
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
3
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
3
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## BEGIN ########
-------- switch to master -------
INSERT INTO t1 SET f1= 3 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
4
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
3
-------- switch to master -------
BEGIN;
SELECT MAX(f1) FROM t1;
MAX(f1)
4
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
4
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
4
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
4
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## DROP TABLE mysqltest1.t2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 4 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
5
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
4
-------- switch to master -------
DROP TABLE mysqltest1.t2;
SELECT MAX(f1) FROM t1;
MAX(f1)
5
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
5
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
5
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
5
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TABLES LIKE 't2';
Tables_in_mysqltest1 (t2)
-------- switch to slave --------
SHOW TABLES LIKE 't2';
Tables_in_mysqltest1 (t2)
-------- switch to master -------
######## DROP TEMPORARY TABLE mysqltest1.t23 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
5
-------- switch to master -------
DROP TEMPORARY TABLE mysqltest1.t23;
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
5
-------- switch to master -------
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT MAX(f1) FROM t1;
MAX(f1)
5
TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
6
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TABLES LIKE 't23';
Tables_in_mysqltest1 (t23)
-------- switch to slave --------
SHOW TABLES LIKE 't23';
Tables_in_mysqltest1 (t23)
-------- switch to master -------
######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to master -------
RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
6
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
6
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TABLES LIKE 't20';
Tables_in_mysqltest1 (t20)
t20
-------- switch to slave --------
SHOW TABLES LIKE 't20';
Tables_in_mysqltest1 (t20)
t20
-------- switch to master -------
######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
-------- switch to master -------
INSERT INTO t1 SET f1= 6 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
7
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
6
-------- switch to master -------
ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
SELECT MAX(f1) FROM t1;
MAX(f1)
7
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
7
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
7
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
7
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
describe mysqltest1.t4;
Field Type Null Key Default Extra
f1 bigint(20) YES NULL
f2 bigint(20) YES NULL
-------- switch to slave --------
describe mysqltest1.t4;
Field Type Null Key Default Extra
f1 bigint(20) YES NULL
f2 bigint(20) YES NULL
-------- switch to master -------
######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 7 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
8
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
7
-------- switch to master -------
CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
SELECT MAX(f1) FROM t1;
MAX(f1)
8
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
8
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
8
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
8
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
8
-------- switch to master -------
CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
8
-------- switch to master -------
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT MAX(f1) FROM t1;
MAX(f1)
8
TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
9
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## TRUNCATE TABLE mysqltest1.t7 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to master -------
TRUNCATE TABLE mysqltest1.t7;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
9
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT * FROM mysqltest1.t7;
f1
-------- switch to slave --------
SELECT * FROM mysqltest1.t7;
f1
-------- switch to master -------
######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
-------- switch to master -------
INSERT INTO t1 SET f1= 9 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
9
-------- switch to master -------
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
UNLOCK TABLES;
######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
UNLOCK TABLES;
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
LOCK TABLES mysqltest1.t1 READ;
######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
UNLOCK TABLES;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
10
-------- switch to master -------
UNLOCK TABLES;
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
11
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
11
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
######## DROP INDEX my_idx6 ON mysqltest1.t6 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 11 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
12
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
11
-------- switch to master -------
DROP INDEX my_idx6 ON mysqltest1.t6;
SELECT MAX(f1) FROM t1;
MAX(f1)
12
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
12
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
12
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
12
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW INDEX FROM mysqltest1.t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-------- switch to slave --------
SHOW INDEX FROM mysqltest1.t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-------- switch to master -------
######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
-------- switch to master -------
INSERT INTO t1 SET f1= 12 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
13
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
12
-------- switch to master -------
CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
SELECT MAX(f1) FROM t1;
MAX(f1)
13
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
13
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
13
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
13
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW INDEX FROM mysqltest1.t5;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
-------- switch to slave --------
SHOW INDEX FROM mysqltest1.t5;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE
-------- switch to master -------
######## DROP DATABASE mysqltest2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 13 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
14
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
13
-------- switch to master -------
DROP DATABASE mysqltest2;
SELECT MAX(f1) FROM t1;
MAX(f1)
14
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
14
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
14
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
14
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW DATABASES LIKE "mysqltest2";
Database (mysqltest2)
-------- switch to slave --------
SHOW DATABASES LIKE "mysqltest2";
Database (mysqltest2)
-------- switch to master -------
######## CREATE DATABASE mysqltest3 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 14 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
15
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
14
-------- switch to master -------
CREATE DATABASE mysqltest3;
SELECT MAX(f1) FROM t1;
MAX(f1)
15
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
15
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
15
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
15
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW DATABASES LIKE "mysqltest3";
Database (mysqltest3)
mysqltest3
-------- switch to slave --------
SHOW DATABASES LIKE "mysqltest3";
Database (mysqltest3)
mysqltest3
-------- switch to master -------
######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 15 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
15
-------- switch to master -------
CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
16
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment
######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 16 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to master -------
ALTER PROCEDURE p1 COMMENT "I have been altered";
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
17
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment I have been altered
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment I have been altered
######## DROP PROCEDURE p1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 17 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to master -------
DROP PROCEDURE p1;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 18 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to master -------
CREATE OR REPLACE VIEW v1 as select * from t1;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
-------- switch to slave -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
######## ALTER VIEW v1 AS select f1 from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 19 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to master -------
ALTER VIEW v1 AS select f1 from t1;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
-------- switch to slave -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
######## DROP VIEW IF EXISTS v1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 20 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to master -------
DROP VIEW IF EXISTS v1;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
-------- switch to slave -------
SHOW CREATE VIEW v1;
ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 21 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to master -------
CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
-------- switch to slave -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
######## DROP TRIGGER trg1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 22 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to master -------
DROP TRIGGER trg1;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
-------- switch to slave -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
######## CREATE USER user1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 23 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to master -------
CREATE USER user1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
######## RENAME USER user1@localhost TO rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 24 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to master -------
RENAME USER user1@localhost TO rename1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
######## DROP USER rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 25 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to master -------
DROP USER rename1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
26
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int, b int) engine=NDB;
insert into t1 values(1,1);
select * from t1;
a b
1 1
delete from t1;
select * from t1;
a b
drop table t1;
......@@ -70,3 +70,4 @@ row2 new on slave 2
SHOW SLAVE STATUS;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
DROP TABLE IF EXISTS t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=NDB;
CREATE TABLE t2 (
a int unsigned, # to force INSERT SELECT to have a certain order
b int unsigned
) ENGINE=NDB;
INSERT INTO t1 VALUES (NULL, 1);
INSERT INTO t1 VALUES (NULL, 2);
INSERT INTO t1 VALUES (NULL, 3);
INSERT INTO t1 VALUES (NULL, 4);
INSERT INTO t2 VALUES (1, 1);
INSERT INTO t2 VALUES (2, 2);
INSERT INTO t2 VALUES (3, 5);
INSERT INTO t2 VALUES (4, 3);
INSERT INTO t2 VALUES (5, 4);
INSERT INTO t2 VALUES (6, 6);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
drop table t1;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=myisam;
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 VALUES (2, 2);
INSERT INTO t1 VALUES (3, 3);
INSERT INTO t1 VALUES (4, 4);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
drop table t1, t2;
......@@ -16,7 +16,6 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -35,7 +34,6 @@ master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
......@@ -47,14 +45,12 @@ show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
flush logs;
create table t5 (a int)ENGINE=NDB;
drop table t5;
create table t3 (a int)ENGINE=NDB;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=NDB;
insert into t1 values (1);
drop table t1;
create table t2 (n int)ENGINE=NDB;
insert into t2 values (1);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -73,34 +69,27 @@ master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Table_map 1 # cluster_replication.apply_status
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # COMMIT
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB
master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Table_map 1 # cluster_replication.apply_status
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Table_map 1 # test.t2
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # COMMIT
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1798
master-bin.000002 991
master-bin.000001 1722
master-bin.000002 603
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 2205
slave-bin.000002 583
slave-bin.000001 1817
slave-bin.000002 198
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
......@@ -113,33 +102,29 @@ slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Table_map 2 # test.t1
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
slave-bin.000002 # Query 2 # BEGIN
slave-bin.000002 # Table_map 2 # cluster_replication.apply_status
slave-bin.000002 # Write_rows 2 #
slave-bin.000002 # Table_map 2 # test.t1
slave-bin.000002 # Table_map 2 # test.t2
slave-bin.000002 # Write_rows 2 #
slave-bin.000002 # Query 2 # COMMIT
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 991 # # master-bin.000002 Yes Yes # 0 0 991 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 603 # # master-bin.000002 Yes Yes # 0 0 603 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1,t2;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=NDB;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=NDB;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
a b
1 0
2 0
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 1
UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
SELECT * FROM t1 ORDER BY a;
a b
1 4
2 5
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 1
SELECT * FROM t1 ORDER BY a;
a b
1 4
2 5
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 1
drop table t1,t2;
reset master;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (0);
UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
select * from t1;
a
3
select * from t1;
a
3
drop table t1;
......@@ -9,11 +9,11 @@ start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
) ENGINE=NDB;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
) ENGINE=NDB;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
......@@ -122,3 +122,75 @@ SELECT * FROM t1;
i j x y z
1 2 23 24 71
DROP TABLE t1, t2, t3;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE t1 (
idp int(11) NOT NULL default '0',
idpro int(11) default NULL,
price decimal(19,4) default NULL,
PRIMARY KEY (idp)
);
CREATE TABLE t2 (
idpro int(11) NOT NULL default '0',
price decimal(19,4) default NULL,
nbprice int(11) default NULL,
PRIMARY KEY (idpro)
);
INSERT INTO t1 VALUES
(1,1,'3.0000'),
(2,2,'1.0000'),
(3,1,'1.0000'),
(4,1,'4.0000'),
(5,3,'2.0000'),
(6,2,'4.0000');
INSERT INTO t2 VALUES
(1,'0.0000',0),
(2,'0.0000',0),
(3,'0.0000',0);
update
t2
join
( select idpro, min(price) as min_price, count(*) as nbr_price
from t1
where idpro>0 and price>0
group by idpro
) as table_price
on t2.idpro = table_price.idpro
set t2.price = table_price.min_price,
t2.nbprice = table_price.nbr_price;
select "-- MASTER AFTER JOIN --" as "";
-- MASTER AFTER JOIN --
select * from t1;
idp idpro price
1 1 3.0000
2 2 1.0000
3 1 1.0000
4 1 4.0000
5 3 2.0000
6 2 4.0000
select * from t2;
idpro price nbprice
1 1.0000 3
2 1.0000 2
3 2.0000 1
select "-- SLAVE AFTER JOIN --" as "";
-- SLAVE AFTER JOIN --
select * from t1;
idp idpro price
1 1 3.0000
2 2 1.0000
3 1 1.0000
4 1 4.0000
5 3 2.0000
6 2 4.0000
select * from t2;
idpro price nbprice
1 1.0000 3
2 1.0000 2
3 2.0000 1
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
create table t1 (a int) engine=NDB;
reset slave;
start slave;
stop slave;
start slave;
select max(a) from t1;
max(a)
8000
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aaron
Aaron
Aaron
Aaron
Ababa
Ababa
STOP SLAVE;
SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
START SLAVE;
SET PASSWORD FOR root@"localhost" = PASSWORD('');
CREATE TABLE t3(n INT);
INSERT INTO t3 VALUES(1),(2);
SELECT * FROM t3 ORDER BY n;
n
1
2
SELECT SUM(LENGTH(word)) FROM t1;
SUM(LENGTH(word))
1022
DROP TABLE t1,t3;
CREATE TABLE t1 (n INT) ENGINE=NDB;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
SELECT COUNT(*) FROM t1;
COUNT(*)
5000
LOCK TABLES t1 READ;
START SLAVE;
UNLOCK TABLES;
SELECT COUNT(*) FROM t1;
COUNT(*)
5000
DROP TABLE t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES(3456);
SELECT n FROM t1;
n
3456
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER;
CREATE PROCEDURE test.p1()
BEGIN
INSERT INTO test.t1 VALUES (4);
SELECT get_lock("test", 100);
UPDATE test.t1 set a=a+4 WHERE a=4;
END|
CREATE PROCEDURE test.p2()
BEGIN
UPDATE test.t1 SET a=a+1;
END|
SELECT get_lock("test", 200);
get_lock("test", 200)
1
CALL test.p1();
CALL test.p2();
SELECT release_lock("test");
release_lock("test")
1
SELECT * FROM test.t1;
a
5
SELECT * FROM test.t1;
a
5
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER;
CALL test.p2();
CALL test.p1();
get_lock("test", 100)
0
SELECT * FROM test.t1;
a
8
SELECT * FROM test.t1;
a
8
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE PROCEDURE mysqltest1.p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
CALL mysqltest1.p2();
CALL mysqltest1.p1();
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE PROCEDURE test.p1(IN i INT)
BEGIN
DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=NDBCLUSTER;
START TRANSACTION;
INSERT INTO test.t1 VALUES(i);
savepoint t1_save;
INSERT INTO test.t1 VALUES (14);
ROLLBACK to savepoint t1_save;
COMMIT;
END|
< ---- Master selects-- >
-------------------------
CALL test.p1(12);
Warnings:
Note 1051 Unknown table 't1'
SELECT * FROM test.t1;
num
12
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t1;
num
12
< ---- Master selects-- >
-------------------------
CALL test.p1(13);
SELECT * FROM test.t1;
num
13
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t1;
num
13
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
......@@ -25,11 +25,13 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE cluster_replication.backup_info;
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
hex(c1) hex(c2) c3
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TRIGGER test.t1_bi_t2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=NDB;
CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=NDB;
CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
INSERT INTO test.t2 VALUES (1, 0.0);
INSERT INTO test.t2 VALUES (1, 0.0);
Got one of the listed errors
select * from test.t1;
n d
1 1.234
select * from test.t2;
n f
1 0
select * from test.t1;
n d
1 1.234
select * from test.t2;
n f
1 0
DROP TRIGGER test.t1_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
......@@ -11,7 +11,7 @@ set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
......@@ -19,7 +19,7 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
......
......@@ -25,11 +25,6 @@ SHOW TABLES;
Tables_in_test_ignore
t2
INSERT INTO t2 VALUES (3,3), (4,4);
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 195 Table_map 1 235 test.t1
master-bin.000001 235 Write_rows 1 282
**** On Slave ****
SHOW DATABASES;
Database
......
......@@ -16,9 +16,6 @@ data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
**** Data Insert Validation Master Section test.t1 ****
......
......@@ -16,9 +16,6 @@ data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
**** Data Insert Validation Master Section test.t1 ****
......
......@@ -7,7 +7,7 @@ start slave;
create table t1(a int not null primary key) engine=myisam;
insert delayed into t1 values (1),(2),(3);
flush tables;
select * from t1;
SELECT * FROM t1 ORDER BY a;
a
1
2
......@@ -19,7 +19,7 @@ master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null pri
master-bin.000001 222 Table_map 1 261 test.t1
master-bin.000001 261 Write_rows 1 305
master-bin.000001 305 Query 1 380 use `test`; flush tables
select * from t1;
SELECT * FROM t1 ORDER BY a;
a
1
2
......
......@@ -16,7 +16,6 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -27,7 +26,6 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
......@@ -39,14 +37,12 @@ show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Write_rows 1 #
flush logs;
create table t5 (a int)ENGINE=MyISAM;
drop table t5;
create table t3 (a int)ENGINE=MyISAM;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=MyISAM;
insert into t1 values (1);
drop table t1;
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -57,26 +53,23 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
master-bin.000002 # Table_map 1 # test.t2
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1332
master-bin.000002 525
master-bin.000001 1256
master-bin.000002 373
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1506
slave-bin.000002 350
slave-bin.000001 1354
slave-bin.000002 274
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
......@@ -87,19 +80,19 @@ slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
slave-bin.000002 # Table_map 1 # test.t1
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Table_map 1 # test.t2
slave-bin.000002 # Write_rows 1 #
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 525 # # master-bin.000002 Yes Yes # 0 0 525 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 373 # # master-bin.000002 Yes Yes # 0 0 373 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
......@@ -16,7 +16,6 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -29,7 +28,6 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
......@@ -41,14 +39,12 @@ show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Write_rows 1 #
flush logs;
create table t5 (a int)ENGINE=InnoDB;
drop table t5;
create table t3 (a int)ENGINE=InnoDB;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=InnoDB;
insert into t1 values (1);
drop table t1;
create table t2 (n int)ENGINE=InnoDB;
insert into t2 values (1);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -61,27 +57,24 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
master-bin.000002 # Table_map 1 # test.t2
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Xid 1 # COMMIT /* XID */
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1386
master-bin.000002 552
master-bin.000001 1310
master-bin.000002 400
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1560
slave-bin.000002 377
slave-bin.000001 1408
slave-bin.000002 301
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
......@@ -94,20 +87,20 @@ slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Xid 1 # COMMIT /* XID */
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
slave-bin.000002 # Table_map 1 # test.t1
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
slave-bin.000002 # Table_map 1 # test.t2
slave-bin.000002 # Write_rows 1 #
slave-bin.000002 # Xid 1 # COMMIT /* XID */
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 552 # # master-bin.000002 Yes Yes # 0 0 552 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 400 # # master-bin.000002 Yes Yes # 0 0 400 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
......@@ -29,17 +29,5 @@ a
SELECT * FROM test.t2;
a
2
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 193 use `test`; DROP TABLE IF EXISTS test.t2
master-bin.000001 193 Query 1 299 use `test`; CREATE TABLE test.t1 (a INT,PRIMARY KEY(a))
master-bin.000001 299 Query 1 405 use `test`; CREATE TABLE test.t2 (a INT,PRIMARY KEY(a))
master-bin.000001 405 Table_map 1 444 test.t1
master-bin.000001 444 Write_rows 1 483
master-bin.000001 483 Table_map 1 540 mysql.proc
master-bin.000001 540 Write_rows 1 723
master-bin.000001 723 Table_map 1 762 test.t2
master-bin.000001 762 Write_rows 1 796
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
......@@ -12,6 +12,7 @@ CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=INNOD
CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
INSERT INTO test.t2 VALUES (1, 0.0);
INSERT INTO test.t2 VALUES (1, 0.0);
Got one of the listed errors
select * from test.t1;
n d
1 1.234
......
......@@ -16,7 +16,6 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -27,7 +26,6 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
......@@ -39,14 +37,12 @@ show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
flush logs;
create table t5 (a int)ENGINE=MyISAM;
drop table t5;
create table t3 (a int)ENGINE=MyISAM;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=MyISAM;
insert into t1 values (1);
drop table t1;
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
......@@ -57,25 +53,22 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; insert into t1 values (1)
master-bin.000002 # Query 1 # use `test`; drop table t1
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
show binary logs;
Log_name File_size
master-bin.000001 1419
master-bin.000002 540
master-bin.000001 1343
master-bin.000002 388
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1595
slave-bin.000002 365
slave-bin.000001 1443
slave-bin.000002 289
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
......@@ -86,18 +79,18 @@ slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
slave-bin.000002 # Query 1 # use `test`; insert into t1 values (1)
slave-bin.000002 # Query 1 # use `test`; drop table t1
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 540 # # master-bin.000002 Yes Yes # 0 0 540 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 388 # # master-bin.000002 Yes Yes # 0 0 388 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
......@@ -4,6 +4,9 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
create table t2 (a int auto_increment, primary key (a), b int);
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
......
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
ERROR 42000: Unknown database 'testdb-1'
show create database `#mysql50#testdb-1`;
Database Create Database
#mysql50#testdb-1 CREATE DATABASE `#mysql50#testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `testdb1`;
Tables_in_testdb1
#mysql50#t-1
t1
show tables in `#mysql50#testdb-1`;
Tables_in_#mysql50#testdb-1
#mysql50#t-1
t1
show create database `testdb1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
Database Create Database
testdb-1 CREATE DATABASE `testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#testdb-1`;
ERROR 42000: Unknown database '#mysql50#testdb-1'
show tables in `testdb1`;
Tables_in_testdb1
t1
t-1
show tables in `testdb-1`;
Tables_in_testdb-1
t1
t-1
drop database `testdb1`;
drop database `testdb-1`;
......@@ -520,3 +520,25 @@ UpdateXML(@xml, '/a/b/@bb2', '')
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"')
<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb3="bb3">bb</b></a>
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
select extractvalue(@xml,'order/clerk');
extractvalue(@xml,'order/clerk')
lesser wombat
select extractvalue(@xml,'/order/clerk');
extractvalue(@xml,'/order/clerk')
lesser wombat
select extractvalue('<a><b>B</b></a>','/a|/b');
extractvalue('<a><b>B</b></a>','/a|/b')
select extractvalue('<a><b>B</b></a>','/a|b');
extractvalue('<a><b>B</b></a>','/a|b')
select extractvalue('<a>a<b>B</b></a>','/a|/b');
extractvalue('<a>a<b>B</b></a>','/a|/b')
a
select extractvalue('<a>a<b>B</b></a>','/a|b');
extractvalue('<a>a<b>B</b></a>','/a|b')
a
select extractvalue('<a>a<b>B</b></a>','a|/b');
extractvalue('<a>a<b>B</b></a>','a|/b')
a
......@@ -9,31 +9,40 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
events : Test case instability - infinite locking. To be fixed.
func_group : Bug#15448
func_math : Bug#15448
group_min_max : Bug#15448
#ndb_alter_table_row : sometimes wrong error 1015!=1046
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
ndb_binlog_basic : Results are not deterministic, Tomas will fix
ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING]
ndb_gis : garbled msgs from corrupt THD*
partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
rpl_bit_npk : Bug#13418
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ndb_auto_inc : Bug#17086
rpl_ndb_basic : Bug#16228 [IN REVIEW]
rpl_ndb_relay_space : Bug#16993
rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
subselect : Bug#15706 (ps mode) [PATCH PENDING]
rpl_ndb_log : result not deterministic
binlog_row_insert_select : Bug #17385
rpl_row_basic_2myisam : Bug #17385
rpl_row_basic_3innodb : Bug #17385
rpl_row_create_table : Bug #17385
ndb_load : Bug#17233
events : Test case instability - infinite locking. To be fixed.
func_group : Bug#15448
func_math : Bug#15448
group_min_max : Bug#15448
#ndb_alter_table_row : sometimes wrong error 1015!=1046
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
ndb_binlog_basic : Results are not deterministic, Tomas will fix
ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING]
ndb_dd_backuprestore : Bug#17045 NdbDictionaryImpl::fix_blob_events causes core
ndb_gis : garbled msgs from corrupt THD*
ndb_load : Bug#17233
partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
rpl_bit_npk : Bug#13418
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ndb_auto_inc : Bug#17086
rpl_ndb_basic : Bug#16228 [IN REVIEW]
rpl_ndb_charset : Bug#17246
rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296
#rpl_ndb_log : result not deterministic
rpl_ndb_relay_space : Bug#16993
rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_sp007 : Bug #17290
rpl_row_create_table : Bug #17385
rpl_row_basic_2myisam : Bug #17385
rpl_row_basic_3innodb : Bug #17385
rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
subselect : Bug#15706 (ps mode) [PATCH PENDING]
rpl_ndb_blob : Bug #17505
rpl_ndb_blob2 : Bug #17505
rpl_ndb_log : results are not deterministic
########################################
# Author: JBM
# Date: 2006-01-24
# Purpose: Test CDD backup and restore
########################################
-- source include/have_ndb.inc
--disable_warnings
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t4;
DROP TABLE IF EXISTS test.t5;
DROP TABLE IF EXISTS test.t6;
--enable_warnings
############ Test 1 Simple DD backup and restore #############
-- echo **** Test 1 Simple DD backup and restore ****
CREATE LOGFILE GROUP log_group1
ADD UNDOFILE './log_group1/undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE TABLESPACE table_space1
ADD DATAFILE './table_space1/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 CHAR(50) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
let $j= 500;
--disable_query_log
while ($j)
{
eval INSERT INTO test.t1 VALUES (NULL, "Sweden", $j, b'1');
dec $j;
}
--enable_query_log
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
-- source include/ndb_backup.inc
DROP TABLE test.t1;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
-- source include/ndb_restore_master.inc
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
################# Mixed Cluster Test ############################
-- echo **** Test 2 Mixed Cluster Test backup and restore ****
CREATE TABLE test.t2
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB;
let $j= 500;
--disable_query_log
while ($j)
{
eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas", $j, b'0');
dec $j;
}
--enable_query_log
CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB;
let $j= 50;
--disable_query_log
while ($j)
{
INSERT INTO test.t3 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t3 VALUES (NULL, repeat('b',16*1024));
INSERT INTO test.t4 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t4 VALUES (NULL, repeat('b',16*1024));
dec $j;
}
--enable_query_log
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
SELECT COUNT(*) FROM test.t4;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
-- source include/ndb_backup.inc
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
-- source include/ndb_restore_master.inc
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
SELECT COUNT(*) FROM test.t4;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
###################### Adding partition #################################
-- echo **** Test 3 Adding partition Test backup and restore ****
CREATE TABLESPACE table_space2
ADD DATAFILE './table_space2/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
SHOW CREATE TABLE test.t1;
SHOW CREATE TABLE test.t2;
SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6;
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
let $j= 500;
--disable_query_log
while ($j)
{
eval INSERT INTO test.t1 VALUES (NULL, "Sweden, Texas", $j, b'0');
eval INSERT INTO test.t4 VALUES (NULL, "Sweden, Texas", $j, b'0');
dec $j;
eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
eval INSERT INTO test.t5 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
dec $j;
eval INSERT INTO test.t3 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1');
eval INSERT INTO test.t6 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1'); } --enable_query_log
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t5;
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t6;
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
-- source include/ndb_backup.inc
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE table_space2
DROP DATAFILE './table_space2/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP TABLESPACE table_space2
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
-- source include/ndb_restore_master.inc
SHOW CREATE TABLE test.t1;
SHOW CREATE TABLE test.t2;
SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6;
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t5;
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t6;
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
# Cleanup
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
DROP TABLESPACE table_space1 ENGINE = NDB;
DROP TABLESPACE table_space2 ENGINE = NDB;
DROP LOGFILE GROUP log_group1 ENGINE = NDB;
#End 5.1 test case
########################################################
# By JBM 2006-02-14 Wrapped to share test code between #
# engines. Added to skip test when NDB is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_EE_err.test
#####################################
# Wrapper for rpl_auto_increment.test#
#####################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
let $engine_type2=myisam;
......
#####################################
# Wrapper for rpl_commit_after_flush#
#####################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_commit_after_flush.test
......@@ -24,10 +24,10 @@
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/not_ndb_default.inc
--source include/have_innodb.inc
--source include/master-slave.inc
let $engine_type= "InnoDB";
......
################################
# Wrapper for rpl_deadlock.test#
################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_deadlock.test
###################################################
# By JBM 2006-02-14 added to skip test when NDB #
##################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_delete_no_where.test
#######################################
# Wrapper for rpl_failed_optimize.test#
#######################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_failed_optimize.test
......@@ -5,6 +5,7 @@
# Change Date: 2006-01-17
# Change: FK not supported, skip test when NDB is forced
####################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_foreign_key.test
#################################
# Wrapper for rpl_insert_id.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_insert_id.test
#################################
# Wrapper for rpl_insert_id.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_insert_id_pk.test
#####################################
# Wrapper for rpl_insert_ignore.test#
#####################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
let $engine_type2=myisam;
......
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_loaddata.test
......@@ -36,6 +36,9 @@ delimiter ;|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column;
save_master_pos;
# Need to allow some time when NDB engine is used for
# the injector thread to have time to populate binlog
sleep 10;
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1 ORDER BY blob_column;
......
source include/master-slave.inc;
create table t1 (a int);
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
delete t1.* from t1, t2 where t1.a = t2.a;
save_master_pos;
......
......@@ -36,7 +36,7 @@ select * from a;
# BUG#3461
connection master;
create table t1 (a int);
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
......
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_multi_update.test
#######################################################
# Wrapper for rpl_multi_update2.test to allow multi #
# Engines to reuse test code. By JBM 2006-02-15 #
# Added comments section and to skip when ndb is #
# Default engine. #
#######################################################
--source include/not_ndb_default.inc
let $engine_type=MyISAM;
--source extra/rpl_tests/rpl_multi_update2.test
#######################################################
# Wrapper for rpl_multi_update3.test to allow multi #
# Engines to reuse test code. By JBM 2006-02-15 #
# Added comments section and to skip when ndb is #
# Default engine. #
#######################################################
--source include/not_ndb_default.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_multi_update3.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
let $engine_type=NDB;
--source extra/rpl_tests/rpl_row_UUID.test
--auto-increment-increment=10 --auto-increment-offset=2
#
# Test of auto_increment in CRBR
#
#####################################
# Wrapper for rpl_auto_increment.test#
# By: JBM
# Date: 2006-02-10
# Change: Augmented test to use with cluster
#####################################
-- source include/have_innodb.inc
let $engine_type=NDB;
let $engine_type2=myisam;
-- source extra/rpl_tests/rpl_auto_increment.test
-- source include/master-slave.inc
--echo ***************** Test 1 ************************
--echo
CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where b=4;
insert into t1 values (NULL,5),(NULL,6);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(600);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
set @@insert_id=600;
# We expect a duplicate key error that we will ignore below
--error 1022
insert into t1 values(600),(NULL),(NULL);
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
#
# Test that auto-increment works when slave has rows in the table
#
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
sync_slave_with_master;
insert into t1 values(2),(12),(22),(32),(42);
connection master;
insert into t1 values (NULL),(NULL);
insert into t1 values (3),(NULL),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
--echo ** Slave should have 2, 12, 22, 32, 42 **
--echo ** Master will have 2 but not 12, 22, 32, 42 **
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
# End cleanup
sync_slave_with_master;
#################################
# Wrapper for rpl_row_blob.test #
# Using wrapper to share test #
# code between engine tests #
#################################
-- source include/have_ndb.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_blob.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_charset.test
#####################################
# Wrapper for rpl_commit_after_flush#
# Wrapped to reuse test code on #
# Different engines #
# By JBM 2004-02-15 #
#####################################
-- source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_commit_after_flush.test
######################## rpl_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
# #
##############################################################
#
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
#
# 1. !All! objects to be dropped, renamed, altered ... must be created
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
# sequences start.
#
# 2. Never use a test object, which was direct or indirect affected by a
# preceeding test sequence again.
# Except table d1.t1 where ONLY DML is allowed.
#
# If one preceeding test sequence hits a (sometimes not good visible,
# because the sql error code of the statement might be 0) bug
# and these rules are ignored, a following test sequence might earn ugly
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/have_ndb.inc
--source include/master-slave.inc
let $engine_type= "NDB";
-- source extra/rpl_tests/rpl_ddl.test
#########################################
# By JBM 2006-02-14 Test wrapping to #
# Share test code between engine tests #
#########################################
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_delete_no_where.test
......@@ -109,3 +109,8 @@ SELECT * FROM t1;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
SHOW SLAVE STATUS;
connection master;
DROP TABLE IF EXISTS t1;
# End of 5.1 Test
#####################################
# Wrapper for rpl_insert_ignore.test#
#####################################
-- source include/have_ndb.inc
let $engine_type=NDB;
let $engine_type2=myisam;
-- source extra/rpl_tests/rpl_insert_ignore.test
--replicate-ignore-table=nothing.sensible
############################################################
# By JBM 2006-02-15 Wrapper for rpl_multi_update2.test #
# to reuse test code between engine runs #
############################################################
-- source include/have_ndb.inc
let $engine_type=NDB;
--source extra/rpl_tests/rpl_multi_update2.test
############################################################
# By JBM 2006-02-15 Wrapper for rpl_multi_update3.test #
# to reuse test code between engine runs #
############################################################
-- source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_multi_update3.test
-O max_relay_log_size=16384
--innodb
--log-warnings
############################################################
# By JBM 2006-02-15 Wrapper for rpl_relayrotate.test #
# to reuse test code between engine runs #
############################################################
-- source include/have_ndb.inc
-- source include/have_ndb_extra.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_relayrotate.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_001.test
#################################
# Wrapper for rpl_row_sp003.test#
# These tests have been wrapped #
# so the same code can be used #
# For different engines #
#################################
-- source include/have_ndb.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp003.test
#################################
# Wrapper for rpl_row_sp006.test#
# These tests have been wrapped #
# so the same code can be used #
# For different engines #
#################################
-- source include/have_ndb.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp006.test
#################################
# Wrapper for rpl_row_sp007.test#
# These tests have been wrapped #
# so the same code can be used #
# For different engines #
#################################
-- source include/have_ndb.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp007.test
......@@ -27,12 +27,13 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
# take a backup on master
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
let the_backup_id=`select @the_backup_id` ;
DROP TABLE cluster_replication.backup_info;
# update a row
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
......@@ -129,3 +130,5 @@ connection slave;
reset slave;
# should now contain nothing
select * from cluster_replication.apply_status;
# End 5.1 Test
#############################################################################
# Original Author: JBM #
# Original Date: 2006-02-14 #
#############################################################################
# TEST: Use before insert triggers and has the second insert fail #
# Test is wrapped to save code and share between engines #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
-- source include/master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_trig004.test
......@@ -3,9 +3,14 @@
# You can replace OPTIMIZE by REPAIR.
#####################################
# Change Author: JBM
# Change Date: 2006-01-17
# Change:
# Change Date: 2006-02-09
# Change: NDB does not and will not support
# OPTIMIZE for memory tables. If and when
# it does support for Disk Data, a new
# version of this test will be need.
# Skipping this test if default engine = ndb
#####################################
-- source include/not_ndb_default.inc
-- source include/master-slave.inc
create table t1 (a int not null auto_increment primary key, b int, key(b));
......
#
# Test of replicating user variables
#
###########################################################
# 2006-02-08 By JBM added order by for use w/ NDB engine
###########################################################
source include/master-slave.inc;
#save_master_pos;
......@@ -20,7 +23,7 @@ set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
select * from t1;
SELECT * FROM t1 ORDER BY n;
set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
......@@ -30,7 +33,7 @@ execute stmt2 using @var1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
SELECT * FROM t1 ORDER BY n;
connection master;
......
......@@ -15,6 +15,7 @@
#Change Date: 2006-02-03 #
#Change: Added Comments #
###################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_sv_relay_space.test
......
......@@ -15,6 +15,7 @@
#Change Date: 2006-02-03 #
#Change: Added Comments #
###################################
-- source include/not_ndb_default.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_sv_relay_space.test
#######################################################
# Wrapper for rpl_relayrotate.test to allow multi #
# Engines to reuse test code. By JBM 2006-02-15 #
# Added comments section and to skip when ndb is #
# Default engine. #
#######################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_relayrotate.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=MYISAM;
-- source extra/rpl_tests/rpl_row_001.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
--source extra/rpl_tests/rpl_row_UUID.test
......@@ -17,7 +17,7 @@ USE test_ignore;
CREATE TABLE t2 (a INT, b INT);
SHOW TABLES;
INSERT INTO t2 VALUES (3,3), (4,4);
SHOW BINLOG EVENTS FROM 102;
#SHOW BINLOG EVENTS FROM 102;
sync_slave_with_master;
--echo **** On Slave ****
SHOW DATABASES;
......
#################################
# Wrapper for rpl_row_blob.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_row_blob.test
......
#################################
# Wrapper for rpl_row_blob.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_blob.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_charset.test
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_delayed_ins.test
###################################
# Wrapper for rpl_row_func003.test#
###################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_func003.test
......@@ -5,6 +5,11 @@
# Same test. NDB produced a diff #
# bin-log #
###################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
......
......@@ -5,6 +5,7 @@
# Same test. NDB produced a diff #
# bin-log #
###################################
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
let $engine_type=InnoDB;
......
......@@ -4,6 +4,7 @@
# Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source extra/rpl_tests/rpl_max_relay_size.test
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_row_multi_update3.test
#################################
# Wrapper for rpl_row_sp002.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_sp002.test
#################################
# Wrapper for rpl_row_sp003.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_sp003.test
#################################
# Wrapper for rpl_row_sp006.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_row_sp006.test
#################################
# Wrapper for rpl_row_sp007.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_sp007.test
......@@ -46,11 +46,6 @@ connection slave;
sync_with_master;
SELECT * FROM test.t2;
connection master;
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
show binlog events;
# Cleanup
connection master;
......
......@@ -4,8 +4,12 @@
#############################################################################
# TEST: Use before insert triggers and has the second insert fail #
#############################################################################
# Change by JBM 2006-02-14 added to skip when NDB default engine #
# This test has been wrapped to allow multipal engines to use same code #
#############################################################################
# Includes
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
-- source include/master-slave.inc
......
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
......
......@@ -3,7 +3,14 @@
# Adding statement include due to Bug 12574
# TODO: Remove statement include once 12574 is patched
--source include/have_binlog_format_statement.inc
source include/master-slave.inc;
--source include/master-slave.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
#
# #12482: Triggers has side effects with auto_increment values
......
--disable_warnings
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
--enable_warnings
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
--error 1049
show create database `testdb-1`;
show create database `#mysql50#testdb-1`;
show tables in `testdb1`;
show tables in `#mysql50#testdb-1`;
--exec $MYSQL_CHECK --all-databases --fix-db-names --fix-table-names
show create database `testdb1`;
show create database `testdb-1`;
--error 1049
show create database `#mysql50#testdb-1`;
show tables in `testdb1`;
show tables in `testdb-1`;
drop database `testdb1`;
drop database `testdb-1`;
......@@ -215,3 +215,19 @@ select UpdateXML(@xml, '/a/b/@bb1', '');
select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"');
select UpdateXML(@xml, '/a/b/@bb2', '');
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
#
# Bug#16234 XML: Crash if ExtractValue()
#
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
select extractvalue(@xml,'order/clerk');
select extractvalue(@xml,'/order/clerk');
#
# Bug#16314 XML: extractvalue() crash if vertical bar
#
select extractvalue('<a><b>B</b></a>','/a|/b');
select extractvalue('<a><b>B</b></a>','/a|b');
select extractvalue('<a>a<b>B</b></a>','/a|/b');
select extractvalue('<a>a<b>B</b></a>','/a|b');
select extractvalue('<a>a<b>B</b></a>','a|/b');
......@@ -31,6 +31,7 @@ bin_SCRIPTS = @server_scripts@ \
mysqlhotcopy \
mysqldumpslow \
mysql_explain_log \
mysql_upgrade \
mysqld_multi \
mysql_create_system_tables
......@@ -57,6 +58,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysqldumpslow.sh \
mysql_explain_log.sh \
mysqld_multi.sh \
mysql_upgrade.sh \
mysqld_safe.sh \
mysql_create_system_tables.sh
......@@ -85,6 +87,7 @@ CLEANFILES = @server_scripts@ \
mysqldumpslow \
mysql_explain_log \
mysql_tableinfo \
mysql_upgrade \
mysqld_multi \
make_win_src_distribution \
mysql_create_system_tables
......
#!/bin/sh
# Copyright (C) 2002-2003 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file.
# Runs mysqlcheck --check-upgrade in case it has not been done on this
# major MySQL version
# This script should always be run when upgrading from one major version
# to another (ie: 4.1 -> 5.0 -> 5.1)
#
# Note that in most cases one have to use '--password' as
# arguments as these needs to be passed on to the mysqlcheck command
user=root
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$1"; shift
;;
esac
parse_arguments() {
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
# the command line) into the args variable.
pick_args=
if test "$1" = PICK-ARGS-FROM-ARGV
then
pick_args=1
shift
fi
for arg do
case "$arg" in
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--ldata=*|--data=*|--datadir=*) DATADIR=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--force) force=1 ;;
--verbose) verbose=1 ;;
*)
if test -n "$pick_args"
then
# This sed command makes sure that any special chars are quoted,
# so the arg gets passed exactly to the server.
args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.=-]\),\\\\\1,g'`
fi
;;
esac
done
}
#
# Find where my_print_defaults is
#
find_my_print_defaults () {
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_print_defaults"
elif test -x ./extra/my_print_defaults
then
print_defaults="./extra/my_print_defaults"
elif test -x @bindir@/my_print_defaults
then
print_defaults="@bindir@/my_print_defaults"
elif test -x @bindir@/mysql_print_defaults
then
print_defaults="@bindir@/mysql_print_defaults"
else
print_defaults="my_print_defaults"
fi
}
find_my_print_defaults
# Get first arguments from the my.cfg file, groups [mysqld] and
# [mysql_upgrade], and then merge with the command line arguments
args=
DATADIR=
bindir=
MY_BASEDIR_VERSION=
verbose=0
force=0
parse_arguments `$print_defaults $defaults mysqld mysql_upgrade`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
#
# Try to find where binaries are installed
#
MY_PWD=`pwd`
# Check for the directories we would expect from a binary release install
if test -z "$MY_BASEDIR_VERSION"
then
if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
then
MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
bindir="$MY_BASEDIR_VERSION/bin"
# Check for the directories we would expect from a source install
elif test -f ./share/mysql/english/errmsg.sys -a -x ./libexec/mysqld
then
MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are
bindir="$MY_BASEDIR_VERSION/bin"
# Since we didn't find anything, used the compiled-in defaults
else
MY_BASEDIR_VERSION=@prefix@
bindir=@bindir@
fi
else
bindir="$MY_BASEDIR_VERSION/bin"
fi
#
# Try to find the data directory
#
if test -z "$DATADIR"
then
# Try where the binary installs put it
if test -d $MY_BASEDIR_VERSION/data/mysql
then
DATADIR=$MY_BASEDIR_VERSION/data
# Next try where the source installs put it
elif test -d $MY_BASEDIR_VERSION/var/mysql
then
DATADIR=$MY_BASEDIR_VERSION/var
# Or just give up and use our compiled-in default
else
DATADIR=@localstatedir@
fi
fi
if test ! -x "$bindir/mysqlcheck"
then
echo "Can't find program '$bindir/mysqlcheck'"
echo "Please restart with --basedir=mysql-install-directory"
exit 1
fi
if test ! -f "$DATADIR/mysql/user.frm"
then
echo "Can't find data directory. Please restart with --datadir=path-to-data-dir"
exit 1
fi
CHECK_FILE=$DATADIR/mysql_upgrade.info
if test -f $CHECK_FILE -a $force = 0
then
version=`cat $CHECK_FILE`
if test "$version" = "@MYSQL_BASE_VERSION@"
then
if test $verbose = 1
then
echo "mysql_upgrade already done for this version"
fi
$bindir/mysql_fix_privilege_tables --silent $args
exit 0
fi
fi
#
# Run the upgrade
#
check_args="--check-upgrade --all-databases --auto-repair --user=$user"
if test $verbose = 1
then
echo "Running $bindir/mysqlcheck $args $check_args"
fi
$bindir/mysqlcheck $check_args $args
if [ $? = 0 ]
then
# Remember base version so that we don't run this script again on the
# same base version
echo "@MYSQL_BASE_VERSION@" > $CHECK_FILE
fi
$bindir/mysql_fix_privilege_tables --silent --user=$user $args
......@@ -1078,9 +1078,9 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
else if (flag == ANALYZE_PARTS)
error= file->analyze(thd, check_opt);
else if (flag == CHECK_PARTS)
error= file->check(thd, check_opt);
error= file->ha_check(thd, check_opt);
else if (flag == REPAIR_PARTS)
error= file->repair(thd, check_opt);
error= file->ha_repair(thd, check_opt);
else
{
DBUG_ASSERT(FALSE);
......
......@@ -359,6 +359,7 @@ static int ha_init_errors(void)
SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine");
SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED));
SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE));
/* Register the error messages for use with my_error(). */
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
......@@ -1975,6 +1976,9 @@ void handler::print_error(int error, myf errflag)
my_error(ER_DROP_INDEX_FK, MYF(0), ptr);
DBUG_VOID_RETURN;
}
case HA_ERR_TABLE_NEEDS_UPGRADE:
textno=ER_TABLE_NEEDS_UPGRADE;
break;
default:
{
/* The error was "unknown" to this function.
......@@ -2016,6 +2020,100 @@ bool handler::get_error_message(int error, String* buf)
}
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
{
KEY *keyinfo, *keyend;
KEY_PART_INFO *keypart, *keypartend;
if (!table->s->mysql_version)
{
/* check for blob-in-key error */
keyinfo= table->key_info;
keyend= table->key_info + table->s->keys;
for (; keyinfo < keyend; keyinfo++)
{
keypart= keyinfo->key_part;
keypartend= keypart + keyinfo->key_parts;
for (; keypart < keypartend; keypart++)
{
if (!keypart->fieldnr)
continue;
Field *field= table->field[keypart->fieldnr-1];
if (field->type() == FIELD_TYPE_BLOB)
{
if (check_opt->sql_flags & TT_FOR_UPGRADE)
check_opt->flags= T_MEDIUM;
return HA_ADMIN_NEEDS_CHECK;
}
}
}
}
return check_for_upgrade(check_opt);
}
int handler::check_old_types()
{
Field** field;
if (!table->s->mysql_version)
{
/* check for bad DECIMAL field */
for (field= table->field; (*field); field++)
{
if ((*field)->type() == FIELD_TYPE_NEWDECIMAL)
{
return HA_ADMIN_NEEDS_ALTER;
}
}
}
return 0;
}
static bool update_frm_version(TABLE *table, bool needs_lock)
{
char path[FN_REFLEN];
File file;
int result= 1;
DBUG_ENTER("update_frm_version");
if (table->s->mysql_version != MYSQL_VERSION_ID)
DBUG_RETURN(0);
strxmov(path, table->s->normalized_path.str, reg_ext, NullS);
if (needs_lock)
pthread_mutex_lock(&LOCK_open);
if ((file= my_open(path, O_RDWR|O_BINARY, MYF(MY_WME))) >= 0)
{
uchar version[4];
char *key= table->s->table_cache_key.str;
uint key_length= table->s->table_cache_key.length;
TABLE *entry;
HASH_SEARCH_STATE state;
int4store(version, MYSQL_VERSION_ID);
if ((result= my_pwrite(file,(byte*) version,4,51L,MYF_RW)))
goto err;
for (entry=(TABLE*) hash_first(&open_cache,(byte*) key,key_length, &state);
entry;
entry= (TABLE*) hash_next(&open_cache,(byte*) key,key_length, &state))
entry->s->mysql_version= MYSQL_VERSION_ID;
}
err:
if (file >= 0)
VOID(my_close(file,MYF(MY_WME)));
if (needs_lock)
pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(result);
}
/* Return key if error because of duplicated keys */
uint handler::get_dup_key(int error)
......@@ -2092,6 +2190,56 @@ void handler::drop_table(const char *name)
}
/*
Performs checks upon the table.
SYNOPSIS
check()
thd thread doing CHECK TABLE operation
check_opt options from the parser
NOTES
RETURN
HA_ADMIN_OK Successful upgrade
HA_ADMIN_NEEDS_UPGRADE Table has structures requiring upgrade
HA_ADMIN_NEEDS_ALTER Table has structures requiring ALTER TABLE
HA_ADMIN_NOT_IMPLEMENTED
*/
int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
{
int error;
if ((table->s->mysql_version >= MYSQL_VERSION_ID) &&
(check_opt->sql_flags & TT_FOR_UPGRADE))
return 0;
if (table->s->mysql_version < MYSQL_VERSION_ID)
{
if ((error= check_old_types()))
return error;
error= ha_check_for_upgrade(check_opt);
if (error && (error != HA_ADMIN_NEEDS_CHECK))
return error;
if (!error && (check_opt->sql_flags & TT_FOR_UPGRADE))
return 0;
}
if ((error= check(thd, check_opt)))
return error;
return update_frm_version(table, 0);
}
int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
{
int result;
if ((result= repair(thd, check_opt)))
return result;
return update_frm_version(table, 0);
}
/*
Tell the storage engine that it is allowed to "disable transaction" in the
handler. It is a hint that ACID is not required - it is used in NDB for
......
......@@ -43,6 +43,9 @@
#define HA_ADMIN_TRY_ALTER -7
#define HA_ADMIN_WRONG_CHECKSUM -8
#define HA_ADMIN_NOT_BASE_TABLE -9
#define HA_ADMIN_NEEDS_UPGRADE -10
#define HA_ADMIN_NEEDS_ALTER -11
#define HA_ADMIN_NEEDS_CHECK -12
/* Bits in table_flags() to show what database can do */
......@@ -1660,10 +1663,26 @@ class handler :public Sql_alloc
{ return HA_ERR_WRONG_COMMAND; }
virtual void update_create_info(HA_CREATE_INFO *create_info) {}
protected:
/* to be implemented in handlers */
/* admin commands - called from mysql_admin_table */
virtual int check(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
/*
in these two methods check_opt can be modified
to specify CHECK option to use to call check()
upon the table
*/
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt)
{ return 0; }
public:
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
int check_old_types();
/* to be actually called to get 'check()' functionality*/
int ha_check(THD *thd, HA_CHECK_OPT *check_opt);
virtual int backup(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
/*
......@@ -1672,8 +1691,11 @@ class handler :public Sql_alloc
*/
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
protected:
virtual int repair(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
public:
int ha_repair(THD* thd, HA_CHECK_OPT* check_opt);
virtual int optimize(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt)
......
......@@ -101,6 +101,7 @@ typedef struct my_xpath_st
MY_XPATH_FUNC *func; /* last scanned function creator */
Item *item; /* current expression */
Item *context; /* last scanned context */
Item *rootelement; /* The root element */
String *context_cache; /* last context provider */
String *pxml; /* Parsed XML, an array of MY_XML_NODE */
CHARSET_INFO *cs; /* character set/collation string comparison */
......@@ -1464,6 +1465,8 @@ static int my_xpath_parse_LocationPath(MY_XPATH *xpath)
{
Item *context= xpath->context;
if (!xpath->context)
xpath->context= xpath->rootelement;
int rc= my_xpath_parse_RelativeLocationPath(xpath) ||
my_xpath_parse_AbsoluteLocationPath(xpath);
......@@ -1496,7 +1499,7 @@ static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath)
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
return 0;
xpath->context= new Item_nodeset_func_rootelement(xpath->pxml);
xpath->context= xpath->rootelement;
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
{
......@@ -2292,6 +2295,8 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
my_xpath_lex_init(&xpath->prevtok, str, strend);
my_xpath_lex_scan(xpath, &xpath->lasttok, str, strend);
xpath->rootelement= new Item_nodeset_func_rootelement(xpath->pxml);
return
my_xpath_parse_Expr(xpath) &&
my_xpath_parse_term(xpath, MY_XPATH_LEX_EOF);
......
......@@ -552,6 +552,7 @@ static SYMBOL symbols[] = {
{ "UNSIGNED", SYM(UNSIGNED)},
{ "UNTIL", SYM(UNTIL_SYM)},
{ "UPDATE", SYM(UPDATE_SYM)},
{ "UPGRADE", SYM(UPGRADE_SYM)},
{ "USAGE", SYM(USAGE)},
{ "USE", SYM(USE_SYM)},
{ "USER", SYM(USER)},
......
......@@ -5804,3 +5804,5 @@ ER_FOREIGN_DUPLICATE_KEY 23000 S1009
eng "Upholding foreign key constraints for table '%.64s', entry '%-.64s', key %d would lead to a duplicate entry"
ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
eng "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use scripts/mysql_fix_privilege_tables"
ER_TABLE_NEEDS_UPGRADE
eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
......@@ -1346,7 +1346,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
save_vio = thd->net.vio;
thd->net.vio = 0;
/* Rebuild the index file from the copied data file (with REPAIR) */
error=file->repair(thd,&check_opt) != 0;
error=file->ha_repair(thd,&check_opt) != 0;
thd->net.vio = save_vio;
if (error)
my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str);
......
......@@ -2992,7 +2992,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
open_for_modify= 0;
}
if (table->table->s->crashed && operator_func == &handler::check)
if (table->table->s->crashed && operator_func == &handler::ha_check)
{
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
......@@ -3004,6 +3004,21 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
goto err;
}
if (operator_func == &handler::ha_repair)
{
if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) ||
(table->table->file->ha_check_for_upgrade(check_opt) ==
HA_ADMIN_NEEDS_ALTER))
{
close_thread_tables(thd);
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
result_code= mysql_recreate_table(thd, table, 0);
reenable_binlog(thd);
goto send_result;
}
}
result_code = (table->table->file->*operator_func)(thd, check_opt);
send_result:
......@@ -3130,6 +3145,19 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
break;
}
case HA_ADMIN_NEEDS_UPGRADE:
case HA_ADMIN_NEEDS_ALTER:
{
char buf[ERRMSGSIZE];
uint length;
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
length=my_snprintf(buf, ERRMSGSIZE, ER(ER_TABLE_NEEDS_UPGRADE), table->table_name);
protocol->store(buf, length, system_charset_info);
fatal_error=1;
break;
}
default: // Probably HA_ADMIN_INTERNAL_ERROR
{
char buf[ERRMSGSIZE+20];
......@@ -3200,7 +3228,7 @@ bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
test(check_opt->sql_flags & TT_USEFRM),
HA_OPEN_FOR_REPAIR,
&prepare_for_repair,
&handler::repair, 0));
&handler::ha_repair, 0));
}
......@@ -3573,7 +3601,7 @@ bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
"check", lock_type,
0, HA_OPEN_FOR_REPAIR, 0, 0,
&handler::check, &view_checksum));
&handler::ha_check, &view_checksum));
}
......
......@@ -665,6 +665,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token UNSIGNED
%token UNTIL_SYM
%token UPDATE_SYM
%token UPGRADE_SYM
%token USAGE
%token USER
%token USE_FRM
......@@ -5456,7 +5457,8 @@ mi_check_type:
| FAST_SYM { Lex->check_opt.flags|= T_FAST; }
| MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; };
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }
| FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; };
optimize:
OPTIMIZE opt_no_write_to_binlog table_or_tables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment