diff options
author | monty@hundin.mysql.fi <> | 2002-08-08 15:24:47 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-08-08 15:24:47 +0300 |
commit | 087261482a9bbdaa3bc0e26052a719ebdb73644b (patch) | |
tree | e7f4a2013ed3d66e640f6574e62cb7e534a5d77f /innobase/include | |
parent | 8be1cdeb89ca59be790d58dc0d43993cdc4f4191 (diff) | |
parent | 3f48e0369b2e49026e9ddd4fddcee68ebe17db1e (diff) | |
download | mariadb-git-087261482a9bbdaa3bc0e26052a719ebdb73644b.tar.gz |
merge with 3.23.52
Diffstat (limited to 'innobase/include')
-rw-r--r-- | innobase/include/btr0btr.h | 8 | ||||
-rw-r--r-- | innobase/include/buf0buf.h | 6 | ||||
-rw-r--r-- | innobase/include/buf0buf.ic | 37 | ||||
-rw-r--r-- | innobase/include/dict0dict.h | 20 | ||||
-rw-r--r-- | innobase/include/dict0mem.h | 4 | ||||
-rw-r--r-- | innobase/include/dyn0dyn.h | 11 | ||||
-rw-r--r-- | innobase/include/fsp0fsp.h | 10 | ||||
-rw-r--r-- | innobase/include/ha0ha.h | 8 | ||||
-rw-r--r-- | innobase/include/ha0ha.ic | 10 | ||||
-rw-r--r-- | innobase/include/log0log.h | 40 | ||||
-rw-r--r-- | innobase/include/log0log.ic | 85 | ||||
-rw-r--r-- | innobase/include/log0recv.h | 7 | ||||
-rw-r--r-- | innobase/include/os0file.h | 6 | ||||
-rw-r--r-- | innobase/include/os0sync.ic | 14 | ||||
-rw-r--r-- | innobase/include/os0thread.h | 28 | ||||
-rw-r--r-- | innobase/include/srv0start.h | 2 | ||||
-rw-r--r-- | innobase/include/sync0rw.ic | 3 | ||||
-rw-r--r-- | innobase/include/sync0sync.ic | 4 | ||||
-rw-r--r-- | innobase/include/trx0sys.h | 13 | ||||
-rw-r--r-- | innobase/include/trx0trx.h | 4 | ||||
-rw-r--r-- | innobase/include/univ.i | 12 | ||||
-rw-r--r-- | innobase/include/ut0dbg.h | 13 |
22 files changed, 243 insertions, 102 deletions
diff --git a/innobase/include/btr0btr.h b/innobase/include/btr0btr.h index bf433c0c264..f66ad3639d4 100644 --- a/innobase/include/btr0btr.h +++ b/innobase/include/btr0btr.h @@ -313,14 +313,6 @@ btr_discard_page( btr_cur_t* cursor, /* in: cursor on the page to discard: not on the root page */ mtr_t* mtr); /* in: mtr */ -/************************************************************************ -Declares the latching order level for the page latch in the debug version. */ -UNIV_INLINE -void -btr_declare_page_latch( -/*===================*/ - page_t* page, /* in: page */ - ibool leaf); /* in: TRUE if a leaf */ /******************************************************************** Parses the redo log record for setting an index record as the predefined minimum record. */ diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index b80ed96f54c..591c0ec54ab 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -463,6 +463,12 @@ buf_print_io( /*=========*/ char* buf, /* in/out: buffer where to print */ char* buf_end);/* in: buffer end */ +/************************************************************************** +Refreshes the statistics used to print per-second averages. */ + +void +buf_refresh_io_stats(void); +/*======================*/ /************************************************************************* Checks that all file pages in the buffer are in a replaceable state. */ diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index e5a2c480922..7227c79dc6a 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -211,8 +211,15 @@ buf_block_align( block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) >> UNIV_PAGE_SIZE_SHIFT); - ut_a(block >= buf_pool->blocks); - ut_a(block < buf_pool->blocks + buf_pool->max_size); + if (block < buf_pool->blocks + || block >= buf_pool->blocks + buf_pool->max_size) { + + fprintf(stderr, +"InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, + (ulint)frame_zero, buf_pool->max_size); + ut_a(0); + } return(block); } @@ -238,8 +245,15 @@ buf_block_align_low( block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) >> UNIV_PAGE_SIZE_SHIFT); - ut_a(block >= buf_pool->blocks); - ut_a(block < buf_pool->blocks + buf_pool->max_size); + if (block < buf_pool->blocks + || block >= buf_pool->blocks + buf_pool->max_size) { + + fprintf(stderr, +"InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, + (ulint)frame_zero, buf_pool->max_size); + ut_a(0); + } return(block); } @@ -259,10 +273,17 @@ buf_frame_align( frame = ut_align_down(ptr, UNIV_PAGE_SIZE); - ut_a((ulint)frame - >= (ulint)(buf_pool_get_nth_block(buf_pool, 0)->frame)); - ut_a((ulint)frame <= (ulint)(buf_pool_get_nth_block(buf_pool, - buf_pool->max_size - 1)->frame)); + if (((ulint)frame + < (ulint)(buf_pool->frame_zero)) + || ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool, + buf_pool->max_size - 1)->frame))) { + fprintf(stderr, +"InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, + (ulint)(buf_pool->frame_zero), buf_pool->max_size); + ut_a(0); + } + return(frame); } diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h index fd79e17090a..832654d2666 100644 --- a/innobase/include/dict0dict.h +++ b/innobase/include/dict0dict.h @@ -96,17 +96,17 @@ dict_col_get_clust_pos( /*===================*/ dict_col_t* col); /************************************************************************ -Initializes the autoinc counter. It is not an error to initialize already +Initializes the autoinc counter. It is not an error to initialize an already initialized counter. */ void dict_table_autoinc_initialize( /*==========================*/ dict_table_t* table, /* in: table */ - ib_longlong value); /* in: value which was assigned to a row */ + ib_longlong value); /* in: next value to assign to a row */ /************************************************************************ -Gets the next autoinc value, 0 if not yet initialized. If initialized, -increments the counter by 1. */ +Gets the next autoinc value (== autoinc counter value), 0 if not yet +initialized. If initialized, increments the counter by 1. */ ib_longlong dict_table_autoinc_get( @@ -123,12 +123,22 @@ dict_table_autoinc_read( /* out: value of the counter */ dict_table_t* table); /* in: table */ /************************************************************************ -Updates the autoinc counter if the value supplied is bigger than the +Peeks the autoinc counter value, 0 if not yet initialized. Does not +increment the counter. The read not protected by any mutex! */ + +ib_longlong +dict_table_autoinc_peek( +/*====================*/ + /* out: value of the counter */ + dict_table_t* table); /* in: table */ +/************************************************************************ +Updates the autoinc counter if the value supplied is equal or bigger than the current value. If not inited, does nothing. */ void dict_table_autoinc_update( /*======================*/ + dict_table_t* table, /* in: table */ ib_longlong value); /* in: value which was assigned to a row */ /************************************************************************** diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h index ef15c99fdba..cc27f2bad12 100644 --- a/innobase/include/dict0mem.h +++ b/innobase/include/dict0mem.h @@ -388,8 +388,8 @@ struct dict_table_struct{ /* TRUE if the autoinc counter has been inited; MySQL gets the init value by executing SELECT MAX(auto inc column) */ - ib_longlong autoinc;/* autoinc counter value already given to - a row */ + ib_longlong autoinc;/* autoinc counter value to give to the + next inserted row */ ulint magic_n;/* magic number */ }; #define DICT_TABLE_MAGIC_N 76333786 diff --git a/innobase/include/dyn0dyn.h b/innobase/include/dyn0dyn.h index 6f08da1533b..501fde05e90 100644 --- a/innobase/include/dyn0dyn.h +++ b/innobase/include/dyn0dyn.h @@ -17,7 +17,8 @@ typedef struct dyn_block_struct dyn_block_t; typedef dyn_block_t dyn_array_t; -/* This must be > MLOG_BUF_MARGIN + 30 */ +/* This is the initial 'payload' size of a dynamic array; +this must be > MLOG_BUF_MARGIN + 30! */ #define DYN_ARRAY_DATA_SIZE 512 /************************************************************************* @@ -123,14 +124,6 @@ dyn_block_get_data( /*===============*/ /* out: pointer to data */ dyn_block_t* block); /* in: dyn array block */ -/************************************************************************ -Gets the next block in a dyn array. */ -UNIV_INLINE -dyn_block_t* -dyn_block_get_next( -/*===============*/ - /* out: pointer to next, NULL if end of list */ - dyn_block_t* block); /* in: dyn array block */ /************************************************************ Pushes n bytes to a dyn array. */ UNIV_INLINE diff --git a/innobase/include/fsp0fsp.h b/innobase/include/fsp0fsp.h index a0197ec2d97..3494f336b1e 100644 --- a/innobase/include/fsp0fsp.h +++ b/innobase/include/fsp0fsp.h @@ -57,6 +57,16 @@ fsp_header_get_free_limit( /* out: free limit in megabytes */ ulint space); /* in: space id */ /************************************************************************** +Gets the size of the tablespace from the tablespace header. If we do not +have an auto-extending data file, this should be equal to the size of the +data files. If there is an auto-extending data file, this can be smaller. */ + +ulint +fsp_header_get_tablespace_size( +/*===========================*/ + /* out: size in pages */ + ulint space); /* in: space id */ +/************************************************************************** Initializes the space header of a new created space. */ void diff --git a/innobase/include/ha0ha.h b/innobase/include/ha0ha.h index 945b1198a41..0beac928b7e 100644 --- a/innobase/include/ha0ha.h +++ b/innobase/include/ha0ha.h @@ -131,6 +131,14 @@ ha_print_info( char* buf_end,/* in: buffer end */ 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" diff --git a/innobase/include/ha0ha.ic b/innobase/include/ha0ha.ic index 9d344bca04c..761bc3b20de 100644 --- a/innobase/include/ha0ha.ic +++ b/innobase/include/ha0ha.ic @@ -9,16 +9,6 @@ Created 8/18/1994 Heikki Tuuri #include "ut0rnd.h" #include "mem0mem.h" -/* 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 */ -}; - /*************************************************************** Deletes a hash node. */ diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h index 5d848b85658..f200371de9d 100644 --- a/innobase/include/log0log.h +++ b/innobase/include/log0log.h @@ -431,15 +431,30 @@ log_block_set_data_len( byte* log_block, /* in: log block */ ulint len); /* in: data length */ /**************************************************************** -Gets a log block number stored in the trailer. */ +Calculates the checksum for a log block. */ UNIV_INLINE ulint -log_block_get_trl_no( -/*=================*/ - /* out: log block number stored in the block - trailer */ +log_block_calc_checksum( +/*====================*/ + /* out: checksum */ + byte* block); /* in: log block */ +/**************************************************************** +Gets a log block checksum field value. */ +UNIV_INLINE +ulint +log_block_get_checksum( +/*===================*/ + /* out: checksum */ byte* log_block); /* in: log block */ /**************************************************************** +Sets a log block checksum field value. */ +UNIV_INLINE +void +log_block_set_checksum( +/*===================*/ + byte* log_block, /* in: log block */ + ulint checksum); /* in: checksum */ +/**************************************************************** Gets a log block first mtr log record group offset. */ UNIV_INLINE ulint @@ -497,6 +512,12 @@ log_print( /*======*/ char* buf, /* in/out: buffer where to print */ char* buf_end);/* in: buffer end */ +/************************************************************************** +Refreshes the statistics used to print per-second averages. */ + +void +log_refresh_stats(void); +/*===================*/ extern log_t* log_sys; @@ -544,10 +565,11 @@ extern log_t* log_sys; bytes */ /* Offsets of a log block trailer from the end of the block */ -#define LOG_BLOCK_TRL_CHECKSUM 4 /* 1 byte checksum of the log block - contents */ -#define LOG_BLOCK_TRL_NO 3 /* 3 lowest bytes of the log block - number */ +#define LOG_BLOCK_CHECKSUM 4 /* 4 byte checksum of the log block + contents; in InnoDB versions + < 3.23.52 this did not contain the + checksum but the same value as + .._HDR_NO */ #define LOG_BLOCK_TRL_SIZE 4 /* trailer size in bytes */ /* Offsets for a checkpoint field */ diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic index 36e65239374..8de239df0bd 100644 --- a/innobase/include/log0log.ic +++ b/innobase/include/log0log.ic @@ -170,33 +170,6 @@ log_block_set_checkpoint_no( } /**************************************************************** -Gets a log block number stored in the trailer. */ -UNIV_INLINE -ulint -log_block_get_trl_no( -/*=================*/ - /* out: log block number stored in the block - trailer */ - byte* log_block) /* in: log block */ -{ - return(mach_read_from_3(log_block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_NO)); -} - -/**************************************************************** -Sets the log block number stored in the trailer. */ -UNIV_INLINE -void -log_block_set_trl_no( -/*=================*/ - byte* log_block, /* in: log block */ - ulint n) /* in: log block number */ -{ - mach_write_to_3(log_block + OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_NO, - n & 0xFFFFFF); -} - -/**************************************************************** Converts a lsn to a log block number. */ UNIV_INLINE ulint @@ -217,6 +190,61 @@ log_block_convert_lsn_to_no( } /**************************************************************** +Calculates the checksum for a log block. */ +UNIV_INLINE +ulint +log_block_calc_checksum( +/*====================*/ + /* out: checksum */ + byte* block) /* in: log block */ +{ + ulint sum; + ulint sh; + ulint i; + + sum = 1; + sh = 0; + + for (i = 0; i < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE; i++) { + sum = sum & 0x7FFFFFFF; + sum += (((ulint)(*(block + i))) << sh) + (ulint)(*(block + i)); + sh++; + if (sh > 24) { + sh = 0; + } + } + + return(sum); +} + +/**************************************************************** +Gets a log block checksum field value. */ +UNIV_INLINE +ulint +log_block_get_checksum( +/*===================*/ + /* out: checksum */ + byte* log_block) /* in: log block */ +{ + return(mach_read_from_4(log_block + OS_FILE_LOG_BLOCK_SIZE + - LOG_BLOCK_CHECKSUM)); +} + +/**************************************************************** +Sets a log block checksum field value. */ +UNIV_INLINE +void +log_block_set_checksum( +/*===================*/ + byte* log_block, /* in: log block */ + ulint checksum) /* in: checksum */ +{ + mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE + - LOG_BLOCK_CHECKSUM, + checksum); +} + +/**************************************************************** Initializes a log block in the log buffer. */ UNIV_INLINE void @@ -232,7 +260,6 @@ log_block_init( no = log_block_convert_lsn_to_no(lsn); log_block_set_hdr_no(log_block, no); - log_block_set_trl_no(log_block, no); log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE); log_block_set_first_rec_group(log_block, 0); @@ -256,7 +283,7 @@ log_block_init_in_old_format( log_block_set_hdr_no(log_block, no); mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_NO - 1, no); + - LOG_BLOCK_CHECKSUM, no); log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE); log_block_set_first_rec_group(log_block, 0); } diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 0825325965d..baa2ba50c7d 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -313,6 +313,11 @@ struct recv_sys_struct{ this lsn */ dulint limit_lsn;/* recovery should be made at most up to this lsn */ + ibool found_corrupt_log; + /* this is set to TRUE if we during log + scan find a corrupt log block, or a corrupt + log record, or there is a log parsing + buffer overflow */ log_group_t* archive_group; /* in archive recovery: the log group whose archive is read */ @@ -328,6 +333,8 @@ extern ibool recv_recovery_on; extern ibool recv_no_ibuf_operations; extern ibool recv_needed_recovery; +extern ibool recv_is_making_a_backup; + /* Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many times! */ #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024) diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index b7911c5014a..d65c7fd47e3 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -408,6 +408,12 @@ os_aio_print( char* buf, /* in/out: buffer where to print */ char* buf_end);/* in: buffer end */ /************************************************************************** +Refreshes the statistics used to print per-second averages. */ + +void +os_aio_refresh_stats(void); +/*======================*/ +/************************************************************************** Checks that all slots in the system have been freed, that is, there are no pending io operations. */ diff --git a/innobase/include/os0sync.ic b/innobase/include/os0sync.ic index 6bff75d8ec6..10b85c435e3 100644 --- a/innobase/include/os0sync.ic +++ b/innobase/include/os0sync.ic @@ -27,7 +27,21 @@ os_fast_mutex_trylock( return(0); #else +#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10) + /* Since the hot backup version is standalone, MySQL does not redefine + pthread_mutex_trylock for HP-UX-10.20, and consequently we must invert + the return value here */ + + return((ulint) (1 - pthread_mutex_trylock(fast_mutex))); +#else + /* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock + so that it returns 0 on success. In the operating system + libraries, HP-UX-10.20 follows the old Posix 1003.4a Draft 4 and + returns 1 on success (but MySQL remaps that to 0), while Linux, + FreeBSD, Solaris, AIX, Tru64 Unix, HP-UX-11.0 return 0 on success. */ + return((ulint) pthread_mutex_trylock(fast_mutex)); #endif +#endif } diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h index 0d6fa5a8f37..636cfd79e50 100644 --- a/innobase/include/os0thread.h +++ b/innobase/include/os0thread.h @@ -28,12 +28,30 @@ typedef void* os_thread_t; #else typedef pthread_t os_thread_t; #endif -typedef unsigned long int os_thread_id_t; + +#define os_thread_id_t os_thread_t /* Define a function pointer type to use in a typecast */ typedef void* (*os_posix_f_t) (void*); +/******************************************************************* +Compares two threads or thread ids for equality */ + +ibool +os_thread_eq( +/*=========*/ + /* out: TRUE if equal */ + os_thread_t a, /* in: OS thread or thread id */ + os_thread_t b); /* in: OS thread or thread id */ +/******************************************************************** +Converts an OS thread or thread id to a ulint. It is NOT guaranteed that +the ulint is unique for the thread though! */ +ulint +os_thread_pf( +/*=========*/ + /* out: unsigned long int */ + os_thread_t a); /* in: thread or thread id */ /******************************************************************** Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter @@ -73,14 +91,6 @@ os_thread_t os_thread_get_curr(void); /*====================*/ /********************************************************************* -Converts a thread id to a ulint. */ - -ulint -os_thread_conv_id_to_ulint( -/*=======================*/ - /* out: converted to ulint */ - os_thread_id_t id); /* in: thread id */ -/********************************************************************* Waits for a thread to terminate. */ void diff --git a/innobase/include/srv0start.h b/innobase/include/srv0start.h index 01ac063e1c9..646d2c1bb06 100644 --- a/innobase/include/srv0start.h +++ b/innobase/include/srv0start.h @@ -85,7 +85,7 @@ extern ibool srv_is_being_shut_down; /* At a shutdown the value first climbs from 0 to SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE */ -extern ulint srv_shutdown_state; +extern ulint srv_shutdown_state; #define SRV_SHUTDOWN_CLEANUP 1 #define SRV_SHUTDOWN_LAST_PHASE 2 diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic index 43e9202360b..36ef0a985ed 100644 --- a/innobase/include/sync0rw.ic +++ b/innobase/include/sync0rw.ic @@ -312,7 +312,8 @@ rw_lock_x_lock_func_nowait( && ((rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) || ((rw_lock_get_writer(lock) == RW_LOCK_EX) && (lock->pass == 0) - && (lock->writer_thread == os_thread_get_curr_id())))) { + && os_thread_eq(lock->writer_thread, + os_thread_get_curr_id())))) { rw_lock_set_writer(lock, RW_LOCK_EX); lock->writer_thread = os_thread_get_curr_id(); diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic index 9014eb5fb54..c11cc0d196e 100644 --- a/innobase/include/sync0sync.ic +++ b/innobase/include/sync0sync.ic @@ -104,6 +104,10 @@ mutex_test_and_set( ret = os_fast_mutex_trylock(&(mutex->os_fast_mutex)); if (ret == 0) { + /* We check that os_fast_mutex_trylock does not leak + and allow race conditions */ + ut_a(mutex->lock_word == 0); + mutex->lock_word = 1; } diff --git a/innobase/include/trx0sys.h b/innobase/include/trx0sys.h index b08df7f6901..a54a6424a4f 100644 --- a/innobase/include/trx0sys.h +++ b/innobase/include/trx0sys.h @@ -257,6 +257,15 @@ void trx_sys_print_mysql_binlog_offset(void); /*===================================*/ /********************************************************************* +Prints to stdout the MySQL binlog info in the system header if the +magic number shows it valid. */ + +void +trx_sys_print_mysql_binlog_offset_from_page( +/*========================================*/ + byte* page); /* in: buffer containing the trx system header page, + i.e., page number TRX_SYS_PAGE_NO in the tablespace */ +/********************************************************************* Prints to stderr the MySQL master log offset info in the trx system header if the magic number shows it valid. */ @@ -300,11 +309,11 @@ therefore 256; each slot is currently 8 bytes in size */ #define TRX_SYS_MYSQL_LOG_NAME_LEN 512 #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344 -/* The offset of the MySQL replication info on the trx system header page; +/* The offset of the MySQL replication info in the trx system header; this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ #define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000) -/* The offset of the MySQL binlog offset info on the trx system header page */ +/* The offset of the MySQL binlog offset info in the trx system header */ #define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000) #define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD 0 /* magic number which shows if we have valid data in the diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 83789966514..6e98f22c34b 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -309,6 +309,9 @@ struct trx_struct{ of view of concurrency control: TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY, ... */ + time_t start_time; /* time the trx object was created + or the state last time became + TRX_ACTIVE */ ibool check_foreigns; /* normally TRUE, but if the user wants to suppress foreign key checks, (in table imports, for example) we @@ -468,6 +471,7 @@ struct trx_struct{ TRX_QUE_LOCK_WAIT, this points to the lock request, otherwise this is NULL */ + time_t wait_started; /* lock wait started at this time */ UT_LIST_BASE_NODE_T(que_thr_t) wait_thrs; /* query threads belonging to this trx that are in the QUE_THR_LOCK_WAIT diff --git a/innobase/include/univ.i b/innobase/include/univ.i index c852741d5ac..a4f29dc4cf3 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -80,8 +80,8 @@ memory is read outside the allocated blocks. */ /* #define UNIV_DEBUG -#define UNIV_MEM_DEBUG #define UNIV_SYNC_DEBUG +#define UNIV_MEM_DEBUG #define UNIV_IBUF_DEBUG #define UNIV_SEARCH_DEBUG @@ -116,7 +116,7 @@ memory is read outside the allocated blocks. */ #define UNIV_INLINE extern inline #else /* extern inline doesn't work with gcc 3.0.2 */ -#define UNIV_INLINE static inline +#define UNIV_INLINE static inline #endif #endif @@ -204,8 +204,12 @@ headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */ #endif /* The following number as the length of a logical field means that the field -has the SQL NULL as its value. */ -#define UNIV_SQL_NULL ULINT_UNDEFINED +has the SQL NULL as its value. NOTE that because we assume that the length +of a field is a 32-bit integer when we store it, for example, to an undo log +on disk, we must have also this number fit in 32 bits, also in 64-bit +computers! */ + +#define UNIV_SQL_NULL ULINT32_UNDEFINED /* Lengths which are not UNIV_SQL_NULL, but bigger than the following number indicate that a field contains a reference to an externally diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h index fc5d493ca5e..3407483696c 100644 --- a/innobase/include/ut0dbg.h +++ b/innobase/include/ut0dbg.h @@ -26,9 +26,11 @@ extern ulint* ut_dbg_null_ptr; ulint dbg_i;\ \ if (!((ulint)(EXPR) + ut_dbg_zero)) {\ + ut_print_timestamp(stderr);\ fprintf(stderr,\ - "InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\ - os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\ + " InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\ + os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\ + (ulint)__LINE__);\ fprintf(stderr,\ "InnoDB: We intentionally generate a memory trap.\n");\ fprintf(stderr,\ @@ -42,16 +44,17 @@ extern ulint* ut_dbg_null_ptr; if (ut_dbg_stop_threads) {\ fprintf(stderr,\ "InnoDB: Thread %lu stopped in file %s line %lu\n",\ - os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\ + os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\ os_thread_sleep(1000000000);\ }\ } #define ut_error {\ ulint dbg_i;\ + ut_print_timestamp(stderr);\ fprintf(stderr,\ - "InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\ - os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\ + " InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\ + os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\ fprintf(stderr,\ "InnoDB: We intentionally generate a memory trap.\n");\ fprintf(stderr,\ |