bk commit into 4.1 tree (marko:1.2198) BUG#5436 -
04-19-2005
, 07:24 AM
Below is the list of changes that have just been committed into a local
4.1 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/in...urce-tree.html
ChangeSet
1.2198 05/04/19 14:35:47 marko (AT) hundin (DOT) mysql.fi +5 -0
InnoDB: Truncate SHOW INNODB STATUS output at the start of the list
of active transactions, if necessary and possible. (Bug #5436)
sql/ha_innodb.cc
1.192 05/04/19 14:32:49 marko (AT) hundin (DOT) mysql.fi +37 -9
innodb_show_status(): Truncate oversized output at the beginning
of the list of active transactions, if possible.
innobase/srv/srv0srv.c
1.78 05/04/19 14:32:18 marko (AT) hundin (DOT) mysql.fi +25 -4
srv_printf_innodb_monitor(): Add output parameters trx_start and trx_end.
innobase/include/srv0srv.h
1.44 05/04/19 14:31:59 marko (AT) hundin (DOT) mysql.fi +5 -1
srv_printf_innodb_monitor(): Add output parameters trx_start and trx_end.
innobase/lock/lock0lock.c
1.48 05/04/19 14:31:17 marko (AT) hundin (DOT) mysql.fi +22 -13
Split lock_print_info() into lock_print_info_summary()
and lock_print_info_all_transactions().
innobase/include/lock0lock.h
1.19 05/04/19 14:31:17 marko (AT) hundin (DOT) mysql.fi +9 -2
Split lock_print_info() into lock_print_info_summary()
and lock_print_info_all_transactions().
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: marko
# Host: hundin.mysql.fi
# Root: /home/marko/mysql-4.1
--- 1.18/innobase/include/lock0lock.h Tue Nov 30 23:12:04 2004
+++ 1.19/innobase/include/lock0lock.h Tue Apr 19 14:31:17 2005
@@ -530,8 +530,15 @@
Prints info of locks for all transactions. */
void
-lock_print_info(
-/*============*/
+lock_print_info_summary(
+/*====================*/
+ FILE* file); /* in: file where to print */
+/************************************************** ***********************
+Prints info of locks for each transaction. */
+
+void
+lock_print_info_all_transactions(
+/*=============================*/
FILE* file); /* in: file where to print */
/************************************************** ***********************
Validates the lock queue on a table. */
--- 1.43/innobase/include/srv0srv.h Tue Mar 8 16:01:55 2005
+++ 1.44/innobase/include/srv0srv.h Tue Apr 19 14:31:59 2005
@@ -398,7 +398,11 @@
void
srv_printf_innodb_monitor(
/*======================*/
- FILE* file); /* in: output stream */
+ FILE* file, /* in: output stream */
+ ulint* trx_start, /* out: file position of the start of
+ the list of active transactions */
+ ulint* trx_end); /* out: file position of the end of
+ the list of active transactions */
/* Types for the threads existing in the system. Threads of types 4 - 9
--- 1.47/innobase/lock/lock0lock.c Tue Nov 30 17:52:23 2004
+++ 1.48/innobase/lock/lock0lock.c Tue Apr 19 14:31:17 2005
@@ -4126,21 +4126,10 @@
Prints info of locks for all transactions. */
void
-lock_print_info(
-/*============*/
+lock_print_info_summary(
+/*====================*/
FILE* file) /* in: file where to print */
{
- lock_t* lock;
- trx_t* trx;
- ulint space;
- ulint page_no;
- page_t* page;
- ibool load_page_first = TRUE;
- ulint nth_trx = 0;
- ulint nth_lock = 0;
- ulint i;
- mtr_t mtr;
-
/* We must protect the MySQL thd->query field with a MySQL mutex, and
because the MySQL mutex must be reserved before the kernel_mutex of
InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */
@@ -4179,6 +4168,26 @@
fprintf(file,
"Total number of lock structs in row lock hash table %lu\n",
(ulong) lock_get_n_rec_locks());
+}
+
+/************************************************** ***********************
+Prints info of locks for each transaction. */
+
+void
+lock_print_info_all_transactions(
+/*=============================*/
+ FILE* file) /* in: file where to print */
+{
+ lock_t* lock;
+ ulint space;
+ ulint page_no;
+ page_t* page;
+ ibool load_page_first = TRUE;
+ ulint nth_trx = 0;
+ ulint nth_lock = 0;
+ ulint i;
+ mtr_t mtr;
+ trx_t* trx;
fprintf(file, "LIST OF TRANSACTIONS FOR EACH SESSION:\n");
--- 1.77/innobase/srv/srv0srv.c Tue Mar 8 16:01:56 2005
+++ 1.78/innobase/srv/srv0srv.c Tue Apr 19 14:32:18 2005
@@ -1470,7 +1470,11 @@
void
srv_printf_innodb_monitor(
/*======================*/
- FILE* file) /* in: output stream */
+ FILE* file, /* in: output stream */
+ ulint* trx_start, /* out: file position of the start of
+ the list of active transactions */
+ ulint* trx_end) /* out: file position of the end of
+ the list of active transactions */
{
double time_elapsed;
time_t current_time;
@@ -1519,7 +1523,24 @@
mutex_exit(&dict_foreign_err_mutex);
- lock_print_info(file);
+ lock_print_info_summary(file);
+ if (trx_start) {
+ long t = ftell(file);
+ if (t < 0) {
+ *trx_start = ULINT_UNDEFINED;
+ } else {
+ *trx_start = (ulint) t;
+ }
+ }
+ lock_print_info_all_transactions(file);
+ if (trx_end) {
+ long t = ftell(file);
+ if (t < 0) {
+ *trx_end = ULINT_UNDEFINED;
+ } else {
+ *trx_end = (ulint) t;
+ }
+ }
fputs("--------\n"
"FILE I/O\n"
"--------\n", file);
@@ -1672,13 +1693,13 @@
last_monitor_time = time(NULL);
if (srv_print_innodb_monitor) {
- srv_printf_innodb_monitor(stderr);
+ srv_printf_innodb_monitor(stderr, NULL, NULL);
}
if (srv_innodb_status) {
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
- srv_printf_innodb_monitor(srv_monitor_file);
+ srv_printf_innodb_monitor(srv_monitor_file, NULL, NULL);
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
--- 1.191/sql/ha_innodb.cc Mon Apr 18 12:17:09 2005
+++ 1.192/sql/ha_innodb.cc Tue Apr 19 14:32:49 2005
@@ -5168,8 +5168,12 @@
/*===============*/
THD* thd) /* in: the MySQL query thread of the caller */
{
- Protocol *protocol= thd->protocol;
- trx_t* trx;
+ Protocol* protocol = thd->protocol;
+ trx_t* trx;
+ static const char truncated_msg[] = "... truncated...\n";
+ const long MAX_STATUS_SIZE = 64000;
+ ulint trx_list_start = ULINT_UNDEFINED;
+ ulint trx_list_end = ULINT_UNDEFINED;
DBUG_ENTER("innodb_show_status");
@@ -5184,33 +5188,57 @@
innobase_release_stat_resources(trx);
- /* We let the InnoDB Monitor to output at most 64000 bytes of text. */
+ /* We let the InnoDB Monitor to output at most MAX_STATUS_SIZE
+ bytes of text. */
- long flen;
+ long flen, usable_len;
char* str;
mutex_enter_noninline(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
- srv_printf_innodb_monitor(srv_monitor_file);
+ srv_printf_innodb_monitor(srv_monitor_file,
+ &trx_list_start, &trx_list_end);
flen = ftell(srv_monitor_file);
os_file_set_eof(srv_monitor_file);
if (flen < 0) {
flen = 0;
- } else if (flen > 64000 - 1) {
- flen = 64000 - 1;
+ }
+
+ if (flen > MAX_STATUS_SIZE) {
+ usable_len = MAX_STATUS_SIZE;
+ } else {
+ usable_len = flen;
}
/* allocate buffer for the string, and
read the contents of the temporary file */
- if (!(str = my_malloc(flen + 1, MYF(0))))
+ if (!(str = my_malloc(usable_len + 1, MYF(0))))
{
mutex_exit_noninline(&srv_monitor_file_mutex);
DBUG_RETURN(-1);
}
rewind(srv_monitor_file);
- flen = fread(str, 1, flen, srv_monitor_file);
+ if (flen < MAX_STATUS_SIZE) {
+ /* Display the entire output. */
+ flen = fread(str, 1, flen, srv_monitor_file);
+ } else if (trx_list_end < (ulint) flen
+ && trx_list_start < trx_list_end
+ && trx_list_start + (flen - trx_list_end)
+ < MAX_STATUS_SIZE - sizeof truncated_msg - 1) {
+ /* Omit the beginning of the list of active transactions. */
+ long len = fread(str, 1, trx_list_start, srv_monitor_file);
+ memcpy(str + len, truncated_msg, sizeof truncated_msg - 1);
+ len += sizeof truncated_msg - 1;
+ usable_len = (MAX_STATUS_SIZE - 1) - len;
+ fseek(srv_monitor_file, flen - usable_len, SEEK_SET);
+ len += fread(str + len, 1, usable_len, srv_monitor_file);
+ flen = len;
+ } else {
+ /* Omit the end of the output. */
+ flen = fread(str, 1, MAX_STATUS_SIZE - 1, srv_monitor_file);
+ }
mutex_exit_noninline(&srv_monitor_file_mutex);
--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?uns...ie.nctu.edu.tw |