summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2000-11-16 20:55:52 +0200
committerunknown <monty@narttu.mysql.fi>2000-11-16 20:55:52 +0200
commit24137ef26120c29263acda059d79e7c21fe59319 (patch)
tree73da460ce6a9f196fc94d6ac2b197566c0bf4958 /sql
parent113fb0ffaa802ebb0550d3f5829d18eea916cf10 (diff)
parent2187c0c3f3f4d0e03fdb13b8610bdc1d1006e017 (diff)
downloadmariadb-git-24137ef26120c29263acda059d79e7c21fe59319.tar.gz
merge
mysys/my_open.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.cc: Auto merged BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc37
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sql_class.cc4
-rw-r--r--sql/sql_class.h10
4 files changed, 31 insertions, 22 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 87b5d2362cf..c697ae276fc 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -156,7 +156,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
&tmp_stat, MYF(0)));
- if ((file=my_open(log_file_name,O_APPEND | O_WRONLY | O_BINARY|O_CREAT,
+ if ((file=my_open(log_file_name,O_CREAT | O_APPEND | O_WRONLY | O_BINARY,
MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, WRITE_CACHE,
my_tell(file,MYF(MY_WME)), 0, MYF(MY_WME | MY_NABP)))
@@ -194,30 +194,39 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
}
else if (log_type == LOG_BIN)
{
- // Explanation of the boolean black magic:
- //
- // if we are supposed to write magic number try write
- // clean up if failed
- // then if index_file has not been previously opened, try to open it
- // clean up if failed
-
+ /*
+ Explanation of the boolean black magic:
+ if we are supposed to write magic number try write
+ clean up if failed
+ then if index_file has not been previously opened, try to open it
+ clean up if failed
+ */
if ((do_magic && my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4)) ||
(index_file < 0 &&
(index_file = my_open(index_file_name,
- O_APPEND | O_BINARY | O_RDWR |O_CREAT,
+ O_APPEND | O_BINARY | O_RDWR | O_CREAT,
MYF(MY_WME))) < 0))
goto err;
Start_log_event s;
+ bool error;
s.write(&log_file);
flush_io_cache(&log_file);
pthread_mutex_lock(&LOCK_index);
- my_write(index_file, log_file_name,strlen(log_file_name), MYF(0));
- my_write(index_file, "\n",1, MYF(0));
+ error=(my_write(index_file, log_file_name,strlen(log_file_name),
+ MYF(MY_NABP | MY_WME)) ||
+ my_write(index_file, "\n", 1, MYF(MY_NABP | MY_WME)));
pthread_mutex_unlock(&LOCK_index);
+ if (error)
+ {
+ my_close(index_file,MYF(0));
+ index_file= -1;
+ goto err;
+ }
}
return;
err:
+ sql_print_error("Could not use %s for logging (error %d)", log_name,errno);
if (file >= 0)
my_close(file,MYF(0));
end_io_cache(&log_file);
@@ -411,7 +420,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
#ifdef HAVE_FTRUNCATE
if (ftruncate(index_file,0))
{
- sql_print_error("Ouch! Could not truncate the binlog index file \
+ sql_print_error("Could not truncate the binlog index file \
during log purge for write");
error = LOG_INFO_FATAL;
goto err;
@@ -421,10 +430,10 @@ during log purge for write");
my_close(index_file, MYF(MY_WME));
my_delete(index_file_name, MYF(MY_WME));
if(!(index_file = my_open(index_file_name,
- O_BINARY | O_RDWR | O_APPEND |O_CREAT,
+ O_CREAT | O_BINARY | O_RDWR | O_APPEND,
MYF(MY_WME))))
{
- sql_print_error("Ouch! Could not re-open the binlog index file \
+ sql_print_error("Could not re-open the binlog index file \
during log purge for write");
error = LOG_INFO_FATAL;
goto err;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e82a7751b43..76728503b53 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2313,7 +2313,7 @@ static struct option long_options[] = {
(int) OPT_REPLICATE_REWRITE_DB},
{"safe-mode", no_argument, 0, (int) OPT_SAFE},
{"socket", required_argument, 0, (int) OPT_SOCKET},
- {"server-id", required_argument, 0, (int)OPT_SERVER_ID},
+ {"server-id", required_argument, 0, (int)OPT_SERVER_ID},
{"set-variable", required_argument, 0, 'O'},
#ifdef HAVE_BERKELEY_DB
{"skip-bdb", no_argument, 0, (int) OPT_BDB_SKIP},
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1b84f07fd1a..5be12636bef 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -115,7 +115,7 @@ THD::THD()
ull=0;
system_thread=0;
bzero((char*) &mem_root,sizeof(mem_root));
-#if defined(HAVE_BDB) || defined(HAVE_INNOBASE) || defined(HAVE_GEMENI)
+#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB)
if (open_cached_file(&transactions.trans_log,
mysql_tempdir,LOG_PREFIX,0,MYF(MY_WME)))
killed=1;
@@ -144,7 +144,7 @@ THD::~THD()
close_thread_tables(this);
}
close_temporary_tables(this);
-#if defined(HAVE_BDB) || defined(HAVE_INNOBASE) || defined(HAVE_GEMENI)
+#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB)
close_cached_file(transactions.trans_log);
#endif
if (global_read_lock)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index bc3681e3170..af5dcc65688 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -238,7 +238,7 @@ public:
const char *where;
char* last_nx_table; // last non-existent table, we need this for replication
char* last_nx_db; // database of the last nx table
- time_t start_time,time_after_lock;
+ time_t start_time,time_after_lock,user_time;
time_t connect_time,thr_create_time; // track down slow pthread_create
thr_lock_type update_lock_default;
delayed_insert *di;
@@ -266,7 +266,7 @@ public:
char scramble[9];
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool no_errors, allow_sum_func, password, fatal_error;
- bool query_start_used,last_insert_id_used,insert_id_used,user_time;
+ bool query_start_used,last_insert_id_used,insert_id_used;
bool volatile killed,bootstrap;
bool system_thread,in_lock_tables,global_read_lock;
bool query_error;
@@ -278,9 +278,9 @@ public:
~THD();
bool store_globals();
inline time_t query_start() { query_start_used=1; return start_time; }
- inline void set_time() { if (!user_time) time_after_lock=time(&start_time); }
- inline void end_time() { if(!user_time) time(&start_time); }
- inline void set_time(time_t t) { time_after_lock=start_time=t; user_time=1; }
+ inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); }
+ inline void end_time() { time(&start_time); }
+ inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; }
inline void lock_time() { time(&time_after_lock); }
inline void insert_id(ulonglong id)
{ last_insert_id=id; insert_id_used=1; }