summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <paul@teton.kitebird.com>2002-08-19 09:05:40 -0500
committerunknown <paul@teton.kitebird.com>2002-08-19 09:05:40 -0500
commitfe7480f3fa7d87812b4c066d524b3d1d3611e45f (patch)
tree712eca4bd8a1448c59583027e207fceea8e2fac0
parenta63d258922a6bd63f3d9ba9d64a32335a53a2d17 (diff)
parent338b68acf6a049c6950b7d2e697c04bf5c6a74bf (diff)
downloadmariadb-git-fe7480f3fa7d87812b4c066d524b3d1d3611e45f.tar.gz
Merge paul@work.mysql.com:/home/bk/mysql-4.0
into teton.kitebird.com:/home/paul/mysql-4.0 Docs/manual.texi: Auto merged
-rw-r--r--.bzrignore1
-rwxr-xr-xBuild-tools/Do-compile8
-rw-r--r--Docs/manual.texi15
-rw-r--r--client/mysqltest.c71
-rw-r--r--configure.in2
-rw-r--r--innobase/configure.in2
-rw-r--r--libmysql/libmysql.c11
-rw-r--r--myisam/mi_update.c6
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/rpl000015.result1
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result1
-rw-r--r--mysql-test/t/rpl000001.test4
-rw-r--r--mysys/my_getopt.c4
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/slave.cc76
-rw-r--r--sql/sql_repl.cc13
16 files changed, 132 insertions, 95 deletions
diff --git a/.bzrignore b/.bzrignore
index 6a62ded71b2..8022245b859 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -493,3 +493,4 @@ sql-bench/innotest2a
sql-bench/innotest2b
myisam/test2.MYD
myisam/test2.MYI
+libmysqld/set_var.cc
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 58bd2e49a38..d262fc82f94 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -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);
diff --git a/Docs/manual.texi b/Docs/manual.texi
index a9fee2629dd..a7d0f1d4458 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -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
@@ -50260,6 +50265,16 @@ each individual 4.0.x release.
@appendixsubsec Changes in release 4.0.3 (Aug 2002: Beta)
@itemize @bullet
+@item Fixed all boolean type variables to work with the old syntax,
+e.g. all of these work: --lower-case-table-names, --lower-case-table-names=1,
+-O lower-case-table-names=1, --set-variable=lower-case-table-names=1
+@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
diff --git a/client/mysqltest.c b/client/mysqltest.c
index a50e8e4a14c..cc253e21be1 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -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;
diff --git a/configure.in b/configure.in
index fd9fa35147c..d4ae062865d 100644
--- a/configure.in
+++ b/configure.in
@@ -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"
diff --git a/innobase/configure.in b/innobase/configure.in
index ea518ef1dfd..ef9cbcf9310 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -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
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index bc07bf0367c..c6f88c1fb60 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -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))
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index c52989f493e..1614d6ca19d 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -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)
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 146d6ba12ff..a4e9b0ea08a 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -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"
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index a35004298e0..7010349e5ff 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -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
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 66e28b32312..5a82df19ef5 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -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
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index fb4255f27b3..0f195c65fb0 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -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;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 436e557c914..5b86fddbbdb 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -269,7 +269,7 @@ int handle_options(int *argc, char ***argv,
return EXIT_AMBIGUOUS_OPTION;
}
}
- if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
+ if (must_be_var && !optp->value)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
@@ -278,7 +278,7 @@ int handle_options(int *argc, char ***argv,
}
if (optp->arg_type == NO_ARG)
{
- if (optend && !special_used)
+ if (optend && special_used)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1ccbab496a9..d086dda3e9f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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
diff --git a/sql/slave.cc b/sql/slave.cc
index 9873831cd28..c80b2090592 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -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)
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 9cc596f9bb5..8975a05ac3a 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -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);
}