mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
a5868736ff
Fixes: - Bug #24712: SHOW TABLE STATUS for file-per-table showing incorrect time fields - Bug #24386: Performance degradation caused by instrumentation in mutex_struct - Bug #24190: many exportable definitions of field_in_record_is_null - Bug #21468: InnoDB crash during recovery with corrupted data pages: XA bug? storage/innobase/buf/buf0buf.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1045: buf_page_init_for_read(): Correct the indentation. storage/innobase/buf/buf0flu.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1038: Port r983 from branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG. storage/innobase/dict/dict0dict.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. storage/innobase/ha/ha0ha.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/ha/hash0hash.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/handler/ha_innodb.cc: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1028: Merge a change from MySQL AB. ChangeSet 2006/11/10 17:22:43+02:00 aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi Bug #24190 many exportable definitions of field_in_record_is_null mysql had several(2) exportable definitions of field_in_record_is_null function. Fixed with adding static. storage/innobase/handler/ha_innodb.cc 2006/11/10 17:22:36+02:00 aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi +1 -1 made static Revision r1008: Minor cleanup. ha_innobase::rnd_pos(): Use correct format in DBUG_PRINT statements. buf_page_release(): Remove the local variable buf_fix_count. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. Revision r1134: Fix a potential bug in ha_innodb.cc:innobase_query_is_update() where the function can be called with "current_thd == NULL". Minor non-functional fix in log0recv.c Revision r1098: Fix bug #24712: SHOW TABLE STATUS for file-per-table showing incorrect time fields Revision r1109: ha_innodb.cc: Remove unused define MAX_ULONG_BIT. storage/innobase/include/btr0sea.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1088: Replace the Latin abbreviation "cf." in comments. storage/innobase/include/buf0buf.ic: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1008: Minor cleanup. ha_innobase::rnd_pos(): Use correct format in DBUG_PRINT statements. buf_page_release(): Remove the local variable buf_fix_count. storage/innobase/include/data0type.ic: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1088: Replace the Latin abbreviation "cf." in comments. storage/innobase/include/dict0dict.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. storage/innobase/include/ha0ha.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/include/hash0hash.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/include/sync0rw.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/include/sync0sync.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1038: Port r983 from branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG. Revision r1037: Port r972 from branches/zip: Enclose some debug code in #ifdef UNIV_SYNC_DEBUG. The code was previously unused in non-debug builds. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) Revision r1084: Remove the unused constants SYNC_INFINITE_TIME and SYNC_TIME_EXCEEDED. storage/innobase/include/sync0sync.ic: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/include/univ.i: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1006: Introduce #define UNIV_LIST_DEBUG for enabling the debug code in UT_LIST_REMOVE_CLEAR(). Revision r1088: Replace the Latin abbreviation "cf." in comments. Revision r1083: univ.i: Document the debug flags (UNIV_DEBUG et al). storage/innobase/include/ut0lst.h: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1006: Introduce #define UNIV_LIST_DEBUG for enabling the debug code in UT_LIST_REMOVE_CLEAR(). storage/innobase/lock/lock0lock.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1009: Remove duplicate printing of row lock counts in SHOW INNODB STATUS, and in the remaining print, add a comma so it doesn't get combined with the heap size. Both problems were introduced in r383. storage/innobase/log/log0recv.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1134: Fix a potential bug in ha_innodb.cc:innobase_query_is_update() where the function can be called with "current_thd == NULL". Minor non-functional fix in log0recv.c Revision r1078: Merge r1067:1077 from branches/5.0: innobase_start_or_create_for_mysql(): Remove unnecessary delay now that we moved the setting sync_order_checks_on=TRUE to log0recv.c, to the start of the rollback phase in crash recovery. Fix assertion failure sync0sync.c line 1239 (the latter ut_error in sync_thread_reset_level()) in crash recovery when UNIV_SYNC_DEBUG is enabled. Revision r1080: Merge r1079 from branches/5.0: recv_recovery_from_checkpoint_finish(): Add 1 sec delay before switching on the sync order checks in crash recovery, so that file I/O threads have time to suspend themselves. storage/innobase/row/row0ins.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. storage/innobase/row/row0sel.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1038: Port r983 from branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG. Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. storage/innobase/row/row0upd.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1124: Unify dict_table_get_and_increment_handle_count() with dict_table_get() by adding a second parameter, adjust callers. storage/innobase/srv/srv0start.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1038: Port r983 from branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG. Revision r1078: Merge r1067:1077 from branches/5.0: innobase_start_or_create_for_mysql(): Remove unnecessary delay now that we moved the setting sync_order_checks_on=TRUE to log0recv.c, to the start of the rollback phase in crash recovery. Fix assertion failure sync0sync.c line 1239 (the latter ut_error in sync_thread_reset_level()) in crash recovery when UNIV_SYNC_DEBUG is enabled. Revision r1070: Remove another accidentally committed change to srv0start.c. The change was accidentally committed with the merge in r1068. This revision corresponds to r1051 with a properly merged r1067 of branches/5.0. Revision r1068: Merge r1067 from branches/5.0: trx_rollback_for_mysql(), trx_commit_for_mysql(): Protect the creation of trx_dummy_sess with kernel_mutex. This error was introduced in r1046 and r1050. Revision r1069: Remove an accidentally committed change to srv0start.c. The change was accidentally committed with the merge in r1068. storage/innobase/sync/sync0rw.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/sync/sync0sync.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1038: Port r983 from branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG. Revision r1037: Port r972 from branches/zip: Enclose some debug code in #ifdef UNIV_SYNC_DEBUG. The code was previously unused in non-debug builds. Revision r1039: Port r1034 from branches/zip: Remove some instrumentation and reduce the output of SHOW MUTEX STATUS in non-debug builds. (Bug #24386) storage/innobase/trx/trx0roll.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1049: Merge r1048 from branches/5.0: trx_rollback_for_mysql(): Do not set trx->sess back to NULL. This bug was introduced in r1046. Revision r1047: Merge r1046 from branches/5.0: branches/5.0: trx_rollback_for_mysql(): Ensure that trx->sess is non-NULL when calling trx_general_rollback_for_mysql(). This removes a segmentation fault when rolling back a prepared transaction in XA recovery. (Bug #21468) Revision r1068: Merge r1067 from branches/5.0: trx_rollback_for_mysql(), trx_commit_for_mysql(): Protect the creation of trx_dummy_sess with kernel_mutex. This error was introduced in r1046 and r1050. Revision r1051: Merge r1050 from branches/5.0: trx_rollback_for_mysql(): Fix the comment introduced in r1046. trx_commit_for_mysql(): Use the dummy trx->sess also for committing a prepared transaction in XA recovery, just in case our code would need the session object also in that case (does not seem to need it right now). storage/innobase/trx/trx0trx.c: Applied innodb-5.1-ss1039 and innodb-5.1-ss1134 snapshots. Revision r1009: Remove duplicate printing of row lock counts in SHOW INNODB STATUS, and in the remaining print, add a comma so it doesn't get combined with the heap size. Both problems were introduced in r383. Revision r1068: Merge r1067 from branches/5.0: trx_rollback_for_mysql(), trx_commit_for_mysql(): Protect the creation of trx_dummy_sess with kernel_mutex. This error was introduced in r1046 and r1050. Revision r1051: Merge r1050 from branches/5.0: trx_rollback_for_mysql(): Fix the comment introduced in r1046. trx_commit_for_mysql(): Use the dummy trx->sess also for committing a prepared transaction in XA recovery, just in case our code would need the session object also in that case (does not seem to need it right now).
140 lines
4.5 KiB
C
140 lines
4.5 KiB
C
/******************************************************
|
|
The hash table with external chains
|
|
|
|
(c) 1994-1997 Innobase Oy
|
|
|
|
Created 8/18/1994 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef ha0ha_h
|
|
#define ha0ha_h
|
|
|
|
#include "univ.i"
|
|
|
|
#include "hash0hash.h"
|
|
#include "page0types.h"
|
|
|
|
/*****************************************************************
|
|
Looks for an element in a hash table. */
|
|
UNIV_INLINE
|
|
void*
|
|
ha_search_and_get_data(
|
|
/*===================*/
|
|
/* out: pointer to the data of the first hash
|
|
table node in chain having the fold number,
|
|
NULL if not found */
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold); /* in: folded value of the searched data */
|
|
/*************************************************************
|
|
Looks for an element when we know the pointer to the data and updates
|
|
the pointer to data if found. */
|
|
|
|
void
|
|
ha_search_and_update_if_found(
|
|
/*==========================*/
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold, /* in: folded value of the searched data */
|
|
void* data, /* in: pointer to the data */
|
|
void* new_data);/* in: new pointer to the data */
|
|
/*****************************************************************
|
|
Creates a hash table with >= n array cells. The actual number of cells is
|
|
chosen to be a prime number slightly bigger than n. */
|
|
|
|
hash_table_t*
|
|
ha_create_func(
|
|
/*===========*/
|
|
/* out, own: created table */
|
|
ibool in_btr_search, /* in: TRUE if the hash table is used in
|
|
the btr_search module */
|
|
ulint n, /* in: number of array cells */
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
ulint mutex_level, /* in: level of the mutexes in the latching
|
|
order: this is used in the debug version */
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
ulint n_mutexes); /* in: number of mutexes to protect the
|
|
hash table: must be a power of 2 */
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
# define ha_create(b,n_c,n_m,level) ha_create_func(b,n_c,level,n_m)
|
|
#else /* UNIV_SYNC_DEBUG */
|
|
# define ha_create(b,n_c,n_m,level) ha_create_func(b,n_c,n_m)
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
/*****************************************************************
|
|
Inserts an entry into a hash table. If an entry with the same fold number
|
|
is found, its node is updated to point to the new data, and no new node
|
|
is inserted. */
|
|
|
|
ibool
|
|
ha_insert_for_fold(
|
|
/*===============*/
|
|
/* out: TRUE if succeed, FALSE if no more
|
|
memory could be allocated */
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold, /* in: folded value of data; if a node with
|
|
the same fold value already exists, it is
|
|
updated to point to the same data, and no new
|
|
node is created! */
|
|
void* data); /* in: data, must not be NULL */
|
|
/*****************************************************************
|
|
Deletes an entry from a hash table. */
|
|
|
|
void
|
|
ha_delete(
|
|
/*======*/
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold, /* in: folded value of data */
|
|
void* data); /* in: data, must not be NULL and must exist
|
|
in the hash table */
|
|
/*************************************************************
|
|
Looks for an element when we know the pointer to the data and deletes
|
|
it from the hash table if found. */
|
|
UNIV_INLINE
|
|
ibool
|
|
ha_search_and_delete_if_found(
|
|
/*==========================*/
|
|
/* out: TRUE if found */
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold, /* in: folded value of the searched data */
|
|
void* data); /* in: pointer to the data */
|
|
/*********************************************************************
|
|
Removes from the chain determined by fold all nodes whose data pointer
|
|
points to the page given. */
|
|
|
|
void
|
|
ha_remove_all_nodes_to_page(
|
|
/*========================*/
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint fold, /* in: fold value */
|
|
page_t* page); /* in: buffer page */
|
|
/*****************************************************************
|
|
Validates a given range of the cells in hash table. */
|
|
|
|
ibool
|
|
ha_validate(
|
|
/*========*/
|
|
/* out: TRUE if ok */
|
|
hash_table_t* table, /* in: hash table */
|
|
ulint start_index, /* in: start index */
|
|
ulint end_index); /* in: end index */
|
|
/*****************************************************************
|
|
Prints info of a hash table. */
|
|
|
|
void
|
|
ha_print_info(
|
|
/*==========*/
|
|
FILE* file, /* in: file where to print */
|
|
hash_table_t* table); /* in: hash table */
|
|
|
|
/* The hash table external chain node */
|
|
|
|
typedef struct ha_node_struct ha_node_t;
|
|
struct ha_node_struct {
|
|
ha_node_t* next; /* next chain node or NULL if none */
|
|
void* data; /* pointer to the data */
|
|
ulint fold; /* fold value for the data */
|
|
};
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "ha0ha.ic"
|
|
#endif
|
|
|
|
#endif
|