Below is the list of changes that have just been committed into a local
5.1 repository of ndbdev. When ndbdev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-09 22:07:30+02:00, jmiller@stripped +3 -0
rpl_ndb_dd_advance.test, rpl_ndb_dd_advance.result:
updated test case to reduce time spent and to enable parts of the test that had been disabled do to a bug that has since been patched.
tpcb_DiskData.inc:
bk cp tpcb.inc tpcb_DiskData.inc
comments added
New include file for rpl_ndb_stm_innodb test
updated
new support file for testing disk data
Trying to fix push build. Not failing on my system, so I am doing a little guessing here
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-05-09 22:07:13+02:00, jmiller@stripped +25 -13
new support file for testing disk data
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-05-09 21:13:25+02:00, jmiller@stripped +0 -0
bk cp tpcb.inc tpcb_DiskData.inc
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-04-25 20:42:17+02:00, jmiller@stripped +2 -2
updated
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-04-23 23:34:28+02:00, jmiller@stripped +0 -3
Trying to fix push build. Not failing on my system, so I am doing a little guessing here
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-04-20 14:55:27+02:00, jmiller@stripped +9 -0
comments added
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-04-19 23:03:29+02:00, jmiller@stripped +148 -0
New include file for rpl_ndb_stm_innodb test
mysql-test/include/tpcb_DiskData.inc@stripped, 2007-04-19 23:03:29+02:00, jmiller@stripped +0 -0
mysql-test/r/rpl_ndb_dd_advance.result@stripped, 2007-05-09 22:06:32+02:00, jmiller@stripped +44 -132
updated test case to reduce time spent and to enable parts of the test that had been disabled do to a bug that has since been patched.
mysql-test/t/rpl_ndb_dd_advance.test@stripped, 2007-05-09 22:06:04+02:00, jmiller@stripped +18 -170
updated test case to reduce time spent and to enable parts of the test that had been disabled do to a bug that has since been patched.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jmiller
# Host: ndb08.mysql.com
# Root: /data1/mysql-5.1-telco
--- New file ---
+++ mysql-test/include/tpcb_DiskData.inc 07/04/19 23:03:29
##################################################
# 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
##################################################
DROP DATABASE IF EXISTS tpcb;
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
--- 1.10/mysql-test/r/rpl_ndb_dd_advance.result 2007-05-09 22:07:42 +02:00
+++ 1.11/mysql-test/r/rpl_ndb_dd_advance.result 2007-05-09 22:07:42 +02:00
@@ -56,6 +56,7 @@
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 @@
`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 @@
`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 @@
`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 @@
`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 @@
`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 @@
`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,46 @@
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
+TABLESPACE ts2 STORAGE DISK
+ENGINE=NDBCLUSTER;
+
+CREATE TABLE tpcb.branch
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
-PRIMARY KEY(bid))
-ENGINE=NDB;
-CREATE TABLE tpcb.teller
+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=NDB;
-CREATE TABLE tpcb.history
+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 +228,11 @@
********** 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 +263,10 @@
********** 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 +280,7 @@
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 +296,12 @@
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;
--- 1.12/mysql-test/t/rpl_ndb_dd_advance.test 2007-05-09 22:07:42 +02:00
+++ 1.13/mysql-test/t/rpl_ndb_dd_advance.test 2007-05-09 22:07:42 +02:00
@@ -98,7 +98,7 @@
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 @@
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 @@
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;
-
-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 ;|
+let engine_type=NDBCLUSTER;
+let table_space=ts2;
+let format='RBR';
+
+--source include/tpcb_DiskData.inc
--echo ****** TEST 2 test time *********************************
USE tpcb;
@@ -372,15 +228,16 @@
--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 @@
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 @@
--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
@@ -490,11 +347,11 @@
# 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 +364,6 @@
--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;
| Thread |
|---|
| • bk commit into 5.1 tree (jmiller:1.2530) | Jonathan Miller | 9 May |