summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-21 16:30:16 +0200
committerunknown <monty@donna.mysql.com>2001-01-21 16:30:16 +0200
commitab7afc8c36279051e25d157993281bd9dba4a58a (patch)
treec772f489364087df96cf8f0582915a11ba82ae54 /sql/log.cc
parent9223381f9c85297d7548f99e7ea7cd6c157e763a (diff)
downloadmariadb-git-ab7afc8c36279051e25d157993281bd9dba4a58a.tar.gz
Changes for --with-server-suffix
Fixed mutex bug in logging (crash on windows when doing SET PASSWORD=) Changed MERGE tables to not use FILE BitKeeper/deleted/.del-m.MRG~3f5632c37af00f18: Delete: mysql-test/std_data/m.MRG BitKeeper/deleted/.del-m.frm~e351dfe0b6824c0c: Delete: mysql-test/std_data/m.frm Docs/manual.texi: Added DNS section configure.in: Update to 3.23.32 include/Makefile.am: Added my_config.h include/mysql_com.h: Changes for --with-server-suffix include/mysql_version.h.in: cleanup merge/open.c: Don't use FILE mysql-test/Makefile.am: removed not needed data files mysql-test/r/merge.result: generate merge file mysql-test/t/merge.test: generate merge file sql-bench/Results/ATIS-mysql-NT_4.0: New benchmark results sql-bench/Results/RUN-mysql-NT_4.0: New benchmark results sql-bench/Results/alter-table-mysql-NT_4.0: New benchmark results sql-bench/Results/big-tables-mysql-NT_4.0: New benchmark results sql-bench/Results/connect-mysql-NT_4.0: New benchmark results sql-bench/Results/create-mysql-NT_4.0: New benchmark results sql-bench/Results/insert-mysql-NT_4.0: New benchmark results sql-bench/Results/select-mysql-NT_4.0: New benchmark results sql-bench/Results/wisconsin-mysql-NT_4.0: New benchmark results sql/log.cc: Ensure that mutex are initialized before used sql/log_event.h: Changes for --with-server-suffix sql/mysql_priv.h: Changes for --with-server-suffix sql/mysqlbinlog.cc: Changes for --with-server-suffix sql/mysqld.cc: changed strnmov -> strmake sql/net_pkg.cc: Prepare for adding char-set conversion to SHOW commands
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc36
1 files changed, 20 insertions, 16 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 45e4c1620b5..5ce9a7a4deb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -269,7 +269,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name)
for(;;)
{
uint length;
- if (!(length=my_b_gets(&io_cache, fname, FN_REFLEN)))
+ if (!(length=my_b_gets(&io_cache, fname, FN_REFLEN-1)))
{
error = !io_cache.error ? LOG_INFO_EOF : LOG_INFO_IO;
goto err;
@@ -608,7 +608,9 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
bool MYSQL_LOG::write(Query_log_event* event_info)
{
/* In most cases this is only called if 'is_open()' is true */
- bool error=1;
+ bool error=0;
+ if (!inited) // Can't use mutex if not init
+ return 0;
VOID(pthread_mutex_lock(&LOCK_log));
if (is_open())
{
@@ -622,7 +624,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
}
-
+ error=1;
+
if (thd->last_insert_id_used)
{
Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id);
@@ -665,8 +668,6 @@ err:
if (file == &log_file)
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
- else
- error=0;
VOID(pthread_mutex_unlock(&LOCK_log));
return error;
}
@@ -729,23 +730,26 @@ err:
bool MYSQL_LOG::write(Load_log_event* event_info)
{
bool error=0;
- VOID(pthread_mutex_lock(&LOCK_log));
- if (is_open())
+ if (inited)
{
- THD *thd=event_info->thd;
- if ((thd->options & OPTION_BIN_LOG) ||
- !(thd->master_access & PROCESS_ACL))
+ VOID(pthread_mutex_lock(&LOCK_log));
+ if (is_open())
{
- if (event_info->write(&log_file) || flush_io_cache(&log_file))
+ THD *thd=event_info->thd;
+ if ((thd->options & OPTION_BIN_LOG) ||
+ !(thd->master_access & PROCESS_ACL))
{
- if (!write_error)
- sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
- error=write_error=1;
+ if (event_info->write(&log_file) || flush_io_cache(&log_file))
+ {
+ if (!write_error)
+ sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
+ error=write_error=1;
+ }
+ VOID(pthread_cond_broadcast(&COND_binlog_update));
}
- VOID(pthread_cond_broadcast(&COND_binlog_update));
}
+ VOID(pthread_mutex_unlock(&LOCK_log));
}
- VOID(pthread_mutex_unlock(&LOCK_log));
return error;
}