diff options
author | unknown <tsmith/tim@siva.hindu.god> | 2006-10-23 23:41:07 -0600 |
---|---|---|
committer | unknown <tsmith/tim@siva.hindu.god> | 2006-10-23 23:41:07 -0600 |
commit | 31959774de006ba846b8206eea8f4df3cb85ad63 (patch) | |
tree | b815e7b7375e547bf047b6c3eb460d93b7f3d761 /storage | |
parent | 9852dfbcf5d3bfb5eec4316977b3d0d37761520e (diff) | |
parent | 5742b2bf4b42065d3726cd5b224db3cde4f6e2c3 (diff) | |
download | mariadb-git-31959774de006ba846b8206eea8f4df3cb85ad63.tar.gz |
Merge siva.hindu.god:/usr/home/tim/m/bk/g51
into siva.hindu.god:/usr/home/tim/m/bk/51
include/m_ctype.h:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/rename.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/view.test:
Auto merged
mysys/mf_iocache.c:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/opt_range.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/table.cc:
Auto merged
storage/myisam/sort.c:
Manual merge
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/btr/btr0btr.c | 3 | ||||
-rw-r--r-- | storage/innobase/dict/dict0dict.c | 34 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 13 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/mem0dbg.h | 13 | ||||
-rw-r--r-- | storage/innobase/include/mtr0mtr.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/mtr0mtr.ic | 2 | ||||
-rw-r--r-- | storage/innobase/include/sync0rw.h | 5 | ||||
-rw-r--r-- | storage/innobase/include/sync0sync.h | 6 | ||||
-rw-r--r-- | storage/innobase/include/univ.i | 59 | ||||
-rw-r--r-- | storage/innobase/include/ut0ut.h | 10 | ||||
-rw-r--r-- | storage/innobase/mem/mem0dbg.c | 14 | ||||
-rw-r--r-- | storage/innobase/mem/mem0pool.c | 17 | ||||
-rw-r--r-- | storage/innobase/mtr/mtr0mtr.c | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0purge.c | 2 | ||||
-rw-r--r-- | storage/innobase/sync/sync0rw.c | 15 | ||||
-rw-r--r-- | storage/innobase/sync/sync0sync.c | 19 | ||||
-rw-r--r-- | storage/innobase/ut/ut0ut.c | 12 | ||||
-rw-r--r-- | storage/myisam/sort.c | 4 |
19 files changed, 103 insertions, 133 deletions
diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index ffaf2065045..7a8e5626e25 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -571,9 +571,6 @@ btr_page_get_father_for_rec( tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, btr_page_get_level(page, mtr)); - /* In the following, we choose just any index from the tree as the - first parameter for btr_cur_search_to_nth_level. */ - btr_cur_search_to_nth_level(index, btr_page_get_level(page, mtr) + 1, tuple, PAGE_CUR_LE, diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 44a374fe550..7c2fc18accd 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -3547,6 +3547,7 @@ syntax_error: /*==================== END OF FOREIGN KEY PROCESSING ====================*/ +#ifdef UNIV_DEBUG /************************************************************************** Returns an index object if it is found in the dictionary cache. */ @@ -3556,7 +3557,6 @@ dict_index_get_if_in_cache( /* out: index, NULL if not found */ dulint index_id) /* in: index id */ { - dict_table_t* table; dict_index_t* index; if (dict_sys == NULL) { @@ -3565,29 +3565,13 @@ dict_index_get_if_in_cache( mutex_enter(&(dict_sys->mutex)); - table = UT_LIST_GET_FIRST(dict_sys->table_LRU); - - while (table) { - index = UT_LIST_GET_FIRST(table->indexes); - - while (index) { - if (0 == ut_dulint_cmp(index->id, index_id)) { - - goto found; - } + index = dict_index_find_on_id_low(index_id); - index = UT_LIST_GET_NEXT(indexes, index); - } - - table = UT_LIST_GET_NEXT(table_LRU, table); - } - - index = NULL; -found: mutex_exit(&(dict_sys->mutex)); return(index); } +#endif /* UNIV_DEBUG */ #ifdef UNIV_DEBUG /************************************************************************** @@ -4162,18 +4146,8 @@ dict_print_info_on_foreign_key_in_create_format( dict_remove_db_name( foreign->referenced_table_name)); } else { - /* Look for the '/' in the table name */ - - i = 0; - while (foreign->referenced_table_name[i] != '/') { - i++; - } - - ut_print_namel(file, trx, TRUE, - foreign->referenced_table_name, i); - putc('.', file); ut_print_name(file, trx, TRUE, - foreign->referenced_table_name + i + 1); + foreign->referenced_table_name); } putc(' ', file); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 066c0ce48d4..0e4e6251dbc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6630,7 +6630,7 @@ innodb_mutex_show_status( mutex->count_spin_rounds, mutex->count_os_wait, mutex->count_os_yield, - mutex->lspent_time/1000); + (ulong) mutex->lspent_time/1000); if (stat_print(thd, innobase_hton_name, hton_name_len, buf1, buf1len, @@ -6660,7 +6660,7 @@ innodb_mutex_show_status( rw_lock_count, rw_lock_count_spin_loop, rw_lock_count_spin_rounds, rw_lock_count_os_wait, rw_lock_count_os_yield, - rw_lock_wait_time/1000); + (ulong) rw_lock_wait_time/1000); if (stat_print(thd, innobase_hton_name, hton_name_len, STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) { @@ -6812,7 +6812,8 @@ ha_innobase::store_lock( && lock_type != TL_IGNORE)) { /* The OR cases above are in this order: - 1) MySQL is doing LOCK TABLES ... READ LOCAL, or + 1) MySQL is doing LOCK TABLES ... READ LOCAL, or we + are processing a stored procedure or function, or 2) (we do not know when TL_READ_HIGH_PRIORITY is used), or 3) this is a SELECT ... IN SHARE MODE, or 4) we are doing a complex SQL statement like @@ -6880,7 +6881,8 @@ ha_innobase::store_lock( single transaction stored procedure call deterministic (if it does not use a consistent read). */ - if (lock_type == TL_READ && thd->in_lock_tables) { + if (lock_type == TL_READ + && thd->lex->sql_command == SQLCOM_LOCK_TABLES) { /* We come here if MySQL is processing LOCK TABLES ... READ LOCAL. MyISAM under that table lock type reads the table as it was at the time the lock was @@ -6939,8 +6941,7 @@ ha_innobase::store_lock( (MySQL does have thd->in_lock_tables TRUE there). */ if (lock_type == TL_READ_NO_INSERT - && (!thd->in_lock_tables - || thd->lex->sql_command == SQLCOM_CALL)) { + && thd->lex->sql_command != SQLCOM_LOCK_TABLES) { lock_type = TL_READ; } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index a9775ab3d40..2582effbb29 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -778,9 +778,8 @@ const dict_col_t* dict_field_get_col( /*===============*/ const dict_field_t* field); -/************************************************************************** -In an index tree, finds the index corresponding to a record in the tree. */ +#ifdef UNIV_DEBUG /************************************************************************** Returns an index object if it is found in the dictionary cache. */ @@ -789,7 +788,6 @@ dict_index_get_if_in_cache( /*=======================*/ /* out: index, NULL if not found */ dulint index_id); /* in: index id */ -#ifdef UNIV_DEBUG /************************************************************************** Checks that a tuple has n_fields_cmp value in a sensible range, so that no comparison can occur with the page number field in a node pointer. */ diff --git a/storage/innobase/include/mem0dbg.h b/storage/innobase/include/mem0dbg.h index 0f4441f4f9d..36cd7a89565 100644 --- a/storage/innobase/include/mem0dbg.h +++ b/storage/innobase/include/mem0dbg.h @@ -30,6 +30,7 @@ check fields at the both ends of the field. */ #define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT) #endif +#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG /******************************************************************* Checks a memory heap for consistency and prints the contents if requested. Outputs the sum of sizes of buffers given to the user (only in @@ -59,15 +60,8 @@ mem_heap_validate_or_print( ulint* n_blocks); /* out: number of blocks in the heap, if a NULL pointer is passed as this argument, it is ignored */ -#ifdef UNIV_MEM_DEBUG -/****************************************************************** -Prints the contents of a memory heap. */ - -void -mem_heap_print( -/*===========*/ - mem_heap_t* heap); /* in: memory heap */ -#endif /* UNIV_MEM_DEBUG */ +#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */ +#ifdef UNIV_DEBUG /****************************************************************** Checks that an object is a memory heap (or a block of it) */ @@ -76,6 +70,7 @@ mem_heap_check( /*===========*/ /* out: TRUE if ok */ mem_heap_t* heap); /* in: memory heap */ +#endif /* UNIV_DEBUG */ /****************************************************************** Validates the contents of a memory heap. */ diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 9e8250cb545..2a160d27e0c 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -265,6 +265,7 @@ mtr_memo_release( mtr_t* mtr, /* in: mtr */ void* object, /* in: object */ ulint type); /* in: object type: MTR_MEMO_S_LOCK, ... */ +#ifdef UNIV_DEBUG /************************************************************** Checks if memo contains the given item. */ UNIV_INLINE @@ -282,6 +283,7 @@ void mtr_print( /*======*/ mtr_t* mtr); /* in: mtr */ +#endif /* UNIV_DEBUG */ /*######################################################################*/ #define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */ diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index d81f6cb9c0d..81eec3bfc92 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -113,6 +113,7 @@ mtr_release_s_latch_at_savepoint( slot->object = NULL; } +#ifdef UNIV_DEBUG /************************************************************** Checks if memo contains the given item. */ UNIV_INLINE @@ -148,6 +149,7 @@ mtr_memo_contains( return(FALSE); } +#endif /* UNIV_DEBUG */ /******************************************************************* Returns the log object of a mini-transaction buffer. */ diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index d8f3c400918..7c0241f2e02 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -358,8 +358,9 @@ rw_lock_print( Prints debug info of currently locked rw-locks. */ void -rw_lock_list_print_info(void); -/*=========================*/ +rw_lock_list_print_info( +/*====================*/ + FILE* file); /* in: file where to print */ /******************************************************************* Returns the number of currently locked rw-locks. Works only in the debug version. */ diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 7d795e60efd..a1184d44257 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -224,12 +224,6 @@ Counts currently reserved mutexes. Works only in the debug version. */ ulint mutex_n_reserved(void); /*==================*/ -/********************************************************************** -Prints debug info of currently reserved mutexes. */ - -void -mutex_list_print_info(void); -/*========================*/ #endif /* UNIV_SYNC_DEBUG */ /********************************************************************** NOT to be used outside this module except in debugging! Gets the value diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 63fdabbe823..8765987d472 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -10,18 +10,18 @@ Created 1/20/1994 Heikki Tuuri #define univ_i #if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__) -#undef __WIN__ -#define __WIN__ +# undef __WIN__ +# define __WIN__ -#include <windows.h> +# include <windows.h> -#if !defined(WIN64) && !defined(_WIN64) -#define UNIV_CAN_USE_X86_ASSEMBLER -#endif +# if !defined(WIN64) && !defined(_WIN64) +# define UNIV_CAN_USE_X86_ASSEMBLER +# endif -#ifdef _NT_ -#define __NT__ -#endif +# ifdef _NT_ +# define __NT__ +# endif #else /* The defines used with MySQL */ @@ -30,42 +30,33 @@ Created 1/20/1994 Heikki Tuuri in compiling more Posix-compatible. These headers also define __WIN__ if we are compiling on Windows. */ -#include <my_global.h> -#include <my_pthread.h> +# include <my_global.h> +# include <my_pthread.h> /* Include <sys/stat.h> to get S_I... macros defined for os0file.c */ -#include <sys/stat.h> +# include <sys/stat.h> -#undef PACKAGE -#undef VERSION +# undef PACKAGE +# undef VERSION /* Include the header file generated by GNU autoconf */ -#ifndef __WIN__ -#include "config.h" -#endif - -#ifdef HAVE_SCHED_H -#include <sched.h> -#endif - -/* When compiling for Itanium IA64, undefine the flag below to prevent use -of the 32-bit x86 assembler in mutex operations. */ +# include "config.h" -#if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64) -#define UNIV_CAN_USE_X86_ASSEMBLER -#endif +# ifdef HAVE_SCHED_H +# include <sched.h> +# endif /* We only try to do explicit inlining of functions with gcc and Microsoft Visual C++ */ -#if !defined(__GNUC__) && !defined(__WIN__) -#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ -#define UNIV_MUST_NOT_INLINE -#endif +# if !defined(__GNUC__) +# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ +# define UNIV_MUST_NOT_INLINE +# endif -#ifdef HAVE_PREAD -#define HAVE_PWRITE -#endif +# ifdef HAVE_PREAD +# define HAVE_PWRITE +# endif #endif /* #if (defined(WIN32) || ... */ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 1eafa680d8d..b4e9fa91491 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -218,7 +218,10 @@ ut_print_filename( struct trx_struct; /************************************************************************** -Outputs a NUL-terminated string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_name( @@ -230,7 +233,10 @@ ut_print_name( const char* name); /* in: name to print */ /************************************************************************** -Outputs a fixed-length string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_namel( diff --git a/storage/innobase/mem/mem0dbg.c b/storage/innobase/mem/mem0dbg.c index 419f410cf1b..eb77dd01f6d 100644 --- a/storage/innobase/mem/mem0dbg.c +++ b/storage/innobase/mem/mem0dbg.c @@ -66,7 +66,6 @@ mem_hash_get_nth_cell(ulint i) return(&(mem_hash_table[i])); } -#endif /* UNIV_MEM_DEBUG */ /* Accessor functions for a memory field in the debug version */ @@ -106,6 +105,7 @@ mem_field_trailer_get_check(byte* field) return(mach_read_from_4(field + mem_field_header_get_len(field))); } +#endif /* UNIV_MEM_DEBUG */ /********************************************************************** Initializes the memory system. */ @@ -136,6 +136,7 @@ mem_init( mem_comm_pool = mem_pool_create(size); } +#ifdef UNIV_MEM_DEBUG /********************************************************************** Initializes an allocated memory field in the debug version. */ @@ -163,7 +164,6 @@ mem_field_init( mem_field_header_set_check(usr_buf, rnd); mem_field_trailer_set_check(usr_buf, rnd); -#ifdef UNIV_MEM_DEBUG /* Update the memory allocation information */ mutex_enter(&mem_hash_mutex); @@ -182,7 +182,6 @@ mem_field_init( combination of 0xBA and 0xBE */ mem_init_buf(usr_buf, n); -#endif /* UNIV_MEM_DEBUG */ } /********************************************************************** @@ -199,7 +198,6 @@ mem_field_erase( usr_buf = buf + MEM_FIELD_HEADER_SIZE; -#ifdef UNIV_MEM_DEBUG mutex_enter(&mem_hash_mutex); mem_current_allocated_memory -= n; mutex_exit(&mem_hash_mutex); @@ -211,10 +209,8 @@ mem_field_erase( combination of 0xDE and 0xAD */ mem_erase_buf(buf, MEM_SPACE_NEEDED(n)); -#endif /* UNIV_MEM_DEBUG */ } -#ifdef UNIV_MEM_DEBUG /******************************************************************* Initializes a buffer to a random combination of hex BA and BE. Used to initialize allocated memory. */ @@ -376,6 +372,7 @@ mem_hash_remove( } #endif /* UNIV_MEM_DEBUG */ +#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG /******************************************************************* Checks a memory heap for consistency and prints the contents if requested. Outputs the sum of sizes of buffers given to the user (only in @@ -549,10 +546,12 @@ completed: } *error = FALSE; } +#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */ +#ifdef UNIV_DEBUG /****************************************************************** Prints the contents of a memory heap. */ - +static void mem_heap_print( /*===========*/ @@ -615,6 +614,7 @@ mem_heap_validate( return(TRUE); } +#endif /* UNIV_DEBUG */ #ifdef UNIV_MEM_DEBUG /********************************************************************* diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c index 6a419ff33ec..a7acd331e16 100644 --- a/storage/innobase/mem/mem0pool.c +++ b/storage/innobase/mem/mem0pool.c @@ -35,7 +35,7 @@ The main components of the memory consumption are: 8. session for each user, and 9. stack for each OS thread. -Items 1-3 are managed by an LRU algorithm. Items 5 and 6 can potentially +Items 1 and 2 are managed by an LRU algorithm. Items 5 and 6 can potentially consume very much memory. Items 7 and 8 should consume quite little memory, and the OS should take care of item 9, which too should consume little memory. @@ -54,16 +54,15 @@ common pool and the buffers in the buffer pool into a single LRU list and manage it uniformly, but this approach does not take into account the parsing and other costs unique to SQL statements. -So, let the SQL statements and the data dictionary entries form one single -LRU list, let us call it the dictionary LRU list. The locks for a transaction -can be seen as a part of the state of the transaction. Hence, they should be -stored in the common pool. We still have the problem of a very big update -transaction, for example, which will set very many x-locks on rows, and the -locks will consume a lot of memory, say, half of the buffer pool size. +The locks for a transaction can be seen as a part of the state of the +transaction. Hence, they should be stored in the common pool. We still +have the problem of a very big update transaction, for example, which +will set very many x-locks on rows, and the locks will consume a lot +of memory, say, half of the buffer pool size. Another problem is what to do if we are not able to malloc a requested -block of memory from the common pool. Then we can truncate the LRU list of -the dictionary cache. If it does not help, a system error results. +block of memory from the common pool. Then we can request memory from +the operating system. If it does not help, a system error results. Because 5 and 6 may potentially consume very much memory, we let them grow into the buffer pool. We may let the locks of a transaction take frames diff --git a/storage/innobase/mtr/mtr0mtr.c b/storage/innobase/mtr/mtr0mtr.c index 1a65da6e7f4..365fa15878a 100644 --- a/storage/innobase/mtr/mtr0mtr.c +++ b/storage/innobase/mtr/mtr0mtr.c @@ -318,6 +318,7 @@ mtr_read_dulint( return(mach_read_from_8(ptr)); } +#ifdef UNIV_DEBUG /************************************************************* Prints info of an mtr handle. */ @@ -332,3 +333,4 @@ mtr_print( (ulong) dyn_array_get_data_size(&(mtr->memo)), (ulong) dyn_array_get_data_size(&(mtr->log))); } +#endif /* UNIV_DEBUG */ diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c index 889a11a7a76..1fef47da13f 100644 --- a/storage/innobase/row/row0purge.c +++ b/storage/innobase/row/row0purge.c @@ -563,7 +563,7 @@ row_purge_parse_undo_rec( /* Read to the partial row the fields that occur in indexes */ - if (!cmpl_info & UPD_NODE_NO_ORD_CHANGE) { + if (!(cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { ptr = trx_undo_rec_get_partial_row(ptr, clust_index, &(node->row), node->heap); } diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c index 304801d0a3b..441933843d7 100644 --- a/storage/innobase/sync/sync0rw.c +++ b/storage/innobase/sync/sync0rw.c @@ -758,8 +758,9 @@ rw_lock_is_locked( Prints debug info of currently locked rw-locks. */ void -rw_lock_list_print_info(void) -/*=========================*/ +rw_lock_list_print_info( +/*====================*/ + FILE* file) /* in: file where to print */ { rw_lock_t* lock; ulint count = 0; @@ -769,7 +770,7 @@ rw_lock_list_print_info(void) fputs("-------------\n" "RW-LATCH INFO\n" - "-------------\n", stderr); + "-------------\n", file); lock = UT_LIST_GET_FIRST(rw_lock_list); @@ -783,12 +784,12 @@ rw_lock_list_print_info(void) || (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_waiters(lock) != 0)) { - fprintf(stderr, "RW-LOCK: %p ", (void*) lock); + fprintf(file, "RW-LOCK: %p ", (void*) lock); if (rw_lock_get_waiters(lock)) { - fputs(" Waiters for the lock exist\n", stderr); + fputs(" Waiters for the lock exist\n", file); } else { - putc('\n', stderr); + putc('\n', file); } info = UT_LIST_GET_FIRST(lock->debug_list); @@ -802,7 +803,7 @@ rw_lock_list_print_info(void) lock = UT_LIST_GET_NEXT(list, lock); } - fprintf(stderr, "Total number of rw-locks %ld\n", count); + fprintf(file, "Total number of rw-locks %ld\n", count); mutex_exit(&rw_lock_list_mutex); } diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c index 91fd248502a..ff7056b0afe 100644 --- a/storage/innobase/sync/sync0sync.c +++ b/storage/innobase/sync/sync0sync.c @@ -628,10 +628,11 @@ mutex_own( /********************************************************************** Prints debug info of currently reserved mutexes. */ - +static void -mutex_list_print_info(void) -/*=======================*/ +mutex_list_print_info( +/*==================*/ + FILE* file) /* in: file where to print */ { mutex_t* mutex; const char* file_name; @@ -641,7 +642,7 @@ mutex_list_print_info(void) fputs("----------\n" "MUTEX INFO\n" - "----------\n", stderr); + "----------\n", file); mutex_enter(&mutex_list_mutex); @@ -653,7 +654,7 @@ mutex_list_print_info(void) if (mutex_get_lock_word(mutex) != 0) { mutex_get_debug_info(mutex, &file_name, &line, &thread_id); - fprintf(stderr, + fprintf(file, "Locked mutex: addr %p thread %ld" " file %s line %ld\n", (void*) mutex, os_thread_pf(thread_id), @@ -663,7 +664,7 @@ mutex_list_print_info(void) mutex = UT_LIST_GET_NEXT(list, mutex); } - fprintf(stderr, "Total number of mutexes %ld\n", count); + fprintf(file, "Total number of mutexes %ld\n", count); mutex_exit(&mutex_list_mutex); } @@ -1343,7 +1344,7 @@ sync_print_wait_info( FILE* file) /* in: file where to print */ { #ifdef UNIV_SYNC_DEBUG - fprintf(stderr, "Mutex exits %lu, rws exits %lu, rwx exits %lu\n", + fprintf(file, "Mutex exits %lu, rws exits %lu, rwx exits %lu\n", mutex_exit_count, rw_s_exit_count, rw_x_exit_count); #endif @@ -1369,9 +1370,9 @@ sync_print( FILE* file) /* in: file where to print */ { #ifdef UNIV_SYNC_DEBUG - mutex_list_print_info(); + mutex_list_print_info(file); - rw_lock_list_print_info(); + rw_lock_list_print_info(file); #endif /* UNIV_SYNC_DEBUG */ sync_array_print_info(file, sync_primary_wait_array); diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 10641b88a17..d805cc3b4b2 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -394,7 +394,10 @@ done: } /************************************************************************** -Outputs a NUL-terminated string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_name( @@ -409,7 +412,10 @@ ut_print_name( } /************************************************************************** -Outputs a fixed-length string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_namel( @@ -424,7 +430,7 @@ ut_print_namel( #ifdef UNIV_HOTBACKUP fwrite(name, 1, namelen, f); #else - char* slash = strchr(name, '/'); + char* slash = memchr(name, '/', namelen); if (UNIV_LIKELY_NULL(slash)) { /* Print the database name and table name separately. */ diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index bdbfa91ced4..0c1b303620e 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -327,7 +327,7 @@ pthread_handler_t thr_find_all_keys(void *arg) if (sort_param->sort_info->got_error) goto err; - if (sort_param->keyinfo->flag && HA_VAR_LENGTH_KEY) + if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY) { sort_param->write_keys= write_keys_varlen; sort_param->read_to_buffer= read_to_buffer_varlen; @@ -543,7 +543,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) { if (got_error) continue; - if (sinfo->keyinfo->flag && HA_VAR_LENGTH_KEY) + if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY) { sinfo->write_keys=write_keys_varlen; sinfo->read_to_buffer=read_to_buffer_varlen; |