Commit a5edb200 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixed timing problem with rpl000001 replication test.

Fixed configure problems with HPUX and openbsd
SHOW SLAVE STATUS returns empty set if slave is not initialized
SHOW MASTER STATUS returns empty set if binary logging is not enabled.
Fixed shutdown problem on Solaris.
parent f7c8bd0e
......@@ -493,3 +493,4 @@ sql-bench/innotest2a
sql-bench/innotest2b
myisam/test2.MYD
myisam/test2.MYI
libmysqld/set_var.cc
......@@ -118,8 +118,12 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution)
safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be
# in the future
system("touch timestamp; find . -newer timestamp -print | xargs touch; rm -f timestamp");
# in the future. The following is done this way to ensure that
# we don't get any errors from xargs touch
system("touch timestamp");
sleep(2);
system("touch timestamp2");
system("find . -newer timestamp -print | xargs touch; rm -f timestamp");
sleep(2);
# Ensure that files we don't want to rebuild are newer than other files
safe_cd($ver);
......
......@@ -8172,6 +8172,11 @@ Renamed mysqld startup options @code{--skip-locking} to
@code{--skip-external-locking} and @code{--enable-locking} to
@code{--external-locking}.
@item
@code{SHOW MASTER STATUS} now returns an empty set if binary log is not
enabled.
@item
@code{SHOW SLAVE STATUS} now returns an empty set if slave is not initialized.
@item
mysqld now has the option @code{--temp-pool} enabled by default as this
gives better performance with some OS.
@item
......@@ -50261,6 +50266,13 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed shutdown problem (SIGTERM signal handling) on Solaris. (Bug from 4.0.2).
@item
@code{SHOW MASTER STATUS} now returns an empty set if binary log is not
enabled.
@item
@code{SHOW SLAVE STATUS} now returns an empty set if slave is not initialized.
@item
Don't update MyISAM index file on update if not strictly necessary.
@item
Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY
......@@ -178,7 +178,7 @@ struct connection* cur_con, *next_con, *cons_end;
enum enum_commands {
Q_CONNECTION=1, Q_QUERY,
Q_CONNECT, Q_SLEEP,
Q_CONNECT, Q_SLEEP, Q_REAL_SLEEP,
Q_INC, Q_DEC,
Q_SOURCE, Q_DISCONNECT,
Q_LET, Q_ECHO,
......@@ -213,25 +213,45 @@ struct st_query
enum enum_commands type;
};
const char *command_names[] = {
"connection", "query",
"connect", "sleep",
"inc", "dec",
"source", "disconnect",
"let", "echo",
"while", "end",
"system", "result",
"require", "save_master_pos",
"sync_with_master", "error",
"send", "reap",
"dirty_close", "replace_result",
"ping", "eval",
"rpl_probe", "enable_rpl_parse",
"disable_rpl_parse", "eval_result",
"enable_query_log", "disable_query_log",
"enable_result_log", "disable_result_log",
"server_start", "server_stop",
"require_manager", "wait_for_slave_to_stop",
const char *command_names[]=
{
"connection",
"query",
"connect",
"sleep",
"real_sleep",
"inc",
"dec",
"source",
"disconnect",
"let",
"echo",
"while",
"end",
"system",
"result",
"require",
"save_master_pos",
"sync_with_master",
"error",
"send",
"reap",
"dirty_close",
"replace_result",
"ping",
"eval",
"rpl_probe",
"enable_rpl_parse",
"disable_rpl_parse",
"eval_result",
"enable_query_log",
"disable_query_log",
"enable_result_log",
"disable_result_log",
"server_start",
"server_stop",
"require_manager",
"wait_for_slave_to_stop",
"require_version",
0
};
......@@ -973,7 +993,7 @@ int do_sync_with_master(struct st_query* q)
mysql_errno(mysql), mysql_error(mysql));
if (!(last_result = res = mysql_store_result(mysql)))
die("line %u: mysql_store_result() retuned NULL", start_lineno);
die("line %u: mysql_store_result() returned NULL", start_lineno);
if (!(row = mysql_fetch_row(res)))
die("line %u: empty result in %s", start_lineno, query_buf);
if (!row[0])
......@@ -1052,7 +1072,7 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
}
int do_sleep(struct st_query* q)
int do_sleep(struct st_query* q, my_bool real_sleep)
{
char* p=q->first_argument;
struct timeval t;
......@@ -1064,7 +1084,7 @@ int do_sleep(struct st_query* q)
#ifdef OS2
if (opt_sleep)
if (opt_sleep && !real_sleep)
DosSleep( opt_sleep * 1000);
else
DosSleep( atof( p) * 1000);
......@@ -1072,7 +1092,7 @@ int do_sleep(struct st_query* q)
return 0;
#else
if (opt_sleep)
if (opt_sleep && !real_sleep)
t.tv_sec = opt_sleep;
else
{
......@@ -2394,7 +2414,8 @@ int main(int argc, char** argv)
case Q_ENABLE_RESULT_LOG: disable_result_log=0; break;
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_SOURCE: do_source(q); break;
case Q_SLEEP: do_sleep(q); break;
case Q_SLEEP: do_sleep(q, 0); break;
case Q_REAL_SLEEP: do_sleep(q, 1); break;
case Q_REQUIRE_VERSION: do_require_version(q); break;
case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break;
case Q_REQUIRE_MANAGER: do_require_manager(q); break;
......
......@@ -893,7 +893,7 @@ case $SYSTEM_TYPE in
*hpux10.20*)
echo "Enabling workarounds for hpux 10.20"
CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT HAVE_POSIX1003_4a_MUTEX"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
if test "$with_named_thread" = "no"
then
echo "Using --with-named-thread=-lpthread"
......
......@@ -97,7 +97,7 @@ case "$target_os" in
sysv5uw7*)
# Problem when linking on SCO
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
*-openbsd*)
openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac
......
......@@ -1259,11 +1259,12 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql)
return 1;
}
if (!(row = mysql_fetch_row(res)))
goto err;
/* check master host for emptiness/NULL */
if (row[0] && *(row[0]))
row= mysql_fetch_row(res);
/*
Check master host for emptiness/NULL
For MySQL 4.0 it's enough to check for row[0]
*/
if (row && row[0] && *(row[0]))
{
/* this is a slave, ask it for the master */
if (get_master(mysql, res, row) || get_slaves_from_master(mysql))
......
......@@ -119,7 +119,11 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
}
}
}
if (changed)
/*
If we are running with external locking, we must update the index file
that something has changed
*/
if (changed || !my_disable_locking)
key_changed|= HA_STATE_KEY_CHANGED;
if (share->calc_checksum)
......
......@@ -873,7 +873,7 @@ start_slave()
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
--report-host=127.0.0.1 --report-user=root \
--report-port=$slave_port \
--master-retry-count=5 \
--master-retry-count=10 \
-O slave_net_timeout=10 \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
......
......@@ -5,7 +5,6 @@ master-bin.001 79
reset slave;
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
0 0 0 0 No No 0 0 0 0
change master to master_host='127.0.0.1';
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
......
......@@ -7,6 +7,5 @@ slave start;
drop table if exists t1;
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
0 0 0 0 No No 0 0 0 0
load table t1 from master;
Error in fetch_master_table
......@@ -18,8 +18,10 @@ set password for root@"localhost" = password('foo');
connection slave;
slave start;
connection master;
#
# Give slave time to do at last one failed connect retry
sleep 2;
# This one must be short so that the slave will not stop retrying
real_sleep 2;
set password for root@"localhost" = password('');
# Give slave time to connect (will retry every second)
sleep 2;
......
......@@ -706,12 +706,12 @@ void kill_mysql(void)
#elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore
#elif defined(HAVE_PTHREAD_KILL)
if (pthread_kill(signal_thread,SIGTERM)) /* End everything nicely */
if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
{
DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */
}
#elif !defined(SIGNALS_DONT_BREAK_READ)
kill(current_pid,SIGTERM);
kill(current_pid, MYSQL_KILL_SIGNAL);
#endif
DBUG_PRINT("quit",("After pthread_kill"));
shutdown_in_progress=1; // Safety if kill didn't work
......@@ -1459,8 +1459,8 @@ static void init_signals(void)
sigaddset(&set,SIGQUIT);
sigaddset(&set,SIGTERM);
sigaddset(&set,SIGHUP);
signal(SIGTERM,SIG_DFL); // If it's blocked by parent
signal(SIGHUP,SIG_DFL); // If it's blocked by parent
sigset(SIGTERM, print_signal_warning); // If it's blocked by parent
sigset(SIGHUP, print_signal_warning); // If it's blocked by parent
#ifdef SIGTSTP
sigaddset(&set,SIGTSTP);
#endif
......@@ -1560,7 +1560,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
int error; // Used when debugging
if (shutdown_in_progress && !abort_loop)
{
sig=SIGTERM;
sig= SIGTERM;
error=0;
}
else
......
......@@ -1411,36 +1411,38 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
String* packet = &thd->packet;
packet->length(0);
if (mi->host[0])
{
String *packet= &thd->packet;
packet->length(0);
pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&mi->rli.data_lock);
net_store_data(packet, mi->host);
net_store_data(packet, mi->user);
net_store_data(packet, (uint32) mi->port);
net_store_data(packet, (uint32) mi->connect_retry);
net_store_data(packet, mi->master_log_name);
net_store_data(packet, (longlong) mi->master_log_pos);
net_store_data(packet, mi->rli.relay_log_name +
dirname_length(mi->rli.relay_log_name));
net_store_data(packet, (longlong) mi->rli.relay_log_pos);
net_store_data(packet, mi->rli.master_log_name);
net_store_data(packet, mi->slave_running ? "Yes":"No");
net_store_data(packet, mi->rli.slave_running ? "Yes":"No");
net_store_data(packet, &replicate_do_db);
net_store_data(packet, &replicate_ignore_db);
net_store_data(packet, (uint32)mi->rli.last_slave_errno);
net_store_data(packet, mi->rli.last_slave_error);
net_store_data(packet, mi->rli.slave_skip_counter);
net_store_data(packet, (longlong) mi->rli.master_log_pos);
net_store_data(packet, (longlong) mi->rli.log_space_total);
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&mi->rli.data_lock);
net_store_data(packet, mi->host);
net_store_data(packet, mi->user);
net_store_data(packet, (uint32) mi->port);
net_store_data(packet, (uint32) mi->connect_retry);
net_store_data(packet, mi->master_log_name);
net_store_data(packet, (longlong) mi->master_log_pos);
net_store_data(packet, mi->rli.relay_log_name +
dirname_length(mi->rli.relay_log_name));
net_store_data(packet, (longlong) mi->rli.relay_log_pos);
net_store_data(packet, mi->rli.master_log_name);
net_store_data(packet, mi->slave_running ? "Yes":"No");
net_store_data(packet, mi->rli.slave_running ? "Yes":"No");
net_store_data(packet, &replicate_do_db);
net_store_data(packet, &replicate_ignore_db);
net_store_data(packet, (uint32)mi->rli.last_slave_errno);
net_store_data(packet, mi->rli.last_slave_error);
net_store_data(packet, mi->rli.slave_skip_counter);
net_store_data(packet, (longlong) mi->rli.master_log_pos);
net_store_data(packet, (longlong) mi->rli.log_space_total);
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
}
send_eof(&thd->net);
DBUG_RETURN(0);
}
......@@ -1484,22 +1486,20 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
return -1;
}
DBUG_ASSERT(*master_log_name || master_log_pos == 0);
cmp_result = 0;
if (*master_log_name)
{
/*
We should use dirname_length() here when we have a version of
this that doesn't modify the argument */
char *basename = strrchr(master_log_name, FN_LIBCHAR);
if (basename)
++basename;
else
basename = master_log_name;
TODO:
Replace strncmp() with a comparison function that
can handle comparison of the following files:
mysqlbin.999
mysqlbin.1000
*/
char *basename= master_log_name + dirname_length(master_log_name);
cmp_result = strncmp(basename, log_name->ptr(),
log_name->length());
}
else
cmp_result = 0;
pos_reached = ((!cmp_result && master_log_pos >= log_pos) ||
cmp_result > 0);
if (pos_reached || thd->killed)
......
......@@ -1000,18 +1000,9 @@ int show_binlog_info(THD* thd)
net_store_data(packet, (longlong)li.pos);
net_store_data(packet, &binlog_do_db);
net_store_data(packet, &binlog_ignore_db);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
}
else
{
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
net_store_null(packet);
}
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
send_eof(&thd->net);
DBUG_RETURN(0);
}
......
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