diff options
-rw-r--r-- | BitKeeper/etc/logging_ok | 5 | ||||
-rw-r--r-- | Docs/Makefile.am | 4 | ||||
-rwxr-xr-x | Docs/Support/test-make-manual | 68 | ||||
-rw-r--r-- | Docs/manual.texi | 92 | ||||
-rw-r--r-- | client/mysqltest.c | 45 | ||||
-rw-r--r-- | include/mysql.h | 4 | ||||
-rw-r--r-- | libmysql/libmysql.c | 65 | ||||
-rw-r--r-- | mysql-test/r/dirty-close.result | 4 | ||||
-rw-r--r-- | mysql-test/t/dirty-close.test | 10 | ||||
-rw-r--r-- | mysql-test/t/rpl000001.test | 2 | ||||
-rw-r--r-- | mysys/my_vsnprintf.c | 39 | ||||
-rw-r--r-- | mysys/test_vsnprintf.c | 45 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 14 | ||||
-rw-r--r-- | sql/ha_myisam.h | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 |
16 files changed, 292 insertions, 113 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 124401427f2..5cbdd9a0da8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,5 +1,8 @@ +jcole@tetra.spaceapes.com +monty@donna.mysql.com mwagner@work.mysql.com +paul@central.snake.net sasha@mysql.sashanet.com sasha@work.mysql.com +serg@donna.mysql.com tim@cane.mysql.fi -monty@donna.mysql.com diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 4f61d93c0e5..3d8c3e39905 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -39,8 +39,8 @@ paper: manual_a4.ps manual_letter.ps $(PDFMANUAL) # The Makefile contains the previous version so we can not use that include.texi: ../configure.in - echo -n "@c This file is autogenerated by the Makefile" > $@ - echo -n "@set mysql_version " > $@ + echo "@c This file is autogenerated by the Makefile" > $@ + echo -n "@set mysql_version " >> $@ grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> $@ echo -n "@set default_port " >> $@ diff --git a/Docs/Support/test-make-manual b/Docs/Support/test-make-manual index 72f4fdac10d..ab76fae915b 100755 --- a/Docs/Support/test-make-manual +++ b/Docs/Support/test-make-manual @@ -7,6 +7,54 @@ function die exit 1 } +needed_flags=0 +needed_texi2html=0 +needed_texinfo_tex=0 +needed_include_texi=0 + +if [ -e Flags/usa.txt ]; then + echo "Good, Flags are there." +else + echo -n "Checking out Flags..." + bk edit Flags >/dev/null 2>&1 + echo " Done." + needed_flags=1 +fi + +if [ -e Support/texi2html ]; then + echo "Good, texi2html is there." +else + echo -n "Checking out texi2html..." + bk edit Support/texi2html >/dev/null 2>&1 + echo " Done." + needed_texi2html=1 +fi + +if [ -e Support/texinfo.tex ]; then + echo "Good, texinfo.tex is there." +else + echo -n "Checking out texinfo.tex..." + bk edit Support/texinfo.tex >/dev/null 2>&1 + echo " Done." + needed_texinfo_tex=1 +fi + +if [ -e include.texi ]; then + echo "Good, include.texi is there." +else + echo -n "Creating include.texi..." + bk edit ../configure.in >/dev/null 2>&1 + echo "@c This file was generated by test-make-manual" > include.texi + echo -n "@set mysql_version " >> include.texi + grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ + sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> include.texi + echo -n "@set default_port " >> include.texi + grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \ + sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> include.texi + echo " Done." + needed_include_texi=1 +fi + echo -n "Running makeinfo..." makeinfo --no-split -I . manual.texi @@ -36,6 +84,26 @@ else echo " Looks good." fi +needed_flags=0 +needed_texi2html=0 +needed_texinfo_tex=0 +needed_include_texi=0 + +if [ $needed_flags ]; then + bk clean Flags +fi + +if [ $needed_texi2html ]; then + bk clean Support/texi2html +fi + +if [ $needed_texinfo_tex ]; then + bk clean Support/texinfo.tex +fi + +if [ $needed_include_texi ]; then + rm -f include.texi +fi [ -z $BROWSER ] && BROWSER=netscape diff --git a/Docs/manual.texi b/Docs/manual.texi index d13c48f6f26..ceeeb9ee0e4 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -17998,6 +17998,12 @@ The different table types are: @end multitable @xref{Table types}. +If a table type is specified, and that particular type is not available, +@strong{MySQL} will choose the closest table type to the one that you have +specified. For example, if @code{TYPE=BDB} is specified, and that distribution +of @strong{MySQL} does not support @code{BDB} tables, the table will be created +as @code{MyISAM} instead. + The other table options are used to optimize the behavior of the table. In most cases, you don't have to specify any of them. The options work for all table types, if not otherwise indicated: @@ -40716,7 +40722,14 @@ Added missing @file{my_config.h} to RPM distribution. @item Added @code{--with-version-suffix} to configure. @item -Added MASTER_POS_WAIT() +Fixed coredump when client aborted connection without @code{mysql_close()}. +@item +Fixed bug in @code{RESTORE TABLE} when trying to restore from a non-existing +directory. +@item +Fixed coredump on the slave replicating @code{SET PASSWORD}. +@item +Added @code{MASTER_POS_WAIT()}. @end itemize @node News-3.23.31, News-3.23.30, News-3.23.32, News-3.23.x @@ -40724,19 +40737,19 @@ Added MASTER_POS_WAIT() @itemize @bullet @item The test suite now tests all reachable BDB interface code. During -testing we found and fixed a lot of errors in the interface code. +testing we found and fixed many errors in the interface code. @item Using @code{HAVING} on an empty table could produce one result row when it shouldn't. @item -Fixed that the @strong{MySQL} RPM is not depending on perl5 anymore. +Fixed that the @strong{MySQL} RPM is not dependent on Perl5 anymore. @item -Fixed some problems with @code{HEAP} tables on windows. +Fixed some problems with @code{HEAP} tables on Windows. @item @code{SHOW TABLE STATUS} didn't show correct average row length for tables -bigger than 4G. +larger than 4G. @item -@code{CHECK TABLE .. EXTENED} didn't check row links for fixed size tables. +@code{CHECK TABLE ... EXTENDED} didn't check row links for fixed size tables. @item Added option @code{MEDIUM} to @code{CHECK TABLE}. @item @@ -40753,19 +40766,19 @@ Fixed buffer overflow bug when writing a certain error message. Added usage of @code{getrlimit()} on Linux to get @code{-O --open-files-limit=#} to work on Linux. @item -Added new mysqld variable: bdb_version. +Added new @code{mysqld} variable: @code{bdb_version}. @item Fixed bug when using expression of type -@code{SELECT ... FROM t1 left join t2 on (t1.a=t2.a) WHERE t1.a=t2.a}. In this +@code{SELECT ... FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=t2.a}. In this case the test in the @code{WHERE} clause was wrongly optimized away. @item Fixed bug in @code{MyISAM} when deleting keys with possible @code{NULL} values, but the first key-column was not a prefix-compressed text column. @item -Fixed that @code{mysql.server} reads the @code{mysql.server} option section +Fixed @code{mysql.server} to read the @code{mysql.server} option section instead of @code{mysql_server}. @item -Fixed that @code{safe_mysqld} and @code{mysql.server} also reads the +Fixed @code{safe_mysqld} and @code{mysql.server} to also read the @code{server} option section. @item Added @code{Threads_created} status variable to @code{mysqld}. @@ -40775,36 +40788,36 @@ Added @code{Threads_created} status variable to @code{mysqld}. @appendixsubsec Changes in release 3.23.30 @itemize @bullet @item -Fixed that @code{myisamdump} works against old mysqld servers. +Fixed that @code{myisamdump} works against old @code{mysqld} servers. @item -Fixed that @code{myisamchk -k#} works again. +Fixed @code{myisamchk -k#} so that it works again. @item Fixed a problem with replication when the binary log file went over 2G -on 32 bit systems. +on 32-bit systems. @item -@code{LOCK TABLES} will now automaticly start a new transaction. +@code{LOCK TABLES} will now automatically start a new transaction. @item Changed BDB tables to not use internal subtransactions and reuse open files to get more speed. @item -Added option @code{--mysqld=#} to @code{safe_mysqld} +Added option @code{--mysqld=#} to @code{safe_mysqld}. @item Allow hex constants in the @code{--fields-*-by} and @code{--lines-terminated-by} options to @code{mysqldump} and @code{mysqlimport}. By Paul DuBois. @item -Added option @code{--safe-show-databases}. +Added option @code{--safe-show-database} to @code{mysqld}. @item Added @code{have_bdb}, @code{have_gemini}, @code{have_innobase}, @code{have_raid} and @code{have_ssl} to @code{SHOW VARIABLES} to make it easy to test for supported extensions. @item -Added option @code{open-files-limit} to @code{mysqld}. +Added option @code{--open-files-limit} to @code{mysqld}. @item -Changed option @code{open-files} to @code{open-files-limit} in +Changed option @code{--open-files} to @code{--open-files-limit} in @code{safe_mysqld}. @item -Item fixed a bug where some rows where not found with @code{HEAP} tables +Fixed a bug where some rows were not found with @code{HEAP} tables that had many keys. @item Fixed that @code{--bdb-no-sync} works. @@ -40856,7 +40869,7 @@ specified all key parts both in the update and the @code{WHERE} part. In this case @strong{MySQL} could try to update a record that didn't match the whole @code{WHERE} part. @item -Changed drop table to first drop the tables and then the @code{.frm} file. +Changed drop table to first drop the tables and then the @file{.frm} file. @item Fixed a bug in the hostname cache which caused @code{mysqld} to report the hostname as @code{''} in some error messages. @@ -40871,11 +40884,11 @@ to make it easier to use the binary log. @item Renamed variable @code{bdb_lock_max} to @code{bdb_max_lock}. @item -Added support for @code{auto_increment} on sub fields for BDB tables. +Added support for @code{auto_increment} on sub-fields for BDB tables. @item Added @code{ANALYZE} of BDB tables. @item -Store in BDB tables the number of rows; This helps to optimize queries +In BDB tables, we now store the number of rows; This helps to optimize queries when we need an approximation of the number of rows. @item If we get an error in a multi-row statement, we now only rollback the @@ -40911,7 +40924,7 @@ slave server restart. @item @code{SHOW KEYS} now shows whether or not key is @code{FULLTEXT}. @item -New script @code{mysqld_multi}. @xref{mysqld_multi}. +New script @file{mysqld_multi}. @xref{mysqld_multi}. @item Added new script, @file{mysql-multi.server.sh}. Thanks to Tim Bunce @email{Tim.Bunce@@ig.co.uk} for modifying @file{mysql.server} to @@ -40933,12 +40946,12 @@ Added a warning if number of rows changes on @code{REPAIR}/@code{OPTIMIZE}. Applied patches for OS/2 by @code{Yuri Dario}. @item @code{FLUSH TABLES table_name} didn't always flush the index tree -properly to disk. +to disk properly. @item -@code{--bootstrap} is now run in a separate thread. This fixes the problem -that @code{mysql_install_db} core dumped on some Linux machines. +@code{--bootstrap} is now run in a separate thread. This fixes a problem +that caused @code{mysql_install_db} to core dump on some Linux machines. @item -Changed @code{mi_create()} to use less stack. +Changed @code{mi_create()} to use less stack space. @item Fixed bug with optimizer trying to over-optimize @code{MATCH} when used with @code{UNIQUE} key. @@ -40972,10 +40985,10 @@ Fixed crash when automatic repair of @code{MyISAM} table failed. Fixed a major performance bug in the table locking code when one constantly had a LOT of @code{SELECT}, @code{UPDATE} and @code{INSERT} statements running. The symptom was that the @code{UPDATE} and -@code{INSERT} queries was locked a long time while new @code{SELECT} -statements where executed before the updates. +@code{INSERT} queries were locked for a long time while new @code{SELECT} +statements were executed before the updates. @item -When reading options_files with @code{mysql_options()} the +When reading @code{options_files} with @code{mysql_options()} the @code{return-found-rows} option was ignored. @item One can now specify @code{interactive-timeout} in the option file that @@ -40985,7 +40998,7 @@ programs that run for a long time (like @code{mysqlhotcopy}) to use @item Added to the slow query log the time and the user name for each logged query. If you are using @code{--log-long-format} then also queries that -are not using indexes are logged, even the query takes less than +do not use an index are logged, even if the query takes less than @code{long_query_time} seconds. @item Fixed a problem in @code{LEFT JOIN} which caused all columns in a reference @@ -41006,16 +41019,16 @@ the compiler submitted with RedHat 7.0. (Reported by Trond Eivind Glomsrød) @item The option @code{--skip-networking} now works properly on NT. @item -Fixed long outstanding bug in the @code{ISAM} tables when a row with a length +Fixed a long outstanding bug in the @code{ISAM} tables when a row with a length of more than 65K was shortened by a single byte. @item -Fixed bug in @code{MyISAM} when running multiple updating processes on +Fixed a bug in @code{MyISAM} when running multiple updating processes on the same table. @item Allow one to use @code{FLUSH TABLE tablename}. @item Added @code{--replicate-ignore-table}, @code{--replicate-do-table}, - @code{--replicate-wild-ignore-table}, @code{--replicate-wild-do-table} + @code{--replicate-wild-ignore-table}, @code{--replicate-wild-do-table}. @item Changed all log files to use our own @code{IO_CACHE} mechanism instead of @code{FILE} to avoid OS problems when there are many files open. @@ -41050,8 +41063,7 @@ Fixed an overflow bug in the client code when using overly long database names. @code{timeout} seconds. @item @code{SLAVE START} did not work if you started with -@code{--skip-slave-start} and had not explicitly run @code{CHANGE -MASTER TO}. +@code{--skip-slave-start} and had not explicitly run @code{CHANGE MASTER TO}. @item Fixed the output of @code{SHOW MASTER STATUS} to be consistent with @code{SHOW SLAVE STATUS}. (It now has no directory in the log name.) @@ -41065,7 +41077,7 @@ shortage when compiled @code{--with-debug=full}. @item Fixed several coredumps in out-of-memory conditions. @item -@code{SHOW SLAVE STATUS} was using an unititialized mutex if the slave had +@code{SHOW SLAVE STATUS} was using an uninitialized mutex if the slave had not been started yet. @item Fixed bug in @code{ELT()} and @code{MAKE_SET()} when the query used @@ -41174,7 +41186,7 @@ on a patch from John Jones. @appendixsubsec Changes in release 3.23.25 @itemize @bullet @item -Fixed that databasename works as second argument to @code{mysqlhotcopy}. +Fixed that @code{databasename} works as second argument to @code{mysqlhotcopy}. @item @code{UMASK} and @code{UMASK_DIR} can now be specified in octal. @item @@ -41930,8 +41942,6 @@ Fixed optimization bug in @code{SELECT ... LEFT JOIN ... key_column IS NULL}, when @code{key_column} could contain @code{NULL} values. @item Fixed problem with 8-bit characters as separators in @code{LOAD DATA INFILE}. -@item - @end itemize @node News-3.23.8, News-3.23.7, News-3.23.9, News-3.23.x @@ -42181,6 +42191,7 @@ Some configure issues to fix problems with big file system detection. @appendixsubsec Changes in release 3.23.3 @itemize @bullet +@item Added patches for MIT-pthreads on NetBSD. @item Fixed range bug in MyISAM. @@ -42295,6 +42306,7 @@ Fixed some compilation problems. @appendixsubsec Changes in release 3.23.0 @itemize @bullet +@item A new table handler library (@code{MyISAM}) with a lot of new features. @xref{MyISAM}. @item diff --git a/client/mysqltest.c b/client/mysqltest.c index 5ea4194fc03..992583bb230 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -61,6 +61,7 @@ #include <sys/stat.h> #include <unistd.h> #include <errno.h> +#include <violite.h> #define MAX_QUERY 65536 #define PAD_SIZE 128 @@ -71,6 +72,8 @@ #define MIN_VAR_ALLOC 32 #define BLOCK_STACK_DEPTH 32 #define MAX_EXPECTED_ERRORS 10 +#define QUERY_SEND 1 +#define QUERY_REAP 2 static int record = 0, verbose = 0, silent = 0, opt_sleep=0; static char *db = 0, *pass=0; @@ -147,14 +150,14 @@ struct st_query Q_SLEEP, Q_INC, Q_DEC,Q_SOURCE, Q_DISCONNECT,Q_LET, Q_ECHO, Q_WHILE, Q_END_BLOCK, Q_SYSTEM, Q_RESULT, Q_REQUIRE, Q_SAVE_MASTER_POS, - Q_SYNC_WITH_MASTER, Q_ERROR, + Q_SYNC_WITH_MASTER, Q_ERROR, Q_SEND, Q_REAP, Q_DIRTY_CLOSE, Q_UNKNOWN, Q_COMMENT, Q_COMMENT_WITH_COMMAND} type; }; const char *command_names[] = { "connection", "query","connect","sleep","inc","dec","source","disconnect", "let","echo","while","end","system","result", "require", "save_master_pos", - "sync_with_master", "error", 0 + "sync_with_master", "error", "send", "reap", "dirty_close", 0 }; TYPELIB command_typelib= {array_elements(command_names),"", @@ -661,6 +664,15 @@ int close_connection(struct st_query* q) { if (!strcmp(con->name, name)) { + if(q->type == Q_DIRTY_CLOSE) + { + if(con->mysql.net.vio) + { + vio_delete(con->mysql.net.vio); + con->mysql.net.vio = 0; + } + } + mysql_close(&con->mysql); DBUG_RETURN(0); } @@ -1211,7 +1223,7 @@ void reject_dump(const char* record_file, char* buf, int size) } -int run_query(MYSQL* mysql, struct st_query* q) +int run_query(MYSQL* mysql, struct st_query* q, int flags) { MYSQL_RES* res = 0; MYSQL_FIELD* fields; @@ -1220,6 +1232,7 @@ int run_query(MYSQL* mysql, struct st_query* q) unsigned long* lengths; char* val; int len; + int q_error = 0 ; DYNAMIC_STRING *ds; DYNAMIC_STRING ds_tmp; DBUG_ENTER("run_query"); @@ -1231,8 +1244,14 @@ int run_query(MYSQL* mysql, struct st_query* q) } else ds= &ds_res; - - if (mysql_query(mysql, q->query)) + + if((flags & QUERY_SEND) && + (q_error = mysql_send_query(mysql, q->query))) + die("At line %u: unable to send query '%s'", start_lineno, q->query); + if(!(flags & QUERY_REAP)) + return 0; + + if (mysql_reap_query(mysql)) { if (q->require_file) abort_not_supported_test(); @@ -1416,7 +1435,9 @@ int main(int argc, char** argv) switch (q->type) { case Q_CONNECT: do_connect(q); break; case Q_CONNECTION: select_connection(q); break; - case Q_DISCONNECT: close_connection(q); break; + case Q_DISCONNECT: + case Q_DIRTY_CLOSE: + close_connection(q); break; case Q_SOURCE: do_source(q); break; case Q_SLEEP: do_sleep(q); break; case Q_INC: do_inc(q); break; @@ -1425,15 +1446,25 @@ int main(int argc, char** argv) case Q_SYSTEM: do_system(q); break; case Q_LET: do_let(q); break; case Q_QUERY: + case Q_REAP: { + int flags = QUERY_REAP; + if(q->type == Q_QUERY) + flags |= QUERY_SEND; + if (save_file[0]) { strmov(q->record_file,save_file); q->require_file=require_file; save_file[0]=0; } - error |= run_query(&cur_con->mysql, q); break; + error |= run_query(&cur_con->mysql, q, QUERY_SEND|QUERY_REAP); + break; } + case Q_SEND: + q->query += q->first_word_len; + error |= run_query(&cur_con->mysql, q, QUERY_SEND); + break; case Q_RESULT: get_file_name(save_file,q); require_file=0; diff --git a/include/mysql.h b/include/mysql.h index 5c2646b592d..fbc30b0373f 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -229,8 +229,12 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, void STDCALL mysql_close(MYSQL *sock); int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_query(MYSQL *mysql, const char *q); +int STDCALL mysql_send_query(MYSQL *mysql, const char *q); +int STDCALL mysql_reap_query(MYSQL *mysql); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned int length); +int STDCALL mysql_real_send_query(MYSQL *mysql, const char *q, + unsigned int len); int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); int STDCALL mysql_shutdown(MYSQL *mysql); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 5f4604701ae..52c76c4043a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1708,6 +1708,71 @@ mysql_query(MYSQL *mysql, const char *query) return mysql_real_query(mysql,query, (uint) strlen(query)); } +int STDCALL +mysql_send_query(MYSQL* mysql, const char* query) +{ + return mysql_real_send_query(mysql, query, strlen(query)); +} + +/* send the query and return so we can do something else */ +/* needs to be followed by mysql_reap_query() when we want to + finish processing it +*/ +int STDCALL +mysql_real_send_query(MYSQL* mysql, const char* query, uint len) +{ + return simple_command(mysql, COM_QUERY, query, len, 1); +} + +int STDCALL +mysql_reap_query(MYSQL* mysql) +{ + uchar *pos; + ulong field_count; + MYSQL_DATA *fields; + uint len; + DBUG_ENTER("mysql_reap_query"); + DBUG_PRINT("enter",("handle: %lx",mysql)); + if((len = net_safe_read(mysql)) == packet_error) + DBUG_RETURN(-1); + free_old_query(mysql); /* Free old result */ + get_info: + pos=(uchar*) mysql->net.read_pos; + if ((field_count= net_field_length(&pos)) == 0) + { + mysql->affected_rows= net_field_length_ll(&pos); + mysql->insert_id= net_field_length_ll(&pos); + if (mysql->server_capabilities & CLIENT_TRANSACTIONS) + { + mysql->server_status=uint2korr(pos); pos+=2; + } + if (pos < mysql->net.read_pos+len && net_field_length(&pos)) + mysql->info=(char*) pos; + DBUG_RETURN(0); + } + if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */ + { + int error=send_file_to_server(mysql,(char*) pos); + if ((len=net_safe_read(mysql)) == packet_error || error) + DBUG_RETURN(-1); + goto get_info; /* Get info packet */ + } + if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) + mysql->server_status|= SERVER_STATUS_IN_TRANS; + + mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */ + if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5))) + DBUG_RETURN(-1); + if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc, + (uint) field_count,0, + (my_bool) test(mysql->server_capabilities & + CLIENT_LONG_FLAG)))) + DBUG_RETURN(-1); + mysql->status=MYSQL_STATUS_GET_RESULT; + mysql->field_count=field_count; + DBUG_RETURN(0); + +} int STDCALL mysql_real_query(MYSQL *mysql, const char *query, uint length) diff --git a/mysql-test/r/dirty-close.result b/mysql-test/r/dirty-close.result new file mode 100644 index 00000000000..f85b057eefa --- /dev/null +++ b/mysql-test/r/dirty-close.result @@ -0,0 +1,4 @@ +n +1 +2 +3 diff --git a/mysql-test/t/dirty-close.test b/mysql-test/t/dirty-close.test new file mode 100644 index 00000000000..69ee7162314 --- /dev/null +++ b/mysql-test/t/dirty-close.test @@ -0,0 +1,10 @@ +connect (con1,localhost,root,,test,0,mysql-master.sock); +connect (con2,localhost,root,,test,0,mysql-master.sock); +connection con1; +dirty_close con1; +connection con2; +drop table if exists t1; +create table t1 (n int); +insert into t1 values (1),(2),(3); +select * from t1; +drop table t1; diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index a26580d7ef7..c7b1f817e81 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -5,6 +5,8 @@ drop table if exists t1; create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; drop table if exists foo; +set password = password('foo'); +set password = password(''); create table foo(n int); insert into foo values(1),(2); save_master_pos; diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index ac89e3bcf1a..030846ea63b 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -24,7 +24,6 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; - for (; *fmt ; fmt++) { if (fmt[0] != '%') @@ -38,10 +37,14 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) fmt++; while (isdigit(*fmt) || *fmt == '.' || *fmt == '-') fmt++; + if(*fmt == 'l') + fmt++; if (*fmt == 's') /* String parameter */ { reg2 char *par = va_arg(ap, char *); - uint plen = (uint) strlen(par); + uint plen; + if(!par) par = (char*)"(null)"; + plen = (uint) strlen(par); if ((uint) (end-to) > plen) /* Replace if possible */ { to=strmov(to,par); @@ -68,3 +71,35 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) *to='\0'; /* End of errmessage */ return (uint) (to - start); } + +#ifdef MAIN +static void my_printf(const char * fmt, ...) +{ + char buf[32]; + int n; + va_list ar; + va_start(ar, fmt); + n = my_vsnprintf(buf, sizeof(buf),fmt, ar); + printf(buf); + printf("n=%d, strlen=%d\n", n, strlen(buf)); + va_end(ar); +} + +int main() +{ + + my_printf("Hello\n"); + my_printf("Hello int, %d\n", 1); + my_printf("Hello string '%s'\n", "I am a string"); + my_printf("Hello hack hack hack hack hack hack hack %d\n", 1); + my_printf("Hello %d hack %d\n", 1, 4); + my_printf("Hello %d hack hack hack hack hack %d\n", 1, 4); + my_printf("Hello '%s' hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "hack"); + my_printf("Hello hhhhhhhhhhhhhh %d sssssssssssssss\n", 1); + my_printf("Hello %u\n", 1); + my_printf("conn %ld to: '%-.64s' user: '%-.32s' host:\ + `%-.64s' (%-.64s)", 1, 0,0,0,0); + return 0; +} +#endif + diff --git a/mysys/test_vsnprintf.c b/mysys/test_vsnprintf.c deleted file mode 100644 index b9ffb014181..00000000000 --- a/mysys/test_vsnprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -#include "mysys_priv.h" - -static void my_printf(const char * fmt, ...) -{ - char buf[32]; - int n; - va_list ar; - va_start(ar, fmt); - n = my_vsnprintf(buf, sizeof(buf),fmt, ar); - printf(buf); - printf("n=%d, strlen=%d\n", n, strlen(buf)); - va_end(ar); -} - -int main() -{ - - my_printf("Hello\n"); - my_printf("Hello int, %d\n", 1); - my_printf("Hello string '%s'\n", "I am a string"); - my_printf("Hello hack hack hack hack hack hack hack %d\n", 1); - my_printf("Hello %d hack %d\n", 1, 4); - my_printf("Hello %d hack hack hack hack hack %d\n", 1, 4); - my_printf("Hello '%s' hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "hack"); - my_printf("Hello hhhhhhhhhhhhhh %d sssssssssssssss\n", 1); - my_printf("Hello %u\n", 1); - return 0; -} diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index ac88c802949..60e0c4eec94 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -1136,19 +1136,9 @@ int ha_myisam::ft_read(byte * buf) thread_safe_increment(ha_read_next_count,&LOCK_status); // why ? - if ((error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf))) - ft_handler=NULL; // Magic here ! See Item_func_match::val() - // and ha_myisam::index_init() + error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf); + table->status=error ? STATUS_NOT_FOUND: 0; return error; } -int ha_myisam::index_init(uint idx) -{ - if (idx != active_index) - ft_handler=NULL; // Magic here ! - - active_index=idx; - return 0; -} - diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h index c72b29ed3c7..6451e2b80ee 100644 --- a/sql/ha_myisam.h +++ b/sql/ha_myisam.h @@ -71,7 +71,7 @@ class ha_myisam: public handler int index_first(byte * buf); int index_last(byte * buf); int index_next_same(byte *buf, const byte *key, uint keylen); - int index_init(uint idx); + int index_end() { ft_handler=NULL; return 0; } int ft_init() { if(!ft_handler) return 1; ft_reinit_search(ft_handler); return 0; } void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 85d57914c78..2317c896dfd 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -781,8 +781,8 @@ bool change_password(THD *thd, const char *host, const char *user, length=(uint) strlen(new_password); new_password[length & 16]=0; - if (!thd || strcmp(thd->user,user) || - my_strcasecmp(host,thd->host ? thd->host : thd->ip)) + if (!thd || (!thd->slave_thread && ( strcmp(thd->user,user) || + my_strcasecmp(host,thd->host ? thd->host : thd->ip)))) { if (check_access(thd, UPDATE_ACL, "mysql",0,1)) return 1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1d41ae6230a..1b46cc51bfc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -408,7 +408,7 @@ pthread_handler_decl(handle_one_connection,arg) { sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), thd->thread_id,(thd->db ? thd->db : "unconnected"), - thd->user, + thd->user ? thd->user : "unauthenticated", (thd->host ? thd->host : thd->ip ? thd->ip : "unknown"), (net->last_errno ? ER(net->last_errno) : ER(ER_UNKNOWN_ERROR))); |