Commit 1dd9333f authored by unknown's avatar unknown

Merge


sql/ha_ndbcluster.cc:
  Auto merged
mysql-test/mysql-test-run.sh:
  SCCS merged
parents 1ddc28a4 bc6207ee
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
disable_query_log; disable_query_log;
show variables like "have_ndbcluster"; show variables like "have_ndbcluster";
enable_query_log; enable_query_log;
connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT"1",);
...@@ -36,8 +36,13 @@ then ...@@ -36,8 +36,13 @@ then
data=var/slave-data data=var/slave-data
ldata=$fix_bin/var/slave-data ldata=$fix_bin/var/slave-data
else else
data=var/master-data if [ x$1 = x"-1" ]
ldata=$fix_bin/var/master-data then
data=var/master-data1
else
data=var/master-data
fi
ldata=$fix_bin/$data
fi fi
mdata=$data/mysql mdata=$data/mysql
......
...@@ -198,9 +198,11 @@ DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH" ...@@ -198,9 +198,11 @@ DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
MASTER_RUNNING=0 MASTER_RUNNING=0
MASTER1_RUNNING=0
MASTER_MYPORT=9306 MASTER_MYPORT=9306
MASTER_MYPORT1=9307
SLAVE_RUNNING=0 SLAVE_RUNNING=0
SLAVE_MYPORT=9307 SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
NDBCLUSTER_PORT=9350 NDBCLUSTER_PORT=9350
MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
...@@ -435,6 +437,7 @@ MANAGER_PID_FILE="$MYRUN_DIR/manager.pid" ...@@ -435,6 +437,7 @@ MANAGER_PID_FILE="$MYRUN_DIR/manager.pid"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data" MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock" MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
MASTER_MYPID="$MYRUN_DIR/master.pid" MASTER_MYPID="$MYRUN_DIR/master.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log" MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err" MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
...@@ -448,7 +451,7 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err" ...@@ -448,7 +451,7 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test" CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M" SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
if [ x$SOURCE_DIST = x1 ] ; then if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR MY_BASEDIR=$MYSQL_TEST_DIR
...@@ -745,13 +748,22 @@ report_stats () { ...@@ -745,13 +748,22 @@ report_stats () {
mysql_install_db () { mysql_install_db () {
$ECHO "Removing Stale Files" $ECHO "Removing Stale Files"
$RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $MY_LOG_DIR/* $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1" $SLAVE_MYDDIR $MY_LOG_DIR/*
$ECHO "Installing Master Databases" $ECHO "Installing Master Databases"
$INSTALL_DB $INSTALL_DB
if [ $? != 0 ]; then if [ $? != 0 ]; then
error "Could not install master test DBs" error "Could not install master test DBs"
exit 1 exit 1
fi fi
if [ ! -z "$USE_NDBCLUSTER" ]
then
$ECHO "Installing Master Databases 1"
$INSTALL_DB -1
if [ $? != 0 ]; then
error "Could not install master test DBs 1"
exit 1
fi
fi
$ECHO "Installing Slave Databases" $ECHO "Installing Slave Databases"
$INSTALL_DB -slave $INSTALL_DB -slave
if [ $? != 0 ]; then if [ $? != 0 ]; then
...@@ -890,10 +902,10 @@ manager_term() ...@@ -890,10 +902,10 @@ manager_term()
ident=$2 ident=$2
if [ $USE_MANAGER = 0 ] ; then if [ $USE_MANAGER = 0 ] ; then
# Shutdown time must be high as slave may be in reconnect # Shutdown time must be high as slave may be in reconnect
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
res=$? res=$?
# Some systems require an extra connect # Some systems require an extra connect
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
if test $res = 0 if test $res = 0
then then
wait_for_pid $pid wait_for_pid $pid
...@@ -912,17 +924,18 @@ EOF ...@@ -912,17 +924,18 @@ EOF
start_master() start_master()
{ {
if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then eval "this_master_running=\$MASTER$1_RUNNING"
if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
return return
fi fi
# Remove stale binary logs except for 2 tests which need them # Remove stale binary logs except for 2 tests which need them
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ] if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
then then
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.* $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
fi fi
# Remove old master.info and relay-log.info files # Remove old master.info and relay-log.info files
$RM -f $MYSQL_TEST_DIR/var/master-data/master.info $MYSQL_TEST_DIR/var/master-data/relay-log.info $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
#run master initialization shell script if one exists #run master initialization shell script if one exists
...@@ -931,20 +944,27 @@ start_master() ...@@ -931,20 +944,27 @@ start_master()
/bin/sh $master_init_script /bin/sh $master_init_script
fi fi
cd $BASEDIR # for gcov cd $BASEDIR # for gcov
if [ -n "$1" ] ; then
id=`$EXPR $1 + 101`;
this_master_myport=`$EXPR $MASTER_MYPORT + $1`
else
id=1;
this_master_myport=$MASTER_MYPORT
fi
if [ -z "$DO_BENCH" ] if [ -z "$DO_BENCH" ]
then then
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
--server-id=1 \ --server-id=$id \
--basedir=$MY_BASEDIR \ --basedir=$MY_BASEDIR \
--port=$MASTER_MYPORT \ --port=$this_master_myport \
--local-infile \ --local-infile \
--exit-info=256 \ --exit-info=256 \
--core \ --core \
$USE_NDBCLUSTER \ $USE_NDBCLUSTER \
--datadir=$MASTER_MYDDIR \ --datadir=$MASTER_MYDDIR$1 \
--pid-file=$MASTER_MYPID \ --pid-file=$MASTER_MYPID$1 \
--socket=$MASTER_MYSOCK \ --socket=$MASTER_MYSOCK$1 \
--log=$MASTER_MYLOG \ --log=$MASTER_MYLOG$1 \
--character-sets-dir=$CHARSETSDIR \ --character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \ --default-character-set=$CHARACTER_SET \
--tmpdir=$MYSQL_TMP_DIR \ --tmpdir=$MYSQL_TMP_DIR \
...@@ -955,14 +975,14 @@ start_master() ...@@ -955,14 +975,14 @@ start_master()
$SMALL_SERVER \ $SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
else else
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
--server-id=1 --rpl-recovery-rank=1 \ --server-id=$id --rpl-recovery-rank=1 \
--basedir=$MY_BASEDIR --init-rpl-role=master \ --basedir=$MY_BASEDIR --init-rpl-role=master \
--port=$MASTER_MYPORT \ --port=$this_master_myport \
--local-infile \ --local-infile \
--datadir=$MASTER_MYDDIR \ --datadir=$MASTER_MYDDIR$1 \
--pid-file=$MASTER_MYPID \ --pid-file=$MASTER_MYPID$1 \
--socket=$MASTER_MYSOCK \ --socket=$MASTER_MYSOCK$1 \
--character-sets-dir=$CHARSETSDIR \ --character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \ --default-character-set=$CHARACTER_SET \
--core \ --core \
...@@ -1018,11 +1038,11 @@ EOF ...@@ -1018,11 +1038,11 @@ EOF
-title "Master" -e gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD -title "Master" -e gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD
fi fi
else else
manager_launch master $MASTER_MYSQLD $master_args manager_launch master$1 $MASTER_MYSQLD $master_args
fi fi
sleep_until_file_created $MASTER_MYPID $wait_for_master sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
MASTER_RUNNING=1 eval "MASTER$1_RUNNING=1"
} }
start_slave() start_slave()
...@@ -1198,22 +1218,23 @@ stop_slave_threads () ...@@ -1198,22 +1218,23 @@ stop_slave_threads ()
stop_master () stop_master ()
{ {
if [ x$MASTER_RUNNING = x1 ] eval "this_master_running=\$MASTER$1_RUNNING"
if [ x$this_master_running = x1 ]
then then
# For embedded server we don't stop anyting but mark that # For embedded server we don't stop anyting but mark that
# MASTER_RUNNING=0 to get cleanup when calling start_master(). # MASTER_RUNNING=0 to get cleanup when calling start_master().
if [ x$USE_EMBEDDED_SERVER != x1 ] ; then if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
pid=`$CAT $MASTER_MYPID` pid=`$CAT $MASTER_MYPID$1`
manager_term $pid master manager_term $pid master
if [ $? != 0 ] && [ -f $MASTER_MYPID ] if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
then # try harder! then # try harder!
$ECHO "master not cooperating with mysqladmin, will try manual kill" $ECHO "master not cooperating with mysqladmin, will try manual kill"
kill $pid kill $pid
sleep_until_file_deleted $pid $MASTER_MYPID sleep_until_file_deleted $pid $MASTER_MYPID$1
if [ -f $MASTER_MYPID ] ; then if [ -f $MASTER_MYPID$1 ] ; then
$ECHO "master refused to die. Sending SIGKILL" $ECHO "master refused to die. Sending SIGKILL"
kill -9 `$CAT $MASTER_MYPID` kill -9 `$CAT $MASTER_MYPID$1`
$RM -f $MASTER_MYPID $RM -f $MASTER_MYPID$1
else else
$ECHO "master responded to SIGTERM " $ECHO "master responded to SIGTERM "
fi fi
...@@ -1221,7 +1242,7 @@ stop_master () ...@@ -1221,7 +1242,7 @@ stop_master ()
sleep $SLEEP_TIME_AFTER_RESTART sleep $SLEEP_TIME_AFTER_RESTART
fi fi
fi fi
MASTER_RUNNING=0 eval "MASTER$1_RUNNING=0"
fi fi
} }
...@@ -1231,6 +1252,7 @@ mysql_stop () ...@@ -1231,6 +1252,7 @@ mysql_stop ()
$ECHO "Shutting-down MySQL daemon" $ECHO "Shutting-down MySQL daemon"
$ECHO "" $ECHO ""
stop_master stop_master
stop_master 1
$ECHO "Master shutdown finished" $ECHO "Master shutdown finished"
stop_slave stop_slave
stop_slave 1 stop_slave 1
...@@ -1361,8 +1383,12 @@ run_testcase () ...@@ -1361,8 +1383,12 @@ run_testcase ()
;; ;;
esac esac
stop_master stop_master
stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master start_master
if [ ! -z "$USE_NDBCLUSTER" ] ; then
start_master 1
fi
TZ=$MY_TZ; export TZ TZ=$MY_TZ; export TZ
else else
# If we had extra master opts to the previous run # If we had extra master opts to the previous run
...@@ -1373,8 +1399,12 @@ run_testcase () ...@@ -1373,8 +1399,12 @@ run_testcase ()
then then
EXTRA_MASTER_OPT="" EXTRA_MASTER_OPT=""
stop_master stop_master
stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master start_master
if [ ! -z "$USE_NDBCLUSTER" ] ; then
start_master 1
fi
else else
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
fi fi
...@@ -1528,11 +1558,11 @@ then ...@@ -1528,11 +1558,11 @@ then
if [ ! -z "$USE_NDBCLUSTER" ] if [ ! -z "$USE_NDBCLUSTER" ]
then then
if [ -z "$USE_RUNNING_NDBCLUSTER" ] if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then then
# Kill any running ndbcluster stuff # Kill any running ndbcluster stuff
./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop ./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
fi fi
fi fi
# Remove files that can cause problems # Remove files that can cause problems
...@@ -1541,6 +1571,7 @@ then ...@@ -1541,6 +1571,7 @@ then
# Remove old berkeley db log files that can confuse the server # Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.* $RM -f $MASTER_MYDDIR/log.*
$RM -f $MASTER_MYDDIR"1"/log.*
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
...@@ -1552,7 +1583,7 @@ then ...@@ -1552,7 +1583,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ] if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then then
echo "Starting ndbcluster" echo "Starting ndbcluster"
if [ "$DO_BENCH" = 1 ] if [ "$DO_BENCH" = 1 -a ! "$DO_SMALL_BENCH" = 1 ]
then then
NDBCLUSTER_OPTS="" NDBCLUSTER_OPTS=""
else else
......
...@@ -147,7 +147,25 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans) ...@@ -147,7 +147,25 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
int m_batch_execute= 0; int m_batch_execute= 0;
if (false && m_batch_execute) if (false && m_batch_execute)
return 0; return 0;
return trans->execute(NoCommit); return trans->execute(NoCommit,AbortOnError,1);
}
inline
int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
{
int m_batch_execute= 0;
if (false && m_batch_execute)
return 0;
return trans->execute(Commit,AbortOnError,1);
}
inline
int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
{
int m_batch_execute= 0;
if (false && m_batch_execute)
return 0;
return trans->execute(NoCommit,IgnoreError,1);
} }
/* /*
...@@ -802,7 +820,7 @@ void ha_ndbcluster::release_metadata() ...@@ -802,7 +820,7 @@ void ha_ndbcluster::release_metadata()
int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type) int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type)
{ {
int lm; int lm;
if (type == TL_WRITE_ALLOW_WRITE) if (type >= TL_WRITE_ALLOW_WRITE)
lm= NdbOperation::LM_Exclusive; lm= NdbOperation::LM_Exclusive;
else if (uses_blob_value(retrieve_all_fields)) else if (uses_blob_value(retrieve_all_fields))
/* /*
...@@ -994,7 +1012,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) ...@@ -994,7 +1012,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
} }
} }
if (trans->execute(NoCommit, IgnoreError) != 0) if (execute_no_commit_ie(this,trans) != 0)
{ {
table->status= STATUS_NOT_FOUND; table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
...@@ -1115,7 +1133,7 @@ int ha_ndbcluster::unique_index_read(const byte *key, ...@@ -1115,7 +1133,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
} }
} }
if (trans->execute(NoCommit, IgnoreError) != 0) if (execute_no_commit_ie(this,trans) != 0)
{ {
table->status= STATUS_NOT_FOUND; table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
...@@ -1192,7 +1210,7 @@ inline int ha_ndbcluster::next_result(byte *buf) ...@@ -1192,7 +1210,7 @@ inline int ha_ndbcluster::next_result(byte *buf)
} }
else else
{ {
if (ops_pending && (trans->execute(Commit) != 0)) if (ops_pending && (execute_commit(this,trans) != 0))
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
trans->restart(); trans->restart();
} }
...@@ -1626,7 +1644,7 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1626,7 +1644,7 @@ int ha_ndbcluster::write_row(byte *record)
} }
else else
{ {
if (trans->execute(Commit) != 0) if (execute_commit(this,trans) != 0)
{ {
skip_auto_increment= true; skip_auto_increment= true;
no_uncommitted_rows_execute_failure(); no_uncommitted_rows_execute_failure();
...@@ -2668,14 +2686,13 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd, ...@@ -2668,14 +2686,13 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
enum thr_lock_type lock_type) enum thr_lock_type lock_type)
{ {
DBUG_ENTER("store_lock"); DBUG_ENTER("store_lock");
if (lock_type != TL_IGNORE && m_lock.type == TL_UNLOCK) if (lock_type != TL_IGNORE && m_lock.type == TL_UNLOCK)
{ {
/* If we are not doing a LOCK TABLE, then allow multiple /* If we are not doing a LOCK TABLE, then allow multiple
writers */ writers */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && if ((lock_type >= TL_WRITE_ALLOW_WRITE &&
lock_type <= TL_WRITE) && !thd->in_lock_tables) lock_type <= TL_WRITE) && !thd->in_lock_tables)
lock_type= TL_WRITE_ALLOW_WRITE; lock_type= TL_WRITE_ALLOW_WRITE;
...@@ -2913,7 +2930,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction) ...@@ -2913,7 +2930,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
"stmt" : "all")); "stmt" : "all"));
DBUG_ASSERT(ndb && trans); DBUG_ASSERT(ndb && trans);
if (trans->execute(Commit) != 0) if (execute_commit(0,trans) != 0)
{ {
const NdbError err= trans->getNdbError(); const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation(); const NdbOperation *error_op= trans->getNdbErrorOperation();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment