mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
into mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge mysql-test/t/disabled.def: Auto merged sql/item_sum.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_yacc.yy: Auto merged include/my_base.h: Manual merge main->rpl 5.1 mysql-test/t/innodb.test: Manual merge main->rpl 5.1
This commit is contained in:
@ -398,7 +398,10 @@ enum ha_base_keytype {
|
||||
#define HA_ERR_GENERIC 168 /* Generic error */
|
||||
#define HA_ERR_RECORD_IS_THE_SAME 169 /* row not actually updated :
|
||||
new values same as the old values */
|
||||
#define HA_ERR_LAST 169 /*Copy last error nr.*/
|
||||
|
||||
#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
|
||||
statement */
|
||||
#define HA_ERR_LAST 170 /*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)
|
||||
|
||||
|
290
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
Normal file
290
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
Normal file
@ -0,0 +1,290 @@
|
||||
#############################################
|
||||
#Authors: TU and Jeb
|
||||
#Date: 2007/04
|
||||
#Purpose: Generic replication to cluster
|
||||
# and ensuring that the ndb_apply_status
|
||||
# table is updated.
|
||||
#############################################
|
||||
# Notes:
|
||||
# include/select_ndb_apply_status.inc
|
||||
# Selects out the log name, start & end pos
|
||||
# from the ndb_apply_status table
|
||||
#
|
||||
# include/show_binlog_using_logname.inc
|
||||
# To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
#
|
||||
# include/tpcb.inc
|
||||
# Creates DATABASE tpcb, the tables and
|
||||
# stored procedures for loading the DB
|
||||
# and for running transactions against DB.
|
||||
##############################################
|
||||
|
||||
|
||||
--echo
|
||||
--echo *** Test 1 ***
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
create table t1 (a int key, b int) engine innodb;
|
||||
create table t2 (a int key, b int) engine innodb;
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
alter table t1 engine ndb;
|
||||
alter table t2 engine ndb;
|
||||
|
||||
--echo
|
||||
|
||||
# check binlog position without begin
|
||||
connection master;
|
||||
insert into t1 values (1,2);
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
# here is actually a bug, since there is no begin statement, the
|
||||
# query is autocommitted, and end_pos shows end of the insert and not
|
||||
# end of the commit
|
||||
--replace_result $start_pos <start_pos>
|
||||
--replace_column 5 #
|
||||
--eval show binlog events from $start_pos limit 1
|
||||
--echo
|
||||
--replace_result $start_pos <start_pos> $end_pos <end_pos>
|
||||
--replace_column 2 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
--eval show binlog events from $start_pos limit 1,1
|
||||
|
||||
--echo
|
||||
|
||||
# check binlog position with begin
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
insert into t2 values (3,4);
|
||||
commit;
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
connection master;
|
||||
--replace_result $start_pos <start_pos>
|
||||
--replace_column 5 #
|
||||
--eval show binlog events from $start_pos limit 1
|
||||
--echo
|
||||
--replace_result $start_pos <start_pos>
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--eval show binlog events from $start_pos limit 1,2
|
||||
--echo
|
||||
--replace_result $start_pos <start_pos> $end_pos <end_pos>
|
||||
--replace_column 2 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
--eval show binlog events from $start_pos limit 3,1
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
DROP TABLE test.t1, test.t2;
|
||||
--sync_slave_with_master
|
||||
SHOW TABLES;
|
||||
|
||||
# Run in some transactions using stored procedures
|
||||
# and ensure that the ndb_apply_status table is
|
||||
# updated to show the transactions
|
||||
|
||||
|
||||
--echo
|
||||
--echo *** Test 2 ***
|
||||
--echo
|
||||
|
||||
# Create database/tables and stored procdures
|
||||
connection master;
|
||||
--source include/tpcb.inc
|
||||
|
||||
# Switch tables on slave to use NDB
|
||||
--sync_slave_with_master
|
||||
USE tpcb;
|
||||
ALTER TABLE account ENGINE NDB;
|
||||
ALTER TABLE branch ENGINE NDB;
|
||||
ALTER TABLE teller ENGINE NDB;
|
||||
ALTER TABLE history ENGINE NDB;
|
||||
|
||||
--echo
|
||||
|
||||
# Load DB tpcb and run some transactions
|
||||
connection master;
|
||||
--disable_query_log
|
||||
CALL tpcb.load();
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Flush the logs on the master moving all
|
||||
# Transaction to a new binlog and ensure
|
||||
# that the ndb_apply_status table is updated
|
||||
# to show the use of the new binlog.
|
||||
|
||||
--echo
|
||||
--echo ** Test 3 **
|
||||
--echo
|
||||
|
||||
# Flush logs on master which should force it
|
||||
# to switch to binlog #2
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
# Run in some transaction to increase end pos in
|
||||
# binlog
|
||||
|
||||
--disable_query_log
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Now we reset both the master and the slave
|
||||
# Run some more transaction and ensure
|
||||
# that the ndb_apply_status is updated
|
||||
# correctly
|
||||
|
||||
--echo
|
||||
--echo ** Test 4 **
|
||||
--echo
|
||||
|
||||
# Reset both slave and master
|
||||
# This should reset binlog to #1
|
||||
--source include/master-slave-reset.inc
|
||||
|
||||
--echo
|
||||
|
||||
# Run in some transactions and check
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Since we are doing replication, it is a good
|
||||
# idea to check to make sure all data was
|
||||
# Replicated correctly
|
||||
|
||||
--echo
|
||||
--echo *** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
|
||||
--exec $MYSQL_DUMP -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
|
||||
|
||||
--exec $MYSQL_DUMP_SLAVE -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql
|
||||
|
||||
connection master;
|
||||
DROP DATABASE tpcb;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
####### Commenting out until decision on Bug#27960 ###########
|
||||
|
||||
#--source include/select_ndb_apply_status.inc
|
||||
|
||||
#connection master;
|
||||
#--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos
|
||||
#--source include/show_binlog_using_logname.inc
|
||||
|
||||
--echo ****** Do dumps compare ************
|
||||
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/master_apply_status.sql $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql;
|
||||
|
||||
## Note: Ths files should only get removed, if the above diff succeeds.
|
||||
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql
|
||||
|
||||
|
||||
# End of 5.1 Test
|
@ -41,7 +41,7 @@ end|
|
||||
delimiter ;|
|
||||
# test both in SELECT and in INSERT
|
||||
select fn1(0);
|
||||
create table t2 (a int);
|
||||
eval create table t2 (a int) engine=$engine_type;
|
||||
insert into t2 values(fn1(2));
|
||||
|
||||
sync_slave_with_master;
|
||||
|
@ -13,52 +13,63 @@ drop table if exists t1,t2;
|
||||
# first, we need a table to record something from an event
|
||||
|
||||
eval CREATE TABLE `t1` (
|
||||
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` INT(10) UNSIGNED NOT NULL,
|
||||
`c` VARCHAR(50) NOT NULL,
|
||||
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=$engine_type DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO t1 (c) VALUES ('manually');
|
||||
INSERT INTO t1 (id, c) VALUES (1, 'manually');
|
||||
|
||||
# then, we create the event
|
||||
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
|
||||
(c) VALUES ('from justonce');
|
||||
# We create the event so that it inserts exactly 1 row in the table
|
||||
# A recuring event is used so that we can be sure the event will
|
||||
# fire regardless of timing delays on the server. Otherwise, it is
|
||||
# possible for the event to timeout before it has inserted a row.
|
||||
--echo "Creating event test.justonce on the master"
|
||||
CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
|
||||
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
|
||||
|
||||
# Show the event is alive and present on master
|
||||
--echo "Checking event is active on master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
|
||||
# wait 3 seconds, so the event can trigger
|
||||
--real_sleep 3
|
||||
let $wait_condition=
|
||||
SELECT count(*) = 1 FROM t1 WHERE c = 'from justonce';
|
||||
--source include/wait_condition.inc
|
||||
# Wait until event has fired. We know this because t1 will contain
|
||||
# the row from the event.
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM t1 WHERE c = 'from justonce';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# check that table t1 contains something
|
||||
--echo "in the master"
|
||||
--echo "Checking event data on the master"
|
||||
--enable_info
|
||||
--replace_column 3 TIMESTAMP
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo "in the slave"
|
||||
--echo "Checking event data on the slave"
|
||||
--enable_info
|
||||
--replace_column 3 TIMESTAMP
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
--disable_info
|
||||
|
||||
--echo "Checking event is inactive on slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
|
||||
# Create an event on the slave and check to see what the originator is.
|
||||
--echo "Dropping event test.slave_once on the slave"
|
||||
--disable_warnings
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
--enable_warnings
|
||||
|
||||
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||||
INSERT INTO t1(c) VALUES ('from slave_once');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
|
||||
|
||||
--echo "Checking event status on the slave for originator value = slave's server_id"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
|
||||
|
||||
--echo "Dropping event test.slave_once on the slave"
|
||||
--disable_warnings
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
--enable_warnings
|
||||
@ -66,57 +77,74 @@ DROP EVENT IF EXISTS test.slave_once;
|
||||
connection master;
|
||||
|
||||
# BUG#20384 - disable events on slave
|
||||
--echo "Dropping event test.justonce on the master"
|
||||
--disable_warnings
|
||||
DROP EVENT IF EXISTS test.justonce;
|
||||
--enable_warnings
|
||||
|
||||
--echo "Creating event test.er on the master"
|
||||
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT INTO t1(c) VALUES ('from er');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
|
||||
|
||||
--echo "Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo "in the slave"
|
||||
--echo "Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
|
||||
connection master;
|
||||
--echo "in the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
|
||||
--echo "Altering event test.er on the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
|
||||
|
||||
--echo "Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo "in the slave"
|
||||
--echo "Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
|
||||
connection master;
|
||||
--echo "in the master"
|
||||
--echo "Dropping event test.er on the master"
|
||||
DROP EVENT test.er;
|
||||
|
||||
--echo "Checking event status on the master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo "in the slave"
|
||||
--echo "Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
|
||||
# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
|
||||
# on CREATE EVENT
|
||||
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
--echo "Creating event test.slave_terminate on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
|
||||
|
||||
--echo "Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
|
||||
--echo "Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
--echo "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
|
||||
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
|
||||
|
||||
--echo "Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
|
||||
--echo "Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
|
||||
--echo "in the master"
|
||||
--echo "Cleanup"
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
13
mysql-test/include/select_ndb_apply_status.inc
Normal file
13
mysql-test/include/select_ndb_apply_status.inc
Normal file
@ -0,0 +1,13 @@
|
||||
##################################################
|
||||
# Author: Jeb
|
||||
# Date: 2007/04
|
||||
# Purpose: To select out log name, start and end
|
||||
# positions from ndb_apply_status table
|
||||
##################################################
|
||||
--replace_column 1 <log_name> 2 <start_pos> 3 <end_pos>
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
--let $start_pos = `select @start_pos`
|
||||
--let $end_pos = `select @end_pos`
|
||||
--let $log_name = `select @log_name`
|
||||
|
13
mysql-test/include/show_binlog_using_logname.inc
Normal file
13
mysql-test/include/show_binlog_using_logname.inc
Normal file
@ -0,0 +1,13 @@
|
||||
########################################################
|
||||
# Author: Jeb
|
||||
# Date: 2007/04
|
||||
# Purpose: To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
########################################################
|
||||
|
||||
--replace_result $start_pos <start_pos> $end_pos <end_pos>
|
||||
--replace_column 2 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
--eval show binlog events in '$log_name' from $start_pos limit $off_set,1
|
||||
|
155
mysql-test/include/tpcb.inc
Normal file
155
mysql-test/include/tpcb.inc
Normal file
@ -0,0 +1,155 @@
|
||||
##################################################
|
||||
# Author: Jeb
|
||||
# Date: 2007/04
|
||||
# Purpose: To create a tpcb database, tables and
|
||||
# stored procedures to load the database
|
||||
# and run transactions against the DB
|
||||
##################################################
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
--enable_warnings
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
--echo
|
||||
CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id));
|
||||
--echo
|
||||
CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid));
|
||||
--echo
|
||||
CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid));
|
||||
--echo
|
||||
CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id));
|
||||
|
||||
--echo
|
||||
--echo --- Create stored procedures & functions ---
|
||||
--echo
|
||||
|
||||
--disable_query_log
|
||||
delimiter |;
|
||||
CREATE PROCEDURE tpcb.load()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 100;
|
||||
DECLARE brch INT DEFAULT 10;
|
||||
DECLARE tell INT DEFAULT 100;
|
||||
DECLARE tmp INT DEFAULT 10;
|
||||
WHILE brch > 0 DO
|
||||
SET tmp = 100;
|
||||
WHILE tmp > 0 DO
|
||||
INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
|
||||
SET acct = acct - 1;
|
||||
SET tmp = tmp -1;
|
||||
END WHILE;
|
||||
INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
|
||||
SET brch = brch - 1;
|
||||
END WHILE;
|
||||
WHILE tell > 0 DO
|
||||
INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
|
||||
SET tell = tell - 1;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.account_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 100 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.teller_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 100 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE tpcb.trans(in format varchar(3))
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 0;
|
||||
DECLARE brch INT DEFAULT 0;
|
||||
DECLARE tell INT DEFAULT 0;
|
||||
DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
|
||||
DECLARE test INT DEFAULT 0;
|
||||
DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_user VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SELECT RAND() * 10 INTO test;
|
||||
SELECT tpcb.account_id() INTO acct;
|
||||
SELECT tpcb.teller_id() INTO tell;
|
||||
|
||||
SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
|
||||
SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
|
||||
SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
|
||||
SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
|
||||
|
||||
IF (test < 5)
|
||||
THEN
|
||||
SET bal = bal + amount;
|
||||
SET bbal = bbal + amount;
|
||||
SET tbal = tbal + amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
ELSE
|
||||
SET bal = bal - amount;
|
||||
SET bbal = bbal - amount;
|
||||
SET tbal = tbal - amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
END IF;
|
||||
|
||||
IF (format = 'SBR')
|
||||
THEN
|
||||
SET local_uuid=UUID();
|
||||
SET local_user=USER();
|
||||
SET local_time= NOW();
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
|
||||
local_uuid,'completed trans');
|
||||
ELSE
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, NOW(), USER(),
|
||||
UUID(),'completed trans');
|
||||
END IF;
|
||||
END|
|
||||
delimiter ;|
|
||||
--enable_query_log
|
||||
--echo
|
||||
--echo *** Stored Procedures Created ***
|
||||
--echo
|
||||
|
166
mysql-test/include/tpcb_disk_data.inc
Normal file
166
mysql-test/include/tpcb_disk_data.inc
Normal file
@ -0,0 +1,166 @@
|
||||
##################################################
|
||||
# Author: Jeb
|
||||
# Date: 2007/05
|
||||
# Purpose: To create a tpcb database using Disk Data,
|
||||
# tables and stored procedures to load the database
|
||||
# and run transactions against the DB
|
||||
##################################################
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
--enable_warnings
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
--echo
|
||||
eval CREATE TABLE tpcb.account
|
||||
(id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id))
|
||||
TABLESPACE $table_space STORAGE DISK
|
||||
ENGINE=$engine_type;
|
||||
--echo
|
||||
eval CREATE TABLE tpcb.branch
|
||||
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid))TABLESPACE $table_space STORAGE DISK
|
||||
ENGINE=$engine_type;
|
||||
--echo
|
||||
eval CREATE TABLE tpcb.teller
|
||||
(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid)) TABLESPACE $table_space STORAGE DISK
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo
|
||||
eval CREATE TABLE tpcb.history
|
||||
(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id))
|
||||
TABLESPACE $table_space STORAGE DISK
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo
|
||||
--echo --- Create stored procedures & functions ---
|
||||
--echo
|
||||
|
||||
--disable_query_log
|
||||
delimiter |;
|
||||
CREATE PROCEDURE tpcb.load()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 100;
|
||||
DECLARE brch INT DEFAULT 10;
|
||||
DECLARE tell INT DEFAULT 100;
|
||||
DECLARE tmp INT DEFAULT 10;
|
||||
WHILE brch > 0 DO
|
||||
SET tmp = 100;
|
||||
WHILE tmp > 0 DO
|
||||
INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
|
||||
SET acct = acct - 1;
|
||||
SET tmp = tmp -1;
|
||||
END WHILE;
|
||||
INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
|
||||
SET brch = brch - 1;
|
||||
END WHILE;
|
||||
WHILE tell > 0 DO
|
||||
INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
|
||||
SET tell = tell - 1;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.account_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 100 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.teller_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 100 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE tpcb.trans(in format varchar(3))
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 0;
|
||||
DECLARE brch INT DEFAULT 0;
|
||||
DECLARE tell INT DEFAULT 0;
|
||||
DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
|
||||
DECLARE test INT DEFAULT 0;
|
||||
DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_user VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SELECT RAND() * 10 INTO test;
|
||||
SELECT tpcb.account_id() INTO acct;
|
||||
SELECT tpcb.teller_id() INTO tell;
|
||||
|
||||
SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
|
||||
SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
|
||||
SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
|
||||
SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
|
||||
|
||||
IF (test < 5)
|
||||
THEN
|
||||
SET bal = bal + amount;
|
||||
SET bbal = bbal + amount;
|
||||
SET tbal = tbal + amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
ELSE
|
||||
SET bal = bal - amount;
|
||||
SET bbal = bbal - amount;
|
||||
SET tbal = tbal - amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
END IF;
|
||||
|
||||
IF (format = 'SBR')
|
||||
THEN
|
||||
SET local_uuid=UUID();
|
||||
SET local_user=USER();
|
||||
SET local_time= NOW();
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
|
||||
local_uuid,'completed trans');
|
||||
ELSE
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, NOW(), USER(),
|
||||
UUID(),'completed trans');
|
||||
END IF;
|
||||
END|
|
||||
delimiter ;|
|
||||
--enable_query_log
|
||||
--echo
|
||||
--echo *** Stored Procedures Created ***
|
||||
--echo
|
||||
|
@ -631,6 +631,7 @@ our @tags=
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
["include/have_multi_ndb.inc", "ndb_test", 1],
|
||||
["include/have_ndb_extra.inc", "ndb_extra", 1],
|
||||
["require_manager", "require_manager", 1],
|
||||
);
|
||||
|
@ -30,8 +30,6 @@ master-bin.000001 # Query # # use `test`; TRUNCATE t1b
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1n)
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1n
|
||||
@ -41,8 +39,10 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
@ -69,8 +69,10 @@ ERROR HY000: Binary logging not possible. Message: Row-based format required for
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1m)
|
||||
|
@ -865,4 +865,25 @@ blob 65535 65535
|
||||
text 65535 65535
|
||||
text 65535 32767
|
||||
drop table t1;
|
||||
create table t1 (a char(1) character set ucs2);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select hex(group_concat(a)) from t1;
|
||||
hex(group_concat(a))
|
||||
0061002C0062002C0063
|
||||
select collation(group_concat(a)) from t1;
|
||||
collation(group_concat(a))
|
||||
ucs2_general_ci
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
set character_set_connection=ucs2;
|
||||
select hex(group_concat(a separator ',')) from t1;
|
||||
hex(group_concat(a separator ','))
|
||||
612C622C63
|
||||
select collation(group_concat(a separator ',')) from t1;
|
||||
collation(group_concat(a separator ','))
|
||||
latin1_swedish_ci
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
End of 5.0 tests
|
||||
|
@ -7,6 +7,13 @@ character_set_server ucs2
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select hex(group_concat(a)) from t1;
|
||||
hex(group_concat(a))
|
||||
612C622C63
|
||||
drop table t1;
|
||||
CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
|
||||
col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
|
||||
UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
|
||||
|
30
mysql-test/r/ndb_binlog_format.result
Normal file
30
mysql-test/r/ndb_binlog_format.result
Normal file
@ -0,0 +1,30 @@
|
||||
drop table if exists t1, t2, t3;
|
||||
CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t3 (e INT, f INT) ENGINE=NDB;
|
||||
RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
|
||||
UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
DROP TABLE t1, t2, t3;
|
@ -451,7 +451,7 @@ CREATE TABLE t2 (
|
||||
var1 int(2) NOT NULL,
|
||||
var2 int(2) NOT NULL,
|
||||
PRIMARY KEY (var1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii CHECKSUM=1;
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=ascii CHECKSUM=1;
|
||||
CREATE TRIGGER testtrigger
|
||||
AFTER UPDATE ON t1 FOR EACH ROW BEGIN
|
||||
REPLACE INTO t2 SELECT * FROM t1 WHERE t1.var1 = NEW.var1;END|
|
||||
|
@ -1,7 +1,7 @@
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
create table t1 (id int primary key, a int not null, b decimal (63,30) default 0) engine=ndb;
|
||||
create table t2 (op char(1), a int not null, b decimal (63,30));
|
||||
create table t3 select 1 as i;
|
||||
create table t2 (op char(1), a int not null, b decimal (63,30)) engine=ndb;
|
||||
create table t3 engine=ndb select 1 as i;
|
||||
create table t4 (a int not null primary key, b int) engine=ndb;
|
||||
create table t5 (a int not null primary key, b int) engine=ndb;
|
||||
create trigger t1_bu before update on t1 for each row
|
||||
|
@ -9,153 +9,191 @@ set binlog_format=row;
|
||||
DROP EVENT IF EXISTS test.justonce;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE `t1` (
|
||||
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` INT(10) UNSIGNED NOT NULL,
|
||||
`c` VARCHAR(50) NOT NULL,
|
||||
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 (c) VALUES ('manually');
|
||||
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
|
||||
(c) VALUES ('from justonce');
|
||||
INSERT INTO t1 (id, c) VALUES (1, 'manually');
|
||||
"Creating event test.justonce on the master"
|
||||
CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
|
||||
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
|
||||
"Checking event is active on master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
db name status originator
|
||||
test justonce ENABLED 1
|
||||
"in the master"
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
"Checking event data on the master"
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id c ts
|
||||
1 manually TIMESTAMP
|
||||
2 from justonce TIMESTAMP
|
||||
affected rows: 2
|
||||
"in the slave"
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
"Checking event data on the slave"
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id c ts
|
||||
1 manually TIMESTAMP
|
||||
2 from justonce TIMESTAMP
|
||||
affected rows: 2
|
||||
"Checking event is inactive on slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
db name status originator
|
||||
test justonce SLAVESIDE_DISABLED 1
|
||||
"Dropping event test.slave_once on the slave"
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||||
INSERT INTO t1(c) VALUES ('from slave_once');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
|
||||
"Checking event status on the slave for originator value = slave's server_id"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
|
||||
db name status originator
|
||||
test slave_once ENABLED 2
|
||||
"Dropping event test.slave_once on the slave"
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
"Dropping event test.justonce on the master"
|
||||
DROP EVENT IF EXISTS test.justonce;
|
||||
"Creating event test.er on the master"
|
||||
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT INTO t1(c) VALUES ('from er');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
|
||||
"in the slave"
|
||||
test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
|
||||
"in the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
|
||||
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
|
||||
"Altering event test.er on the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
|
||||
"in the slave"
|
||||
test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
|
||||
"in the master"
|
||||
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
|
||||
"Dropping event test.er on the master"
|
||||
DROP EVENT test.er;
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
db name status originator
|
||||
"in the slave"
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
db name status originator
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
"Creating event test.slave_terminate on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
db name status originator
|
||||
test slave_terminate ENABLED 2
|
||||
"Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
|
||||
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
db name status originator
|
||||
test slave_terminate SLAVESIDE_DISABLED 2
|
||||
"Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
"in the master"
|
||||
"Cleanup"
|
||||
DROP TABLE t1;
|
||||
set binlog_format=statement;
|
||||
DROP EVENT IF EXISTS test.justonce;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE `t1` (
|
||||
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id` INT(10) UNSIGNED NOT NULL,
|
||||
`c` VARCHAR(50) NOT NULL,
|
||||
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 (c) VALUES ('manually');
|
||||
CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
|
||||
(c) VALUES ('from justonce');
|
||||
INSERT INTO t1 (id, c) VALUES (1, 'manually');
|
||||
"Creating event test.justonce on the master"
|
||||
CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
|
||||
INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
|
||||
"Checking event is active on master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
db name status originator
|
||||
test justonce ENABLED 1
|
||||
"in the master"
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
"Checking event data on the master"
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id c ts
|
||||
1 manually TIMESTAMP
|
||||
2 from justonce TIMESTAMP
|
||||
affected rows: 2
|
||||
"in the slave"
|
||||
SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
|
||||
"Checking event data on the slave"
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id c ts
|
||||
1 manually TIMESTAMP
|
||||
2 from justonce TIMESTAMP
|
||||
affected rows: 2
|
||||
"Checking event is inactive on slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
|
||||
db name status originator
|
||||
test justonce SLAVESIDE_DISABLED 1
|
||||
"Dropping event test.slave_once on the slave"
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||||
INSERT INTO t1(c) VALUES ('from slave_once');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
|
||||
"Checking event status on the slave for originator value = slave's server_id"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
|
||||
db name status originator
|
||||
test slave_once ENABLED 2
|
||||
"Dropping event test.slave_once on the slave"
|
||||
DROP EVENT IF EXISTS test.slave_once;
|
||||
"Dropping event test.justonce on the master"
|
||||
DROP EVENT IF EXISTS test.justonce;
|
||||
"Creating event test.er on the master"
|
||||
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT INTO t1(c) VALUES ('from er');
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
|
||||
"in the slave"
|
||||
test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
|
||||
"in the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
|
||||
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
|
||||
"Altering event test.er on the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
|
||||
"in the slave"
|
||||
test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||||
db name status originator body
|
||||
test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
|
||||
"in the master"
|
||||
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
|
||||
"Dropping event test.er on the master"
|
||||
DROP EVENT test.er;
|
||||
"Checking event status on the master"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
db name status originator
|
||||
"in the slave"
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
||||
db name status originator
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
"Creating event test.slave_terminate on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
db name status originator
|
||||
test slave_terminate ENABLED 2
|
||||
"Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
|
||||
DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
|
||||
"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
|
||||
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
|
||||
"Checking event status on the slave"
|
||||
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
|
||||
db name status originator
|
||||
test slave_terminate SLAVESIDE_DISABLED 2
|
||||
"Dropping event test.slave_terminate on the slave"
|
||||
DROP EVENT test.slave_terminate;
|
||||
"in the master"
|
||||
"Cleanup"
|
||||
DROP TABLE t1;
|
||||
CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
|
||||
DO BEGIN
|
||||
|
@ -24,7 +24,7 @@ end|
|
||||
select fn1(0);
|
||||
fn1(0)
|
||||
0
|
||||
create table t2 (a int);
|
||||
create table t2 (a int) engine=NDB;
|
||||
insert into t2 values(fn1(2));
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
9
mysql-test/r/rpl_ndb_ctype_ucs2_def.result
Normal file
9
mysql-test/r/rpl_ndb_ctype_ucs2_def.result
Normal file
@ -0,0 +1,9 @@
|
||||
show variables like 'collation_server';
|
||||
Variable_name Value
|
||||
collation_server ucs2_unicode_ci
|
||||
show variables like "%character_set_ser%";
|
||||
Variable_name Value
|
||||
character_set_server ucs2
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
@ -56,6 +56,7 @@ undofile.dat UNDO LOG NULL lg1
|
||||
undofile02.dat UNDO LOG NULL lg1
|
||||
**** Do First Set of ALTERs in the master table ****
|
||||
CREATE INDEX t1_i ON t1(c2, c3);
|
||||
CREATE UNIQUE INDEX t1_i2 ON t1(c2);
|
||||
ALTER TABLE t1 ADD c4 TIMESTAMP;
|
||||
ALTER TABLE t1 ADD c5 DOUBLE;
|
||||
ALTER TABLE t1 ADD INDEX (c5);
|
||||
@ -68,6 +69,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`),
|
||||
KEY `c5` (`c5`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
@ -81,6 +83,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`),
|
||||
KEY `c5` (`c5`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
@ -101,6 +104,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Show second set of ALTERs on SLAVE ****
|
||||
@ -113,6 +117,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Third and last set of alters for test1 ****
|
||||
@ -135,6 +140,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c3` blob,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
@ -153,8 +159,16 @@ t1 CREATE TABLE `t1` (
|
||||
`c3` blob,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
c1 c2 c3 c5
|
||||
1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
3 6.00 0000-00-00 00:00:00 NULL
|
||||
4 8.00 0000-00-00 00:00:00 NULL
|
||||
5 10.00 0000-00-00 00:00:00 NULL
|
||||
SELECT * FROM t1 where c1 = 1;
|
||||
c1 c2 c3 c5
|
||||
1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
@ -167,148 +181,44 @@ START SLAVE;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile03.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
INITIAL_SIZE 10M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile04.dat'
|
||||
INITIAL_SIZE 12M
|
||||
INITIAL_SIZE 5M
|
||||
ENGINE=NDB;
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'tpcb'; database doesn't exist
|
||||
CREATE DATABASE tpcb;
|
||||
*********** Create TPCB Tables *****************
|
||||
CREATE TABLE tpcb.account
|
||||
|
||||
CREATE TABLE tpcb.account
|
||||
(id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id))
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE tpcb.branch
|
||||
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid))
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE tpcb.teller
|
||||
(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE tpcb.history
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.branch
|
||||
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid))TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.teller
|
||||
(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid)) TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.history
|
||||
(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
********* Create Procedures and Functions ************
|
||||
CREATE PROCEDURE tpcb.load()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 1000;
|
||||
DECLARE brch INT DEFAULT 100;
|
||||
DECLARE tell INT DEFAULT 1000;
|
||||
DECLARE tmp INT DEFAULT 100;
|
||||
WHILE brch > 0 DO
|
||||
SET tmp = 100;
|
||||
WHILE tmp > 0 DO
|
||||
INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
|
||||
SET acct = acct - 1;
|
||||
SET tmp = tmp -1;
|
||||
END WHILE;
|
||||
INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
|
||||
SET brch = brch - 1;
|
||||
END WHILE;
|
||||
WHILE tell > 0 DO
|
||||
INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
|
||||
SET tell = tell - 1;
|
||||
END WHILE;
|
||||
END|
|
||||
CREATE FUNCTION tpcb.account_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 2)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSEIF (ran < 4)
|
||||
THEN
|
||||
SELECT RAND() * 100 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 1000 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
CREATE FUNCTION tpcb.teller_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 2)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSEIF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 100 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 1000 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
CREATE PROCEDURE tpcb.trans()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 0;
|
||||
DECLARE brch INT DEFAULT 0;
|
||||
DECLARE tell INT DEFAULT 0;
|
||||
DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
|
||||
DECLARE test INT DEFAULT 0;
|
||||
DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_user VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
SELECT RAND() * 10 INTO test;
|
||||
SELECT tpcb.account_id() INTO acct;
|
||||
SELECT tpcb.teller_id() INTO tell;
|
||||
SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
|
||||
SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
|
||||
SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
|
||||
SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
|
||||
IF (test < 5)
|
||||
THEN
|
||||
SET bal = bal + amount;
|
||||
SET bbal = bbal + amount;
|
||||
SET tbal = tbal + amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
ELSE
|
||||
SET bal = bal - amount;
|
||||
SET bbal = bbal - amount;
|
||||
SET tbal = tbal - amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
END IF;
|
||||
SET local_uuid=UUID();
|
||||
SET local_user=USER();
|
||||
SET local_time= NOW();
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
|
||||
local_uuid,'completed trans');
|
||||
END|
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
--- Create stored procedures & functions ---
|
||||
|
||||
|
||||
*** Stored Procedures Created ***
|
||||
|
||||
****** TEST 2 test time *********************************
|
||||
USE tpcb;
|
||||
*********** Load up the database ******************
|
||||
@ -316,11 +226,11 @@ CALL tpcb.load();
|
||||
********** Check load master and slave **************
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
10000
|
||||
1000
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
10000
|
||||
1000
|
||||
******** Run in some transactions ***************
|
||||
***** Time to try slave sync ***********
|
||||
**** Must make sure slave is clean *****
|
||||
@ -351,10 +261,10 @@ DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
********** Take a backup of the Master *************
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
1000
|
||||
100
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
2000
|
||||
200
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
|
||||
DELETE FROM mysql.backup_info;
|
||||
LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
|
||||
@ -368,7 +278,7 @@ CREATE DATABASE tpcb;
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
10000
|
||||
1000
|
||||
***** Add some more records to master *********
|
||||
***** Finsh the slave sync process *******
|
||||
@the_epoch:=MAX(epoch)
|
||||
@ -384,12 +294,12 @@ START SLAVE;
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
4050
|
||||
400
|
||||
****** SLAVE ********
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
4050
|
||||
400
|
||||
*** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
*************** TEST 2 CLEANUP SECTION ********************
|
||||
DROP PROCEDURE IF EXISTS tpcb.load;
|
||||
|
129
mysql-test/r/rpl_ndb_mix_innodb.result
Normal file
129
mysql-test/r/rpl_ndb_mix_innodb.result
Normal file
@ -0,0 +1,129 @@
|
||||
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;
|
||||
|
||||
*** Test 1 ***
|
||||
|
||||
create table t1 (a int key, b int) engine innodb;
|
||||
create table t2 (a int key, b int) engine innodb;
|
||||
|
||||
alter table t1 engine ndb;
|
||||
alter table t2 engine ndb;
|
||||
|
||||
insert into t1 values (1,2);
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events from <start_pos> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2)
|
||||
|
||||
show binlog events from <start_pos> limit 1,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 445 COMMIT /* XID */
|
||||
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
insert into t2 values (3,4);
|
||||
commit;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
show binlog events from <start_pos> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN
|
||||
|
||||
show binlog events from <start_pos> limit 1,2;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
|
||||
|
||||
show binlog events from <start_pos> limit 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
DROP TABLE test.t1, test.t2;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
|
||||
*** Test 2 ***
|
||||
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id));
|
||||
|
||||
CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid));
|
||||
|
||||
CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid));
|
||||
|
||||
CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id));
|
||||
|
||||
--- Create stored procedures & functions ---
|
||||
|
||||
|
||||
*** Stored Procedures Created ***
|
||||
|
||||
USE tpcb;
|
||||
ALTER TABLE account ENGINE NDB;
|
||||
ALTER TABLE branch ENGINE NDB;
|
||||
ALTER TABLE teller ENGINE NDB;
|
||||
ALTER TABLE history ENGINE NDB;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 3 **
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000002' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 4 **
|
||||
|
||||
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;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
*** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
DROP DATABASE tpcb;
|
||||
****** Do dumps compare ************
|
@ -4,37 +4,126 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
|
||||
*** Test 1 ***
|
||||
|
||||
create table t1 (a int key, b int) engine innodb;
|
||||
create table t2 (a int key, b int) engine innodb;
|
||||
|
||||
alter table t1 engine ndb;
|
||||
alter table t2 engine ndb;
|
||||
STOP SLAVE;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
START SLAVE;
|
||||
|
||||
insert into t1 values (1,2);
|
||||
select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
|
||||
@start_pos:=start_pos @end_pos:=end_pos
|
||||
<start_pos> <end_pos>
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events from <start_pos> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2)
|
||||
|
||||
show binlog events from <start_pos> limit 1,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 445 COMMIT /* XID */
|
||||
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
insert into t2 values (3,4);
|
||||
commit;
|
||||
select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
|
||||
@start_pos:=start_pos @end_pos:=end_pos
|
||||
<start_pos> <end_pos>
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
show binlog events from <start_pos> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN
|
||||
|
||||
show binlog events from <start_pos> limit 1,2;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
|
||||
|
||||
show binlog events from <start_pos> limit 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
DROP TABLE test.t1, test.t2;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
|
||||
*** Test 2 ***
|
||||
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id));
|
||||
|
||||
CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid));
|
||||
|
||||
CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid));
|
||||
|
||||
CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id));
|
||||
|
||||
--- Create stored procedures & functions ---
|
||||
|
||||
|
||||
*** Stored Procedures Created ***
|
||||
|
||||
USE tpcb;
|
||||
ALTER TABLE account ENGINE NDB;
|
||||
ALTER TABLE branch ENGINE NDB;
|
||||
ALTER TABLE teller ENGINE NDB;
|
||||
ALTER TABLE history ENGINE NDB;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 6,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 3 **
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000002' from <start_pos> limit 6,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 4 **
|
||||
|
||||
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;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 6,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
*** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
DROP DATABASE tpcb;
|
||||
****** Do dumps compare ************
|
||||
|
@ -24,7 +24,7 @@ end|
|
||||
select fn1(0);
|
||||
fn1(0)
|
||||
0
|
||||
create table t2 (a int);
|
||||
create table t2 (a int) engine=myisam;
|
||||
insert into t2 values(fn1(2));
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
@ -1,6 +1,11 @@
|
||||
# Test to test how logging is done depending on the capabilities of
|
||||
# the engines. Unfortunately, we don't have a good row-only logging
|
||||
# engine, and NDB does not really cut is since it is also
|
||||
# self-logging. I'm using it nevertheless.
|
||||
|
||||
source include/have_blackhole.inc;
|
||||
source include/have_ndb.inc;
|
||||
source include/have_binlog_format_mixed_or_row.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
@ -15,9 +20,6 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
|
||||
# I cannot use these statements since the rows logged to the NDB table
|
||||
# eventually shows up in the binary log. I use them anyway, since once
|
||||
# BUG#29222 is fixed, there will be a difference here.
|
||||
echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
@ -40,6 +42,8 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
# might cause it to be out of sync with the results from MyISAM.
|
||||
@ -67,6 +71,8 @@ INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
# might cause it to be out of sync with the results from MyISAM.
|
||||
|
@ -594,4 +594,22 @@ select data_type, character_octet_length, character_maximum_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
|
||||
#
|
||||
create table t1 (a char(1) character set ucs2);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select hex(group_concat(a)) from t1;
|
||||
select collation(group_concat(a)) from t1;
|
||||
drop table t1;
|
||||
|
||||
set names latin1;
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
set character_set_connection=ucs2;
|
||||
select hex(group_concat(a separator ',')) from t1;
|
||||
select collation(group_concat(a separator ',')) from t1;
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -15,6 +15,16 @@ DROP TABLE IF EXISTS t1;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
|
||||
# Check that GROUP_CONCAT works fine with --default-character-set=ucs2
|
||||
#
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select hex(group_concat(a)) from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #27643: query failed : 1114 (The table '' is full)
|
||||
#
|
||||
|
@ -19,7 +19,6 @@ im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests
|
||||
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
|
||||
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
|
||||
im_utils : BUG#28743 Instance manager generates warnings in test suite
|
||||
innodb : Disabling test case awaiting reply from Innobase
|
||||
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
|
||||
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
@ -35,6 +34,8 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa
|
||||
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
|
||||
#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
|
||||
rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB
|
||||
rpl_ndb_mix_innodb : BUG#28123 rpl_ndb_mix_innodb.test casue slave to core on sol10-sparc-a
|
||||
rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset
|
||||
|
||||
rpl_invoked_features : BUG#29020 2007-06-21 Lars Non-deterministic test case
|
||||
ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Double Whopper
|
||||
@ -52,5 +53,4 @@ im_options_set : Bug#20294: Instance manager tests fail randomly
|
||||
im_options_unset : Bug#20294: Instance manager tests fail randomly
|
||||
mysql_upgrade : Bug#28560 test links to /usr/local/mysql/lib libraries, causes non-determinism and failures on ABI breakage
|
||||
rpl_udf : Bug#28993 rpl_udf test causes server crash and valgrind warning in pushbuild
|
||||
rpl_ndb_circular : Bug#29233 rpl_ndb_circular fails randomly
|
||||
ndb_dd_sql_features : Bug#29102 ndb_dd_sql_features fails in pushbuild
|
||||
|
@ -13,6 +13,11 @@
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
# Disabling it temporarily for statement-based logging since some
|
||||
# tests are not safe while binlog is on.
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
#
|
||||
# Small basic test with ignore
|
||||
@ -774,7 +779,7 @@ CREATE TABLE `t2` (
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY_WITH_KEY_NAME
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t1.a+2;
|
||||
# check
|
||||
select * from t2 /* must be (3,1), (4,4) */;
|
||||
@ -786,7 +791,7 @@ delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
insert into t2 values (1,2),(3,4),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY_WITH_KEY_NAME
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
||||
show master status /* there must be no UPDATE query event */;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
let $engine_type=ndbcluster;
|
||||
|
||||
--source include/loaddata_autocom.inc
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
@ -11,6 +9,9 @@
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,);
|
||||
|
||||
# Workaround for Bug#27644
|
||||
# ndb: connecting api node/mysqld may "steal" node_id from running mysqld
|
||||
# - let ndb_waiter use a fixed node id so "steal" cannot happen
|
||||
@ -28,8 +29,14 @@ insert into t1 values (1);
|
||||
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# Wait for mysqld to reconnect and exit from readonly mode
|
||||
# Should preferrably be a "while (!"select ndb_readonly")" loop
|
||||
sleep 2;
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server1
|
||||
--error 1297
|
||||
insert into t1 values (2);
|
||||
--error 1296
|
||||
@ -48,8 +55,13 @@ select * from t2 order by a limit 3;
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# to ensure mysqld has connected again, and recreated system tables
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT
|
||||
sleep 2;
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server2
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t2;
|
||||
@ -67,8 +79,13 @@ reset master;
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# to ensure mysqld has connected again, and recreated system tables
|
||||
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT
|
||||
sleep 2;
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server1
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t2;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,4 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
|
33
mysql-test/t/ndb_binlog_format.test
Normal file
33
mysql-test/t/ndb_binlog_format.test
Normal file
@ -0,0 +1,33 @@
|
||||
#
|
||||
# test different behavior of ndb using different binlog formats
|
||||
#
|
||||
|
||||
-- source include/have_blackhole.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug #29222 Statement mode replicates both statement and
|
||||
# rows when writing to an NDB table
|
||||
#
|
||||
CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t3 (e INT, f INT) ENGINE=NDB;
|
||||
RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
|
||||
# A transaction here is not necessary, but I wanted to group the bad statements
|
||||
START TRANSACTION;
|
||||
INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
|
||||
UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_query_log
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_query_cache.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_query_cache.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
-- source include/have_query_cache.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
-- source include/have_query_cache.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -40,7 +40,6 @@
|
||||
##############################################################
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
########################################
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#################################
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@ -6,7 +6,6 @@
|
||||
########################################
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
|
@ -26,7 +26,6 @@
|
||||
# gives a better idea of what the test is about
|
||||
###########################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
SET storage_engine=ndbcluster;
|
||||
--source include/gis_generic.inc
|
||||
set engine_condition_pushdown = on;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,6 +1,5 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
#--disable_abort_on_error
|
||||
#
|
||||
# Simple test for the partition storage engine
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
#
|
||||
# Simple test for the partition storage engine
|
||||
# Focuses on range partitioning tests
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
#--disable_abort_on_error
|
||||
#
|
||||
# Simple test for the partition storage engine
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
@ -286,7 +285,7 @@ CREATE TABLE t2 (
|
||||
var1 int(2) NOT NULL,
|
||||
var2 int(2) NOT NULL,
|
||||
PRIMARY KEY (var1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii CHECKSUM=1;
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=ascii CHECKSUM=1;
|
||||
|
||||
|
||||
DELIMITER |;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,6 +1,5 @@
|
||||
# Tests which involve triggers and NDB storage engine
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
@ -19,8 +18,8 @@ drop table if exists t1, t2, t3, t4, t5;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id int primary key, a int not null, b decimal (63,30) default 0) engine=ndb;
|
||||
create table t2 (op char(1), a int not null, b decimal (63,30));
|
||||
create table t3 select 1 as i;
|
||||
create table t2 (op char(1), a int not null, b decimal (63,30)) engine=ndb;
|
||||
create table t3 engine=ndb select 1 as i;
|
||||
create table t4 (a int not null primary key, b int) engine=ndb;
|
||||
create table t5 (a int not null primary key, b int) engine=ndb;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndbapi_examples.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -11,7 +11,6 @@
|
||||
use test;
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
let $type= 'NDB' ;
|
||||
-- source include/ps_create.inc
|
||||
-- source include/ps_renew.inc
|
||||
|
@ -5,7 +5,7 @@
|
||||
# By JBM 2004-02-15 #
|
||||
#####################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
-- source include/have_log_bin.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_commit_after_flush.test
|
||||
|
1
mysql-test/t/rpl_ndb_ctype_ucs2_def-master.opt
Normal file
1
mysql-test/t/rpl_ndb_ctype_ucs2_def-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1
|
42
mysql-test/t/rpl_ndb_ctype_ucs2_def.test
Normal file
42
mysql-test/t/rpl_ndb_ctype_ucs2_def.test
Normal file
@ -0,0 +1,42 @@
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# MySQL Bug#15276: MySQL ignores collation-server
|
||||
#
|
||||
show variables like 'collation_server';
|
||||
|
||||
#
|
||||
# Check that NDB replication doesn't explode with default charset
|
||||
# being multibyte.
|
||||
#
|
||||
# Theorised that this could be a problem when dealing with:
|
||||
# Bug #27404 util thd mysql_parse sig11 when mysqld default multibyte charset
|
||||
#
|
||||
# Sort of related to:
|
||||
# Bug#18004 Connecting crashes server when default charset is UCS2
|
||||
#
|
||||
#
|
||||
show variables like "%character_set_ser%";
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int) ENGINE=NDB;
|
||||
drop table t1;
|
||||
|
||||
--connection master
|
||||
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
||||
`nom` char(4) default NULL,
|
||||
`prenom` char(4) default NULL,
|
||||
PRIMARY KEY (`nid`))
|
||||
ENGINE=ndbcluster;
|
||||
|
||||
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
||||
select * from t1 order by nid;
|
||||
|
||||
--sync_slave_with_master
|
||||
# connect to slave and ensure data it there.
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
@ -9,7 +9,7 @@
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/ndb_default_cluster.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/big_test.inc
|
||||
#--source include/big_test.inc
|
||||
#--source include/have_ndb_extra.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
@ -98,7 +98,7 @@ SELECT DISTINCT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, LOGFILE_GROUP_NAME
|
||||
connection master;
|
||||
CREATE INDEX t1_i ON t1(c2, c3);
|
||||
#Bug 18039
|
||||
#CREATE UNIQUE INDEX t1_i2 ON t1(c2);
|
||||
CREATE UNIQUE INDEX t1_i2 ON t1(c2);
|
||||
ALTER TABLE t1 ADD c4 TIMESTAMP;
|
||||
ALTER TABLE t1 ADD c5 DOUBLE;
|
||||
ALTER TABLE t1 ADD INDEX (c5);
|
||||
@ -170,7 +170,7 @@ SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
connection slave;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Bug 18094
|
||||
#SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
SELECT * FROM t1 where c1 = 1;
|
||||
|
||||
connection master;
|
||||
@ -198,163 +198,19 @@ connection master;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile03.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
INITIAL_SIZE 10M
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile04.dat'
|
||||
INITIAL_SIZE 12M
|
||||
INITIAL_SIZE 5M
|
||||
ENGINE=NDB;
|
||||
|
||||
###### CLEAN UP SECTION ##############
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
CREATE DATABASE tpcb;
|
||||
######## Creat Table Section #########
|
||||
--echo *********** Create TPCB Tables *****************
|
||||
CREATE TABLE tpcb.account
|
||||
(id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id))
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
let engine_type=NDBCLUSTER;
|
||||
let table_space=ts2;
|
||||
let format='RBR';
|
||||
|
||||
CREATE TABLE tpcb.branch
|
||||
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid))
|
||||
ENGINE=NDB;
|
||||
|
||||
CREATE TABLE tpcb.teller
|
||||
(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
|
||||
CREATE TABLE tpcb.history
|
||||
(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
|
||||
--echo ********* Create Procedures and Functions ************
|
||||
delimiter |;
|
||||
CREATE PROCEDURE tpcb.load()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 1000;
|
||||
DECLARE brch INT DEFAULT 100;
|
||||
DECLARE tell INT DEFAULT 1000;
|
||||
DECLARE tmp INT DEFAULT 100;
|
||||
WHILE brch > 0 DO
|
||||
SET tmp = 100;
|
||||
WHILE tmp > 0 DO
|
||||
INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
|
||||
SET acct = acct - 1;
|
||||
SET tmp = tmp -1;
|
||||
END WHILE;
|
||||
INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
|
||||
SET brch = brch - 1;
|
||||
END WHILE;
|
||||
WHILE tell > 0 DO
|
||||
INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
|
||||
SET tell = tell - 1;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.account_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 2)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSEIF (ran < 4)
|
||||
THEN
|
||||
SELECT RAND() * 100 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 1000 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION tpcb.teller_id () RETURNS INT
|
||||
BEGIN
|
||||
DECLARE num INT;
|
||||
DECLARE ran INT;
|
||||
SELECT RAND() * 10 INTO ran;
|
||||
IF (ran < 2)
|
||||
THEN
|
||||
SELECT RAND() * 10 INTO num;
|
||||
ELSEIF (ran < 5)
|
||||
THEN
|
||||
SELECT RAND() * 100 INTO num;
|
||||
ELSE
|
||||
SELECT RAND() * 1000 INTO num;
|
||||
END IF;
|
||||
IF (num < 1)
|
||||
THEN
|
||||
RETURN 1;
|
||||
END IF;
|
||||
RETURN num;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE tpcb.trans()
|
||||
BEGIN
|
||||
DECLARE acct INT DEFAULT 0;
|
||||
DECLARE brch INT DEFAULT 0;
|
||||
DECLARE tell INT DEFAULT 0;
|
||||
DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
|
||||
DECLARE test INT DEFAULT 0;
|
||||
DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_user VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SELECT RAND() * 10 INTO test;
|
||||
SELECT tpcb.account_id() INTO acct;
|
||||
SELECT tpcb.teller_id() INTO tell;
|
||||
|
||||
SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
|
||||
SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
|
||||
SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
|
||||
SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
|
||||
|
||||
IF (test < 5)
|
||||
THEN
|
||||
SET bal = bal + amount;
|
||||
SET bbal = bbal + amount;
|
||||
SET tbal = tbal + amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
ELSE
|
||||
SET bal = bal - amount;
|
||||
SET bbal = bbal - amount;
|
||||
SET tbal = tbal - amount;
|
||||
UPDATE tpcb.account SET balance = bal, filler = 'account updated'
|
||||
WHERE id = acct;
|
||||
UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
|
||||
WHERE bid = brch;
|
||||
UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
|
||||
WHERE tid = tell;
|
||||
END IF;
|
||||
|
||||
SET local_uuid=UUID();
|
||||
SET local_user=USER();
|
||||
SET local_time= NOW();
|
||||
INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
|
||||
local_uuid,'completed trans');
|
||||
END|
|
||||
delimiter ;|
|
||||
--source include/tpcb_disk_data.inc
|
||||
|
||||
--echo ****** TEST 2 test time *********************************
|
||||
USE tpcb;
|
||||
@ -372,15 +228,16 @@ SELECT COUNT(*) FROM account;
|
||||
--echo ******** Run in some transactions ***************
|
||||
|
||||
connection master;
|
||||
let $j= 1000;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
CALL tpcb.trans();
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--echo ***** Time to try slave sync ***********
|
||||
--echo **** Must make sure slave is clean *****
|
||||
--connection slave
|
||||
@ -421,11 +278,11 @@ connection master;
|
||||
|
||||
SELECT COUNT(*) FROM history;
|
||||
|
||||
let $j= 1000;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
CALL tpcb.trans();
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
@ -464,11 +321,11 @@ SELECT COUNT(*) FROM account;
|
||||
|
||||
--echo ***** Add some more records to master *********
|
||||
connection master;
|
||||
let $j= 1000;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
CALL tpcb.trans();
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
@ -484,17 +341,18 @@ while ($j)
|
||||
--echo ***** Finsh the slave sync process *******
|
||||
--disable_query_log
|
||||
# 1. 2. 3.
|
||||
--sync_slave_with_master
|
||||
--source include/ndb_setup_slave.inc
|
||||
--enable_query_log
|
||||
|
||||
# 4.
|
||||
--echo * 4. *
|
||||
connection master;
|
||||
let $j= 1000;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
CALL tpcb.trans();
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
@ -507,15 +365,6 @@ START SLAVE;
|
||||
--echo **** We should be ready to continue on *************
|
||||
|
||||
connection master;
|
||||
let $j= 50;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
CALL tpcb.trans();
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo ****** Let's make sure we match *******
|
||||
--echo ***** MASTER *******
|
||||
USE tpcb;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
create table t1 (a int, unique(a)) engine=ndbcluster;
|
||||
create table t2 (a int, unique(a)) engine=innodb;
|
||||
|
1
mysql-test/t/rpl_ndb_mix_innodb-master.opt
Normal file
1
mysql-test/t/rpl_ndb_mix_innodb-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb --default-storage-engine=innodb
|
36
mysql-test/t/rpl_ndb_mix_innodb.test
Normal file
36
mysql-test/t/rpl_ndb_mix_innodb.test
Normal file
@ -0,0 +1,36 @@
|
||||
#############################################
|
||||
#Authors: TU and Jeb
|
||||
#Date: 2007/04
|
||||
#Purpose: Generic replication to cluster
|
||||
# and ensuring that the ndb_apply_status
|
||||
# table is updated.
|
||||
#############################################
|
||||
# Notes:
|
||||
# include/select_ndb_apply_status.inc
|
||||
# Selects out the log name, start & end pos
|
||||
# from the ndb_apply_status table
|
||||
#
|
||||
# include/show_binlog_using_logname.inc
|
||||
# To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
#
|
||||
# include/tpcb.inc
|
||||
# Creates DATABASE tpcb, the tables and
|
||||
# stored procedures for loading the DB
|
||||
# and for running transactions against DB.
|
||||
##############################################
|
||||
|
||||
|
||||
## Includes ##
|
||||
|
||||
--disable_query_log
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
--enable_query_log
|
||||
let $off_set = 9;
|
||||
let $rpl_format = 'MIX';
|
||||
--source extra/rpl_tests/rpl_ndb_apply_status.test
|
||||
|
@ -1 +1 @@
|
||||
--innodb
|
||||
--innodb --default-storage-engine=innodb
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user