diff options
author | unknown <heikki@hundin.mysql.fi> | 2002-07-31 00:47:20 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2002-07-31 00:47:20 +0300 |
commit | 39ee64cd7e7504b7958953b554c8eccf87c7e754 (patch) | |
tree | c292c07f8ce5669e3036ef6b705c347df3e64c0c /innobase | |
parent | da35a07477a643beea0c1335fbf4fcf72ea9e333 (diff) | |
download | mariadb-git-39ee64cd7e7504b7958953b554c8eccf87c7e754.tar.gz |
Many files:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
sql/ha_innobase.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
sql/ha_innobase.cc:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/buf/buf0buf.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/dict/dict0dict.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/fil/fil0fil.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/fsp/fsp0fsp.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/ha/ha0ha.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/dict0dict.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/dict0mem.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/dyn0dyn.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/fsp0fsp.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/log0log.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/log0recv.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/trx0sys.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/trx0trx.h:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/include/log0log.ic:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/lock/lock0lock.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/log/log0log.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/log/log0recv.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/mem/mem0dbg.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/row/row0mysql.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/srv/srv0srv.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/srv/srv0start.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/trx/trx0sys.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
innobase/trx/trx0trx.c:
Merge InnoDB-3.23.52c; improve AUTO-INC algorithm with SHOW TABLE STATUS; new checksum in log
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/buf/buf0buf.c | 22 | ||||
-rw-r--r-- | innobase/dict/dict0dict.c | 39 | ||||
-rw-r--r-- | innobase/fil/fil0fil.c | 2 | ||||
-rw-r--r-- | innobase/fsp/fsp0fsp.c | 30 | ||||
-rw-r--r-- | innobase/ha/ha0ha.c | 9 | ||||
-rw-r--r-- | innobase/include/dict0dict.h | 20 | ||||
-rw-r--r-- | innobase/include/dict0mem.h | 4 | ||||
-rw-r--r-- | innobase/include/dyn0dyn.h | 4 | ||||
-rw-r--r-- | innobase/include/fsp0fsp.h | 10 | ||||
-rw-r--r-- | innobase/include/log0log.h | 34 | ||||
-rw-r--r-- | innobase/include/log0log.ic | 85 | ||||
-rw-r--r-- | innobase/include/log0recv.h | 6 | ||||
-rw-r--r-- | innobase/include/trx0sys.h | 13 | ||||
-rw-r--r-- | innobase/include/trx0trx.h | 4 | ||||
-rw-r--r-- | innobase/lock/lock0lock.c | 9 | ||||
-rw-r--r-- | innobase/log/log0log.c | 20 | ||||
-rw-r--r-- | innobase/log/log0recv.c | 167 | ||||
-rw-r--r-- | innobase/mem/mem0dbg.c | 2 | ||||
-rw-r--r-- | innobase/row/row0mysql.c | 5 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 13 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 28 | ||||
-rw-r--r-- | innobase/trx/trx0sys.c | 28 | ||||
-rw-r--r-- | innobase/trx/trx0trx.c | 64 |
23 files changed, 434 insertions, 184 deletions
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 80e89e16588..e3a4ae50a23 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -1707,10 +1707,11 @@ buf_print(void) mutex_enter(&(buf_pool->mutex)); - printf("LRU len %lu \n", UT_LIST_GET_LEN(buf_pool->LRU)); - printf("free len %lu \n", UT_LIST_GET_LEN(buf_pool->free)); - printf("flush len %lu \n", UT_LIST_GET_LEN(buf_pool->flush_list)); printf("buf_pool size %lu \n", size); + printf("database pages %lu \n", UT_LIST_GET_LEN(buf_pool->LRU)); + printf("free pages %lu \n", UT_LIST_GET_LEN(buf_pool->free)); + printf("modified database pages %lu \n", + UT_LIST_GET_LEN(buf_pool->flush_list)); printf("n pending reads %lu \n", buf_pool->n_pend_reads); @@ -1819,13 +1820,20 @@ buf_print_io( mutex_enter(&(buf_pool->mutex)); buf += sprintf(buf, - "Free list length %lu \n", UT_LIST_GET_LEN(buf_pool->free)); + "Buffer pool size %lu\n", size); + buf += sprintf(buf, + "Free buffers %lu\n", UT_LIST_GET_LEN(buf_pool->free)); + buf += sprintf(buf, + "Database pages %lu\n", UT_LIST_GET_LEN(buf_pool->LRU)); +/* + buf += sprintf(buf, + "Lock heap buffers %lu\n", buf_pool->n_lock_heap_pages); buf += sprintf(buf, - "LRU list length %lu \n", UT_LIST_GET_LEN(buf_pool->LRU)); + "Hash index buffers %lu\n", buf_pool->n_adaptive_hash_pages); +*/ buf += sprintf(buf, - "Flush list length %lu \n", + "Modified db pages %lu\n", UT_LIST_GET_LEN(buf_pool->flush_list)); - buf += sprintf(buf, "Buffer pool size %lu\n", size); buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 9ed1d088290..65f40d345d8 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -261,7 +261,7 @@ dict_table_get_index_noninline( { return(dict_table_get_index(table, name)); } - + /************************************************************************ Initializes the autoinc counter. It is not an error to initialize an already initialized counter. */ @@ -270,7 +270,7 @@ 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 */ { mutex_enter(&(table->autoinc_mutex)); @@ -281,8 +281,8 @@ dict_table_autoinc_initialize( } /************************************************************************ -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( @@ -298,8 +298,8 @@ dict_table_autoinc_get( value = 0; } else { - table->autoinc = table->autoinc + 1; value = table->autoinc; + table->autoinc = table->autoinc + 1; } mutex_exit(&(table->autoinc_mutex)); @@ -334,20 +334,43 @@ dict_table_autoinc_read( } /************************************************************************ -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 */ +{ + ib_longlong value; + + if (!table->autoinc_inited) { + + value = 0; + } else { + value = table->autoinc; + } + + return(value); +} + +/************************************************************************ +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 */ { mutex_enter(&(table->autoinc_mutex)); if (table->autoinc_inited) { - if (value > table->autoinc) { - table->autoinc = value; + if (value >= table->autoinc) { + table->autoinc = value + 1; } } diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 910ca842f21..29bd52ff94f 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -578,7 +578,7 @@ fil_read_flushed_lsn_and_arch_log_no( ulint arch_log_no; buf2 = ut_malloc(2 * UNIV_PAGE_SIZE); - /* Align the memory for a possibel read from a raw device */ + /* Align the memory for a possible read from a raw device */ buf = ut_align(buf2, UNIV_PAGE_SIZE); os_file_read(data_file, buf, 0, 0, UNIV_PAGE_SIZE); diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index d78db2a5ea8..679af640b99 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -933,6 +933,36 @@ fsp_header_get_free_limit( return(limit); } +/************************************************************************** +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 */ +{ + fsp_header_t* header; + ulint size; + mtr_t mtr; + + ut_a(space == 0); /* We have only one log_fsp_current_... variable */ + + mtr_start(&mtr); + + mtr_x_lock(fil_space_get_latch(space), &mtr); + + header = fsp_get_space_header(space, &mtr); + + size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, &mtr); + + mtr_commit(&mtr); + + return(size); +} + /*************************************************************************** Tries to extend the last data file file if it is defined as auto-extending. */ static diff --git a/innobase/ha/ha0ha.c b/innobase/ha/ha0ha.c index c3ad6cdca76..acde236bb2f 100644 --- a/innobase/ha/ha0ha.c +++ b/innobase/ha/ha0ha.c @@ -335,6 +335,11 @@ ha_print_info( } } - buf += sprintf(buf, "Hash table size %lu, used cells %lu\n", - hash_get_n_cells(table), cells); + buf += sprintf(buf, +"Hash table size %lu, used cells %lu", hash_get_n_cells(table), cells); + + if (table->heaps == NULL && table->heap != NULL) { + buf += sprintf(buf, +", node heap has %lu buffer(s)\n", UT_LIST_GET_LEN(table->heap->base)); + } } 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..504aade29d2 100644 --- a/innobase/include/dyn0dyn.h +++ b/innobase/include/dyn0dyn.h @@ -17,7 +17,9 @@ 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 /************************************************************************* 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/log0log.h b/innobase/include/log0log.h index 5d848b85658..4358577c59c 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 @@ -544,10 +559,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..9167246fe45 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; + 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..65f80deee93 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -313,6 +313,10 @@ 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 */ log_group_t* archive_group; /* in archive recovery: the log group whose archive is read */ @@ -328,6 +332,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/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/lock/lock0lock.c b/innobase/lock/lock0lock.c index f7ba49004d7..ea035dbdeb0 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -1565,6 +1565,7 @@ index->table_name); } trx->que_state = TRX_QUE_LOCK_WAIT; + trx->wait_started = time(NULL); ut_a(que_thr_stop(thr)); @@ -2961,6 +2962,7 @@ table->name); } trx->que_state = TRX_QUE_LOCK_WAIT; + trx->wait_started = time(NULL); ut_a(que_thr_stop(thr)); @@ -3503,6 +3505,10 @@ lock_print_info( return; } + buf += sprintf(buf, "Number of sessions %lu\n", + UT_LIST_GET_LEN(trx_sys->mysql_trx_list) + + UT_LIST_GET_LEN(trx_sys->trx_list)); + buf += sprintf(buf, "Trx id counter %lu %lu\n", ut_dulint_get_high(trx_sys->max_trx_id), ut_dulint_get_low(trx_sys->max_trx_id)); @@ -3587,7 +3593,8 @@ loop: if (trx->que_state == TRX_QUE_LOCK_WAIT) { buf += sprintf(buf, - "------------------TRX IS WAITING FOR THE LOCK:\n"); + "------- TRX HAS BEEN WAITING %lu SEC FOR THIS LOCK TO BE GRANTED:\n", + (ulint)difftime(time(NULL), trx->wait_started)); if (lock_get_type(trx->wait_lock) == LOCK_REC) { lock_rec_print(buf, trx->wait_lock); diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 9d79c19a586..644d53ac273 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -270,7 +270,7 @@ part_loop: log->lsn = ut_dulint_add(log->lsn, len); - /* Initialize the next block header and trailer */ + /* Initialize the next block header */ log_block_init(log_block + OS_FILE_LOG_BLOCK_SIZE, log->lsn); } else { log->lsn = ut_dulint_add(log->lsn, len); @@ -1070,28 +1070,16 @@ log_group_file_header_flush( } /********************************************************** -Stores a 1-byte checksum to the trailer checksum field of a log block +Stores a 4-byte checksum to the trailer checksum field of a log block before writing it to a log file. This checksum is used in recovery to -check the consistency of a log block. The checksum is simply the 8 low -bits of 1 + the sum of the bytes in the log block except the trailer bytes. */ +check the consistency of a log block. */ static void log_block_store_checksum( /*=====================*/ byte* block) /* in/out: pointer to a log block */ { - ulint i; - ulint sum; - - sum = 1; - - for (i = 0; i < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE; i++) { - sum += (ulint)(*(block + i)); - } - - mach_write_to_1(block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_CHECKSUM, - 0xFF & sum); + log_block_set_checksum(block, log_block_calc_checksum(block)); } /********************************************************** diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 53f75c176ea..62031005e05 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -63,7 +63,7 @@ log scan */ ulint recv_scan_print_counter = 0; ibool recv_is_from_backup = FALSE; - +ibool recv_is_making_a_backup = FALSE; /************************************************************ Creates the recovery system. */ @@ -124,6 +124,8 @@ recv_sys_init( recv_sys->last_block = ut_align(recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE); + recv_sys->found_corrupt_log = FALSE; + mutex_exit(&(recv_sys->mutex)); } @@ -569,9 +571,9 @@ recv_read_cp_info_for_backup( } /********************************************************** -Checks the 1-byte checksum to the trailer checksum field of a log block. -We also accept a log block in the old format where the checksum field -contained the highest byte of the log block number. */ +Checks the 4-byte checksum to the trailer checksum field of a log block. +We also accept a log block in the old format < InnoDB-3.23.52 where the +checksum field contains the log block number. */ static ibool log_block_checksum_is_ok_or_old_format( @@ -580,29 +582,12 @@ log_block_checksum_is_ok_or_old_format( format of InnoDB version < 3.23.52 */ byte* block) /* in: pointer to a log block */ { - ulint i; - ulint sum; - - sum = 1; - - for (i = 0; i < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE; i++) { - sum += (ulint)(*(block + i)); - } - -/* printf("Checksum %lu, byte %lu\n", 0xFF & sum, - mach_read_from_1(block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_CHECKSUM)); -*/ - if (mach_read_from_1(block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_CHECKSUM) - == (0xFF & sum)) { + if (log_block_calc_checksum(block) == log_block_get_checksum(block)) { return(TRUE); } - if (((0xFF000000 & log_block_get_hdr_no(block)) >> 24) - == mach_read_from_1(block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_CHECKSUM)) { + if (log_block_get_hdr_no(block) == log_block_get_checksum(block)) { /* We assume the log block is in the format of InnoDB version < 3.23.52 and the block is ok */ @@ -649,23 +634,20 @@ recv_scan_log_seg_for_backup( /* fprintf(stderr, "Log block header no %lu\n", no); */ - if ((no & 0xFFFFFF) != log_block_get_trl_no(log_block) - || no != log_block_convert_lsn_to_no(*scanned_lsn) + if (no != log_block_convert_lsn_to_no(*scanned_lsn) || !log_block_checksum_is_ok_or_old_format(log_block)) { /* printf( -"Log block n:o %lu, trailer n:o %lu, scanned lsn n:o %lu\n", - no, log_block_get_trl_no(log_block), - log_block_convert_lsn_to_no(*scanned_lsn)); +"Log block n:o %lu, scanned lsn n:o %lu\n", + no, log_block_convert_lsn_to_no(*scanned_lsn)); */ /* Garbage or an incompletely written log block */ log_block += OS_FILE_LOG_BLOCK_SIZE; /* printf( -"Next log block n:o %lu, trailer n:o %lu\n", - log_block_get_hdr_no(log_block), - log_block_get_trl_no(log_block)); +"Next log block n:o %lu\n", + log_block_get_hdr_no(log_block)); */ break; } @@ -713,7 +695,7 @@ byte* recv_parse_or_apply_log_rec_body( /*=============================*/ /* out: log record end, NULL if not a complete - record */ + record, or a corrupt record */ byte type, /* in: type */ byte* ptr, /* in: pointer to a buffer */ byte* end_ptr,/* in: pointer to the buffer end */ @@ -794,8 +776,11 @@ recv_parse_or_apply_log_rec_body( "InnoDB: is possible that the log scan did not proceed\n" "InnoDB: far enough in recovery. Please run CHECK TABLE\n" "InnoDB: on your InnoDB tables to check that they are ok!\n" - "InnoDB: Corrupt log record type %lu\n", - (ulint)type); + "InnoDB: Corrupt log record type %lu\n, lsn %lu %lu\n", + (ulint)type, ut_dulint_get_high(recv_sys->recovered_lsn), + ut_dulint_get_low(recv_sys->recovered_lsn)); + + recv_sys->found_corrupt_log = TRUE; } ut_ad(!page || new_ptr); @@ -1399,18 +1384,30 @@ recv_apply_log_recs_for_backup( OS_FILE_OPEN, OS_FILE_READ_WRITE, &success); - ut_a(success); + if (!success) { + printf( +"InnoDB: Error: cannot open %lu'th data file %s\n", nth_file); + + exit(1); + } } recv_addr = recv_get_fil_addr_struct(0, i); if (recv_addr != NULL) { - os_file_read(data_file, page, + success = os_file_read(data_file, page, (nth_page_in_file << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFF, nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT), UNIV_PAGE_SIZE); + if (!success) { + printf( +"InnoDB: Error: cannot read page no %lu from %lu'th data file %s\n", + nth_page_in_file, nth_file); + exit(1); + } + /* We simulate a page read made by the buffer pool, to make sure recovery works ok. We must init the block corresponding to buf_pool->frame_zero @@ -1425,12 +1422,19 @@ recv_apply_log_recs_for_backup( mach_read_from_8(page + FIL_PAGE_LSN), 0, i); - os_file_write(data_files[nth_file], + success = os_file_write(data_files[nth_file], data_file, page, (nth_page_in_file << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFF, nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT), UNIV_PAGE_SIZE); + if (!success) { + printf( +"InnoDB: Error: cannot write page no %lu to %lu'th data file %s\n", + nth_page_in_file, nth_file); + + exit(1); + } } if ((100 * i) / n_pages_total @@ -1647,7 +1651,7 @@ ulint recv_parse_log_rec( /*===============*/ /* out: length of the record, or 0 if the record was - not complete */ + not complete or it was corrupt */ byte* ptr, /* in: pointer to a buffer */ byte* end_ptr,/* in: pointer to the buffer end */ byte* type, /* out: type */ @@ -1679,16 +1683,8 @@ recv_parse_log_rec( new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, page_no); - - /* If the operating system writes to the log complete 512-byte - blocks, we should not get the warnings below in recovery. - A warning means that the header and the trailer appeared ok - in a 512-byte block, but in the middle there was something wrong. - TODO: (1) add similar warnings in the case there is an incompletely - written log record which does not extend to the boundary of a - 512-byte block. (2) Add a checksum to a log block. */ - if (!new_ptr) { + return(0); } @@ -1696,12 +1692,17 @@ recv_parse_log_rec( if (*space != 0 || *page_no > 0x8FFFFFFF) { fprintf(stderr, - "InnoDB: WARNING: the log file may have been corrupt and it\n" - "InnoDB: is possible that the log scan did not proceed\n" - "InnoDB: far enough in recovery. Please run CHECK TABLE\n" - "InnoDB: on your InnoDB tables to check that they are ok!\n" - "InnoDB: Corrupt log record type %lu, space id %lu, page no %lu\n", - (ulint)(*type), *space, *page_no); + "InnoDB: WARNING: the log file may have been corrupt and it\n" + "InnoDB: is possible that the log scan did not proceed\n" + "InnoDB: far enough in recovery. Please run CHECK TABLE\n" + "InnoDB: on your InnoDB tables to check that they are ok!\n" + "InnoDB: Corrupt log record type %lu, space id %lu, page no %lu\n", + "InnoDB: lsn %lu %lu\n", + (ulint)(*type), *space, *page_no, + ut_dulint_get_high(recv_sys->recovered_lsn), + ut_dulint_get_low(recv_sys->recovered_lsn)); + + recv_sys->found_corrupt_log = TRUE; return(0); } @@ -1790,6 +1791,7 @@ recv_parse_log_recs( ulint page_no; byte* body; ulint n_recs; + char err_buf[2500]; ut_ad(mutex_own(&(log_sys->mutex))); ut_ad(!ut_dulint_is_zero(recv_sys->parse_start_lsn)); @@ -1813,7 +1815,18 @@ loop: len = recv_parse_log_rec(ptr, end_ptr, &type, &space, &page_no, &body); if (len == 0) { - + if (recv_sys->found_corrupt_log) { + + ut_sprintf_buf(err_buf, + recv_sys->buf + ut_calc_align_down( + recv_sys->recovered_offset, + OS_FILE_LOG_BLOCK_SIZE) - 8, + OS_FILE_LOG_BLOCK_SIZE + 16); + + fprintf(stderr, +"InnoDB: hex dump of a corrupt log segment: %s\n", err_buf); + } + return(FALSE); } @@ -1851,9 +1864,10 @@ loop: #ifdef UNIV_LOG_DEBUG recv_check_incomplete_log_recs(ptr, len); #endif - recv_update_replicate(type, space, page_no, body, +/* recv_update_replicate(type, space, page_no, body, ptr + len); recv_compare_replicate(space, page_no); +*/ } } else { /* Check that all the records associated with the single mtr @@ -1867,7 +1881,18 @@ loop: &page_no, &body); if (len == 0) { - return(FALSE); + if (recv_sys->found_corrupt_log) { + ut_sprintf_buf(err_buf, + recv_sys->buf + ut_calc_align_down( + recv_sys->recovered_offset, + OS_FILE_LOG_BLOCK_SIZE) - 8, + OS_FILE_LOG_BLOCK_SIZE + 16); + + fprintf(stderr, +"InnoDB: hex dump of a corrupt log segment: %s\n", err_buf); + } + + return(FALSE); } if ((!store_to_hash) && (type != MLOG_MULTI_REC_END)) { @@ -1876,8 +1901,10 @@ loop: #ifdef UNIV_LOG_DEBUG recv_check_incomplete_log_recs(ptr, len); #endif +/* recv_update_replicate(type, space, page_no, body, ptr + len); +*/ } if (log_debug_writes) { @@ -1941,7 +1968,7 @@ loop: page has become identical with the original page */ - recv_compare_replicate(space, page_no); +/* recv_compare_replicate(space, page_no); */ } ptr += len; @@ -2095,32 +2122,19 @@ recv_scan_log_recs( /* fprintf(stderr, "Log block header no %lu\n", no); */ - if ((no & 0xFFFFFF) != log_block_get_trl_no(log_block) - || no != log_block_convert_lsn_to_no(scanned_lsn) + if (no != log_block_convert_lsn_to_no(scanned_lsn) || !log_block_checksum_is_ok_or_old_format(log_block)) { - if ((no & 0xFFFFFF) == log_block_get_trl_no(log_block) - && no == log_block_convert_lsn_to_no(scanned_lsn) + if (no == log_block_convert_lsn_to_no(scanned_lsn) && !log_block_checksum_is_ok_or_old_format( log_block)) { fprintf(stderr, "InnoDB: Log block no %lu at lsn %lu %lu has\n" -"InnoDB: ok header and trailer, but checksum field contains %lu\n", - no, ut_dulint_get_high(scanned_lsn), - ut_dulint_get_low(scanned_lsn), - mach_read_from_1(log_block - + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_TRL_CHECKSUM)); - } - - if ((no & 0xFFFFFF) - != log_block_get_trl_no(log_block)) { - fprintf(stderr, -"InnoDB: Log block with header no %lu at lsn %lu %lu has\n" -"InnoDB: trailer no %lu\n", +"InnoDB: ok header, but checksum field contains %lu, should be %lu\n", no, ut_dulint_get_high(scanned_lsn), ut_dulint_get_low(scanned_lsn), - log_block_get_trl_no(log_block)); + log_block_get_checksum(log_block), + log_block_calc_checksum(log_block)); } /* Garbage or an incompletely written log block */ @@ -2213,7 +2227,8 @@ recv_scan_log_recs( *group_scanned_lsn = scanned_lsn; - if (recv_needed_recovery || recv_is_from_backup) { + if (recv_needed_recovery + || (recv_is_from_backup && !recv_is_making_a_backup)) { recv_scan_print_counter++; if (finished || (recv_scan_print_counter % 80 == 0)) { diff --git a/innobase/mem/mem0dbg.c b/innobase/mem/mem0dbg.c index f8f62dffa8b..6bedbd40fef 100644 --- a/innobase/mem/mem0dbg.c +++ b/innobase/mem/mem0dbg.c @@ -666,7 +666,7 @@ mem_print_info_low( mem_pool_print_info(outfile, mem_comm_pool); - mem_validate(); +/* mem_validate(); */ /* fclose(outfile); */ #endif diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 529007dfb26..bb33f7c1485 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -595,6 +595,11 @@ row_lock_table_autoinc_for_mysql( ut_ad(trx); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); + if (trx->auto_inc_lock) { + + return(DB_SUCCESS); + } + trx->op_info = "setting auto-inc lock"; if (node == NULL) { diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 80de52dc4a1..3af2d96d921 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -2475,12 +2475,23 @@ srv_error_monitor_thread( void* arg) /* in: a dummy parameter required by os_thread_create */ { + ulint cnt = 0; + UT_NOT_USED(arg); loop: srv_error_monitor_active = TRUE; - os_thread_sleep(10000000); + cnt++; + + os_thread_sleep(2000000); + +/* mem_print_new_info(); + + if (cnt % 10 == 0) { + mem_print_info(); + } +*/ sync_array_print_long_waits(); /* Flush stdout and stderr so that a database user gets their output diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 9768d484ce6..b35bca1ea8e 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -927,6 +927,8 @@ innobase_start_or_create_for_mysql(void) ulint max_arch_log_no; ibool start_archive; ulint sum_of_new_sizes; + ulint sum_of_data_file_sizes; + ulint tablespace_size_in_header; ulint err; ulint i; ulint k; @@ -1324,7 +1326,33 @@ innobase_start_or_create_for_mysql(void) os_thread_create(&srv_master_thread, NULL, thread_ids + 1 + SRV_MAX_N_IO_THREADS); /* buf_debug_prints = TRUE; */ + + sum_of_data_file_sizes = 0; + for (i = 0; i < srv_n_data_files; i++) { + sum_of_data_file_sizes += srv_data_file_sizes[i]; + } + + tablespace_size_in_header = fsp_header_get_tablespace_size(0); + + if (!srv_auto_extend_last_data_file + && sum_of_data_file_sizes != tablespace_size_in_header) { + + fprintf(stderr, +"InnoDB: Error: tablespace size stored in header is %lu pages, but\n" +"InnoDB: the sum of data file sizes is %lu pages\n", + tablespace_size_in_header, sum_of_data_file_sizes); + } + + if (srv_auto_extend_last_data_file + && sum_of_data_file_sizes < tablespace_size_in_header) { + + fprintf(stderr, +"InnoDB: Error: tablespace size stored in header is %lu pages, but\n" +"InnoDB: the sum of data file sizes is only %lu pages\n", + tablespace_size_in_header, sum_of_data_file_sizes); + } + ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Started\n"); diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c index 675cdf1b7e4..33c962772e8 100644 --- a/innobase/trx/trx0sys.c +++ b/innobase/trx/trx0sys.c @@ -494,6 +494,34 @@ trx_sys_update_mysql_binlog_offset( } /********************************************************************* +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 */ +{ + trx_sysf_t* sys_header; + + sys_header = page + TRX_SYS; + + if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO + + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) + == TRX_SYS_MYSQL_LOG_MAGIC_N) { + + printf( + "ibbackup: Last MySQL binlog file position %lu %lu, file name %s\n", + mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO + + TRX_SYS_MYSQL_LOG_OFFSET_HIGH), + mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO + + TRX_SYS_MYSQL_LOG_OFFSET_LOW), + sys_header + TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME); + } +} + +/********************************************************************* Prints to stderr the MySQL binlog offset info in the trx system header if the magic number shows it valid. */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index c2d99424d33..9c8bfc9f4db 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -72,6 +72,7 @@ trx_create( trx->type = TRX_USER; trx->conc_state = TRX_NOT_STARTED; + trx->start_time = time(NULL); trx->check_foreigns = TRUE; trx->check_unique_secondary = TRUE; @@ -516,6 +517,7 @@ trx_start_low( if (trx->type == TRX_PURGE) { trx->id = ut_dulint_zero; trx->conc_state = TRX_ACTIVE; + trx->start_time = time(NULL); return(TRUE); } @@ -539,6 +541,7 @@ trx_start_low( trx->rseg = rseg; trx->conc_state = TRX_ACTIVE; + trx->start_time = time(NULL); UT_LIST_ADD_FIRST(trx_list, trx_sys->trx_list, trx); @@ -1465,45 +1468,57 @@ trx_print( 500 bytes */ trx_t* trx) /* in: transaction */ { - buf += sprintf(buf, "TRANSACTION %lu %lu, OS thread id %lu", + char* start_of_line; + + buf += sprintf(buf, "TRANSACTION %lu %lu", ut_dulint_get_high(trx->id), - ut_dulint_get_low(trx->id), - (ulint)trx->mysql_thread_id); + ut_dulint_get_low(trx->id)); - if (ut_strlen(trx->op_info) > 0) { - buf += sprintf(buf, " %s", trx->op_info); - } - - if (trx->type != TRX_USER) { - buf += sprintf(buf, " purge trx"); - } - switch (trx->conc_state) { case TRX_NOT_STARTED: buf += sprintf(buf, ", not started"); break; case TRX_ACTIVE: buf += sprintf(buf, - ", active"); break; + ", ACTIVE %lu sec", + (ulint)difftime(time(NULL), trx->start_time)); break; case TRX_COMMITTED_IN_MEMORY: buf += sprintf(buf, - ", committed in memory"); + ", COMMITTED IN MEMORY"); break; default: buf += sprintf(buf, " state %lu", trx->conc_state); } + buf += sprintf(buf, ", OS thread id %lu", + (ulint)trx->mysql_thread_id); + + if (ut_strlen(trx->op_info) > 0) { + buf += sprintf(buf, " %s", trx->op_info); + } + + if (trx->type != TRX_USER) { + buf += sprintf(buf, " purge trx"); + } + + buf += sprintf(buf, "\n"); + + start_of_line = buf; + switch (trx->que_state) { - case TRX_QUE_RUNNING: buf += sprintf(buf, - ", runs or sleeps"); break; + case TRX_QUE_RUNNING: break; case TRX_QUE_LOCK_WAIT: buf += sprintf(buf, - ", lock wait"); break; + "LOCK WAIT "); break; case TRX_QUE_ROLLING_BACK: buf += sprintf(buf, - ", rolling back"); break; + "ROLLING BACK "); break; case TRX_QUE_COMMITTING: buf += sprintf(buf, - ", committing"); break; - default: buf += sprintf(buf, " que state %lu", trx->que_state); + "COMMITTING "); break; + default: buf += sprintf(buf, "que state %lu", trx->que_state); } - if (0 < UT_LIST_GET_LEN(trx->trx_locks)) { - buf += sprintf(buf, ", has %lu lock struct(s)", - UT_LIST_GET_LEN(trx->trx_locks)); + if (0 < UT_LIST_GET_LEN(trx->trx_locks) || + mem_heap_get_size(trx->lock_heap) > 400) { + + buf += sprintf(buf, +"%lu lock struct(s), heap size %lu", + UT_LIST_GET_LEN(trx->trx_locks), + mem_heap_get_size(trx->lock_heap)); } if (trx->has_search_latch) { @@ -1515,7 +1530,10 @@ trx_print( ut_dulint_get_low(trx->undo_no)); } - buf += sprintf(buf, "\n"); + if (buf != start_of_line) { + + buf += sprintf(buf, "\n"); + } if (trx->mysql_thd != NULL) { innobase_mysql_print_thd(buf, trx->mysql_thd); |