Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
17582bc0
Commit
17582bc0
authored
Nov 18, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/cps/mysql/trees/mysql-5.0
into mysql.com:/home/cps/mysql/devel/innotask/mysql-5.0-inno-final
parents
703c498f
e1f5b3f9
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
767 additions
and
273 deletions
+767
-273
innobase/buf/buf0buf.c
innobase/buf/buf0buf.c
+24
-0
innobase/buf/buf0flu.c
innobase/buf/buf0flu.c
+7
-0
innobase/buf/buf0lru.c
innobase/buf/buf0lru.c
+1
-0
innobase/buf/buf0rea.c
innobase/buf/buf0rea.c
+7
-0
innobase/fil/fil0fil.c
innobase/fil/fil0fil.c
+10
-0
innobase/include/buf0buf.h
innobase/include/buf0buf.h
+8
-0
innobase/include/buf0flu.ic
innobase/include/buf0flu.ic
+2
-0
innobase/include/fil0fil.h
innobase/include/fil0fil.h
+2
-0
innobase/include/os0file.h
innobase/include/os0file.h
+3
-0
innobase/include/srv0srv.h
innobase/include/srv0srv.h
+104
-0
innobase/log/log0log.c
innobase/log/log0log.c
+17
-0
innobase/os/os0file.c
innobase/os/os0file.c
+28
-0
innobase/srv/srv0srv.c
innobase/srv/srv0srv.c
+106
-0
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+18
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+8
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+90
-0
sql/ha_innodb.h
sql/ha_innodb.h
+2
-0
sql/handler.cc
sql/handler.cc
+15
-0
sql/handler.h
sql/handler.h
+1
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+3
-0
sql/sql_show.cc
sql/sql_show.cc
+309
-272
sql/structs.h
sql/structs.h
+1
-0
No files found.
innobase/buf/buf0buf.c
View file @
17582bc0
...
...
@@ -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. */
...
...
innobase/buf/buf0flu.c
View file @
17582bc0
...
...
@@ -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
);
}
...
...
innobase/buf/buf0lru.c
View file @
17582bc0
...
...
@@ -432,6 +432,7 @@ buf_LRU_get_free_block(void)
/* 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
();
...
...
innobase/buf/buf0rea.c
View file @
17582bc0
...
...
@@ -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
);
}
...
...
innobase/fil/fil0fil.c
View file @
17582bc0
...
...
@@ -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
)
{
...
...
innobase/include/buf0buf.h
View file @
17582bc0
...
...
@@ -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
...
...
innobase/include/buf0flu.ic
View file @
17582bc0
...
...
@@ -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;
}
/************************************************************************
...
...
innobase/include/fil0fil.h
View file @
17582bc0
...
...
@@ -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
;
...
...
innobase/include/os0file.h
View file @
17582bc0
...
...
@@ -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
...
...
innobase/include/srv0srv.h
View file @
17582bc0
...
...
@@ -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
...
...
innobase/log/log0log.c
View file @
17582bc0
...
...
@@ -190,6 +190,8 @@ log_reserve_and_open(
log_buffer_flush_to_disk
();
srv_log_waits
++
;
ut_ad
(
++
count
<
50
);
goto
loop
;
...
...
@@ -292,6 +294,8 @@ log_write_low(
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 @@ log_group_write_buf(
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 @@ log_group_write_buf(
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
)
{
...
...
innobase/os/os0file.c
View file @
17582bc0
...
...
@@ -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 @@ os_file_read(
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 @@ os_file_read(
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 @@ os_file_read_no_error_handling(
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 @@ os_file_read_no_error_handling(
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,8 +2207,12 @@ os_file_write(
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 @@ os_file_write(
#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
);
...
...
innobase/srv/srv0srv.c
View file @
17582bc0
...
...
@@ -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. */
...
...
mysql-test/r/innodb.result
View file @
17582bc0
...
...
@@ -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
mysql-test/t/innodb.test
View file @
17582bc0
...
...
@@ -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"
;
sql/ha_innodb.cc
View file @
17582bc0
...
...
@@ -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. */
...
...
sql/ha_innodb.h
View file @
17582bc0
...
...
@@ -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
);
...
...
sql/handler.cc
View file @
17582bc0
...
...
@@ -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
;
...
...
sql/handler.h
View file @
17582bc0
...
...
@@ -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
);
...
...
sql/mysql_priv.h
View file @
17582bc0
...
...
@@ -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
;
...
...
sql/mysqld.cc
View file @
17582bc0
...
...
@@ -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
,
...
...
sql/sql_show.cc
View file @
17582bc0
...
...
@@ -1401,38 +1401,49 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Status functions
*****************************************************************************/
bool
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
static
bool
show_status_array
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
enum
enum_var_type
value_type
,
pthread_mutex_t
*
mutex
,
struct
system_status_var
*
status_var
)
struct
system_status_var
*
status_var
,
const
char
*
prefix
)
{
char
buff
[
1024
];
List
<
Item
>
field_list
;
char
buff
[
1024
],
*
prefix_end
;
/* the variable name should not be longer then 80 characters */
char
name_buffer
[
80
];
int
len
;
Protocol
*
protocol
=
thd
->
protocol
;
LEX_STRING
null_lex_str
;
DBUG_ENTER
(
"
mysqld_show
"
);
DBUG_ENTER
(
"
show_status_array
"
);
field_list
.
push_back
(
new
Item_empty_string
(
"Variable_name"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"Value"
,
256
));
if
(
protocol
->
send_fields
(
&
field_list
,
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
))
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
null_lex_str
.
str
=
0
;
// For sys_var->value_ptr()
null_lex_str
.
length
=
0
;
pthread_mutex_lock
(
mutex
);
prefix_end
=
strnmov
(
name_buffer
,
prefix
,
sizeof
(
name_buffer
)
-
1
);
len
=
name_buffer
+
sizeof
(
name_buffer
)
-
prefix_end
;
for
(;
variables
->
name
;
variables
++
)
{
strnmov
(
prefix_end
,
variables
->
name
,
len
);
name_buffer
[
sizeof
(
name_buffer
)
-
1
]
=
0
;
/* Safety */
SHOW_TYPE
show_type
=
variables
->
type
;
if
(
show_type
==
SHOW_VARS
)
{
show_status_array
(
thd
,
wild
,
(
show_var_st
*
)
variables
->
value
,
value_type
,
status_var
,
variables
->
name
);
}
else
{
if
(
!
(
wild
&&
wild
[
0
]
&&
wild_case_compare
(
system_charset_info
,
variables
->
name
,
wild
)))
name_buffer
,
wild
)))
{
protocol
->
prepare_for_resend
();
protocol
->
store
(
variables
->
name
,
system_charset_info
);
SHOW_TYPE
show_type
=
variables
->
type
;
char
*
value
=
variables
->
value
;
const
char
*
pos
,
*
end
;
long
nr
;
protocol
->
prepare_for_resend
();
protocol
->
store
(
name_buffer
,
system_charset_info
);
if
(
show_type
==
SHOW_SYS
)
{
show_type
=
((
sys_var
*
)
value
)
->
type
();
...
...
@@ -1703,9 +1714,35 @@ bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
}
if
(
protocol
->
store
(
pos
,
(
uint32
)
(
end
-
pos
),
system_charset_info
)
||
protocol
->
write
())
goto
err
;
/* purecov: inspected */
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
}
}
}
DBUG_RETURN
(
FALSE
);
}
bool
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
enum
enum_var_type
value_type
,
pthread_mutex_t
*
mutex
,
struct
system_status_var
*
status_var
)
{
List
<
Item
>
field_list
;
Protocol
*
protocol
=
thd
->
protocol
;
DBUG_ENTER
(
"mysqld_show"
);
ha_update_statistics
();
/* Export engines statistics */
field_list
.
push_back
(
new
Item_empty_string
(
"Variable_name"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"Value"
,
256
));
if
(
protocol
->
send_fields
(
&
field_list
,
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
))
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
pthread_mutex_lock
(
mutex
);
if
(
show_status_array
(
thd
,
wild
,
variables
,
value_type
,
status_var
,
""
))
goto
err
;
pthread_mutex_unlock
(
mutex
);
send_eof
(
thd
);
DBUG_RETURN
(
FALSE
);
...
...
sql/structs.h
View file @
17582bc0
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment