summaryrefslogtreecommitdiff
path: root/innobase/trx
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-07-31 00:47:20 +0300
committerunknown <heikki@hundin.mysql.fi>2002-07-31 00:47:20 +0300
commit39ee64cd7e7504b7958953b554c8eccf87c7e754 (patch)
treec292c07f8ce5669e3036ef6b705c347df3e64c0c /innobase/trx
parentda35a07477a643beea0c1335fbf4fcf72ea9e333 (diff)
downloadmariadb-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/trx')
-rw-r--r--innobase/trx/trx0sys.c28
-rw-r--r--innobase/trx/trx0trx.c64
2 files changed, 69 insertions, 23 deletions
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);