List:Internals« Previous MessageNext Message »
From:tomas Date:May 4 2005 2:08am
Subject:bk commit into 5.1 tree (tomas:1.1814)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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
  1.1814 05/05/04 02:08:41 tomas@stripped +7 -0
  new test for cluster replication, bank
      more env variables for bank test
      enlarged the cluster for running bank replication test
      more operation records

  mysql-test/t/rpl_ndb_bank.test
    1.1 05/05/04 02:08:30 tomas@stripped +179 -0

  mysql-test/t/rpl_ndb_bank.test
    1.0 05/05/04 02:08:30 tomas@stripped +0 -0
    BitKeeper file /home/tomas/wl2325/mysql-test/t/rpl_ndb_bank.test

  mysql-test/r/rpl_ndb_bank.result
    1.1 05/05/04 02:08:27 tomas@stripped +77 -0

  storage/ndb/test/ndbapi/testBlobs.cpp
    1.22 05/05/04 02:08:27 tomas@stripped +1 -1
    marge fix

  mysql-test/r/rpl_ndb_bank.result
    1.0 05/05/04 02:08:27 tomas@stripped +0 -0
    BitKeeper file /home/tomas/wl2325/mysql-test/r/rpl_ndb_bank.result

  mysql-test/ndb/ndbcluster.sh
    1.47 05/05/04 02:08:26 tomas@stripped +1 -1
    more operation records

  mysql-test/ndb/ndb_config_2_node.ini
    1.19 05/05/04 02:08:26 tomas@stripped +8 -0
    enlarged the cluster for running bank replication test

  mysql-test/ndb/ndb_config_1_node.ini
    1.5 05/05/04 02:08:26 tomas@stripped +8 -0
    enlarged the cluster for running bank replication test

  mysql-test/mysql-test-run.sh
    1.268 05/05/04 02:08:26 tomas@stripped +4 -2
    more env variables for bank test

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/wl2325

--- 1.267/mysql-test/mysql-test-run.sh	2005-05-03 12:45:06 +02:00
+++ 1.268/mysql-test/mysql-test-run.sh	2005-05-04 02:08:26 +02:00
@@ -293,7 +293,7 @@
       USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
       USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e
"s;--ndb-connectstring-slave=;;"` ;;
     --ndb-extra-test)
-      NDBCLUSTER_EXTRA_OPTS=" "
+#      NDBCLUSTER_EXTRA_OPTS=" "
       NDB_EXTRA_TEST=1 ;
       ;;
     --ndb_mgm-extra-opts=*)
@@ -737,11 +737,12 @@
   MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A
--datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
 fi
 MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD
$EXTRA_MYSQLDUMP_OPT"
+MYSQL_DUMP_SLAVE="$MYSQL_DUMP --no-defaults -uroot --socket=$SLAVE_MYSOCK
--password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
 MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD
$EXTRA_MYSQLSHOW_OPT"
 MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR 
--character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
 MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost
--port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD
--basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
 MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root
--password=$DBPASSWD"
-export MYSQL MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
+export MYSQL MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
 export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
 export NDB_TOOLS_DIR
 export NDB_MGM
@@ -752,6 +753,7 @@
 export NDB_STATUS_OK
 NDB_SLAVE_STATUS_OK=1
 export NDB_SLAVE_STATUS_OK
+export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
 
 MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
  --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \

--- 1.21/storage/ndb/test/ndbapi/testBlobs.cpp	2005-04-08 02:44:24 +02:00
+++ 1.22/storage/ndb/test/ndbapi/testBlobs.cpp	2005-05-04 02:08:27 +02:00
@@ -23,7 +23,7 @@
 #include <NdbOut.hpp>
 #include <NdbTest.hpp>
 #include <NdbTick.h>
-#include <ndb/src/ndbapi/NdbBlobImpl.hpp>
+#include <storage/ndb/src/ndbapi/NdbBlobImpl.hpp>
 
 struct Bcol {
   bool m_nullable;

--- 1.46/mysql-test/ndb/ndbcluster.sh	2005-04-28 16:43:56 +02:00
+++ 1.47/mysql-test/ndb/ndbcluster.sh	2005-05-04 02:08:26 +02:00
@@ -87,7 +87,7 @@
     --small)
      ndb_no_attr=256
      ndb_no_ord=32
-     ndb_con_op=2048
+     ndb_con_op=5000
      ndb_dmem=10M
      ndb_imem=1M
      ;;

--- 1.18/mysql-test/ndb/ndb_config_2_node.ini	2005-04-28 16:54:36 +02:00
+++ 1.19/mysql-test/ndb/ndb_config_2_node.ini	2005-05-04 02:08:26 +02:00
@@ -30,3 +30,11 @@
 [mysqld]
 
 [mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]

--- 1.4/mysql-test/ndb/ndb_config_1_node.ini	2005-04-28 16:54:11 +02:00
+++ 1.5/mysql-test/ndb/ndb_config_1_node.ini	2005-05-04 02:08:26 +02:00
@@ -27,3 +27,11 @@
 [mysqld]
 
 [mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
--- New file ---
+++ mysql-test/r/rpl_ndb_bank.result	05/05/04 02:08:27
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
STOP SLAVE;
DELETE FROM cluster_replication.binlog_index;
DROP DATABASE IF EXISTS BANK;
CREATE DATABASE BANK;
RESET SLAVE;
DELETE FROM cluster_replication.binlog_index;
DROP DATABASE IF EXISTS BANK;
CREATE DATABASE BANK;
RESET MASTER;
USE BANK;
CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
BALANCE INT UNSIGNED NOT NULL,
DEPOSIT_COUNT INT UNSIGNED NOT NULL,
DEPOSIT_SUM INT UNSIGNED NOT NULL,
WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
PURGED INT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
ENGINE = NDB;
CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
OWNER INT UNSIGNED NOT NULL,
BALANCE INT UNSIGNED NOT NULL,
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (ACCOUNT_ID))
ENGINE = NDB;
CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
ACCOUNT INT UNSIGNED NOT NULL,
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
OTHER_ACCOUNT INT UNSIGNED NOT NULL,
TRANSACTION_TYPE INT UNSIGNED NOT NULL,
TIME BIGINT UNSIGNED NOT NULL,
AMOUNT INT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
ENGINE = NDB;
CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
VALUE BIGINT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
ENGINE = NDB;
CREATE TABLE ACCOUNT_TYPES ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
DESCRIPTION CHAR(64) NOT NULL,
PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
ENGINE = NDB;
CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE
= HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS
TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
SHOW TABLES;
Tables_in_test
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch
ASC LIMIT 1;
@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos>	master-bin.000001
CHANGE MASTER TO
master_log_file = 'master-bin.000001',
master_log_pos = <the_pos>;
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>
SHOW SLAVE STATUS;
Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>
SHOW SLAVE STATUS;
Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>

--- New file ---
+++ mysql-test/t/rpl_ndb_bank.test	05/05/04 02:08:30
#
# Currently this test only runs in the source tree with the 
# ndb/test programs compiled.
# invoke with:  ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_bank
#
# 1. start a "bank" application running on the master cluster
# 2. perform online sync of slave
# 3. periodically check consistency of slave
# 4. stop the bank application
# 5. check that the slave and master BANK databases are the same
#
 
--source include/have_ndb.inc
--source include/have_ndb_extra.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc

--disable_warnings
# stop the save
connection slave;
STOP SLAVE;
DELETE FROM cluster_replication.binlog_index;
DROP DATABASE IF EXISTS BANK;
CREATE DATABASE BANK;
RESET SLAVE;

# reset master
connection master;
DELETE FROM cluster_replication.binlog_index;
DROP DATABASE IF EXISTS BANK;
CREATE DATABASE BANK;
RESET MASTER;
--enable_warnings

#
# These tables should correspond to the table definitions in
# storage/ndb/test/src/NDBT_Tables.cpp
#
connection master;
USE BANK;
CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
                  ACCOUNT_TYPE INT UNSIGNED NOT NULL,
                  BALANCE INT UNSIGNED NOT NULL,
                  DEPOSIT_COUNT INT UNSIGNED NOT NULL,
                  DEPOSIT_SUM INT UNSIGNED NOT NULL,
                  WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
                  WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
                  PURGED INT UNSIGNED NOT NULL,
                  PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
   ENGINE = NDB;

CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
                       OWNER INT UNSIGNED NOT NULL,
                       BALANCE INT UNSIGNED NOT NULL,
                       ACCOUNT_TYPE INT UNSIGNED NOT NULL,
                       PRIMARY KEY USING HASH (ACCOUNT_ID))
   ENGINE = NDB;

CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
                           ACCOUNT INT UNSIGNED NOT NULL,
                           ACCOUNT_TYPE INT UNSIGNED NOT NULL,
                           OTHER_ACCOUNT INT UNSIGNED NOT NULL,
                           TRANSACTION_TYPE INT UNSIGNED NOT NULL,
                           TIME BIGINT UNSIGNED NOT NULL,
                           AMOUNT INT UNSIGNED NOT NULL,
                           PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
   ENGINE = NDB;

CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
                             VALUE BIGINT UNSIGNED NOT NULL,
                             PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
   ENGINE = NDB;

CREATE TABLE ACCOUNT_TYPES ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
                             DESCRIPTION CHAR(64) NOT NULL,
                             PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
   ENGINE = NDB;

#
# start "BANK" application
#
--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT
../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT
../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT
../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT
../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &

#
# let the "BANK" run for a while
#
--sleep 5;

#
# Time to sync the slave:
# start by taking a backup on master
connection master;
--exec $NDB_MGM --no-defaults --ndb-connectstring=localhost:$NDBCLUSTER_PORT -e "start
backup" >> $NDB_TOOLS_OUTPUT

# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring=localhost:$NDBCLUSTER_PORT -d sys
-D , SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE
= HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS
TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
let the_backup_id=`select @the_backup_id`;

# restore on slave, first check that nothing is there
connection slave;

--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults
--ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 32 -b $the_backup_id -n 1 -m -r
--print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >>
$NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults
--ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 32 -b $the_backup_id -n 2 -r -e
--print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >>
$NDB_TOOLS_OUTPUT

SHOW TABLES;

#
# now setup replication to continue from last epoch
# 1. get apply_status epoch from slave
# 2. get corresponding _next_ binlog postition from master
# 3. change master on slave
# 4. start the replication

# 1.
connection slave;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
let $the_epoch= `select @the_epoch` ;

# 2.
connection master;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
   FROM cluster_replication.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC
LIMIT 1;
let $the_pos= `SELECT @the_pos`;
let $the_file= `SELECT @the_file`;

# 3.
connection slave;
--replace_result $the_pos <the_pos>
eval CHANGE MASTER TO
  master_log_file = '$the_file',
  master_log_pos = $the_pos;

# 4.
connection slave;
START SLAVE;


#
# Now loop and check consistency each time on slave
#
connection slave;
let $1=3;
while ($1)
{
  --sleep 2
  --echo $1
  --replace_result $MASTER_MYPORT MASTER_PORT
  --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8
<Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22
<Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
  SHOW SLAVE STATUS;
  --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE
../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
  dec $1;
}

#
# Stop transactions
#
--exec killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL

#
# Check that the databases are the same on slave and master
# 1. dump database BANK on both master and slave
# 2. compare, there should be no difference
#
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info
BANK > master_BANK.sql
--sleep 5
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert
--no-create-info BANK > slave_BANK.sql

--exec diff master_BANK.sql slave_BANK.sql

Thread
bk commit into 5.1 tree (tomas:1.1814)tomas4 May