Commit d067e9e9 authored by petr@mysql.com's avatar petr@mysql.com

Merge mysql.com:/home/cps/mysql/trees/mysql-5.0

into mysql.com:/home/cps/mysql/devel/innotask/mysql-5.0-inno-final
parents 57bdbd4e 30789e7a
......@@ -2136,6 +2136,30 @@ buf_print(void)
ut_a(buf_validate());
}
/*************************************************************************
Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void)
{
buf_block_t* block;
ulint i;
ulint fixed_pages_number = 0;
mutex_enter(&(buf_pool->mutex));
for (i = 0; i < buf_pool->curr_size; i++) {
block = buf_pool_get_nth_block(buf_pool, i);
if ((block->buf_fix_count != 0) || (block->io_fix != 0))
fixed_pages_number++;
}
mutex_exit(&(buf_pool->mutex));
return fixed_pages_number;
}
/*************************************************************************
Returns the number of pending buf pool ios. */
......
......@@ -273,6 +273,10 @@ buf_flush_buffered_writes(void)
}
}
/* increment the doublewrite flushed pages counter */
srv_dblwr_pages_written+= trx_doublewrite->first_free;
srv_dblwr_writes++;
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
} else {
......@@ -901,6 +905,9 @@ buf_flush_batch(
(ulong) page_count);
}
if (page_count != ULINT_UNDEFINED)
srv_buf_pool_flushed+= page_count;
return(page_count);
}
......
......@@ -432,6 +432,7 @@ loop:
/* No free block was found: try to flush the LRU list */
buf_flush_free_margin();
++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
......
......@@ -20,6 +20,10 @@ Created 11/5/1995 Heikki Tuuri
#include "os0file.h"
#include "srv0start.h"
extern ulint srv_read_ahead_rnd;
extern ulint srv_read_ahead_seq;
extern ulint srv_buf_pool_reads;
/* The size in blocks of the area where the random read-ahead algorithm counts
the accessed pages when deciding whether to read-ahead */
#define BUF_READ_AHEAD_RANDOM_AREA BUF_READ_AHEAD_AREA
......@@ -291,6 +295,7 @@ buf_read_ahead_random(
(ulong) count);
}
++srv_read_ahead_rnd;
return(count);
}
......@@ -323,6 +328,7 @@ buf_read_page(
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, offset);
srv_buf_pool_reads+= count2;
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
......@@ -575,6 +581,7 @@ buf_read_ahead_linear(
(ulong) space, (ulong) offset, (ulong) count);
}
++srv_read_ahead_seq;
return(count);
}
......
......@@ -88,6 +88,9 @@ but in the MySQL Embedded Server Library and ibbackup it is not the default
directory, and we must set the base file path explicitly */
const char* fil_path_to_mysql_datadir = ".";
/* The number of fsyncs done to the log */
ulint fil_n_log_flushes = 0;
ulint fil_n_pending_log_flushes = 0;
ulint fil_n_pending_tablespace_flushes = 0;
......@@ -3671,6 +3674,12 @@ fil_io(
mode = OS_AIO_NORMAL;
}
if (type == OS_FILE_READ) {
srv_data_read+= len;
} else if (type == OS_FILE_WRITE) {
srv_data_written+= len;
}
/* Reserve the fil_system mutex and make sure that we can open at
least one file while holding it, if the file is not already open */
......@@ -3956,6 +3965,7 @@ fil_flush(
fil_n_pending_tablespace_flushes++;
} else {
fil_n_pending_log_flushes++;
fil_n_log_flushes++;
}
#ifdef __WIN__
if (node->is_raw_disk) {
......
......@@ -58,6 +58,8 @@ extern buf_pool_t* buf_pool; /* The buffer pool of the database */
extern ibool buf_debug_prints;/* If this is set TRUE, the program
prints info whenever read or flush
occurs */
extern ulint srv_buf_pool_write_requests; /* variable to count write request
issued */
/************************************************************************
Creates the buffer pool. */
......@@ -497,6 +499,12 @@ void
buf_print(void);
/*============*/
/*************************************************************************
Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void);
/*==============================*/
/*************************************************************************
Returns the number of pending buf pool ios. */
ulint
......
......@@ -61,6 +61,8 @@ buf_flush_note_modification(
ut_ad(ut_dulint_cmp(block->oldest_modification,
mtr->start_lsn) <= 0);
}
++srv_buf_pool_write_requests;
}
/************************************************************************
......
......@@ -89,6 +89,8 @@ extern fil_addr_t fil_addr_null;
#define FIL_TABLESPACE 501
#define FIL_LOG 502
extern ulint fil_n_log_flushes;
extern ulint fil_n_pending_log_flushes;
extern ulint fil_n_pending_tablespace_flushes;
......
......@@ -24,6 +24,9 @@ extern ibool os_aio_print_debug;
extern ulint os_file_n_pending_preads;
extern ulint os_file_n_pending_pwrites;
extern ulint os_n_pending_reads;
extern ulint os_n_pending_writes;
#ifdef __WIN__
/* We define always WIN_ASYNC_IO, and check at run-time whether
......
......@@ -184,6 +184,63 @@ i/o handler thread */
extern const char* srv_io_thread_op_info[];
extern const char* srv_io_thread_function[];
/* the number of the log write requests done */
extern ulint srv_log_write_requests;
/* the number of physical writes to the log performed */
extern ulint srv_log_writes;
/* amount of data written to the log files in bytes */
extern ulint srv_os_log_written;
/* amount of writes being done to the log files */
extern ulint srv_os_log_pending_writes;
/* we increase this counter, when there we don't have enough space in the
log buffer and have to flush it */
extern ulint srv_log_waits;
/* variable that counts amount of data read in total (in bytes) */
extern ulint srv_data_read;
/* here we count the amount of data written in total (in bytes) */
extern ulint srv_data_written;
/* this variable counts the amount of times, when the doublewrite buffer
was flushed */
extern ulint srv_dblwr_writes;
/* here we store the number of pages that have been flushed to the
doublewrite buffer */
extern ulint srv_dblwr_pages_written;
/* in this variable we store the number of write requests issued */
extern ulint srv_buf_pool_write_requests;
/* here we store the number of times when we had to wait for a free page
in the buffer pool. It happens when the buffer pool is full and we need
to make a flush, in order to be able to read or create a page. */
extern ulint srv_buf_pool_wait_free;
/* variable to count the number of pages that were written from the
buffer pool to disk */
extern ulint srv_buf_pool_flushed;
/* variable to count the number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
/* variable to count the number of sequential read-aheads were done */
extern ulint srv_read_ahead_seq;
/* variable to count the number of random read-aheads were done */
extern ulint srv_read_ahead_rnd;
/* In this structure we store status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
extern export_struc export_vars;
typedef struct srv_sys_struct srv_sys_t;
/* The server system */
......@@ -400,7 +457,12 @@ void
srv_printf_innodb_monitor(
/*======================*/
FILE* file); /* in: output stream */
/************************************************************************
Function to pass InnoDB status variables to MySQL */
void
srv_export_innodb_status(void);
/*=====================*/
/* Types for the threads existing in the system. Threads of types 4 - 9
are called utility threads. Note that utility threads are mainly disk
......@@ -426,6 +488,48 @@ typedef struct srv_slot_struct srv_slot_t;
/* Thread table is an array of slots */
typedef srv_slot_t srv_table_t;
/* In this structure we store status variables to be passed to MySQL */
struct export_var_struct{
ulint innodb_data_pending_reads;
ulint innodb_data_pending_writes;
ulint innodb_data_pending_fsyncs;
ulint innodb_data_fsyncs;
ulint innodb_data_read;
ulint innodb_data_writes;
ulint innodb_data_written;
ulint innodb_data_reads;
ulint innodb_buffer_pool_pages_total;
ulint innodb_buffer_pool_pages_data;
ulint innodb_buffer_pool_pages_dirty;
ulint innodb_buffer_pool_pages_misc;
ulint innodb_buffer_pool_pages_free;
ulint innodb_buffer_pool_pages_latched;
ulint innodb_buffer_pool_read_requests;
ulint innodb_buffer_pool_reads;
ulint innodb_buffer_pool_wait_free;
ulint innodb_buffer_pool_pages_flushed;
ulint innodb_buffer_pool_write_requests;
ulint innodb_buffer_pool_read_ahead_seq;
ulint innodb_buffer_pool_read_ahead_rnd;
ulint innodb_dblwr_pages_written;
ulint innodb_dblwr_writes;
ulint innodb_log_waits;
ulint innodb_log_write_requests;
ulint innodb_log_writes;
ulint innodb_os_log_written;
ulint innodb_os_log_fsyncs;
ulint innodb_os_log_pending_writes;
ulint innodb_os_log_pending_fsyncs;
ulint innodb_page_size;
ulint innodb_pages_created;
ulint innodb_pages_read;
ulint innodb_pages_written;
ulint innodb_rows_read;
ulint innodb_rows_inserted;
ulint innodb_rows_updated;
ulint innodb_rows_deleted;
};
/* The server system struct */
struct srv_sys_struct{
os_event_t operational; /* created threads must wait for the
......
......@@ -190,6 +190,8 @@ loop:
log_buffer_flush_to_disk();
srv_log_waits++;
ut_ad(++count < 50);
goto loop;
......@@ -292,6 +294,8 @@ part_loop:
if (str_len > 0) {
goto part_loop;
}
srv_log_write_requests++;
}
/****************************************************************
......@@ -1112,11 +1116,15 @@ log_group_file_header_flush(
if (log_do_write) {
log_sys->n_log_ios++;
srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id,
dest_offset / UNIV_PAGE_SIZE,
dest_offset % UNIV_PAGE_SIZE,
OS_FILE_LOG_BLOCK_SIZE,
buf, group);
srv_os_log_pending_writes--;
}
}
......@@ -1181,6 +1189,8 @@ loop:
log_group_file_header_flush(group,
next_offset / group->file_size, start_lsn);
srv_os_log_written+= OS_FILE_LOG_BLOCK_SIZE;
srv_log_writes++;
}
if ((next_offset % group->file_size) + len > group->file_size) {
......@@ -1225,9 +1235,16 @@ loop:
if (log_do_write) {
log_sys->n_log_ios++;
srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id,
next_offset / UNIV_PAGE_SIZE,
next_offset % UNIV_PAGE_SIZE, write_len, buf, group);
srv_os_log_pending_writes--;
srv_os_log_written+= write_len;
srv_log_writes++;
}
if (write_len < len) {
......
......@@ -155,6 +155,10 @@ os_mutex_t os_file_count_mutex;
ulint os_file_n_pending_preads = 0;
ulint os_file_n_pending_pwrites = 0;
/* These are not protected by any mutex */
ulint os_n_pending_writes = 0;
ulint os_n_pending_reads = 0;
/***************************************************************************
Gets the operating system version. Currently works only on Windows. */
......@@ -1987,8 +1991,12 @@ try_again:
goto error_handling;
}
os_n_pending_reads++;
ret = ReadFile(file, buf, n, &len, NULL);
os_n_pending_reads--;
os_mutex_exit(os_file_seek_mutexes[i]);
if (ret && len == n) {
......@@ -2001,8 +2009,12 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
os_n_pending_reads++;
ret = os_file_pread(file, buf, n, offset, offset_high);
os_n_pending_reads--;
if ((ulint)ret == n) {
return(TRUE);
......@@ -2090,8 +2102,12 @@ try_again:
goto error_handling;
}
os_n_pending_reads++;
ret = ReadFile(file, buf, n, &len, NULL);
os_n_pending_reads--;
os_mutex_exit(os_file_seek_mutexes[i]);
if (ret && len == n) {
......@@ -2104,8 +2120,12 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
os_n_pending_reads++;
ret = os_file_pread(file, buf, n, offset, offset_high);
os_n_pending_reads--;
if ((ulint)ret == n) {
return(TRUE);
......@@ -2187,7 +2207,11 @@ retry:
return(FALSE);
}
os_n_pending_writes++;
ret = WriteFile(file, buf, n, &len, NULL);
os_n_pending_writes--;
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
......@@ -2248,8 +2272,12 @@ retry:
#else
ssize_t ret;
os_n_pending_writes++;
ret = os_file_pwrite(file, buf, n, offset, offset_high);
os_n_pending_writes--;
if ((ulint)ret == n) {
return(TRUE);
......
......@@ -186,6 +186,61 @@ that during a time of heavy update/insert activity. */
ulint srv_max_buf_pool_modified_pct = 90;
/* variable counts amount of data read in total (in bytes) */
ulint srv_data_read = 0;
/* here we count the amount of data written in total (in bytes) */
ulint srv_data_written = 0;
/* the number of the log write requests done */
ulint srv_log_write_requests = 0;
/* the number of physical writes to the log performed */
ulint srv_log_writes = 0;
/* amount of data written to the log files in bytes */
ulint srv_os_log_written = 0;
/* amount of writes being done to the log files */
ulint srv_os_log_pending_writes = 0;
/* we increase this counter, when there we don't have enough space in the
log buffer and have to flush it */
ulint srv_log_waits = 0;
/* this variable counts the amount of times, when the doublewrite buffer
was flushed */
ulint srv_dblwr_writes = 0;
/* here we store the number of pages that have been flushed to the
doublewrite buffer */
ulint srv_dblwr_pages_written = 0;
/* in this variable we store the number of write requests issued */
ulint srv_buf_pool_write_requests = 0;
/* here we store the number of times when we had to wait for a free page
in the buffer pool. It happens when the buffer pool is full and we need
to make a flush, in order to be able to read or create a page. */
ulint srv_buf_pool_wait_free = 0;
/* variable to count the number of pages that were written from buffer
pool to the disk */
ulint srv_buf_pool_flushed = 0;
/* variable to count the number of buffer pool reads that led to the
reading of a disk page */
ulint srv_buf_pool_reads = 0;
/* variable to count the number of sequential read-aheads */
ulint srv_read_ahead_seq = 0;
/* variable to count the number of random read-aheads */
ulint srv_read_ahead_rnd = 0;
/* structure to pass status variables to MySQL */
export_struc export_vars;
/* If the following is != 0 we do not allow inserts etc. This protects
the user from forgetting the innodb_force_recovery keyword to my.cnf */
......@@ -1619,6 +1674,57 @@ srv_printf_innodb_monitor(
fflush(file);
}
/**********************************************************************
Function to pass InnoDB status variables to MySQL */
void
srv_export_innodb_status(void)
{
mutex_enter(&srv_innodb_monitor_mutex);
export_vars.innodb_data_pending_reads= os_n_pending_reads;
export_vars.innodb_data_pending_writes= os_n_pending_writes;
export_vars.innodb_data_pending_fsyncs=
fil_n_pending_log_flushes + fil_n_pending_tablespace_flushes;
export_vars.innodb_data_fsyncs= os_n_fsyncs;
export_vars.innodb_data_read= srv_data_read;
export_vars.innodb_data_reads= os_n_file_reads;
export_vars.innodb_data_writes= os_n_file_writes;
export_vars.innodb_data_written= srv_data_written;
export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;
export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;
export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free;
export_vars.innodb_buffer_pool_pages_flushed= srv_buf_pool_flushed;
export_vars.innodb_buffer_pool_reads= srv_buf_pool_reads;
export_vars.innodb_buffer_pool_read_ahead_rnd= srv_read_ahead_rnd;
export_vars.innodb_buffer_pool_read_ahead_seq= srv_read_ahead_seq;
export_vars.innodb_buffer_pool_pages_data= UT_LIST_GET_LEN(buf_pool->LRU);
export_vars.innodb_buffer_pool_pages_dirty= UT_LIST_GET_LEN(buf_pool->flush_list);
export_vars.innodb_buffer_pool_pages_free= UT_LIST_GET_LEN(buf_pool->free);
export_vars.innodb_buffer_pool_pages_latched= buf_get_latched_pages_number();
export_vars.innodb_buffer_pool_pages_total= buf_pool->curr_size;
export_vars.innodb_buffer_pool_pages_misc= buf_pool->max_size -
UT_LIST_GET_LEN(buf_pool->LRU) - UT_LIST_GET_LEN(buf_pool->free);
export_vars.innodb_page_size= UNIV_PAGE_SIZE;
export_vars.innodb_log_waits= srv_log_waits;
export_vars.innodb_os_log_written= srv_os_log_written;
export_vars.innodb_os_log_fsyncs= fil_n_log_flushes;
export_vars.innodb_os_log_pending_fsyncs= fil_n_pending_log_flushes;
export_vars.innodb_os_log_pending_writes= srv_os_log_pending_writes;
export_vars.innodb_log_write_requests= srv_log_write_requests;
export_vars.innodb_log_writes= srv_log_writes;
export_vars.innodb_dblwr_pages_written= srv_dblwr_pages_written;
export_vars.innodb_dblwr_writes= srv_dblwr_writes;
export_vars.innodb_pages_created= buf_pool->n_pages_created;
export_vars.innodb_pages_read= buf_pool->n_pages_read;
export_vars.innodb_pages_written= buf_pool->n_pages_written;
export_vars.innodb_rows_read= srv_n_rows_read;
export_vars.innodb_rows_inserted= srv_n_rows_inserted;
export_vars.innodb_rows_updated= srv_n_rows_updated;
export_vars.innodb_rows_deleted= srv_n_rows_deleted;
mutex_exit(&srv_innodb_monitor_mutex);
}
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long.
This also prints the info output by various InnoDB monitors. */
......
......@@ -1664,3 +1664,21 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2078
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 31706
show status like "Innodb_rows_read";
Variable_name Value
Innodb_rows_read 80161
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29530
......@@ -1180,3 +1180,11 @@ select count(*) from t1 where x = 18446744073709551601;
drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total";
show status like "Innodb_page_size";
show status like "Innodb_rows_deleted";
show status like "Innodb_rows_inserted";
show status like "Innodb_rows_read";
show status like "Innodb_rows_updated";
......@@ -149,6 +149,85 @@ static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
struct show_var_st innodb_status_variables[]= {
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
(char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG},
{"buffer_pool_pages_flushed",
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
{"buffer_pool_pages_free",
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
{"buffer_pool_pages_latched",
(char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
{"buffer_pool_pages_misc",
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
{"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
{"buffer_pool_read_ahead_rnd",
(char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG},
{"buffer_pool_read_ahead_seq",
(char*) &export_vars.innodb_buffer_pool_read_ahead_seq, SHOW_LONG},
{"buffer_pool_read_requests",
(char*) &export_vars.innodb_buffer_pool_read_requests, SHOW_LONG},
{"buffer_pool_reads",
(char*) &export_vars.innodb_buffer_pool_reads, SHOW_LONG},
{"buffer_pool_wait_free",
(char*) &export_vars.innodb_buffer_pool_wait_free, SHOW_LONG},
{"buffer_pool_write_requests",
(char*) &export_vars.innodb_buffer_pool_write_requests, SHOW_LONG},
{"data_fsyncs",
(char*) &export_vars.innodb_data_fsyncs, SHOW_LONG},
{"data_pending_fsyncs",
(char*) &export_vars.innodb_data_pending_fsyncs, SHOW_LONG},
{"data_pending_reads",
(char*) &export_vars.innodb_data_pending_reads, SHOW_LONG},
{"data_pending_writes",
(char*) &export_vars.innodb_data_pending_writes, SHOW_LONG},
{"data_read",
(char*) &export_vars.innodb_data_read, SHOW_LONG},
{"data_reads",
(char*) &export_vars.innodb_data_reads, SHOW_LONG},
{"data_writes",
(char*) &export_vars.innodb_data_writes, SHOW_LONG},
{"data_written",
(char*) &export_vars.innodb_data_written, SHOW_LONG},
{"dblwr_pages_written",
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
{"dblwr_writes",
(char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
{"log_waits",
(char*) &export_vars.innodb_log_waits, SHOW_LONG},
{"log_write_requests",
(char*) &export_vars.innodb_log_write_requests, SHOW_LONG},
{"log_writes",
(char*) &export_vars.innodb_log_writes, SHOW_LONG},
{"os_log_fsyncs",
(char*) &export_vars.innodb_os_log_fsyncs, SHOW_LONG},
{"os_log_pending_fsyncs",
(char*) &export_vars.innodb_os_log_pending_fsyncs, SHOW_LONG},
{"os_log_pending_writes",
(char*) &export_vars.innodb_os_log_pending_writes, SHOW_LONG},
{"os_log_written",
(char*) &export_vars.innodb_os_log_written, SHOW_LONG},
{"page_size",
(char*) &export_vars.innodb_page_size, SHOW_LONG},
{"pages_created",
(char*) &export_vars.innodb_pages_created, SHOW_LONG},
{"pages_read",
(char*) &export_vars.innodb_pages_read, SHOW_LONG},
{"pages_written",
(char*) &export_vars.innodb_pages_written, SHOW_LONG},
{"rows_deleted",
(char*) &export_vars.innodb_rows_deleted, SHOW_LONG},
{"rows_inserted",
(char*) &export_vars.innodb_rows_inserted, SHOW_LONG},
{"rows_read",
(char*) &export_vars.innodb_rows_read, SHOW_LONG},
{"rows_updated",
(char*) &export_vars.innodb_rows_updated, SHOW_LONG},
{NullS, NullS, SHOW_LONG}};
/* General functions */
/**********************************************************************
......@@ -5120,6 +5199,17 @@ ha_innobase::external_lock(
DBUG_RETURN(0);
}
/****************************************************************************
Here we export InnoDB status variables to MySQL. */
void
innodb_export_status(void)
/*======================*/
{
srv_export_innodb_status();
}
/****************************************************************************
Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
Monitor to the client. */
......
......@@ -176,6 +176,7 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2);
};
extern struct show_var_st innodb_status_variables[];
extern uint innobase_init_flags, innobase_lock_type;
extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size;
......@@ -235,6 +236,7 @@ int innobase_savepoint(
int innobase_close_connection(THD *thd);
int innobase_drop_database(char *path);
bool innodb_show_status(THD* thd);
void innodb_export_status(void);
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
uint full_name_len);
......
......@@ -468,6 +468,21 @@ int ha_release_temporary_latches(THD *thd)
return 0;
}
/*
Export statistics for different engines. Currently we use it only for
InnoDB.
*/
int ha_update_statistics()
{
#ifdef HAVE_INNOBASE_DB
if (opt_innodb)
innodb_export_status();
#endif
return 0;
}
int ha_commit_trans(THD *thd, THD_TRANS* trans)
{
int error=0;
......
......@@ -581,6 +581,7 @@ int ha_report_binlog_offset_and_commit(THD *thd, char *log_file_name,
my_off_t end_offset);
int ha_commit_complete(THD *thd);
int ha_release_temporary_latches(THD *thd);
int ha_update_statistics();
int ha_commit_trans(THD *thd, THD_TRANS *trans);
int ha_rollback_trans(THD *thd, THD_TRANS *trans);
int ha_rollback_to_savepoint(THD *thd, char *savepoint_name);
......
......@@ -991,7 +991,7 @@ extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong back_log;
extern ulong specialflag, current_pid;
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
extern my_bool relay_log_purge, opt_innodb_safe_binlog;
extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version, mysqld_port, dropping_tables;
extern uint delay_key_write_options, lower_case_table_names;
......
......@@ -5402,6 +5402,9 @@ struct show_var_st status_vars[]= {
SHOW_LONG_STATUS},
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count),
SHOW_LONG_STATUS},
#ifdef HAVE_INNOBASE_DB
{"Innodb_", (char*) &innodb_status_variables, SHOW_VARS},
#endif /*HAVE_INNOBASE_DB*/
{"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed,
SHOW_KEY_CACHE_LONG},
{"Key_blocks_unused", (char*) &dflt_key_cache_var.blocks_unused,
......
This diff is collapsed.
......@@ -166,6 +166,7 @@ enum SHOW_TYPE
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_DOUBLE,
SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
SHOW_VARS,
#ifdef HAVE_OPENSSL
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment