From fc10f15a277b4130d32b1d311d7c097955381824 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Sep 2004 11:55:34 +0500 Subject: A set of mysql_home_path-related fixes mysys/mf_format.c: I think here i fixed a bug sql/item_strfunc.cc: mysql_real_data_home added sql/sql_class.cc: it's more closer to what manual says sql/sql_load.cc: code rewritten to be similar sql/sql_table.cc: mysql_real_data_home added to the path --- mysys/mf_format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/mf_format.c b/mysys/mf_format.c index 114e19759c8..d1ca1108d02 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -42,7 +42,7 @@ my_string fn_format(my_string to, const char *name, const char *dir, /* Use given directory */ convert_dirname(dev,dir,NullS); /* Fix to this OS */ } - else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(name)) + else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(dev)) { /* Put 'dir' before the given path */ strmake(buff,dev,sizeof(buff)-1); -- cgit v1.2.1 From b953a7a9a943a54fa001435502369bd677e9fc5d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Sep 2004 12:07:01 +0500 Subject: Persian collation, contibuted by Jody McIntyre --- mysys/charset-def.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mysys') diff --git a/mysys/charset-def.c b/mysys/charset-def.c index 420a13a592d..3dcd2a2d116 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -39,6 +39,7 @@ extern CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci; extern CHARSET_INFO my_charset_ucs2_slovak_uca_ci; extern CHARSET_INFO my_charset_ucs2_spanish2_uca_ci; extern CHARSET_INFO my_charset_ucs2_roman_uca_ci; +extern CHARSET_INFO my_charset_ucs2_persian_uca_ci; #endif #ifdef HAVE_CHARSET_utf8 @@ -58,6 +59,7 @@ extern CHARSET_INFO my_charset_utf8_lithuanian_uca_ci; extern CHARSET_INFO my_charset_utf8_slovak_uca_ci; extern CHARSET_INFO my_charset_utf8_spanish2_uca_ci; extern CHARSET_INFO my_charset_utf8_roman_uca_ci; +extern CHARSET_INFO my_charset_utf8_persian_uca_ci; #endif my_bool init_compiled_charsets(myf flags __attribute__((unused))) @@ -127,6 +129,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_ucs2_slovak_uca_ci); add_compiled_collation(&my_charset_ucs2_spanish2_uca_ci); add_compiled_collation(&my_charset_ucs2_roman_uca_ci); + add_compiled_collation(&my_charset_ucs2_persian_uca_ci); #endif #ifdef HAVE_CHARSET_ujis @@ -153,6 +156,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf8_slovak_uca_ci); add_compiled_collation(&my_charset_utf8_spanish2_uca_ci); add_compiled_collation(&my_charset_utf8_roman_uca_ci); + add_compiled_collation(&my_charset_utf8_persian_uca_ci); #endif /* Copy compiled charsets */ -- cgit v1.2.1 From 0d44f8d4ce1aeb4cf0e2d0ffb9084f03829caf37 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 15:50:07 +0400 Subject: A fix and test case for Bug#5315 "mysql_change_user() doesn't free prepared statements." include/hash.h: New declaration for hash_reset() function. The old version was not used. libmysql/client_settings.h: Declaration for mysql_detach_stmt_list(). libmysql/libmysql.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": add call to mysql_detach_stmt_list(prepared statements) to mysql_change_user(): all statements are freed by server, so client counterparts need to be marked as not usable. mysys/hash.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of hash_reset(), which frees all hash elements and prepares the hash for reuse. sql-common/client.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of mysql_detach_stmt_list(): zero connection pointer in given statement list, thus marking given statements as not usable. sql/sql_class.cc: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": reset prepared statements map in THD::change_user(). sql/sql_class.h: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of Statement_map::reset(). A little cleanup of ~Statement_map(): first empty names_hash, as st_hash has a free function, which will delete statements. tests/client_test.c: A test case for bug #5315 "mysql_change_user() doesn't free prepared statements". --- mysys/hash.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mysys') diff --git a/mysys/hash.c b/mysys/hash.c index ce25ae89b63..6f2788ddce7 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -88,6 +88,32 @@ void hash_free(HASH *hash) DBUG_VOID_RETURN; } + +/* + Delete all elements from the hash (the hash itself is to be reused). + + SYNOPSIS + hash_reset() + hash the hash to delete elements of +*/ + +void hash_reset(HASH *hash) +{ + DBUG_ENTER("hash_reset"); + if (hash->free) + { + HASH_LINK *link= dynamic_element(&hash->array, 0, HASH_LINK*); + HASH_LINK *end= link + hash->records; + for (; link < end; ++link) + (*hash->free)(link->data); + } + reset_dynamic(&hash->array); + hash->records= 0; + hash->blength= 1; + hash->current_record= NO_RECORD; + DBUG_VOID_RETURN; +} + /* some helper functions */ /* -- cgit v1.2.1 From cf9e30b8cb8f5cc14ccca866ba4503cb5d8e914d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 13:48:17 +0400 Subject: Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work with memory roots in THD/Statement/Item_arena. Added assertions preventing memory allocation on bzero'ed MEM_ROOT since it is worked by pure luck and was very ineffective. include/my_sys.h: Reimplementation of Monty's optimization of clear_alloc_root(). Now clear_alloc_root() can be used only for detaching memory associated with MEM_ROOT (e.g. to avoid its freeing). It can not be used for MEM_ROOT initialization any longer (it was bad idea anyway since memory allocation on such MEM_ROOT was very ineffective and worked by pure luck). Introduced ALLOC_ROOT_MIN_BLOCK_SIZE constant. mysys/my_alloc.c: Added description of init_alloc_root(). Added assertions to alloc_root() and reset_root_defaults() so now they can only be used on previosly initialized MEM_ROOT. (It worked for bzeroed MEM_ROOT before but by pure luck and very inefficiently). Calling free_root() on bzero'ed MEM_ROOT is still ok (we can't remove this easily because of static MEM_ROOTs). Also now using ALLOC_ROOT_MIN_BLOCK_SIZE constant inside these functions. sql/opt_range.cc: Fixed get_quick_select_for_ref() function to not use bzero'ed MEM_ROOT for allocation. Also QUICK_RANGEs created in this function should be created in memory root of QUICK_SELECT. sql/sql_class.cc: Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work with memory roots in THD/Statement/Item_arena. Now we are always initing THD::transaction.mem_root and THD::mem_root in THD constructor (without memory allocation and with minimal block size) and then later change their parameters in THD::init_for_queries() (this is partially because we can't allocate anything on bzero'ed memory roots anymore). Item_arena() constructor is now trivial and is used only then Item_arena is created as backup storage for other Item_arena (we use Item_arena(bool) now if it is part of Statement). Both trivial Item_arena constructor and destructor are now inline. Removed unneeded clear_alloc_root from Item_arena::restore_backup_item_arena(). sql/sql_class.h: Both trivial Item_arena constructor and destructor are now inline. Commented various Item_arena constructors. --- mysys/my_alloc.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'mysys') diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index c9784ddc9a0..f0bc62b10a0 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -22,6 +22,27 @@ #undef EXTRA_DEBUG #define EXTRA_DEBUG + +/* + Initialize memory root + + SYNOPSIS + init_alloc_root() + mem_root - memory root to initialize + block_size - size of chunks (blocks) used for memory allocation + (It is external size of chunk i.e. it should include + memory required for internal structures, thus it + should be no less than ALLOC_ROOT_MIN_BLOCK_SIZE) + pre_alloc_size - if non-0, then size of block that should be + pre-allocated during memory root initialization. + + DESCRIPTION + This function prepares memory root for further use, sets initial size of + chunk for memory allocation and pre-allocates first block if specified. + Altough error can happen during execution of this function if pre_alloc_size + is non-0 it won't be reported. Instead it will be reported as error in first + alloc_root() on this memory root. +*/ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { @@ -29,7 +50,7 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, DBUG_PRINT("enter",("root: 0x%lx", mem_root)); mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; - mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; mem_root->error_handler= 0; mem_root->block_num= 4; /* We shift this with >>2 */ mem_root->first_block_usage= 0; @@ -54,9 +75,9 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, SYNOPSIS reset_root_defaults() mem_root memory root to change defaults of - block_size new value of block size. Must be - greater than ~68 bytes (the exact value depends on - platform and compilation flags) + block_size new value of block size. Must be greater or equal + than ALLOC_ROOT_MIN_BLOCK_SIZE (this value is about + 68 bytes and depends on platform and compilation flags) pre_alloc_size new size of preallocated block. If not zero, must be equal to or greater than block size, otherwise means 'no prealloc'. @@ -70,7 +91,9 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, void reset_root_defaults(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { - mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; + DBUG_ASSERT(alloc_root_inited(mem_root)); + + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) if (pre_alloc_size) { @@ -123,6 +146,8 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) DBUG_ENTER("alloc_root"); DBUG_PRINT("enter",("root: 0x%lx", mem_root)); + DBUG_ASSERT(alloc_root_inited(mem_root)); + Size+=ALIGN_SIZE(sizeof(USED_MEM)); if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME)))) { @@ -140,6 +165,8 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) reg1 USED_MEM *next= 0; reg2 USED_MEM **prev; + DBUG_ASSERT(alloc_root_inited(mem_root)); + Size= ALIGN_SIZE(Size); if ((*(prev= &mem_root->free)) != NULL) { -- cgit v1.2.1 From 5dd9b86fc572c18b60979c2b9ea1a73be680b96f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 11:54:37 +0200 Subject: Fix for BUG#3248 "Doc says MyISAM warns if disk full but it does not": we force the message to the error log, and we make it more informative; we treat EDQUOT like ENOSPC. mysys/errors.c: more informative message mysys/my_fstream.c: Treat EDQUOT like ENOSPC. mysys/my_pread.c: Treat EDQUOT like ENOSPC. mysys/my_write.c: Treat EDQUOT like ENOSPC. mysys/mysys_priv.h: Define EDQUOT when it does not exist. Finally decided to put it here after discussion with Monty: as this constant is used only in 3 files only in mysys/, I don't make it visible everywhere (there currently is no file of choice for such defines; my_base.h does not contain any). Using a value which never happens avoids collisions. sql/mysqld.cc: If ME_NOREFRESH, we write message to error log, even if it has been saved for client (because if operation is hanging, the message does not get to client now; example is MyISAM waiting for free disk space). --- mysys/errors.c | 2 +- mysys/my_fstream.c | 14 ++++++++------ mysys/my_pread.c | 9 +++++---- mysys/my_write.c | 5 +++-- mysys/mysys_priv.h | 8 ++++++++ 5 files changed, 25 insertions(+), 13 deletions(-) (limited to 'mysys') diff --git a/mysys/errors.c b/mysys/errors.c index 7d755718b16..e21609f6e94 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -41,7 +41,7 @@ const char * NEAR globerrs[GLOBERRS]= "Can't change dir to '%s' (Errcode: %d)", "Warning: '%s' had %d links", "%d files and %d streams is left open\n", - "Disk is full writing '%s'. Waiting for someone to free space...", + "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs", "Can't create directory '%s' (Errcode: %d)", "Character set '%s' is not a compiled character set and is not specified in the '%s' file", "Out of resources when opening file '%s' (Errcode: %d)", diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c index 94f3aaf3464..0ad789e98ac 100644 --- a/mysys/my_fstream.c +++ b/mysys/my_fstream.c @@ -114,13 +114,15 @@ uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags) if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ #endif - if (errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL)) + if ((errno == ENOSPC || errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL)) { - if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) - my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH)); - sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); - VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0))); - continue; + if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) + my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), + "[stream]",my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); + VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); + VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0))); + continue; } #endif if (ferror(stream) || (MyFlags & (MY_NABP | MY_FNABP))) diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 661ef48ab3e..f76233fc4cc 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -115,11 +115,12 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset, if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ #endif - if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL)) + if ((my_errno == ENOSPC || my_errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL)) { if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), - my_filename(Filedes)); + my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); continue; } @@ -131,7 +132,7 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset, { if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { - my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG), + my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG), my_filename(Filedes),my_errno); } DBUG_RETURN(MY_FILE_ERROR); /* Error on read */ @@ -142,4 +143,4 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset, if (MyFlags & (MY_NABP | MY_FNABP)) DBUG_RETURN(0); /* Want only errors */ DBUG_RETURN(writenbytes+written); /* purecov: inspected */ -} /* my_write */ +} /* my_pwrite */ diff --git a/mysys/my_write.c b/mysys/my_write.c index 61fd6097e28..da378d115f1 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -48,12 +48,13 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ #endif - if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL) && + if ((my_errno == ENOSPC || my_errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL) && (uint) writenbytes != (uint) -1) { if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), - my_filename(Filedes)); + my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); continue; } diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h index f79431a0b0b..d7aee04ae20 100644 --- a/mysys/mysys_priv.h +++ b/mysys/mysys_priv.h @@ -29,3 +29,11 @@ extern pthread_mutex_t THR_LOCK_charset; #else #include #endif + +/* + EDQUOT is used only in 3 C files only in mysys/. If it does not exist on + system, we set it to some value which can never happen. +*/ +#ifndef EDQUOT +#define EDQUOT (-1) +#endif -- cgit v1.2.1 From b76f5cd20fe80ff58c41789dab849b1c2c5be6aa Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Oct 2004 18:03:46 +0300 Subject: true,false -> TRUE, FALSE Simple fixes/optimization of things discovered during review of new pushed code include/my_sys.h: Ensure that clear_alloc_root() interacts correctly with alloc_root_inited() mysys/hash.c: More comments Simple optimization (merge identical code) mysys/my_bitmap.c: Change inline -> static inline sql/examples/ha_archive.cc: Fixed compiler warning sql/ha_ndbcluster.cc: true,false -> TRUE, FALSE Change if (false) -> #ifdef NOT_USED sql/ha_ndbcluster.h: true,false -> TRUE, FALSE sql/handler.cc: More comments Remove not needed initializations. #ifdef not used code sql/item_cmpfunc.h: true,false -> TRUE, FALSE sql/item_strfunc.cc: Move local variables to function beginning Remove wrong comments sql/log_event.h: true,false -> TRUE, FALSE sql/sql_base.cc: true,false -> TRUE, FALSE More comments sql/sql_help.cc: true,false -> TRUE, FALSE sql/sql_lex.cc: Simple optimization of new code sql/sql_parse.cc: true,false -> TRUE, FALSE sql/sql_prepare.cc: true,false -> TRUE, FALSE sql/sql_table.cc: true,false -> TRUE, FALSE sql/sql_yacc.yy: true,false -> TRUE, FALSE --- mysys/hash.c | 57 +++++++++++++++++++++++++++++++++++++++---------------- mysys/my_bitmap.c | 4 ++-- 2 files changed, 43 insertions(+), 18 deletions(-) (limited to 'mysys') diff --git a/mysys/hash.c b/mysys/hash.c index 6f2788ddce7..1296a9289e9 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -72,19 +72,48 @@ _hash_init(HASH *hash,CHARSET_INFO *charset, } -void hash_free(HASH *hash) +/* + Call hash->free on all elements in hash. + + SYNOPSIS + hash_free_elements() + hash hash table + + NOTES: + Sets records to 0 +*/ + +static void inline hash_free_elements(HASH *hash) { - DBUG_ENTER("hash_free"); if (hash->free) { - uint i,records; HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*); - for (i=0,records=hash->records ; i < records ; i++) - (*hash->free)(data[i].data); - hash->free=0; + HASH_LINK *end= data + hash->records; + while (data < end) + (*hash->free)((data++)->data); } - delete_dynamic(&hash->array); hash->records=0; +} + + +/* + Free memory used by hash. + + SYNOPSIS + hash_free() + hash the hash to delete elements of + + NOTES: Hash can't be reused wuthing calling hash_init again. +*/ + +void hash_free(HASH *hash) +{ + DBUG_ENTER("hash_free"); + DBUG_PRINT("enter",("hash: 0x%lxd",hash)); + + hash_free_elements(hash); + hash->free= 0; + delete_dynamic(&hash->array); DBUG_VOID_RETURN; } @@ -94,21 +123,17 @@ void hash_free(HASH *hash) SYNOPSIS hash_reset() - hash the hash to delete elements of + hash the hash to delete elements of */ void hash_reset(HASH *hash) { DBUG_ENTER("hash_reset"); - if (hash->free) - { - HASH_LINK *link= dynamic_element(&hash->array, 0, HASH_LINK*); - HASH_LINK *end= link + hash->records; - for (; link < end; ++link) - (*hash->free)(link->data); - } + DBUG_PRINT("enter",("hash: 0x%lxd",hash)); + + hash_free_elements(hash); reset_dynamic(&hash->array); - hash->records= 0; + /* Set row pointers so that the hash can be reused at once */ hash->blength= 1; hash->current_record= NO_RECORD; DBUG_VOID_RETURN; diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 3a09255b0b0..ca75842ffcf 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -38,7 +38,7 @@ #include -inline void bitmap_lock(MY_BITMAP *map) +static inline void bitmap_lock(MY_BITMAP *map) { #ifdef THREAD if (map->mutex) @@ -47,7 +47,7 @@ inline void bitmap_lock(MY_BITMAP *map) } -inline void bitmap_unlock(MY_BITMAP *map) +static inline void bitmap_unlock(MY_BITMAP *map) { #ifdef THREAD if (map->mutex) -- cgit v1.2.1 From da02110dae49d1e9546d27f13ad6a8e9a97a4d81 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Oct 2004 01:28:42 +0300 Subject: Review of all code pushed since last review Simple optimzations and cleanups Removed compiler warnings and fixed portability issues Added client functions 'mysql_embedded()' to allow client to check if we are using embedded server Fixes for purify client/mysqlimport.c: Remove not used variable client/mysqltest.c: Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN) Simplified code Remove usage of sprintf("%llu") as this is not portable include/mysql.h: Added mysql_embedded() to be able to easily check if we are using the embedded server innobase/srv/srv0start.c: Don't use memcmp() when using purify (to avoid false warnings) libmysql/libmysql.c: Added mysql_embedded() to be able to easily check if we are using the embedded server libmysql/libmysql.def: Added mysql_embedded() to be able to easily check if we are using the embedded server myisam/myisam_ftdump.c: Remove compiler warning myisam/myisamchk.c: Remove compiler warning myisam/rt_test.c: #ifdef not used code mysys/hash.c: Remove compiler warning (from last push) mysys/my_gethwaddr.c: Remove compiler warning ndb/src/ndbapi/ndberror.c: #ifdef not used code regex/regcomp.c: Remove not used code regex/regcomp.ih: Remove not used code (to remove compiler warnings) sql-common/client.c: Remove compiler warnings sql/field.cc: Simple optimization sql/ha_innodb.cc: Rename mysql_embedded -> mysqld_embedded sql/item.cc: Fix comments Move variables first on block Remove else after return Simple optimizations (no logic changes) sql/item_cmpfunc.cc: Added comment sql/mysql_priv.h: Rename mysql_embedded -> mysqld_embedded sql/mysqld.cc: Rename mysql_embedded -> mysqld_embedded sql/sql_acl.cc: Added comments simple optimization Fixed 'very unlikely' bug when doing REVOKE ALL PRIVILEGES sql/sql_select.cc: More comments Simple optimization sql/sql_show.cc: Simple changes to make similar code similar More comments sql/sql_string.cc: Trivial optimization and better code layout strings/Makefile.am: Change xml.c to use bcmp to avoid warnings from purify strings/xml.c: Change xml.c to use bcmp to avoid warnings from purify tests/client_test.c: Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN) --- mysys/hash.c | 2 +- mysys/my_gethwaddr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mysys') diff --git a/mysys/hash.c b/mysys/hash.c index 1296a9289e9..cf0f1d2dde6 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -83,7 +83,7 @@ _hash_init(HASH *hash,CHARSET_INFO *charset, Sets records to 0 */ -static void inline hash_free_elements(HASH *hash) +static inline void hash_free_elements(HASH *hash) { if (hash->free) { diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 72f1cb975c4..222abe81933 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -107,7 +107,7 @@ my_bool my_gethwaddr(uchar *to __attribute__((unused))) } #endif -#else MAIN +#else /* MAIN */ int main(int argc __attribute__((unused)),char **argv) { uchar mac[6]; -- cgit v1.2.1 From 0a505ccc080eca79903103d081da8214bcd51d47 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Oct 2004 16:04:28 +0300 Subject: Fix test case for innodb-lock mysql-test/r/innodb-lock.result: Fix test case (old one didn't test things correctly) mysql-test/t/innodb-lock.test: Fix test case (old one didn't test things correctly) mysys/thr_lock.c: More debugging information sql/mysqld.cc: Enable innodb_table_locks as default, as otherwise there is a possibility for deadlocks sql/sql_base.cc: More debug information --- mysys/thr_lock.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mysys') diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index d5236cb1ef9..935ed4ea282 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -552,8 +552,14 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) !lock->write_wait.data && lock->write.data->type == TL_WRITE_ALLOW_WRITE)) { - /* We have already got a write lock or all locks are - TL_WRITE_ALLOW_WRITE */ + /* + We have already got a write lock or all locks are + TL_WRITE_ALLOW_WRITE + */ + DBUG_PRINT("info", ("write_wait.data: 0x%lx old_type: %d", + (ulong) lock->write_wait.data, + lock->write.data->type)); + (*lock->write.last)=data; /* Add to running fifo */ data->prev=lock->write.last; lock->write.last= &data->next; @@ -568,6 +574,8 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) } else { + DBUG_PRINT("info", ("write_wait.data: 0x%lx", + (ulong) lock->write_wait.data)); if (!lock->write_wait.data) { /* no scheduled write locks */ if (lock_type == TL_WRITE_CONCURRENT_INSERT && -- cgit v1.2.1 From 3bfa0e9caa77dda2470d4430e1c1d2dc69ba7dd5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Oct 2004 18:44:51 +0300 Subject: Fix compiler warnings (detected by Intel's C++ compiler) Fixed checking of privilege handling in CREATE ... SELECT (Bug #6094) client/mysql.cc: Fix compiler warnings client/mysqltest.c: Fix wrong counting of lines Remove compiler warnings heap/hp_hash.c: Fix compiler warnings innobase/dict/dict0load.c: Fix compiler warnings innobase/include/mem0mem.h: Fix compiler warnings libmysql/client_settings.h: Fix compiler warnings myisam/ft_nlq_search.c: Add comments about compiler warnings myisam/rt_index.c: Add comments about compiler warnings myisam/rt_mbr.c: Add comments about compiler warnings mysql-test/r/ps.result: Test case for bug#6094 mysql-test/t/ps.test: Test case for bug#6094 mysys/hash.c: Fix compiler warnings mysys/my_handler.c: Add comments about compiler warnings mysys/my_thr_init.c: Add comments about compiler warnings ndb/include/mgmapi/mgmapi.h: Fix compiler warnings regex/main.c: Fix compiler warnings sql/item.h: Fix compiler warnings sql/item_func.h: Add comments about compiler warnings sql/spatial.h: Add comments about compiler warnings sql/sql_lex.h: Fix compiler warning sql/sql_list.h: Fix compiler warning sql/sql_parse.cc: Move testing of access rights of tables in CREATE ... SELECT to create_table_precheck() to fix privilege checking in CREATE ... SELECT (Bug #6094) sql/sql_prepare.cc: Remove not needed empty line sql/sql_string.h: Fix compiler warnings strings/ctype-mb.c: Fix compiler warnings --- mysys/hash.c | 1 + mysys/my_handler.c | 10 ++++++++++ mysys/my_thr_init.c | 5 +++++ 3 files changed, 16 insertions(+) (limited to 'mysys') diff --git a/mysys/hash.c b/mysys/hash.c index cf0f1d2dde6..d068299d44e 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -174,6 +174,7 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax, /* for compilers which can not handle inline */ +static #if !defined(__SUNPRO_C) && !defined(__USLC__) && !defined(__sgi) inline #endif diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 360a7666e94..00f25924e69 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -309,6 +309,11 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, case HA_KEYTYPE_FLOAT: mi_float4get(f_1,a); mi_float4get(f_2,b); + /* + The following may give a compiler warning about floating point + comparison not being safe, but this is ok in this context as + we are bascily doing sorting + */ if (piks && (flag = CMP_NUM(f_1,f_2))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; @@ -317,6 +322,11 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, case HA_KEYTYPE_DOUBLE: mi_float8get(d_1,a); mi_float8get(d_2,b); + /* + The following may give a compiler warning about floating point + comparison not being safe, but this is ok in this context as + we are bascily doing sorting + */ if (piks && (flag = CMP_NUM(d_1,d_2))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 0ce59bee346..36b37f68b46 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -64,6 +64,11 @@ my_bool my_thread_global_init(void) } #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP pthread_mutexattr_init(&my_fast_mutexattr); + /* + Note that the following statement may give a compiler warning under + some configurations, but there isn't anything we can do about this as + this is a bug in the header files for the thread implementation + */ pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP); #endif #ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -- cgit v1.2.1 From 8255e5a367b588f73a0e7c6dcfbdac22a2cc7103 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Oct 2004 19:30:01 +0300 Subject: A lot of fixes for prepared statements (PS): New mysqltest that can run mysqltest with PS Added support for ZEROFILL in PS Fixed crash when one called mysql_stmt_store_result() without a preceding mysql_stmt_bind_result() Updated test cases to support --ps-protocol (Some tests are still run using old protocol) Fixed crash in PS when using SELECT * FROM t1 NATURAL JOIN t2... Fixed crash in PS when using sub queries Create table didn't signal when table was created. This could cause a "DROP TABLE created_table" in another thread to wait "forever" Fixed wrong permissions check in PS and multi-table updates (one could get permission denied for legal quries) Fix for PS and SELECT ... PROCEDURE Reset all warnings when executing a new PS query group_concat(...ORDER BY) didn't work with PS Fixed problem with test suite when not using innodb BitKeeper/deleted/.del-innodb-lock-master.opt~f76a4a1999728f87: Delete: mysql-test/t/innodb-lock-master.opt client/Makefile.am: mysqltest now uses regex client/mysqltest.c: Added support for testing of prepared statements (with --ps-protocol) Main code was done by Kent, I did mainly some cleanups and minor bug fixes New test commands: --disable_ps_protocol --enable_ps_protocol NOTE: new code still has some things that needs to be cleaned up. For example run_query_stmt_handle_error() should be made more general so that same code can be used also by 'normal' queries configure.in: mysqltest now uses regex libmysql/libmysql.c: Reset warning_count after prepare (safety). In the future we should also provide warnings on prepare integer -> string conversion now handles ZEROFILL double -> string conversion is now closer to the one in the server Fixed crash when one called mysql_stmt_store_result() without preceding mysql_stmt_bind_result() libmysqld/examples/Makefile.am: mysqltest now uses regex mysql-test/include/have_query_cache.inc: Fixes for --ps-protocol mysql-test/include/ps_conv.inc: Fixes for --ps-protocol mysql-test/mysql-test-run.sh: Added options --ps-protocol mysql-test/r/ctype_utf8.result: Fixed test case mysql-test/r/fulltext_cache.result: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/r/fulltext_left_join.result: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/r/fulltext_multi.result: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/r/innodb-lock.result: Fixed test to work even if Innodb is not compiled in. mysql-test/t/create.test: Fixes for --ps-protocol mysql-test/t/ctype_utf8.test: Remove warnings mysql-test/t/date_formats.test: Fixes for --ps-protocol mysql-test/t/fulltext_cache.test: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/t/fulltext_left_join.test: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/t/fulltext_multi.test: Changed output of MATCH to use round() to get same numbers with --ps-protocol mysql-test/t/func_group.test: Fixes for --ps-protocol mysql-test/t/func_sapdb.test: Fixes for --ps-protocol mysql-test/t/innodb-lock.test: Fixed test to work even if Innodb is not compiled in. mysql-test/t/insert.test: Fixes for --ps-protocol mysql-test/t/insert_select.test: Fixes for --ps-protocol mysql-test/t/insert_update.test: Fixes for --ps-protocol mysql-test/t/metadata.test: Fixes for --ps-protocol mysql-test/t/multi_statement.test: Fixes for --ps-protocol mysql-test/t/ps_1general.test: Fixes for --ps-protocol mysql-test/t/rollback.test: Fixes for --ps-protocol mysql-test/t/rpl_redirect.test: Fixes for --ps-protocol mysql-test/t/rpl_user_variables.test: Fixes for --ps-protocol mysql-test/t/select.test: Fixes for --ps-protocol mysql-test/t/status.test: Fixes for --ps-protocol mysql-test/t/type_blob.test: Fixes for --ps-protocol mysql-test/t/type_float.test: Fixes for --ps-protocol mysql-test/t/union.test: Fixes for --ps-protocol mysql-test/t/warnings.test: Fixes for --ps-protocol mysys/my_alloc.c: More debugging information sql-common/client.c: More debugging information sql-common/my_time.c: TIME didn't support full range with PS sql/field.cc: TIME didn't support full range with PS sql/item_cmpfunc.cc: IN(constants,...) didn't work with PS sql/item_subselect.cc: Some subqueries didn't work with PS sql/item_sum.cc: group_concat(...ORDER BY) didn't work with PS Removed variable warning_available as 'warning' can be used for this. sql/item_sum.h: Removed not needed variable sql/protocol.cc: TIME didn't support full range with PS sql/set_var.cc: Style fix sql/sql_base.cc: setup_wild() didn't properly restore old arena, which caused core dump in PS when using SELECT * FROM t1 NATURAL JOIN t2... sql/sql_class.cc: Style fix sql/sql_error.cc: Style fix sql/sql_insert.cc: Create table didn't signal when table was created. This could cause a "DROP TABLE created_table" in another thread to wait "forever" sql/sql_lex.h: Fix for PS and procedures sql/sql_parse.cc: More debugging information Make a copy of 'db' in PS as this may change Fixed wrong permissions check in PS and multi-table updates sql/sql_prepare.cc: Fix for PS and SELECT ... PROCEDURE Reset all warnings when executing a new query sql/sql_union.cc: Fixes for PS and SELECT ... PROCEDURE Reset 'with_wild' as 'wild' is resolved on prepare --- mysys/my_alloc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysys') diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index f0bc62b10a0..d8c19d86e5c 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -158,6 +158,8 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) next->next= mem_root->used; next->size= Size; mem_root->used= next; + DBUG_PRINT("exit",("ptr: 0x%lx", (((char*) next)+ + ALIGN_SIZE(sizeof(USED_MEM))))); DBUG_RETURN((gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM)))); #else uint get_size, block_size; -- cgit v1.2.1