mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 14:32:34 +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).
224 lines
6.7 KiB
C
224 lines
6.7 KiB
C
/**********************************************************************
|
|
List utilities
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 9/10/1995 Heikki Tuuri
|
|
***********************************************************************/
|
|
|
|
#ifndef ut0lst_h
|
|
#define ut0lst_h
|
|
|
|
#include "univ.i"
|
|
|
|
/* This module implements the two-way linear list which should be used
|
|
if a list is used in the database. Note that a single struct may belong
|
|
to two or more lists, provided that the list are given different names.
|
|
An example of the usage of the lists can be found in fil0fil.c. */
|
|
|
|
/***********************************************************************
|
|
This macro expands to the unnamed type definition of a struct which acts
|
|
as the two-way list base node. The base node contains pointers
|
|
to both ends of the list and a count of nodes in the list (excluding
|
|
the base node from the count). TYPE should be the list node type name. */
|
|
|
|
#define UT_LIST_BASE_NODE_T(TYPE)\
|
|
struct {\
|
|
ulint count; /* count of nodes in list */\
|
|
TYPE * start; /* pointer to list start, NULL if empty */\
|
|
TYPE * end; /* pointer to list end, NULL if empty */\
|
|
}\
|
|
|
|
/***********************************************************************
|
|
This macro expands to the unnamed type definition of a struct which
|
|
should be embedded in the nodes of the list, the node type must be a struct.
|
|
This struct contains the pointers to next and previous nodes in the list.
|
|
The name of the field in the node struct should be the name given
|
|
to the list. TYPE should be the list node type name. Example of usage:
|
|
|
|
typedef struct LRU_node_struct LRU_node_t;
|
|
struct LRU_node_struct {
|
|
UT_LIST_NODE_T(LRU_node_t) LRU_list;
|
|
...
|
|
}
|
|
The example implements an LRU list of name LRU_list. Its nodes are of type
|
|
LRU_node_t.
|
|
*/
|
|
|
|
#define UT_LIST_NODE_T(TYPE)\
|
|
struct {\
|
|
TYPE * prev; /* pointer to the previous node,\
|
|
NULL if start of list */\
|
|
TYPE * next; /* pointer to next node, NULL if end of list */\
|
|
}\
|
|
|
|
/***********************************************************************
|
|
Initializes the base node of a two-way list. */
|
|
|
|
#define UT_LIST_INIT(BASE)\
|
|
{\
|
|
(BASE).count = 0;\
|
|
(BASE).start = NULL;\
|
|
(BASE).end = NULL;\
|
|
}\
|
|
|
|
/***********************************************************************
|
|
Adds the node as the first element in a two-way linked list.
|
|
BASE has to be the base node (not a pointer to it). N has to be
|
|
the pointer to the node to be added to the list. NAME is the list name. */
|
|
|
|
#define UT_LIST_ADD_FIRST(NAME, BASE, N)\
|
|
{\
|
|
ut_ad(N);\
|
|
((BASE).count)++;\
|
|
((N)->NAME).next = (BASE).start;\
|
|
((N)->NAME).prev = NULL;\
|
|
if ((BASE).start != NULL) {\
|
|
(((BASE).start)->NAME).prev = (N);\
|
|
}\
|
|
(BASE).start = (N);\
|
|
if ((BASE).end == NULL) {\
|
|
(BASE).end = (N);\
|
|
}\
|
|
}\
|
|
|
|
/***********************************************************************
|
|
Adds the node as the last element in a two-way linked list.
|
|
BASE has to be the base node (not a pointer to it). N has to be
|
|
the pointer to the node to be added to the list. NAME is the list name. */
|
|
|
|
#define UT_LIST_ADD_LAST(NAME, BASE, N)\
|
|
{\
|
|
ut_ad(N);\
|
|
((BASE).count)++;\
|
|
((N)->NAME).prev = (BASE).end;\
|
|
((N)->NAME).next = NULL;\
|
|
if ((BASE).end != NULL) {\
|
|
(((BASE).end)->NAME).next = (N);\
|
|
}\
|
|
(BASE).end = (N);\
|
|
if ((BASE).start == NULL) {\
|
|
(BASE).start = (N);\
|
|
}\
|
|
}\
|
|
|
|
/***********************************************************************
|
|
Inserts a NODE2 after NODE1 in a list.
|
|
BASE has to be the base node (not a pointer to it). NAME is the list
|
|
name, NODE1 and NODE2 are pointers to nodes. */
|
|
|
|
#define UT_LIST_INSERT_AFTER(NAME, BASE, NODE1, NODE2)\
|
|
{\
|
|
ut_ad(NODE1);\
|
|
ut_ad(NODE2);\
|
|
((BASE).count)++;\
|
|
((NODE2)->NAME).prev = (NODE1);\
|
|
((NODE2)->NAME).next = ((NODE1)->NAME).next;\
|
|
if (((NODE1)->NAME).next != NULL) {\
|
|
((((NODE1)->NAME).next)->NAME).prev = (NODE2);\
|
|
}\
|
|
((NODE1)->NAME).next = (NODE2);\
|
|
if ((BASE).end == (NODE1)) {\
|
|
(BASE).end = (NODE2);\
|
|
}\
|
|
}\
|
|
|
|
/* Invalidate the pointers in a list node. */
|
|
#ifdef UNIV_LIST_DEBUG
|
|
# define UT_LIST_REMOVE_CLEAR(NAME, N) \
|
|
((N)->NAME.prev = (N)->NAME.next = (void*) -1)
|
|
#else
|
|
# define UT_LIST_REMOVE_CLEAR(NAME, N) while (0)
|
|
#endif
|
|
|
|
/***********************************************************************
|
|
Removes a node from a two-way linked list. BASE has to be the base node
|
|
(not a pointer to it). N has to be the pointer to the node to be removed
|
|
from the list. NAME is the list name. */
|
|
|
|
#define UT_LIST_REMOVE(NAME, BASE, N) \
|
|
do { \
|
|
ut_ad(N); \
|
|
ut_a((BASE).count > 0); \
|
|
((BASE).count)--; \
|
|
if (((N)->NAME).next != NULL) { \
|
|
((((N)->NAME).next)->NAME).prev = ((N)->NAME).prev; \
|
|
} else { \
|
|
(BASE).end = ((N)->NAME).prev; \
|
|
} \
|
|
if (((N)->NAME).prev != NULL) { \
|
|
((((N)->NAME).prev)->NAME).next = ((N)->NAME).next; \
|
|
} else { \
|
|
(BASE).start = ((N)->NAME).next; \
|
|
} \
|
|
UT_LIST_REMOVE_CLEAR(NAME, N); \
|
|
} while (0)
|
|
|
|
/************************************************************************
|
|
Gets the next node in a two-way list. NAME is the name of the list
|
|
and N is pointer to a node. */
|
|
|
|
#define UT_LIST_GET_NEXT(NAME, N)\
|
|
(((N)->NAME).next)
|
|
|
|
/************************************************************************
|
|
Gets the previous node in a two-way list. NAME is the name of the list
|
|
and N is pointer to a node. */
|
|
|
|
#define UT_LIST_GET_PREV(NAME, N)\
|
|
(((N)->NAME).prev)
|
|
|
|
/************************************************************************
|
|
Alternative macro to get the number of nodes in a two-way list, i.e.,
|
|
its length. BASE is the base node (not a pointer to it). */
|
|
|
|
#define UT_LIST_GET_LEN(BASE)\
|
|
(BASE).count
|
|
|
|
/************************************************************************
|
|
Gets the first node in a two-way list, or returns NULL,
|
|
if the list is empty. BASE is the base node (not a pointer to it). */
|
|
|
|
#define UT_LIST_GET_FIRST(BASE)\
|
|
(BASE).start
|
|
|
|
/************************************************************************
|
|
Gets the last node in a two-way list, or returns NULL,
|
|
if the list is empty. BASE is the base node (not a pointer to it). */
|
|
|
|
#define UT_LIST_GET_LAST(BASE)\
|
|
(BASE).end
|
|
|
|
/************************************************************************
|
|
Checks the consistency of a two-way list. NAME is the name of the list,
|
|
TYPE is the node type, and BASE is the base node (not a pointer to it). */
|
|
|
|
#define UT_LIST_VALIDATE(NAME, TYPE, BASE)\
|
|
{\
|
|
ulint ut_list_i_313;\
|
|
TYPE * ut_list_node_313;\
|
|
\
|
|
ut_list_node_313 = (BASE).start;\
|
|
\
|
|
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\
|
|
ut_list_i_313++) {\
|
|
ut_a(ut_list_node_313);\
|
|
ut_list_node_313 = (ut_list_node_313->NAME).next;\
|
|
}\
|
|
\
|
|
ut_a(ut_list_node_313 == NULL);\
|
|
\
|
|
ut_list_node_313 = (BASE).end;\
|
|
\
|
|
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\
|
|
ut_list_i_313++) {\
|
|
ut_a(ut_list_node_313);\
|
|
ut_list_node_313 = (ut_list_node_313->NAME).prev;\
|
|
}\
|
|
\
|
|
ut_a(ut_list_node_313 == NULL);\
|
|
}\
|
|
|
|
|
|
#endif
|
|
|