From 03dbf8ccbb649825d7aafd9f00234bee35111de9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Oct 2003 14:23:35 +0100 Subject: Fix for BUG#1686 "If 2 master threads with same-name temp table, slave makes bad binlog" and (two birds with one stone) for BUG#1240 "slave of slave breaks when STOP SLAVE was issud on parent slave and temp tables". Here is the design change: in a slave running with --log-slave-updates, events are now logged with the thread id they had on the master. So no more id conflicts between master threads, but introduces id conflicts between one master thread and one normal client thread connected to the slave. This is solved by storing the server id in the temp table's name. New test which requires mysql-test-run to be run with --manager, otherwise it will be skipped. Undoing a Monty's change (hum, a chill runs down my spine ;) which was "Cleanup temporary tables when slave ends" in ChangeSet 1.1572.1.1. mysql-test/mysql-test-run.sh: One new test which needs more than one slave so must be hardcoded in mysql-test-run.sh. sql/log_event.cc: The event needs to carry a slave_proxy_id (which is set at event's creation and used at event's logging). This is used for events created by ::exec_event() in the slave SQL thread: now we want to log these events with the thread id they had on the master. This is so that several same-name temp tables simultaneously created on the master end up with not the same thread id in the slave's binlog. sql/log_event.h: Query and Load need to carry a slave_proxy_id, like they carried a thread_id (to replicate temp tables well). sql/slave.cc: Do not free temp tables in the slave SQL thread. Or they will be lost when one does STOP SLAVE / START SLAVE. We even save them in rli->save_temporary_tables and set thd->temporary_tables=0 to prevent them to be freed. sql/sql_base.cc: Put the server id in the table cache key name for temp tables (we already put the slave_proxy_id, but we also need the server id in case normal clients (not slave threads) are using temp tables on the slave). sql/unireg.h: 4 more bytes, to store the server id. --- mysql-test/mysql-test-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/mysql-test-run.sh') diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 6cba5eecddd..d155c02c652 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1161,7 +1161,7 @@ run_testcase () echo $tname > $CURRENT_TEST SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then - many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` + many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` fi if [ -n "$SKIP_TEST" ] ; then -- cgit v1.2.1 From b4bc448eba986c5a1daecb8c70df8b093402bd10 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 30 Oct 2003 16:12:21 +0100 Subject: Fix to be able to run mysql-test-run --manager --valgrind (without this fix, the manager fails to start mysqld and the tests hang). mysql-test/mysql-test-run.sh: When running with --manager: the MySQL manager wants the complete path of the executable (it uses execv(), not execvp(), so does not search in the $PATH, so telling him to start 'valgrind' is not enough, it wants '/usr/bin/valgrind' or so). So this is a fix to be able to mysql-test-run --manager --valgrind Plus a warning (previously, if valgrind was not installed, tests silently hanged when run with --valgrind). --- mysql-test/mysql-test-run.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mysql-test/mysql-test-run.sh') diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index d155c02c652..cd409e1ace5 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -336,7 +336,13 @@ while test $# -gt 0; do EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" ;; --valgrind) - VALGRIND="valgrind --alignment=8 --leak-check=yes --num-callers=16" + VALGRIND=`which valgrind` # this will print an error if not found + # Give good warning to the user and stop + if [ -z "$VALGRIND" ] ; then + $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://developer.kde.org/~sewardj ." + exit 1 + fi + VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16" EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb" SLEEP_TIME_AFTER_RESTART=10 -- cgit v1.2.1 From c97a38c4d3b2afd4c93771fca61eede965fe71cf Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Nov 2003 15:55:02 +0200 Subject: Call my_sync() after all data is written to .frm file Added my_sync() to mysys which will do fsync/fdatasync/_commit() on a file. VC++Files/mysys/mysys.dsp: Added my_sync.c configure.in: Added testing of fsync and fdatasync include/my_sys.h: Added my_sync() include/mysys_err.h: Added my_sync() isam/extra.c: Added my_sync() myisam/mi_extra.c: Added my_sync() myisam/mi_locking.c: Added my_sync() mysql-test/mysql-test-run.sh: Added option --valgrind-all mysys/Makefile.am: Added my_sync.c mysys/errors.c: Added my_sync() mysys/my_symlink.c: Removed compiler warning mysys/thr_alarm.c: Fix for link error on windows sql/unireg.cc: Call my_sync() after all data is written to .frm file BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- mysql-test/mysql-test-run.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/mysql-test-run.sh') diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index cd409e1ace5..a298701dc7f 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -353,6 +353,9 @@ while test $# -gt 0; do TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"` VALGRIND="$VALGRIND $TMP" ;; + --valgrind-all) + VALGRIND="$VALGRIND -v --show-reachable=yes" + ;; --skip-*) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1" -- cgit v1.2.1