From 1918cce9ea57c1185bc44929e7eef4efcabf19fd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 06:49:28 +0300 Subject: [PATCH 1/9] Fix after merge sql/mysqld.cc: Removed not necessary DBUG line --- sql/ha_innobase.cc | 2 +- sql/mysqld.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index f9c425d0aac..723100da1c4 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -303,7 +303,7 @@ innobase_mysql_print_thd( buf[0]='\n'; buf[1]=0; - ut_a(strlen(old_buf) < 400); + ut_a(strlen(buf) < 400); } } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 150ad8ea379..b4667db5abe 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -617,7 +617,6 @@ void close_server_sock() { DBUG_PRINT("info",("calling shutdown on unix socket")); VOID(shutdown(unix_sock,2)); - DBUG_PRINT("info",("calling closesocket on unix socket")); VOID(unlink(mysql_unix_port)); unix_sock=INVALID_SOCKET; } From 0a4e068c11d92ee305cf27d6e7f1ab346205a2c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 14:55:07 +1000 Subject: [PATCH 2/9] Various little docs fixups. BitKeeper/etc/config: Make my life easier on bk clone/pull. BitKeeper/triggers/post-commit: Little fixes in commit script (from 4.0 script). Added docs-commit@ notification for 3.23 (so we can more easily keep an eye on it). Docs/manual.texi: Change/addition for Sinisa. Clarification of BDB changelog entry. --- BitKeeper/etc/config | 1 + BitKeeper/triggers/post-commit | 37 +++++++++++++++++++++++++++------- Docs/manual.texi | 16 +++++++++++++-- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 257f193723f..85b5a871301 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -68,4 +68,5 @@ pager: # hours: [serg:]checkout:get +[arjen:]checkout:get checkout:edit diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index dc5f2f2b824..8780811a2da 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -4,6 +4,7 @@ TO=dev-public@mysql.com FROM=$USER@mysql.com INTERNALS=internals@lists.mysql.com +DOCS=docs-commit@mysql.com LIMIT=10000 if [ "$REAL_EMAIL" = "" ] @@ -37,17 +38,39 @@ From: $FROM To: $INTERNALS Subject: bk commit into 3.23 tree -Below is the list of changes that have just been commited into a local -3.23. repository of $USER. When $USER does a push, they will be -propogaged to the main repository and within 24 hours after the push into -the public repository. For information on how to access -the public repository see -http://www.mysql.com/doc/I/n/Installing_source_tree.html +Below is the list of changes that have just been committed into a local +3.23 repository of $USER. When $USER does a push these changes will +be propagated to the main repository and, within 24 hours after the +push, to the public repository. +For information on how to access the public repository +see http://www.mysql.com/doc/I/n/Installing_source_tree.html EOF bk changes -v -r+ bk cset -r+ -d ) | head -n $LIMIT | /usr/sbin/sendmail -t + +#++ +# docs-commit@ mail +# Picks up anything under the Docs subdirectory (relevant for docs team). +#-- + bk changes -v -r+ | grep -q " Docs/" + if [ $? -eq 0 ] + then + echo "Notifying docs list at $DOCS" + ( + cat < +From: $FROM +To: $DOCS +Subject: bk commit - 3.23 tree (Manual) + +EOF + bk changes -v -r+ + bk cset -r+ -d + ) | head -n $LIMIT | /usr/sbin/sendmail -t + fi + else - echo "commit failed because '$BK_STATUS', sorry life is hard..." + echo "commit failed because '$BK_STATUS', you may need to re-clone..." fi diff --git a/Docs/manual.texi b/Docs/manual.texi index 6e86d85ee38..0e040c08bc5 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46868,6 +46868,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.53:: Changes in release 3.23.53 * News-3.23.52:: Changes in release 3.23.52 * News-3.23.51:: Changes in release 3.23.51 * News-3.23.50:: Changes in release 3.23.50 @@ -46924,8 +46925,18 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x +@node News-3.23.53, News-3.23.52, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.53 + +@itemize @bullet +@item +Changed behaviour that @code{IF(condition,column,NULL)} always returns +column type. +@end itemize + +@node News-3.23.52, News-3.23.51, News-3.23.53, News-3.23.x @appendixsubsec Changes in release 3.23.52 + @itemize @bullet @item Fixed problem with @code{UNSIGNED BIGINT} on AIX. @@ -47002,7 +47013,8 @@ Fixed bug in @code{DROP DATABASE} with symlinked directory. Fixed optimization problem with @code{DATETIME} and value outside @code{DATETIME} range. @item -Removed BDB documentation. +Removed Sleepycat's BDB doc files from the source tree, as they're not +needed (MySQL covers BDB in its own documentation). @item Fixed mit-pthreads to compile with glibc 2.2 (needed for @code{make dist}). @item From 7f8d57ef6aa7a06753cb06e6e93613b69f6844e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 08:29:15 +0300 Subject: [PATCH 3/9] ha_innobase.cc: Cleanup of latest rewrite of innobase_mysql_print_thd; from now on changing this code is forbidden unless a written permission is received from Heikki 3 days in advance sql/ha_innobase.cc: Cleanup of latest rewrite of innobase_mysql_print_thd; from now on changing this code is forbidden unless a written permission is received from Heikki 3 days in advance --- sql/ha_innobase.cc | 72 ++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 723100da1c4..69d539fc061 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -253,57 +253,66 @@ convert_error_code_to_mysql( extern "C" { /***************************************************************** Prints info of a THD object (== user session thread) to the -standard output. NOTE that mysql/innobase/trx/trx0trx.c must contain +standard output. NOTE that /mysql/innobase/trx/trx0trx.c must contain the prototype for this function! */ void innobase_mysql_print_thd( /*=====================*/ - char* buf, /* in/out: buffer where to print, must be at least + char* buf, /* in/out: buffer where to print, must be at least 400 bytes */ - void* input_thd)/* in: pointer to a MySQL THD object */ + void* input_thd)/* in: pointer to a MySQL THD object */ { - THD* thd; + THD* thd; + char* old_buf = buf; thd = (THD*) input_thd; - /* We can't use value of sprintf() as this is not portable */ - buf+= my_sprintf(buf, - (buf, "MySQL thread id %lu", - thd->thread_id)); - if (thd->host) - { - *buf++=' '; - buf=strnmov(buf, thd->host, 30); + /* We cannot use the return value of normal sprintf() as this is + not portable to some old non-Posix Unixes, e.g., some old SCO + Unixes */ + + buf += my_sprintf(buf, + (buf, "MySQL thread id %lu, query id %lu", + thd->thread_id, thd->query_id)); + if (thd->host) { + *buf = ' '; + buf++; + buf = strnmov(buf, thd->host, 30); } - if (thd->ip) - { - *buf++=' '; - buf=strnmov(buf, thd->ip, 20); + if (thd->ip) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->ip, 20); } - if (thd->user) - { - *buf++=' '; - buf=strnmov(buf, thd->user, 20); + if (thd->user) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->user, 20); } - if (thd->proc_info) - { - *buf++=' '; - buf=strnmov(buf, thd->proc_info, 50); + if (thd->proc_info) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->proc_info, 50); } - if (thd->query) - { - *buf++='\n'; - buf=strnmov(buf, thd->query, 150); + if (thd->query) { + *buf = '\n'; + buf++; + buf=strnmov(buf, thd->query, 150); } - buf[0]='\n'; - buf[1]=0; - ut_a(strlen(buf) < 400); + buf[0] = '\n'; + buf[1] = '\0'; /* Note that we must put a null character here to end + the printed string */ + + /* We test the printed length did not overrun the buffer length of + 400 bytes */ + + ut_a(strlen(old_buf) < 400); } } @@ -2470,6 +2479,7 @@ ha_innobase::rnd_pos( Stores a reference to the current row to 'ref' field of the handle. Note that in the case where we have generated the clustered index for the table, the function parameter is illogical: we MUST ASSUME that 'record' +is the current 'position' of the handle, because if row ref is actually the row id internally generated in InnoDB, then 'record' does not contain it. We just guess that the row id must be for the record where the handle was positioned the last time. */ From d27cd477bc9f1ba41838df0c3c5acbc4be561b27 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 18:24:28 +1000 Subject: [PATCH 4/9] Update docs because of stable tree revert. --- Docs/manual.texi | 3 --- 1 file changed, 3 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 0e040c08bc5..e4b9247c09d 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,9 +46929,6 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet -@item -Changed behaviour that @code{IF(condition,column,NULL)} always returns -column type. @end itemize @node News-3.23.52, News-3.23.51, News-3.23.53, News-3.23.x From 8b572117361a96d8698b17c88c87b60de27fdc4a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 15:11:58 +0200 Subject: [PATCH 5/9] undo InnoDB HANDLER patch as it should not go into 3.23 tree --- innobase/include/trx0trx.h | 7 ----- innobase/trx/trx0trx.c | 11 -------- sql/ha_innobase.cc | 55 -------------------------------------- sql/ha_innobase.h | 1 - 4 files changed, 74 deletions(-) diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index e1f65e9da0f..84d85fcaff6 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -117,13 +117,6 @@ void trx_start_if_not_started( /*=====================*/ trx_t* trx); /* in: transaction */ -/***************************************************************** -Starts the transaction if it is not yet started. */ - -void -trx_start_if_not_started_noninline( -/*===============================*/ - trx_t* trx); /* in: transaction */ /******************************************************************** Commits a transaction. */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index b8cf7ad4a6d..94a11042de5 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -39,17 +39,6 @@ sess_t* trx_dummy_sess = NULL; the kernel mutex */ ulint trx_n_mysql_transactions = 0; -/***************************************************************** -Starts the transaction if it is not yet started. */ - -void -trx_start_if_not_started_noninline( -/*===============================*/ - trx_t* trx) /* in: transaction */ -{ - trx_start_if_not_started(trx); -} - /******************************************************************** Retrieves the error_info field from a trx. */ diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 69d539fc061..878f8855b07 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -398,61 +398,6 @@ ha_innobase::update_thd( return(0); } -/********************************************************************* -Call this when you have opened a new table handle in HANDLER, before you -call index_read_idx() etc. Actually, we can let the cursor stay open even -over a transaction commit! Then you should call this before every operation, -fecth next etc. This function inits the necessary things even after a -transaction commit. */ - -/* TODO: THIS CODE HAS NOT BEEN TESTED!!! */ - -void -ha_innobase::init_table_handle_for_HANDLER(void) -/*============================================*/ -{ - row_prebuilt_t* prebuilt; - - /* If current thd does not yet have a trx struct, create one. - If the current handle does not yet have a prebuilt struct, create - one. Update the trx pointers in the prebuilt struct. Normally - this operation is done in external_lock. */ - - update_thd(current_thd); - - /* Initialize the prebuilt struct much like it would be inited in - external_lock */ - - prebuilt = (row_prebuilt_t*)innobase_prebuilt; - - /* If the transaction is not started yet, start it */ - - trx_start_if_not_started_noninline(prebuilt->trx); - - /* Assign a read view if the transaction does not have it yet */ - - trx_assign_read_view(prebuilt->trx); - - /* We did the necessary inits in this function, no need to repeat them - in row_search_for_mysql */ - - prebuilt->sql_stat_start = FALSE; - - /* We let HANDLER always to do the reads as consistent reads, even - if the trx isolation level would have been specified as SERIALIZABLE */ - - prebuilt->select_lock_type = LOCK_NONE; - - /* Always fetch all columns in the index record */ - - prebuilt->hint_no_need_to_fetch_extra_cols = FALSE; - - /* We want always to fetch all columns in the whole row? Or do - we???? */ - - prebuilt->read_just_key = FALSE; -} - /************************************************************************* Opens an InnoDB database. */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 2c69018ed38..abb6ade79f7 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -157,7 +157,6 @@ class ha_innobase: public handler void free_foreign_key_create_info(char* str); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); - void init_table_handle_for_HANDLER(); /* TODO: NOT TESTED!!! */ longlong get_auto_increment(); }; From d49f3c08cd42a36649ee83ac6c5e6052498305d3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 16:18:37 +0200 Subject: [PATCH 6/9] put InnoDB HANDLER patch back again :)) --- innobase/include/trx0trx.h | 7 +++++ innobase/trx/trx0trx.c | 11 ++++++++ sql/ha_innobase.cc | 55 ++++++++++++++++++++++++++++++++++++++ sql/ha_innobase.h | 1 + 4 files changed, 74 insertions(+) diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 84d85fcaff6..e1f65e9da0f 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -117,6 +117,13 @@ void trx_start_if_not_started( /*=====================*/ trx_t* trx); /* in: transaction */ +/***************************************************************** +Starts the transaction if it is not yet started. */ + +void +trx_start_if_not_started_noninline( +/*===============================*/ + trx_t* trx); /* in: transaction */ /******************************************************************** Commits a transaction. */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 94a11042de5..b8cf7ad4a6d 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -39,6 +39,17 @@ sess_t* trx_dummy_sess = NULL; the kernel mutex */ ulint trx_n_mysql_transactions = 0; +/***************************************************************** +Starts the transaction if it is not yet started. */ + +void +trx_start_if_not_started_noninline( +/*===============================*/ + trx_t* trx) /* in: transaction */ +{ + trx_start_if_not_started(trx); +} + /******************************************************************** Retrieves the error_info field from a trx. */ diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 878f8855b07..69d539fc061 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -398,6 +398,61 @@ ha_innobase::update_thd( return(0); } +/********************************************************************* +Call this when you have opened a new table handle in HANDLER, before you +call index_read_idx() etc. Actually, we can let the cursor stay open even +over a transaction commit! Then you should call this before every operation, +fecth next etc. This function inits the necessary things even after a +transaction commit. */ + +/* TODO: THIS CODE HAS NOT BEEN TESTED!!! */ + +void +ha_innobase::init_table_handle_for_HANDLER(void) +/*============================================*/ +{ + row_prebuilt_t* prebuilt; + + /* If current thd does not yet have a trx struct, create one. + If the current handle does not yet have a prebuilt struct, create + one. Update the trx pointers in the prebuilt struct. Normally + this operation is done in external_lock. */ + + update_thd(current_thd); + + /* Initialize the prebuilt struct much like it would be inited in + external_lock */ + + prebuilt = (row_prebuilt_t*)innobase_prebuilt; + + /* If the transaction is not started yet, start it */ + + trx_start_if_not_started_noninline(prebuilt->trx); + + /* Assign a read view if the transaction does not have it yet */ + + trx_assign_read_view(prebuilt->trx); + + /* We did the necessary inits in this function, no need to repeat them + in row_search_for_mysql */ + + prebuilt->sql_stat_start = FALSE; + + /* We let HANDLER always to do the reads as consistent reads, even + if the trx isolation level would have been specified as SERIALIZABLE */ + + prebuilt->select_lock_type = LOCK_NONE; + + /* Always fetch all columns in the index record */ + + prebuilt->hint_no_need_to_fetch_extra_cols = FALSE; + + /* We want always to fetch all columns in the whole row? Or do + we???? */ + + prebuilt->read_just_key = FALSE; +} + /************************************************************************* Opens an InnoDB database. */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index abb6ade79f7..2c69018ed38 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -157,6 +157,7 @@ class ha_innobase: public handler void free_foreign_key_create_info(char* str); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); + void init_table_handle_for_HANDLER(); /* TODO: NOT TESTED!!! */ longlong get_auto_increment(); }; From 9a78f2fe0f2c37143bdb798cfcec38121d72be42 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Aug 2002 17:31:57 +0300 Subject: [PATCH 7/9] ha_innobase.h, ha_innobase.cc: Put a note that the InnoDB HANDLER code is not used until 4.1, and appears for documentational purposes only sql/ha_innobase.cc: Put a note that the InnoDB HANDLER code is not used until 4.1, and appears for documentational purposes only sql/ha_innobase.h: Put a note that the InnoDB HANDLER code is not used until 4.1, and appears for documentational purposes only --- sql/ha_innobase.cc | 9 +++++++-- sql/ha_innobase.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 69d539fc061..b69cbfa2c48 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -398,6 +398,9 @@ ha_innobase::update_thd( return(0); } +#ifdef notdefined +/* The code here appears for documentational purposes only. Not used +or tested yet. Will be used in 4.1. */ /********************************************************************* Call this when you have opened a new table handle in HANDLER, before you call index_read_idx() etc. Actually, we can let the cursor stay open even @@ -405,14 +408,15 @@ over a transaction commit! Then you should call this before every operation, fecth next etc. This function inits the necessary things even after a transaction commit. */ -/* TODO: THIS CODE HAS NOT BEEN TESTED!!! */ - void ha_innobase::init_table_handle_for_HANDLER(void) /*============================================*/ { row_prebuilt_t* prebuilt; + ut_a(0); /* the code has not been used or tested yet; to prevent + inadvertent usage we assert an error here */ + /* If current thd does not yet have a trx struct, create one. If the current handle does not yet have a prebuilt struct, create one. Update the trx pointers in the prebuilt struct. Normally @@ -452,6 +456,7 @@ ha_innobase::init_table_handle_for_HANDLER(void) prebuilt->read_just_key = FALSE; } +#endif /************************************************************************* Opens an InnoDB database. */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 2c69018ed38..2804280575c 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -157,7 +157,8 @@ class ha_innobase: public handler void free_foreign_key_create_info(char* str); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); - void init_table_handle_for_HANDLER(); /* TODO: NOT TESTED!!! */ + /* void init_table_handle_for_HANDLER(); Not tested or used yet, code + included for documentational purposes only */ longlong get_auto_increment(); }; From 465e56b04641381fda9934b3557232f85f8af845 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Aug 2002 01:22:27 +0300 Subject: [PATCH 8/9] os0thread.h, os0thread.c: Fix a critical portability bug introduced in the Windows version innobase/os/os0thread.c: Fix a critical portability bug introduced in the Windows version innobase/include/os0thread.h: Fix a critical portability bug introduced in the Windows version --- innobase/include/os0thread.h | 24 +++++++++++++----------- innobase/os/os0thread.c | 26 ++++++++++++-------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h index 95a3a95fb74..9459750719f 100644 --- a/innobase/include/os0thread.h +++ b/innobase/include/os0thread.h @@ -25,33 +25,37 @@ can wait inside InnoDB */ #ifdef __WIN__ typedef void* os_thread_t; +typedef ulint os_thread_id_t; /* In Windows the thread id + is an unsigned long int */ #else typedef pthread_t os_thread_t; +typedef os_thread_t os_thread_id_t; /* In Unix we use the thread + handle itself as the id of + the thread */ #endif -#define os_thread_id_t os_thread_t /* Define a function pointer type to use in a typecast */ typedef void* (*os_posix_f_t) (void*); /******************************************************************* -Compares two threads or thread ids for equality */ +Compares two thread ids for equality. */ ibool os_thread_eq( /*=========*/ /* out: TRUE if equal */ - os_thread_t a, /* in: OS thread or thread id */ - os_thread_t b); /* in: OS thread or thread id */ + os_thread_id_t a, /* in: OS thread or thread id */ + os_thread_id_t b); /* in: OS thread or thread id */ /******************************************************************** -Converts an OS thread or thread id to a ulint. It is NOT guaranteed that -the ulint is unique for the thread though! */ +Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is +unique for the thread though! */ ulint os_thread_pf( /*=========*/ /* out: unsigned long int */ - os_thread_t a); /* in: thread or thread id */ + os_thread_id_t a); /* in: thread or thread id */ /******************************************************************** Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter @@ -69,10 +73,8 @@ os_thread_create( #endif void* arg, /* in: argument to start function */ - os_thread_id_t* thread_id); /* out: id of created - thread; currently this is - identical to the handle to - the thread */ + os_thread_id_t* thread_id); /* out: id of the created + thread */ /********************************************************************* A thread calling this function ends its execution. */ diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index 9eb80cdf826..d137014a6af 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -19,14 +19,14 @@ Created 9/8/1995 Heikki Tuuri #include "srv0srv.h" /******************************************************************* -Compares two threads or thread ids for equality */ +Compares two thread ids for equality. */ ibool os_thread_eq( /*=========*/ /* out: TRUE if equal */ - os_thread_t a, /* in: OS thread or thread id */ - os_thread_t b) /* in: OS thread or thread id */ + os_thread_id_t a, /* in: OS thread or thread id */ + os_thread_id_t b) /* in: OS thread or thread id */ { #ifdef __WIN__ if (a == b) { @@ -44,13 +44,13 @@ os_thread_eq( } /******************************************************************** -Converts an OS thread or thread id to a ulint. It is NOT guaranteed that -the ulint is unique for the thread though! */ +Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is +unique for the thread though! */ ulint os_thread_pf( /*=========*/ - os_thread_t a) + os_thread_id_t a) { #ifdef UNIV_HPUX /* In HP-UX a pthread_t is a struct of 3 fields: field1, field2, @@ -64,15 +64,15 @@ os_thread_pf( /********************************************************************* Returns the thread identifier of current thread. Currently the thread -identifier is the thread handle itself. Note that in HP-UX pthread_t is -a struct of 3 fields. */ +identifier in Unix is the thread handle itself. Note that in HP-UX +pthread_t is a struct of 3 fields. */ os_thread_id_t os_thread_get_curr_id(void) /*=======================*/ { #ifdef __WIN__ - return(GetCurrentThread()); + return(GetCurrentThreadId()); #else return(pthread_self()); #endif @@ -95,10 +95,8 @@ os_thread_create( #endif void* arg, /* in: argument to start function */ - os_thread_id_t* thread_id) /* out: id of created - thread; currently this is - identical to the handle to - the thread */ + os_thread_id_t* thread_id) /* out: id of the created + thread */ { #ifdef __WIN__ os_thread_t thread; @@ -120,7 +118,7 @@ os_thread_create( ut_a(SetThreadPriority(thread, srv_query_thread_priority)); } - *thread_id = thread; + *thread_id = win_thread_id; return(thread); #else From 51156c5af2a8a3a978085a7c54de0ad55f73775c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Aug 2002 02:18:39 +0300 Subject: [PATCH 9/9] Changed SQL variable delay_key_write to an enum able delay_key_write as default (as it was in 4.0.2) Docs/manual.texi: Updated information about variable DELAY_KEY_WRITE. mysql-test/r/type_decimal.result: Updated results mysql-test/r/variables.result: Updated results mysql-test/t/type_decimal.test: Fixed test to not cause purify error in mathlib during purify. mysql-test/t/variables.test: Test new usage of DELAY_KEY_WRITE sql/ha_innodb.cc: Merge with 3.23 code sql/mysql_priv.h: Changed SQL variable delay_key_write to an enum sql/mysqld.cc: Changed SQL variable delay_key_write to an enum. Enable delay_key_write as default (as it was in 4.0.2) sql/set_var.cc: Changed SQL variable delay_key_write to an enum sql/set_var.h: Changed SQL variable delay_key_write to an enum sql/sql_class.h: Changed SQL variable delay_key_write to an enum sql/sql_yacc.yy: Changed SQL variable delay_key_write to an enum --- Docs/manual.texi | 50 ++++++++++++-------- mysql-test/r/type_decimal.result | 2 +- mysql-test/r/variables.result | 14 ++++++ mysql-test/t/type_decimal.test | 2 +- mysql-test/t/variables.test | 6 +++ sql/ha_innodb.cc | 69 +++++++++++++++------------ sql/mysql_priv.h | 1 + sql/mysqld.cc | 81 +++++++++++++++++++++----------- sql/set_var.cc | 42 ++++++++++++++++- sql/set_var.h | 23 ++++++++- sql/sql_class.h | 2 + sql/sql_yacc.yy | 1 + 12 files changed, 210 insertions(+), 83 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 1b448cfca06..c16ff752bb1 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -14186,7 +14186,10 @@ Set the default character set. @xref{Character sets}. @item --default-table-type=type Set the default table type for tables. @xref{Table types}. -@item --delay-key-write-for-all-tables +@item --delay-key-write[= OFF | ON | ALL} +How MyISAM @code{DELAYED KEYS} should be used. @xref{Server parameters}. + +@item --delay-key-write-for-all-tables; In MySQL 4.0.3 you should use --delay-key-write=ALL instead. Don't flush key buffers between writes for any @code{MyISAM} table. @xref{Server parameters}. @@ -14321,7 +14324,7 @@ correct it to stay within a given range and also adjusts the value a little to fix for the used algorithm. @item --safe-mode -Skip some optimise stages. Implies @code{--skip-delay-key-write}. +Skip some optimise stages. @item --safe-show-database With this option, the @code{SHOW DATABASES} command returns only those @@ -14340,8 +14343,8 @@ Turn off the ability to select and insert at the same time on @code{MyISAM} tables. (This is only to be used if you think you have found a bug in this feature.) -@item --skip-delay-key-write -Ignore the @code{delay_key_write} option for all tables. +@item --skip-delay-key-write; In MySQL 4.0.3 you should use --delay-key-write=OFF instead. +Ignore the @code{DELAY_KEY_WRITE} option for all tables. @xref{Server parameters}. @item --skip-grant-tables @@ -14370,8 +14373,7 @@ Don't listen for TCP/IP connections at all. All interaction with recommended for systems where only local requests are allowed. @xref{DNS}. @item --skip-new -Don't use new, possible wrong routines. Implies @code{--skip-delay-key-write}. -This will also set default table type to @code{ISAM}. @xref{ISAM}. +Don't use new, possible wrong routines. @item --skip-symlink Don't delete or rename files that a symlinked file in the data directory @@ -19848,16 +19850,20 @@ packet before responding with @code{Bad handshake}. The value of the @code{--datadir} option. @item @code{delay_key_write} -If enabled (is on by default), MySQL will honor the -@code{DELAY_KEY_WRITE} option for @code{CREATE TABLE}. This means that the -key buffer for tables with this option will not get flushed on every -index update, but only when a table is closed. This will speed up -writes on keys a lot, but you should add automatic checking of all tables -with @code{myisamchk --fast --force} if you use this. Note that if you -start @code{mysqld} with the @code{--delay-key-write-for-all-tables} -option this means that all tables will be treated as if they were -created with the @code{delay_key_write} option. You can clear this flag -by starting @code{mysqld} with @code{--skip-new} or @code{--safe-mode}. +Option for MyISAM tables. Can have one of the following values: + +@multitable @columnfractions .30 .70 +@item OFF @tab All CREATE TABLE ... DELAYED_KEY_WRITES are ignored. +@item ON @tab (default) MySQL will honor the @code{DELAY_KEY_WRITE} option +for @code{CREATE TABLE}. +@item ALL @tab All new opened tables are treated as if they were created with the @code{DELAY_KEY_WRITE} option. +@end itemize + +If @code{DELAY_KEY_WRITE} is enabled this means that the key buffer for +tables with this option will not get flushed on every index update, but +only when a table is closed. This will speed up writes on keys a lot, +but you should add automatic checking of all tables with @code{myisamchk +--fast --force} if you use this. @item @code{delayed_insert_limit} After inserting @code{delayed_insert_limit} rows, the @code{INSERT @@ -19961,7 +19967,7 @@ status} and examine the variables @code{Key_read_requests}, The @code{Key_write/Key_write_requests} is usually near 1 if you are using mostly updates/deletes but may be much smaller if you tend to do updates that affect many at the same time or if you are -using @code{delay_key_write}. @xref{SHOW, , @code{SHOW}}. +using @code{DELAY_KEY_WRITE}. @xref{SHOW, , @code{SHOW}}. To get even more speed when writing many rows at the same time, use @code{LOCK TABLES}. @xref{LOCK TABLES, , @code{LOCK TABLES}}. @@ -24477,7 +24483,7 @@ offset by network delays. writes to it, and configure as many slaves as you have the money and rackspace for, distributing the reads among the master and the slaves. You can also start the slaves with @code{--skip-bdb}, -@code{--low-priority-updates} and @code{--delay-key-write-for-all-tables} +@code{--low-priority-updates} and @code{--delay-key-write=ALL} to get speed improvements for the slave. In this case the slave will use non-transactional @code{MyISAM} tables instead of @code{BDB} tables to get more speed. @@ -28630,7 +28636,7 @@ and if you can use @code{GLOBAL} or @code{SESSION} with them. @item concurrent_insert @tab bool @tab GLOBAL @item connect_timeout @tab num @tab GLOBAL @item convert_character_set @tab string @tab SESSION -@item delay_key_write @tab bool @tab GLOBAL +@item delay_key_write @tab OFF | ON | ALL @tab GLOBAL @item delayed_insert_limit @tab num @tab GLOBAL @item delayed_insert_timeout @tab num @tab GLOBAL @item delayed_queue_size @tab num @tab GLOBAL @@ -28717,6 +28723,7 @@ Here is a description of some of the variables: @item identity @tab Alias for last_insert_id (Sybase compatiblity) @item sql_low_priority_updates @tab Alias for low_priority_updates @item sql_max_join_size @tab Alias for max_join_size +@item delay_key_write_for_all_tables @tab If this and delay_key_write is set then all new MyISAM tables that are opened will use delayed key writes. @item version @tab Alias for VERSION() (Sybase (?) compatability) @end multitable @@ -37687,7 +37694,7 @@ The following options to @code{mysqld} can be used to change the behaviour of @item @strong{Option} @tab @strong{Description} @item @code{--myisam-recover=#} @tab Automatic recovery of crashed tables. @item @code{-O myisam_sort_buffer_size=#} @tab Buffer used when recovering tables. -@item @code{--delay-key-write-for-all-tables} @tab Don't flush key buffers between writes for any MyISAM table +@item @code{--delay-key-write=ALL} @tab Don't flush key buffers between writes for any MyISAM table @item @code{-O myisam_max_extra_sort_file_size=#} @tab Used to help MySQL to decide when to use the slow but safe key cache index create method. @strong{Note} that this parameter is given in megabytes before 4.0.3 and in bytes starting from this version. @item @code{-O myisam_max_sort_file_size=#} @tab Don't use the fast sort index method to created index if the temporary file would get bigger than this. @strong{Note} that this parameter is given in megabytes before 4.0.3 and in bytes starting from this version. @item @code{-O bulk_insert_buffer_size=#} @tab Size of tree cache used in bulk insert optimisation. @strong{Note} that this is a limit @strong{per thread}! @@ -50230,6 +50237,9 @@ each individual 4.0.x release. @itemize @bullet @item +Changed variable @code{DELAY_KEY_WRITE} to an enum to allow one set +@code{DELAY_KEY_WRITE} for all tables without taking down the server. +@item Changed behavior of @code{IF(condition,column,NULL)} so that it returns the value of the column type. @item diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index a66809b139b..6550e981f5e 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -267,7 +267,7 @@ insert into t1 values (-.1),(+.1),(.1); insert into t1 values (00000000000001),(+0000000000001),(-0000000000001); insert into t1 values (+111111111.11),(111111111.11),(-11111111.11); insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); -insert into t1 values (1e+1000),(1e-1000),(-1e+1000); +insert into t1 values (1e+100),(1e-100),(-1e+100); insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); select * from t1; a diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 2896636a37c..516204028fe 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -219,7 +219,21 @@ set convert_character_set=cp1251_koi8; set convert_character_set=default; set @@global.concurrent_insert=1; set global connect_timeout=100; +select @@delay_key_write; +@@delay_key_write +ON +set global delay_key_write="OFF"; +select @@delay_key_write; +@@delay_key_write +OFF +set global delay_key_write=ALL; +select @@delay_key_write; +@@delay_key_write +ALL set global delay_key_write=1; +select @@delay_key_write; +@@delay_key_write +ON set global delayed_insert_limit=100; set global delayed_insert_timeout=100; set global delayed_queue_size=100; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 683ed7239e6..95420539611 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -195,7 +195,7 @@ insert into t1 values (-.1),(+.1),(.1); insert into t1 values (00000000000001),(+0000000000001),(-0000000000001); insert into t1 values (+111111111.11),(111111111.11),(-11111111.11); insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); -insert into t1 values (1e+1000),(1e-1000),(-1e+1000); +insert into t1 values (1e+100),(1e-100),(-1e+100); insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); select * from t1; drop table t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index ecc4a0cbcdc..7a1d01c2cb5 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -143,7 +143,13 @@ set convert_character_set=cp1251_koi8; set convert_character_set=default; set @@global.concurrent_insert=1; set global connect_timeout=100; +select @@delay_key_write; +set global delay_key_write="OFF"; +select @@delay_key_write; +set global delay_key_write=ALL; +select @@delay_key_write; set global delay_key_write=1; +select @@delay_key_write; set global delayed_insert_limit=100; set global delayed_insert_timeout=100; set global delayed_queue_size=100; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 97dc26df184..eaf09325124 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -265,51 +265,60 @@ the prototype for this function! */ void innobase_mysql_print_thd( /*=====================*/ - char* buf, /* in/out: buffer where to print, must be at least - 300 bytes */ - void* input_thd)/* in: pointer to a MySQL THD object */ + char* buf, /* in/out: buffer where to print, must be at least + 400 bytes */ + void* input_thd)/* in: pointer to a MySQL THD object */ { - THD* thd; + THD* thd; + char* old_buf = buf; - thd = (THD*) input_thd; + thd = (THD*) input_thd; - /* We can't use value of sprintf() as this is not portable */ - buf+= my_sprintf(buf, + /* We cannot use the return value of normal sprintf() as this is + not portable to some old non-Posix Unixes, e.g., some old SCO + Unixes */ + + buf += my_sprintf(buf, (buf, "MySQL thread id %lu, query id %lu", thd->thread_id, thd->query_id)); - if (thd->host) - { - *buf++=' '; - buf=strnmov(buf, thd->host, 30); + if (thd->host) { + *buf = ' '; + buf++; + buf = strnmov(buf, thd->host, 30); } - if (thd->ip) - { - *buf++=' '; - buf=strnmov(buf, thd->ip, 20); + if (thd->ip) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->ip, 20); } - if (thd->user) - { - *buf++=' '; - buf=strnmov(buf, thd->user, 20); + if (thd->user) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->user, 20); } - if (thd->proc_info) - { - *buf++=' '; - buf=strnmov(buf, thd->proc_info, 50); + if (thd->proc_info) { + *buf = ' '; + buf++; + buf=strnmov(buf, thd->proc_info, 50); } - if (thd->query) - { - *buf++=' '; - buf=strnmov(buf, thd->query, 150); + if (thd->query) { + *buf = '\n'; + buf++; + buf=strnmov(buf, thd->query, 150); } - buf[0]='\n'; - buf[1]=0; - ut_a(strlen(buf) < 400); + buf[0] = '\n'; + buf[1] = '\0'; /* Note that we must put a null character here to end + the printed string */ + + /* We test the printed length did not overrun the buffer length of + 400 bytes */ + + ut_a(strlen(old_buf) < 400); } } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e5a4f0f271f..7bd69055f5f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -635,6 +635,7 @@ extern ulong specialflag, current_pid; extern uint test_flags,select_errors,ha_open_options; extern uint protocol_version,dropping_tables; +extern uint delay_key_write_options; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, use_temp_pool, mysql_embedded; extern bool using_update_log, opt_large_files; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 863ee5912c8..705f843dec0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -47,6 +47,12 @@ #define SIGNAL_THD #endif +#ifdef PURIFY +#define IF_PURIFY(A,B) (A) +#else +#define IF_PURIFY(A,B) (B) +#endif + /* stack traces are only supported on linux intel */ #if defined(__linux__) && defined(__i386__) && defined(USE_PSTACK) #define HAVE_STACK_TRACE_ON_SEGV @@ -259,6 +265,7 @@ bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_enable_named_pipe= 0; my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; +uint delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; static bool opt_do_pstack = 0; static ulong opt_specialflag=SPECIAL_ENGLISH; @@ -2816,8 +2823,8 @@ enum options { OPT_FLUSH, OPT_SAFE, OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, OPT_TABLE_TYPE, OPT_INIT_FILE, - OPT_DELAY_KEY_WRITE, OPT_SLOW_QUERY_LOG, - OPT_USE_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, + OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, + OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_TMP, OPT_BDB_NOSYNC, OPT_BDB_LOCK, OPT_BDB_SKIP, @@ -2994,9 +3001,11 @@ struct my_option my_long_options[] = {"default-table-type", OPT_TABLE_TYPE, "Set the default table type for tables", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE, - "Don't flush key buffers between writes for any MyISAM table", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE", + 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, + "Don't flush key buffers between writes for any MyISAM table (Depricated option, use --delay-key-write=all instead)", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"enable-locking", OPT_ENABLE_LOCK, "Depricated option, use --external-locking instead", (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, @@ -3260,10 +3269,6 @@ struct my_option my_long_options[] = "Use concurrent insert with MyISAM. Disable with prefix --skip-", (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"delay-key-write", OPT_USE_DELAY_KEY_WRITE, - "Use delay_key_write option for all tables. Disable with prefix --skip-", - (gptr*) &myisam_delay_key_write, (gptr*) &myisam_delay_key_write, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, @@ -3335,8 +3340,8 @@ struct my_option my_long_options[] = 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef USE_SYMDIR {"use-symbolic-links", 's', "Enable symbolic link support", - (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, + (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, + USE_PURIFY(0,1), 0, 0, 0, 0, 0}, #endif {"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user, (gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3382,7 +3387,7 @@ struct my_option my_long_options[] = (gptr*) &connect_timeout, (gptr*) &connect_timeout, 0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT, - "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.", + "Ho wlong a INSERT DELAYED thread should wait for INSERT statements before terminating.", (gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0, GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, {"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT, @@ -4119,22 +4124,22 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; - myisam_delay_key_write=0; + delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; myisam_concurrent_insert=0; myisam_recover_options= HA_RECOVER_NONE; my_disable_symlinks=1; my_use_symdir=0; have_symlink=SHOW_OPTION_DISABLED; - ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; + ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); #ifdef HAVE_QUERY_CACHE query_cache_size=0; #endif break; case (int) OPT_SAFE: opt_specialflag|= SPECIAL_SAFE_MODE; - myisam_delay_key_write=0; + delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; myisam_recover_options= HA_RECOVER_NONE; // To be changed - ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; + ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); break; case (int) OPT_SKIP_PRIOR: opt_specialflag|= SPECIAL_NO_PRIOR; @@ -4239,9 +4244,25 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case OPT_SERVER_ID: server_id_supplied = 1; break; + case OPT_DELAY_KEY_WRITE_ALL: + if (argument != disabled_my_option) + argument= (char*) "ALL"; + /* Fall through */ case OPT_DELAY_KEY_WRITE: - ha_open_options|=HA_OPEN_DELAY_KEY_WRITE; - myisam_delay_key_write=1; + if (argument == disabled_my_option) + delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; + else if (! argument) + delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; + else + { + int type; + if ((type=find_type(argument, &delay_key_write_typelib, 2)) <= 0) + { + fprintf(stderr,"Unknown delay_key_write type: %s\n",argument); + exit(1); + } + delay_key_write_options= (uint) type-1; + } break; case OPT_CHARSETS_DIR: strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1); @@ -4364,19 +4385,23 @@ static void get_options(int argc,char **argv) { int ho_error; - myisam_delay_key_write=1; // Allow use of this -#ifndef HAVE_purify - my_use_symdir=1; // Use internal symbolic links -#else - /* Symlinks gives too many warnings with purify */ - my_disable_symlinks=1; - my_use_symdir=0; - have_symlink=SHOW_OPTION_DISABLED; -#endif - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); +#ifdef HAVE_BROKEN_REALPATH + my_use_symdir=0; + my_disable_symlinks=1; + have_symlink=SHOW_OPTION_NO; +#else + if (!my_use_symdir) + { + my_disable_symlinks=1; + have_symlink=SHOW_OPTION_DISABLED; + } +#endif + /* Set global MyISAM variables from delay_key_write_options */ + fix_delay_key_write((THD*) 0, OPT_GLOBAL); + if (mysqld_chroot) set_root(mysqld_chroot); fix_paths(); diff --git a/sql/set_var.cc b/sql/set_var.cc index 87417354b99..3c71d1d32e3 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -62,6 +62,12 @@ TYPELIB bool_typelib= array_elements(bool_type_names)-1, "", bool_type_names }; +const char *delay_key_write_type_names[]= { "OFF", "ON", "ALL", NullS }; +TYPELIB delay_key_write_typelib= +{ + array_elements(delay_key_write_type_names)-1, "", delay_key_write_type_names +}; + static bool sys_check_charset(THD *thd, set_var *var); static bool sys_update_charset(THD *thd, set_var *var); static void sys_set_default_charset(THD *thd, enum_var_type type); @@ -97,8 +103,10 @@ sys_var_bool_ptr sys_concurrent_insert("concurrent_insert", &myisam_concurrent_insert); sys_var_long_ptr sys_connect_timeout("connect_timeout", &connect_timeout); -sys_var_bool_ptr sys_delay_key_write("delay_key_write", - &myisam_delay_key_write); +sys_var_enum sys_delay_key_write("delay_key_write", + &delay_key_write_options, + &delay_key_write_typelib, + fix_delay_key_write); sys_var_long_ptr sys_delayed_insert_limit("delayed_insert_limit", &delayed_insert_limit); sys_var_long_ptr sys_delayed_insert_timeout("delayed_insert_timeout", @@ -625,6 +633,23 @@ static void fix_key_buffer_size(THD *thd, enum_var_type type) } +void fix_delay_key_write(THD *thd, enum_var_type type) +{ + switch ((enum_delay_key_write) delay_key_write_options) { + case DELAY_KEY_WRITE_NONE: + myisam_delay_key_write=0; + break; + case DELAY_KEY_WRITE_ON: + myisam_delay_key_write=1; + break; + case DELAY_KEY_WRITE_ALL: + myisam_delay_key_write=1; + ha_open_options|= HA_OPEN_DELAY_KEY_WRITE; + break; + } +} + + bool sys_var_long_ptr::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); @@ -655,6 +680,19 @@ void sys_var_bool_ptr::set_default(THD *thd, enum_var_type type) } +bool sys_var_enum::update(THD *thd, set_var *var) +{ + *value= (uint) var->save_result.ulong_value; + return 0; +} + + +byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type) +{ + return (byte*) enum_names->type_names[*value]; +} + + bool sys_var_thd_ulong::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); diff --git a/sql/set_var.h b/sql/set_var.h index 46463089b03..cbe479b7902 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -28,7 +28,7 @@ class sys_var; class set_var; typedef struct system_variables SV; -extern TYPELIB bool_typelib; +extern TYPELIB bool_typelib, delay_key_write_typelib; enum enum_var_type { @@ -140,6 +140,26 @@ public: }; +class sys_var_enum :public sys_var +{ + uint *value; + TYPELIB *enum_names; +public: + sys_var_enum(const char *name_arg, uint *value_arg, + TYPELIB *typelib, sys_after_update_func func) + :sys_var(name_arg,func), value(value_arg), enum_names(typelib) + {} + bool check(THD *thd, set_var *var) + { + return check_enum(thd, var, enum_names); + } + bool update(THD *thd, set_var *var); + SHOW_TYPE type() { return SHOW_CHAR; } + byte *value_ptr(THD *thd, enum_var_type type); + bool check_update_type(Item_result type) { return 0; } +}; + + class sys_var_thd :public sys_var { public: @@ -415,5 +435,6 @@ void set_var_init(); void set_var_free(); sys_var *find_sys_var(const char *str, uint length=0); bool sql_set_variables(THD *thd, List *var_list); +void fix_delay_key_write(THD *thd, enum_var_type type); extern sys_var_str sys_charset; diff --git a/sql/sql_class.h b/sql/sql_class.h index 042d4868bf5..102320f8f75 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -31,6 +31,8 @@ enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY }; enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE }; enum enum_log_type { LOG_CLOSED, LOG_NORMAL, LOG_NEW, LOG_BIN }; +enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, + DELAY_KEY_WRITE_ALL }; // log info errors #define LOG_INFO_EOF -1 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0cde960aa2e..0b8b6337998 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3346,6 +3346,7 @@ set_expr_or_default: expr { $$=$1; } | DEFAULT { $$=0; } | ON { $$=new Item_string("ON",2); } + | ALL { $$=new Item_string("ALL",3); } ;