diff options
author | unknown <monty@narttu.mysql.fi> | 2000-11-17 02:36:46 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2000-11-17 02:36:46 +0200 |
commit | 8f906f7790ac9041c9ee09cc9ac072d983fdb777 (patch) | |
tree | 09e51a2c4d96c3afa0d966f7469e46432fc6dc58 /sql | |
parent | 24137ef26120c29263acda059d79e7c21fe59319 (diff) | |
download | mariadb-git-8f906f7790ac9041c9ee09cc9ac072d983fdb777.tar.gz |
Fixes for bugs in the usage of IO_CACHE
Docs/manual.texi:
Fixed the TRUNCATE syntax + Changelog
include/my_sys.h:
Added my_b_vprintf
mysys/mf_iocache2.c:
Added my_b_vprintf
mysys/my_vsnprintf.c:
Fixed fatal (new) bug
mysys/thr_lock.c:
Cleanup
readline/bind.c:
cleanup
scripts/Makefile.am:
Added mysqldumpslow
sql-bench/crash-me.sh:
Fixed TRUNCATE
sql/log.cc:
bug fix
sql/log_event.cc:
Removed compiler warnings
sql/log_event.h:
Fixed non portable header in binary dump
sql/mf_iocache.cc:
cleanup
sql/mysqld.cc:
Fixed loop problem on NT
sql/slave.cc:
cleanup
sql/sql_class.cc:
Fixed typos
sql/sql_parse.cc:
cleanup
sql/sql_select.cc:
bugfix
sql/sql_table.cc:
cleanup
sql/sql_yacc.yy:
Changed ALTER TABLE ... ORDER BY to get fewer warnings
sql/unireg.cc:
cleanup
sql/unireg.h:
Added missing define
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 2 | ||||
-rw-r--r-- | sql/log_event.cc | 16 | ||||
-rw-r--r-- | sql/log_event.h | 20 | ||||
-rw-r--r-- | sql/mf_iocache.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 3 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 8 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 | ||||
-rw-r--r-- | sql/sql_table.cc | 1 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 25 | ||||
-rw-r--r-- | sql/unireg.cc | 6 | ||||
-rw-r--r-- | sql/unireg.h | 1 |
13 files changed, 45 insertions, 50 deletions
diff --git a/sql/log.cc b/sql/log.cc index c697ae276fc..d5b2b16b368 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -582,7 +582,7 @@ void MYSQL_LOG::write(THD *thd,enum enum_server_command command, if (format) { if (my_b_write(&log_file," ",1) || - my_b_printf(&log_file,format,args) == (uint) -1) + my_b_vprintf(&log_file,format,args) == (uint) -1) error=errno; } if (my_b_write(&log_file,"\n",1) || diff --git a/sql/log_event.cc b/sql/log_event.cc index cc06e68e378..e895914aa4d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -246,11 +246,10 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len) case START_EVENT: return new Start_log_event(buf); case STOP_EVENT: return new Stop_log_event(buf); case INTVAR_EVENT: return new Intvar_log_event(buf); - default: return NULL; + default: + break; } - - //impossible - return NULL; + return NULL; // default value } void Log_event::print_header(FILE* file) @@ -351,6 +350,15 @@ Start_log_event::Start_log_event(const char* buf) :Log_event(buf) created = uint4korr(buf + 2 + sizeof(server_version)); } +int Start_log_event::write_data(IO_CACHE* file) +{ + char buff[sizeof(server_version)+2+4]; + int2store(buff,binlog_version); + memcpy(buff+2,server_version,sizeof(server_version)); + int4store(buff+2+sizeof(server_version),created); + return (my_b_write(file, (byte*) buff, sizeof(buff)) ? -1 : 0); +} + Rotate_log_event::Rotate_log_event(const char* buf, int event_len): Log_event(buf),new_log_ident(NULL),alloced(0) { diff --git a/sql/log_event.h b/sql/log_event.h index e5b52377f8d..fb71a52a82e 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -183,7 +183,7 @@ class Load_log_event: public Log_event { protected: char* data_buf; - void Load_log_event::copy_log_event(const char *buf, ulong data_len); + void copy_log_event(const char *buf, ulong data_len); public: int thread_id; @@ -304,9 +304,9 @@ extern char server_version[50]; class Start_log_event: public Log_event { public: + uint32 created; uint16 binlog_version; char server_version[50]; - uint32 created; Start_log_event() :Log_event(time(NULL)),binlog_version(BINLOG_VERSION) { @@ -316,8 +316,7 @@ public: Start_log_event(IO_CACHE* file, time_t when_arg, uint32 server_id) : Log_event(when_arg, 0, 0, server_id) { - char buf[sizeof(server_version) + sizeof(binlog_version) + - sizeof(created)+4]; + char buf[sizeof(server_version) + 2 + 4 + 4]; if (my_b_read(file, (byte*) buf, sizeof(buf))) return; binlog_version = uint2korr(buf+4); @@ -328,18 +327,11 @@ public: ~Start_log_event() {} Log_event_type get_type_code() { return START_EVENT;} - int write_data(IO_CACHE* file) - { - if (my_b_write(file, (byte*) &binlog_version, sizeof(binlog_version)) || - my_b_write(file, (byte*) server_version, sizeof(server_version)) || - my_b_write(file, (byte*) &created, sizeof(created))) - return -1; - return 0; - } + int write_data(IO_CACHE* file); int get_data_size() { - return sizeof(binlog_version) + sizeof(server_version) + - sizeof(created); + // sizeof(binlog_version) + sizeof(server_version) sizeof(created) + return 2 + sizeof(server_version) + 4; } void print(FILE* file, bool short_form = 0); }; diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc index 47c00a8ac00..7f85cc06f57 100644 --- a/sql/mf_iocache.cc +++ b/sql/mf_iocache.cc @@ -320,7 +320,7 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer, read_length=my_net_read(net); if (read_length == (int) packet_error) { - info->error=(uint) -1; + info->error= -1; return 1; } if (read_length == 0) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 76728503b53..ff0307bde1d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1653,7 +1653,7 @@ int main(int argc, char **argv) handler_count--; } } - if (have_tcpip) + if (have_tcpip && !opt_disable_networking) { handler_count++; if (pthread_create(&hThread,&connection_attrib, diff --git a/sql/slave.cc b/sql/slave.cc index 0febb672624..dea11b0119f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -171,9 +171,6 @@ int db_ok(const char* db, I_List<i_string> &do_list, return 1; } - - // impossible - return 0; } static void init_strvar_from_file(char* var, int max_size, FILE* f, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5be12636bef..4ccf3481763 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -116,8 +116,8 @@ THD::THD() system_thread=0; bzero((char*) &mem_root,sizeof(mem_root)); #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))) + if (open_cached_file(&transaction.trans_log, + mysql_tmpdir,LOG_PREFIX,0,MYF(MY_WME))) killed=1; transaction.bdb_lock_count=0; #endif @@ -145,7 +145,7 @@ THD::~THD() } close_temporary_tables(this); #if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB) - close_cached_file(transactions.trans_log); + close_cached_file(&transaction.trans_log); #endif if (global_read_lock) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f21041742d..467feaef6d8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -78,7 +78,7 @@ static inline bool end_active_trans(THD *thd) { if (ha_commit(thd)) return 1; - thd->options&= ~OPTION_BEGIN; + thd->options&= ~(ulong) (OPTION_BEGIN); thd->server_status&= ~SERVER_STATUS_IN_TRANS; } return 0; @@ -1562,7 +1562,7 @@ mysql_execute_command(void) if (!org_options & OPTION_AUTO_COMMIT) { /* We changed to auto_commit mode */ - thd->options&= ~OPTION_BEGIN; + thd->options&= ~(ulong) (OPTION_BEGIN); thd->server_status|= SERVER_STATUS_AUTOCOMMIT; if (ha_commit(thd)) { @@ -1747,7 +1747,7 @@ mysql_execute_command(void) even if there is a problem with the OPTION_AUTO_COMMIT flag (Which of course should never happen...) */ - thd->options&= ~OPTION_BEGIN; + thd->options&= ~(ulong) (OPTION_BEGIN); thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_commit(thd)) send_ok(&thd->net); @@ -1755,7 +1755,7 @@ mysql_execute_command(void) res= -1; break; case SQLCOM_ROLLBACK: - thd->options&= ~OPTION_BEGIN; + thd->options&= ~(ulong) (OPTION_BEGIN); thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_rollback(thd)) send_ok(&thd->net); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f38b1a52b65..9d6742884a5 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3718,7 +3718,8 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, } MI_CREATE_INFO create_info; bzero((char*) &create_info,sizeof(create_info)); - if (options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT) == OPTION_BIG_TABLES) + if ((options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == + OPTION_BIG_TABLES) create_info.data_file_length= ~(ulonglong) 0; if ((error=mi_create(table->real_name,table->keys,&keydef, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3c7e5c3d180..7ae3b525609 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1446,7 +1446,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, mysql_bin_log.write(&qinfo); } goto end_temporary; - DBUG_RETURN(0); } intern_close_table(new_table); /* close temporary table */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 540ae3e9a3f..bfa35750f8a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -138,7 +138,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token BOTH %token BY %token CASCADE -%token CHANGED_FILES %token CHECKSUM_SYM %token CHECK_SYM %token COLUMNS @@ -332,8 +331,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token DATE_SUB_INTERVAL %token DAY_HOUR_SYM %token DAY_MINUTE_SYM -%token DAY_OF_WEEK -%token DAY_OF_YEAR %token DAY_SECOND_SYM %token DAY_SYM %token DECODE_SYM @@ -372,7 +369,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token RIGHT %token ROUND %token SECOND_SYM -%token SEC_TO_TIME %token SUBSTRING %token SUBSTRING_INDEX %token TRIM @@ -385,8 +381,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token UNIQUE_USERS %token UNIX_TIMESTAMP %token USER -%token VERSION_SYM -%token WEEKDAY %token WEEK_SYM %token WHEN_SYM %token WORK_SYM @@ -1040,10 +1034,9 @@ alter: bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.db_type= DB_TYPE_DEFAULT; } - alter_list order_clause opt_create_table_options + alter_list alter_list: - /* empty */ | alter_list_item | alter_list ',' alter_list_item @@ -1082,7 +1075,8 @@ alter_list_item: { Lex->alter_list.push_back(new Alter_column($3.str,(Item*) 0)); } | RENAME opt_to table_alias table_ident { Lex->db=$4->db.str ; Lex->name= $4->table.str; } - | opt_create_table_options + | create_table_options + | order_clause opt_column: /* empty */ {} @@ -1227,7 +1221,7 @@ select_into: | select_from opt_into select_from: - FROM join_table_list where_clause group_clause having_clause order_clause limit_clause procedure_clause + FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause select_options: @@ -1850,9 +1844,12 @@ group_list: ** Order by statement in select */ -order_clause: +opt_order_clause: /* empty */ - | ORDER_SYM BY { Lex->sort_default=1; } order_list + | order_clause + +order_clause: + ORDER_SYM BY { Lex->sort_default=1; } order_list order_list: order_list ',' order_ident order_dir @@ -2136,7 +2133,7 @@ opt_delete_option: | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } truncate: - TRUNCATE_SYM TABLE_SYM table + TRUNCATE_SYM table { Lex->sql_command= SQLCOM_TRUNCATE; Lex->options=0; Lex->lock_option= current_thd->update_lock_default; } @@ -2241,7 +2238,7 @@ flush_options: | flush_option flush_option: - TABLES { Lex->type|= REFRESH_TABLES; } opt_table_list + table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list | TABLES WITH READ_SYM LOCK_SYM { Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; } | HOSTS_SYM { Lex->type|= REFRESH_HOSTS; } | PRIVILEGES { Lex->type|= REFRESH_GRANT; } diff --git a/sql/unireg.cc b/sql/unireg.cc index 49f4a9fbfac..d02af0ef0d0 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -280,11 +280,11 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo) } /* Save keynames */ keyname_pos=pos; - *pos++=NAMES_SEP_CHAR; + *pos++=(uchar) NAMES_SEP_CHAR; for (key=keyinfo ; key != end ; key++) { uchar *tmp=(uchar*) strmov((char*) pos,key->name); - *tmp++=NAMES_SEP_CHAR; + *tmp++= (uchar) NAMES_SEP_CHAR; *tmp=0; pos=tmp; } @@ -458,7 +458,7 @@ static bool pack_fields(File file,List<create_field> &create_fields) } /* Write fieldnames */ - buff[0]=NAMES_SEP_CHAR; + buff[0]=(uchar) NAMES_SEP_CHAR; if (my_write(file,(byte*) buff,1,MYF_RW)) DBUG_RETURN(1); i=0; diff --git a/sql/unireg.h b/sql/unireg.h index 988be3d398f..c293433dd42 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -28,6 +28,7 @@ #define LANGUAGE "english/" #define ERRMSG_FILE "errmsg.sys" #define TEMP_PREFIX "MY" +#define LOG_PREFIX "ML" #define PROGDIR "bin/" #ifndef DATADIR #define DATADIR "data/" |