summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authormarko@hundin.mysql.fi <>2005-05-06 11:45:59 +0300
committermarko@hundin.mysql.fi <>2005-05-06 11:45:59 +0300
commit2f0424cd62255a358bb359655fc8007cba3589cb (patch)
tree62eff238f5dc661e7e582eb505822b283b2a8fe9 /sql/ha_innodb.cc
parent5496b7babbfdc0b689f21bdad4a3bee36dbf8754 (diff)
parentf9e7e2ee900fdde3f46a6d2399a0b52e3e9a1394 (diff)
downloadmariadb-git-2f0424cd62255a358bb359655fc8007cba3589cb.tar.gz
Merge
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc56
1 files changed, 42 insertions, 14 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 0c70713f0d3..ad1805eb264 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6146,10 +6146,12 @@ innodb_show_status(
/*===============*/
THD* thd) /* in: the MySQL query thread of the caller */
{
- Protocol *protocol= thd->protocol;
- trx_t* trx;
- long flen;
- char* str;
+ 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");
@@ -6164,32 +6166,58 @@ innodb_show_status(
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, 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)))) {
- mutex_exit_noninline(&srv_monitor_file_mutex);
-
- DBUG_RETURN(TRUE);
+ if (!(str = my_malloc(usable_len + 1, MYF(0))))
+ {
+ mutex_exit_noninline(&srv_monitor_file_mutex);
+ DBUG_RETURN(TRUE);
}
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);