summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-11-22 03:21:40 +0200
committerunknown <monty@mysql.com>2003-11-22 03:21:40 +0200
commitbab6d9f74ba495e333a334e03f3ae509361dada5 (patch)
treef843dfed18127f94f90e6cffa6456e545f7b6b57 /sql
parent52521cc8c76f99d2046a72a09440e616797e672a (diff)
downloadmariadb-git-bab6d9f74ba495e333a334e03f3ae509361dada5.tar.gz
Don't flush cur_log (relay log) on flush_relay_log_info becasue this crashes the server if cur_log is 'hot' and the io_thread has changed log file.
Updated project files for windows Made rpl_change_master.test portable Ensure that mutex are not freed if not initilized VC++Files/client/mysql.dsp: Updated project files for windows according to suggestions from Intel VC++Files/comp_err/comp_err.dsp: Updated project files for windows according to suggestions from Intel VC++Files/innobase/innobase.dsp: Updated project files for windows according to suggestions from Intel VC++Files/libmysqld/examples/test_libmysqld.dsp: Updated project files for windows according to suggestions from Intel VC++Files/libmysqld/libmysqld.dsp: Updated project files for windows according to suggestions from Intel VC++Files/myisamchk/myisamchk.dsp: Updated project files for windows according to suggestions from Intel VC++Files/myisamlog/myisamlog.dsp: Updated project files for windows according to suggestions from Intel VC++Files/myisampack/myisampack.dsp: Updated project files for windows according to suggestions from Intel VC++Files/mysqlmanager/MySqlManager.dsp: Updated project files for windows according to suggestions from Intel VC++Files/mysqlshutdown/mysqlshutdown.dsp: Updated project files for windows according to suggestions from Intel VC++Files/mysys/mysys.dsp: Updated project files for windows according to suggestions from Intel libmysql/libmysql.c: Removed not used include files (which caused problems on Win64) mysql-test/r/rpl_change_master.result: Made test portable mysql-test/t/rpl_change_master.test: Made test portable sql-common/client.c: Removed not used include files (which caused problems on Win64) sql/ha_innodb.cc: Ensure that mutex is not freed if not initilized sql/hostname.cc: Ensure that mutex is not freed if not initilized sql/slave.cc: Don't flush cur_log (relay log) on flush_relay_log_info becasue this crashes the server if cur_log is 'hot' and the io_thread has changed log file.
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc22
-rw-r--r--sql/hostname.cc12
-rw-r--r--sql/slave.cc9
3 files changed, 24 insertions, 19 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index f79c5b55927..671c62d5cf8 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -46,6 +46,7 @@ InnoDB */
#include "ha_innodb.h"
pthread_mutex_t innobase_mutex;
+bool innodb_inited= 0;
/* Store MySQL definition of 'byte': in Linux it is char while InnoDB
uses unsigned char; the header univ.i which we include next defines
@@ -898,6 +899,7 @@ innobase_init(void)
(void) hash_init(&innobase_open_tables,system_charset_info, 32, 0, 0,
(hash_get_key) innobase_get_key, 0, 0);
pthread_mutex_init(&innobase_mutex, MY_MUTEX_INIT_FAST);
+ innodb_inited= 1;
/* If this is a replication slave and we needed to do a crash recovery,
set the master binlog position to what InnoDB internally knew about
@@ -925,21 +927,21 @@ innobase_end(void)
/*==============*/
/* out: TRUE if error */
{
- int err;
+ int err= 0;
DBUG_ENTER("innobase_end");
- err = innobase_shutdown_for_mysql();
- hash_free(&innobase_open_tables);
- my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR));
- pthread_mutex_destroy(&innobase_mutex);
-
- if (err != DB_SUCCESS) {
-
- DBUG_RETURN(1);
+ if (innodb_inited)
+ {
+ innodb_inited= 0;
+ if (innobase_shutdown_for_mysql() != DB_SUCCESS)
+ err= 1;
+ hash_free(&innobase_open_tables);
+ my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR));
+ pthread_mutex_destroy(&innobase_mutex);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/********************************************************************
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 5c4bde99256..c9cb2a43963 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -61,23 +61,27 @@ bool hostname_cache_init()
{
host_entry tmp;
uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp);
- (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
-
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
sizeof(struct in_addr),NULL,
(hash_free_key) free,
&my_charset_latin1)))
return 1;
hostname_cache->clear();
+ (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
return 0;
}
void hostname_cache_free()
{
- (void) pthread_mutex_destroy(&LOCK_hostname);
- delete hostname_cache;
+ if (hostname_cache)
+ {
+ (void) pthread_mutex_destroy(&LOCK_hostname);
+ delete hostname_cache;
+ hostname_cache= 0;
+ }
}
+
static void add_hostname(struct in_addr *in,const char *name)
{
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
diff --git a/sql/slave.cc b/sql/slave.cc
index 329324efa3d..6d261a97dcd 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3122,9 +3122,10 @@ slave_begin:
Reset errors for a clean start (otherwise, if the master is idle, the SQL
thread may execute no Query_log_event, so the error will remain even
though there's no problem anymore). Do not reset the master timestamp
- (imagine the slave has caught everything, the STOP SLAVE and START SLAVE: as
- we are not sure that we are going to receive a query, we want to remember
- the last master timestamp (to say how many seconds behind we are now.
+ (imagine the slave has caught everything, the STOP SLAVE and START SLAVE:
+ as we are not sure that we are going to receive a query, we want to
+ remember the last master timestamp (to say how many seconds behind we are
+ now.
But the master timestamp is reset by RESET SLAVE & CHANGE MASTER.
*/
clear_slave_error(rli);
@@ -3797,8 +3798,6 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli)
error=1;
if (flush_io_cache(file))
error=1;
- if (flush_io_cache(rli->cur_log)) // QQ Why this call ?
- error=1;
return error;
}