summaryrefslogtreecommitdiff
path: root/sql
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
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')
-rw-r--r--sql/log.cc36
-rw-r--r--sql/log_event.h3
-rw-r--r--sql/mysql_priv.h8
-rw-r--r--sql/mysqlbinlog.cc4
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/net_pkg.cc21
6 files changed, 60 insertions, 24 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;
}
diff --git a/sql/log_event.h b/sql/log_event.h
index 5260b71adb7..4dd5e9140f7 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -311,7 +311,7 @@ public:
void print(FILE* file, bool short_form = 0);
};
-extern char server_version[50];
+extern char server_version[SERVER_VERSION_LENGTH];
class Start_log_event: public Log_event
{
@@ -333,6 +333,7 @@ public:
return;
binlog_version = uint2korr(buf+4);
memcpy(server_version, buf + 6, sizeof(server_version));
+ server_version[sizeof(server_version)-1]=0;
created = uint4korr(buf + 6 + sizeof(server_version));
}
Start_log_event(const char* buf);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 11e847d9b2b..6b4cfbed59d 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -275,6 +275,7 @@ char *net_store_length(char *packet,uint length);
char *net_store_data(char *to,const char *from);
char *net_store_data(char *to,int32 from);
char *net_store_data(char *to,longlong from);
+
bool net_store_null(String *packet);
bool net_store_data(String *packet,uint32 from);
bool net_store_data(String *packet,longlong from);
@@ -282,6 +283,9 @@ bool net_store_data(String *packet,const char *from);
bool net_store_data(String *packet,const char *from,uint length);
bool net_store_data(String *packet,struct tm *tmp);
bool net_store_data(String* packet, I_List<i_string>* str_list);
+bool net_store_data(String *packet,CONVERT *convert, const char *from,
+ uint length);
+bool net_store_data(String *packet, CONVERT *convert, const char *from);
SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length);
int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields,
@@ -464,8 +468,8 @@ void sql_print_error(const char *format,...)
__attribute__ ((format (printf, 1, 2)));
extern uint32 server_id;
-extern char mysql_data_home[2],server_version[50],max_sort_char,
- mysql_real_data_home[];
+extern char mysql_data_home[2],server_version[SERVER_VERSION_LENGTH],
+ max_sort_char, mysql_real_data_home[];
extern my_string mysql_unix_port,mysql_tmpdir;
extern const char *first_keyword, *localhost;
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
diff --git a/sql/mysqlbinlog.cc b/sql/mysqlbinlog.cc
index 497364ca8a4..b09decf1c86 100644
--- a/sql/mysqlbinlog.cc
+++ b/sql/mysqlbinlog.cc
@@ -22,14 +22,14 @@
#include <my_sys.h>
#include <getopt.h>
#include <thr_alarm.h>
-#include "log_event.h"
#define MYSQL_SERVER // We want the C++ version of net
#include <mysql.h>
+#include "log_event.h"
#include "mini_client.h"
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
-char server_version[50];
+char server_version[SERVER_VERSION_LENGTH];
uint32 server_id = 0;
// needed by net_serv.c
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 528e7d8a919..62ee256b9da 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -275,7 +275,7 @@ char mysql_real_data_home[FN_REFLEN],
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
*opt_init_file;
char *opt_bin_logname = 0; // this one needs to be seen in sql_parse.cc
-char server_version[60]=MYSQL_SERVER_VERSION;
+char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION;
const char *first_keyword="first";
const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF";
@@ -1428,7 +1428,10 @@ static void open_log(MYSQL_LOG *log, const char *hostname,
char tmp[FN_REFLEN];
if (!opt_name || !opt_name[0])
{
- strnmov(tmp,hostname,FN_REFLEN-5);
+ /* TODO: The following should be using fn_format(); We just need to
+ first change fn_format() to cut the file name if it's too long.
+ */
+ strmake(tmp,hostname,FN_REFLEN-5);
strmov(strcend(tmp,'.'),extension);
opt_name=tmp;
}
@@ -1650,7 +1653,10 @@ The server will not act as a slave.");
if (!opt_bin_logname)
{
char tmp[FN_REFLEN];
- strnmov(tmp,glob_hostname,FN_REFLEN-5);
+ /* TODO: The following should be using fn_format(); We just need to
+ first change fn_format() to cut the file name if it's too long.
+ */
+ strmake(tmp,glob_hostname,FN_REFLEN-5);
strmov(strcend(tmp,'.'),"-bin");
opt_bin_logname=my_strdup(tmp,MYF(MY_WME));
}
diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc
index 590168930fd..caee12dc6f2 100644
--- a/sql/net_pkg.cc
+++ b/sql/net_pkg.cc
@@ -339,3 +339,24 @@ bool net_store_data(String* packet, I_List<i_string>* str_list)
return net_store_data(packet, (char*)tmp.ptr(), tmp.length());
}
+
+/*
+** translate and store data; These are mainly used by the SHOW functions
+*/
+
+bool
+net_store_data(String *packet,CONVERT *convert, const char *from,uint length)
+{
+ if (convert)
+ return convert->store(packet, from, length);
+ return net_store_date(packet,from,length);
+}
+
+bool
+net_store_data(String *packet, CONVERT *convert, const char *from)
+{
+ uint length=(uint) strlen(from);
+ if (convert)
+ return convert->store(packet, from, length);
+ return net_store_date(packet,from,length);
+}