Merge lp:~laurynas-biveinis/percona-server/xtradb-changed-page-tracking-55 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Merged
Merged at revision: 298
Proposed branch: lp:~laurynas-biveinis/percona-server/xtradb-changed-page-tracking-55
Merge into: lp:percona-server/5.5
Prerequisite: lp:~stewart/percona-server/5.5-merge-5.1-b
Diff against target: 13660 lines (+1603/-10950)
119 files modified
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_release.result (+1/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result (+26/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result (+6/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test (+126/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test (+21/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result (+21/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test (+21/-0)
Percona-Server/storage/innobase/CMakeLists.txt (+30/-1)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+10/-2)
Percona-Server/storage/innobase/include/log0log.h (+5/-0)
Percona-Server/storage/innobase/include/log0online.h (+51/-0)
Percona-Server/storage/innobase/include/log0recv.h (+37/-0)
Percona-Server/storage/innobase/include/os0file.h (+9/-0)
Percona-Server/storage/innobase/include/os0sync.h (+24/-4)
Percona-Server/storage/innobase/include/srv0srv.h (+20/-0)
Percona-Server/storage/innobase/include/ut0rbt.h (+22/-0)
Percona-Server/storage/innobase/log/log0log.c (+124/-2)
Percona-Server/storage/innobase/log/log0online.c (+927/-0)
Percona-Server/storage/innobase/log/log0recv.c (+5/-3)
Percona-Server/storage/innobase/os/os0file.c (+20/-0)
Percona-Server/storage/innobase/srv/srv0srv.c (+50/-0)
Percona-Server/storage/innobase/srv/srv0start.c (+17/-2)
Percona-Server/storage/innobase/ut/ut0rbt.c (+27/-2)
doc/Makefile (+0/-145)
doc/make.bat (+0/-170)
doc/source/compatibility.rst (+0/-27)
doc/source/conf.py (+0/-268)
doc/source/development.rst (+0/-266)
doc/source/diagnostics/index_info_schema_tables.rst (+0/-37)
doc/source/diagnostics/innodb_deadlock_count.rst (+0/-57)
doc/source/diagnostics/innodb_show_lock_names.rst (+0/-24)
doc/source/diagnostics/innodb_show_status.rst (+0/-475)
doc/source/diagnostics/innodb_stats.rst (+0/-157)
doc/source/diagnostics/misc_info_schema_tables.rst (+0/-135)
doc/source/diagnostics/mysql_syslog.rst (+0/-43)
doc/source/diagnostics/process_list.rst (+0/-78)
doc/source/diagnostics/response_time_distribution.rst (+0/-266)
doc/source/diagnostics/show_engines.rst (+0/-40)
doc/source/diagnostics/slow_extended_55.rst (+0/-376)
doc/source/diagnostics/thread_based_profiling.rst (+0/-17)
doc/source/diagnostics/user_stats.rst (+0/-251)
doc/source/ext/psdom.py (+0/-387)
doc/source/faq.rst (+0/-20)
doc/source/feature_comparison.rst (+0/-151)
doc/source/flexibility/buff_read_ahead_area.rst (+0/-36)
doc/source/flexibility/improved_memory_engine.rst (+0/-190)
doc/source/flexibility/innodb_fast_shutdown.rst (+0/-36)
doc/source/flexibility/innodb_files_extend.rst (+0/-25)
doc/source/flexibility/log_warnings_suppress.rst (+0/-49)
doc/source/flexibility/mysql_remove_eol_carret.rst (+0/-31)
doc/source/glossary.rst (+0/-109)
doc/source/index.rst (+0/-174)
doc/source/installation.rst (+0/-203)
doc/source/installation/apt_repo.rst (+0/-70)
doc/source/installation/yum_repo.rst (+0/-81)
doc/source/management/enforce_engine.rst (+0/-36)
doc/source/management/innodb_buffer_pool_shm.rst (+0/-32)
doc/source/management/innodb_dict_size_limit.rst (+0/-95)
doc/source/management/innodb_expand_import.rst (+0/-155)
doc/source/management/innodb_extended_fast_index_creation.rst (+0/-82)
doc/source/management/innodb_fake_changes.rst (+0/-70)
doc/source/management/innodb_fast_index_creation.rst (+0/-45)
doc/source/management/innodb_kill_idle_trx.rst (+0/-25)
doc/source/management/innodb_lru_dump_restore.rst (+0/-171)
doc/source/management/innodb_recovery_patches.rst (+0/-72)
doc/source/management/secure_file_priv_extended.rst (+0/-27)
doc/source/management/sql_no_fcache.rst (+0/-34)
doc/source/management/udf_maatkit.rst (+0/-48)
doc/source/percona-theme/layout.html (+0/-407)
doc/source/percona-theme/searchbox.html (+0/-22)
doc/source/percona-theme/static/default.css_t (+0/-433)
doc/source/percona-theme/static/jquery.min.js (+0/-154)
doc/source/percona-theme/static/percona.com.css (+0/-1850)
doc/source/percona-theme/static/percona.com.js (+0/-269)
doc/source/percona-theme/static/sidebar.js (+0/-151)
doc/source/percona-theme/theme.conf (+0/-32)
doc/source/percona_xtradb.rst (+0/-13)
doc/source/performance/handlersocket.rst (+0/-109)
doc/source/performance/innodb_doublewrite_path.rst (+0/-87)
doc/source/performance/innodb_fast_checksum.rst (+0/-28)
doc/source/performance/innodb_lazy_drop_table.rst (+0/-36)
doc/source/performance/innodb_opt_lru_count.rst (+0/-7)
doc/source/performance/innodb_purge_thread.rst (+0/-7)
doc/source/performance/innodb_thread_concurrency_timer_based.rst (+0/-20)
doc/source/performance/query_cache_enhance.rst (+0/-123)
doc/source/performance/remove_fcntl_excessive_calls.rst (+0/-35)
doc/source/release-notes/Percona-Server-5.5.10-20.1.rst (+0/-48)
doc/source/release-notes/Percona-Server-5.5.11-20.2.rst (+0/-37)
doc/source/release-notes/Percona-Server-5.5.12-20.3.rst (+0/-15)
doc/source/release-notes/Percona-Server-5.5.13-20.4.rst (+0/-49)
doc/source/release-notes/Percona-Server-5.5.14-20.5.rst (+0/-67)
doc/source/release-notes/Percona-Server-5.5.16-22.0.rst (+0/-70)
doc/source/release-notes/Percona-Server-5.5.17-22.1.rst (+0/-20)
doc/source/release-notes/Percona-Server-5.5.18-23.0.rst (+0/-33)
doc/source/release-notes/Percona-Server-5.5.19-24.0.rst (+0/-38)
doc/source/release-notes/Percona-Server-5.5.20-24.1.rst (+0/-19)
doc/source/release-notes/Percona-Server-5.5.21-25.0.rst (+0/-22)
doc/source/release-notes/Percona-Server-5.5.21-25.1.rst (+0/-19)
doc/source/release-notes/Percona-Server-5.5.22-25.2.rst (+0/-15)
doc/source/release-notes/Percona-Server-5.5.23-25.3.rst (+0/-15)
doc/source/release-notes/Percona-Server-5.5.24-26.0.rst (+0/-35)
doc/source/release-notes/Percona-Server-5.5.25a-27.1.rst (+0/-39)
doc/source/release-notes/Percona-Server-5.5.8-20.0.rst (+0/-56)
doc/source/release-notes/release-notes_index.rst (+0/-11)
doc/source/reliability/error_pad.rst (+0/-55)
doc/source/reliability/innodb_corrupt_table_action.rst (+0/-50)
doc/source/reliability/innodb_recovery_update_relay_log.rst (+0/-104)
doc/source/reliability/log_connection_error.rst (+0/-14)
doc/source/reliability/show_slave_status_nolock.rst (+0/-23)
doc/source/scalability/innodb_adaptive_hash_index_partitions.rst (+0/-38)
doc/source/scalability/innodb_extra_rseg.rst (+0/-49)
doc/source/scalability/innodb_insert_buffer.rst (+0/-68)
doc/source/scalability/innodb_io_55.rst (+0/-276)
doc/source/scalability/innodb_split_buf_pool_mutex.rst (+0/-77)
doc/source/trademark-policy.rst (+0/-23)
doc/source/upgrading_guide_51_55.rst (+0/-480)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/xtradb-changed-page-tracking-55
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+120763@code.launchpad.net

Description of the change

Manual merge of XtraDB changed page tracker from 5.1.

Changes from the 5.1 version:
- The log tracker thread and the bitmap file I/O were instrumented for
  PFS.
- Tweaks for very fast InnoDB shutdown changes in 5.5: since 5.5
  closes the log files earlier, make sure that the log reader thread
  quits before then.
- More workload in the test case to reflect larger minimum log file
  sizes in 5.5.
- Ported 64-bit atomic operations checks from Autoconf to CMake.
- New test in sys_vars suite: innodb_track_changed_pages_basic.test,
  re-recorded all_vars.test.
- Removed superfluous 64-bit atomic operations checks from the
  non-64-bit check snippet.
- Included contents of 5.1 revisions 458.1.1 for bug 1032483 and
  458.2.1 for bug 1032606. These revisions must be null-merged now.
  Also included the fix for bug 1036530 that is not merged yet to
  5.1.

Jenkins: http://jenkins.percona.com/job/percona-server-5.5-param/473/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Issue #16274.

Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-09 06:49:56 +0000
+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-22 13:19:13 +0000
@@ -165,6 +165,7 @@
165INNODB_THREAD_CONCURRENCY165INNODB_THREAD_CONCURRENCY
166INNODB_THREAD_CONCURRENCY_TIMER_BASED166INNODB_THREAD_CONCURRENCY_TIMER_BASED
167INNODB_THREAD_SLEEP_DELAY167INNODB_THREAD_SLEEP_DELAY
168INNODB_TRACK_CHANGED_PAGES
168INNODB_TRX_RSEG_N_SLOTS_DEBUG169INNODB_TRX_RSEG_N_SLOTS_DEBUG
169INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT170INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
170INNODB_USE_NATIVE_AIO171INNODB_USE_NATIVE_AIO
171172
=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-07 06:10:00 +0000
+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-22 13:19:13 +0000
@@ -161,6 +161,7 @@
161INNODB_THREAD_CONCURRENCY161INNODB_THREAD_CONCURRENCY
162INNODB_THREAD_CONCURRENCY_TIMER_BASED162INNODB_THREAD_CONCURRENCY_TIMER_BASED
163INNODB_THREAD_SLEEP_DELAY163INNODB_THREAD_SLEEP_DELAY
164INNODB_TRACK_CHANGED_PAGES
164INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT165INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
165INNODB_USE_NATIVE_AIO166INNODB_USE_NATIVE_AIO
166INNODB_USE_SYS_MALLOC167INNODB_USE_SYS_MALLOC
167168
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-08-22 13:19:13 +0000
@@ -0,0 +1,26 @@
1DROP TABLE IF EXISTS t1, t2;
2CREATE TABLE t1 (x INT) ENGINE=InnoDB;
3INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
4INSERT INTO t1 SELECT x FROM t1;
5INSERT INTO t1 SELECT x FROM t1;
6INSERT INTO t1 SELECT x FROM t1;
7INSERT INTO t1 SELECT x FROM t1;
8INSERT INTO t1 SELECT x FROM t1;
9INSERT INTO t1 SELECT x FROM t1;
10INSERT INTO t1 SELECT x FROM t1;
11INSERT INTO t1 SELECT x FROM t1;
12INSERT INTO t1 SELECT x FROM t1;
13INSERT INTO t1 SELECT x FROM t1;
14INSERT INTO t1 SELECT x FROM t1;
15INSERT INTO t1 SELECT x FROM t1;
16CREATE TABLE t2 (x INT) ENGINE=InnoDB;
17INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
18INSERT INTO t1 SELECT x FROM t1;
19INSERT INTO t1 SELECT x FROM t1;
20INSERT INTO t1 SELECT x FROM t1;
21SET GLOBAL INNODB_FAST_SHUTDOWN=2;
22INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
23call mtr.add_suppression("InnoDB: Warning: truncated block detected.*");
24INSERT INTO t1 SELECT x FROM t1;
25ERROR HY000: Lost connection to MySQL server during query
26DROP TABLE t1, t2;
027
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-08-22 13:19:13 +0000
@@ -0,0 +1,6 @@
1DROP TABLE IF EXISTS t1, t2;
2CREATE TABLE t1 (x INT) ENGINE=InnoDB;
3INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
4CREATE TABLE t2 (x INT) ENGINE=InnoDB;
5INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
6DROP TABLE t1, t2;
07
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt 2012-08-22 13:19:13 +0000
@@ -0,0 +1,1 @@
1--innodb_track_changed_pages=TRUE --innodb_log_file_size=5M --innodb_file_per_table --skip-stack-trace --skip-core-file
02
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-08-22 13:19:13 +0000
@@ -0,0 +1,126 @@
1# Tests for the changed page tracking bitmap.
2--source include/not_embedded.inc
3--source include/not_crashrep.inc
4--source include/have_debug.inc
5--source include/have_innodb.inc
6# Valgrind reports useless errors on very fast server shutdowns
7--source include/not_valgrind.inc
8
9let $MYSQLD_DATADIR= `select @@datadir`;
10let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log.1;
11
12--disable_warnings
13DROP TABLE IF EXISTS t1, t2;
14--enable_warnings
15
16# Create some log data, less than log capacity
17CREATE TABLE t1 (x INT) ENGINE=InnoDB;
18INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
19
20# Check that the bitmap file has been created
21file_exists $BITMAP_FILE;
22
23# Test that an empty existing bitmap file is handled properly when it's
24# possible to re-read the entire missing range.
25
26--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
27--shutdown_server 10
28--source include/wait_until_disconnected.inc
29remove_file $BITMAP_FILE;
30write_file $BITMAP_FILE;
31EOF
32--enable_reconnect
33--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
34--source include/wait_until_connected_again.inc
35
36# TODO: check the tracked LSN range continuity once this info is exposed through
37# INFORMATION_SCHEMA.
38
39# Create more log data, larger amount than the log group capacity. At the same time test second space id.
40INSERT INTO t1 SELECT x FROM t1;
41INSERT INTO t1 SELECT x FROM t1;
42INSERT INTO t1 SELECT x FROM t1;
43INSERT INTO t1 SELECT x FROM t1;
44INSERT INTO t1 SELECT x FROM t1;
45INSERT INTO t1 SELECT x FROM t1;
46INSERT INTO t1 SELECT x FROM t1;
47INSERT INTO t1 SELECT x FROM t1;
48INSERT INTO t1 SELECT x FROM t1;
49INSERT INTO t1 SELECT x FROM t1;
50INSERT INTO t1 SELECT x FROM t1;
51INSERT INTO t1 SELECT x FROM t1;
52CREATE TABLE t2 (x INT) ENGINE=InnoDB;
53INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
54
55file_exists $BITMAP_FILE;
56
57# Restart the server to check that the bitmap file is properly read on the startup
58# to resume tracking.
59
60# TODO: check the tracked LSN range continuity once this info is exposed through
61# INFORMATION_SCHEMA.
62--source include/restart_mysqld.inc
63
64file_exists $BITMAP_FILE;
65
66INSERT INTO t1 SELECT x FROM t1;
67INSERT INTO t1 SELECT x FROM t1;
68INSERT INTO t1 SELECT x FROM t1;
69
70# Restart the server again with the very fast shutdown
71SET GLOBAL INNODB_FAST_SHUTDOWN=2;
72
73--source include/restart_mysqld.inc
74
75file_exists $BITMAP_FILE;
76
77# TODO: check the tracked LSN range continuity once this info is exposed through
78# INFORMATION_SCHEMA.
79
80# Test that an empty existing bitmap file is handled properly when it's impossible to re-read the full missing range.
81
82--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
83--shutdown_server 10
84--source include/wait_until_disconnected.inc
85remove_file $BITMAP_FILE;
86write_file $BITMAP_FILE;
87EOF
88--enable_reconnect
89--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
90--source include/wait_until_connected_again.inc
91
92file_exists $BITMAP_FILE;
93
94# Create at least one more bitmap page on shutdown
95INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
96
97# Test that the bitmap file is read in block size multiples with junk at the end discarded
98--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
99--shutdown_server 10
100--source include/wait_until_disconnected.inc
101append_file $BITMAP_FILE;
102junk junk junk junk
103EOF
104--enable_reconnect
105--exec echo "restart:-#d,crash_before_bitmap_write" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
106--source include/wait_until_connected_again.inc
107call mtr.add_suppression("InnoDB: Warning: truncated block detected.*");
108
109file_exists $BITMAP_FILE;
110
111# TODO: check the tracked LSN range continuity once this info is exposed through
112# INFORMATION_SCHEMA.
113
114# Test crashing before writing of new bitmap data
115--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
116--error 2013
117INSERT INTO t1 SELECT x FROM t1;
118--enable_reconnect
119--source include/wait_until_connected_again.inc
120
121file_exists $BITMAP_FILE;
122
123# TODO: check the tracked LSN range continuity once this info is exposed through
124# INFORMATION_SCHEMA.
125
126DROP TABLE t1, t2;
0127
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt 2012-08-22 13:19:13 +0000
@@ -0,0 +1,1 @@
1--innodb_track_changed_pages=TRUE --innodb-file-per-table
02
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-08-22 13:19:13 +0000
@@ -0,0 +1,21 @@
1# Tests for the changed page tracking bitmap. A valgrindable subset of
2# percona_changed_page_bmp test, which contains the full functional tests.
3--source include/have_innodb.inc
4
5let $MYSQLD_DATADIR= `select @@datadir`;
6let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log.1;
7
8--disable_warnings
9DROP TABLE IF EXISTS t1, t2;
10--enable_warnings
11
12# Create some log data with several space ids to have more than bitmap poge.
13CREATE TABLE t1 (x INT) ENGINE=InnoDB;
14INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
15CREATE TABLE t2 (x INT) ENGINE=InnoDB;
16INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
17
18# Check that the bitmap file has been created
19file_exists $BITMAP_FILE;
20
21DROP TABLE t1, t2;
022
=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result'
--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result 2012-08-22 13:19:13 +0000
@@ -0,0 +1,21 @@
1SELECT COUNT(@@GLOBAL.innodb_track_changed_pages);
2COUNT(@@GLOBAL.innodb_track_changed_pages)
31
4SET @@GLOBAL.innodb_track_changed_pages=1;
5ERROR HY000: Variable 'innodb_track_changed_pages' is a read only variable
6SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
7FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
8WHERE VARIABLE_NAME='innodb_track_changed_pages';
9@@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
101
11Warnings:
12Warning 1292 Truncated incorrect DOUBLE value: 'OFF'
13SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages;
14@@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages
151
16SELECT COUNT(@@SESSION.innodb_track_changed_pages);
17ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable
18SELECT COUNT(@@LOCAL.innodb_track_changed_pages);
19ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable
20SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages;
21ERROR 42S22: Unknown column 'innodb_track_changed_pages' in 'field list'
022
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 2012-08-22 13:19:13 +0000
@@ -0,0 +1,21 @@
1# Tests for innodb_track_changed_pages variable
2
3--source include/have_innodb.inc
4
5SELECT COUNT(@@GLOBAL.innodb_track_changed_pages);
6
7--error ER_INCORRECT_GLOBAL_LOCAL_VAR
8SET @@GLOBAL.innodb_track_changed_pages=1;
9
10SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
11FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
12WHERE VARIABLE_NAME='innodb_track_changed_pages';
13
14SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages;
15
16--error ER_INCORRECT_GLOBAL_LOCAL_VAR
17SELECT COUNT(@@SESSION.innodb_track_changed_pages);
18--error ER_INCORRECT_GLOBAL_LOCAL_VAR
19SELECT COUNT(@@LOCAL.innodb_track_changed_pages);
20--error ER_BAD_FIELD_ERROR
21SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages;
022
=== modified file 'Percona-Server/storage/innobase/CMakeLists.txt'
--- Percona-Server/storage/innobase/CMakeLists.txt 2011-03-24 12:00:14 +0000
+++ Percona-Server/storage/innobase/CMakeLists.txt 2012-08-22 13:19:13 +0000
@@ -85,12 +85,41 @@
85 }"85 }"
86 HAVE_IB_GCC_ATOMIC_BUILTINS86 HAVE_IB_GCC_ATOMIC_BUILTINS
87 )87 )
88 CHECK_C_SOURCE_RUNS(
89 "
90 #include <stdint.h>
91 int main()
92 {
93 int64_t x, y, res;
94
95 x = 10;
96 y = 123;
97 res = __sync_bool_compare_and_swap(&x, x, y);
98 if (!res || x != y) {
99 return(1);
100 }
101
102 x = 10;
103 y = 123;
104 res = __sync_add_and_fetch(&x, y);
105 if (res != 123 + 10 || x != 123 + 10) {
106 return(1);
107 }
108
109 return(0);
110 }"
111 HAVE_IB_GCC_ATOMIC_BUILTINS_64
112 )
88ENDIF()113ENDIF()
89114
90IF(HAVE_IB_GCC_ATOMIC_BUILTINS)115IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
91 ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)116 ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
92ENDIF()117ENDIF()
93118
119IF(HAVE_IB_GCC_ATOMIC_BUILTINS_64)
120 ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS_64=1)
121ENDIF()
122
94 # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not123 # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
95IF(NOT CMAKE_CROSSCOMPILING)124IF(NOT CMAKE_CROSSCOMPILING)
96 CHECK_C_SOURCE_RUNS(125 CHECK_C_SOURCE_RUNS(
@@ -227,7 +256,7 @@
227 ibuf/ibuf0ibuf.c256 ibuf/ibuf0ibuf.c
228 pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c257 pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
229 lock/lock0lock.c lock/lock0iter.c258 lock/lock0lock.c lock/lock0iter.c
230 log/log0log.c log/log0recv.c259 log/log0log.c log/log0recv.c log/log0online.c
231 mach/mach0data.c260 mach/mach0data.c
232 mem/mem0mem.c mem/mem0pool.c261 mem/mem0mem.c mem/mem0pool.c
233 mtr/mtr0log.c mtr/mtr0mtr.c262 mtr/mtr0log.c mtr/mtr0mtr.c
234263
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-22 13:19:13 +0000
@@ -361,7 +361,8 @@
361 {&srv_error_monitor_thread_key, "srv_error_monitor_thread", 0},361 {&srv_error_monitor_thread_key, "srv_error_monitor_thread", 0},
362 {&srv_monitor_thread_key, "srv_monitor_thread", 0},362 {&srv_monitor_thread_key, "srv_monitor_thread", 0},
363 {&srv_master_thread_key, "srv_master_thread", 0},363 {&srv_master_thread_key, "srv_master_thread", 0},
364 {&srv_purge_thread_key, "srv_purge_thread", 0}364 {&srv_purge_thread_key, "srv_purge_thread", 0},
365 {&srv_log_tracking_thread_key, "srv_redo_log_follow_thread", 0}
365};366};
366# endif /* UNIV_PFS_THREAD */367# endif /* UNIV_PFS_THREAD */
367368
@@ -371,7 +372,8 @@
371static PSI_file_info all_innodb_files[] = {372static PSI_file_info all_innodb_files[] = {
372 {&innodb_file_data_key, "innodb_data_file", 0},373 {&innodb_file_data_key, "innodb_data_file", 0},
373 {&innodb_file_log_key, "innodb_log_file", 0},374 {&innodb_file_log_key, "innodb_log_file", 0},
374 {&innodb_file_temp_key, "innodb_temp_file", 0}375 {&innodb_file_temp_key, "innodb_temp_file", 0},
376 {&innodb_file_bmp_key, "innodb_bmp_file", 0}
375};377};
376# endif /* UNIV_PFS_IO */378# endif /* UNIV_PFS_IO */
377#endif /* HAVE_PSI_INTERFACE */379#endif /* HAVE_PSI_INTERFACE */
@@ -12658,6 +12660,11 @@
12658 "NULLS_UNEQUAL and NULLS_IGNORED",12660 "NULLS_UNEQUAL and NULLS_IGNORED",
12659 NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);12661 NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);
1266012662
12663static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages,
12664 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
12665 "Track the redo log for changed pages and output a changed page bitmap",
12666 NULL, NULL, FALSE);
12667
12661#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG12668#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
12662static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,12669static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
12663 PLUGIN_VAR_RQCMDARG,12670 PLUGIN_VAR_RQCMDARG,
@@ -12942,6 +12949,7 @@
12942 MYSQL_SYSVAR(use_sys_malloc),12949 MYSQL_SYSVAR(use_sys_malloc),
12943 MYSQL_SYSVAR(use_native_aio),12950 MYSQL_SYSVAR(use_native_aio),
12944 MYSQL_SYSVAR(change_buffering),12951 MYSQL_SYSVAR(change_buffering),
12952 MYSQL_SYSVAR(track_changed_pages),
12945#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG12953#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
12946 MYSQL_SYSVAR(change_buffering_debug),12954 MYSQL_SYSVAR(change_buffering_debug),
12947#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */12955#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
1294812956
=== modified file 'Percona-Server/storage/innobase/include/log0log.h'
--- Percona-Server/storage/innobase/include/log0log.h 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/include/log0log.h 2012-08-22 13:19:13 +0000
@@ -962,6 +962,11 @@
962 become signaled */962 become signaled */
963 /* @} */963 /* @} */
964#endif /* UNIV_LOG_ARCHIVE */964#endif /* UNIV_LOG_ARCHIVE */
965 ib_uint64_t tracked_lsn; /*!< log tracking has advanced to this
966 lsn. Field accessed atomically where
967 64-bit atomic ops are supported,
968 protected by the log sys mutex
969 otherwise. */
965};970};
966971
967/** Test if flush order mutex is owned. */972/** Test if flush order mutex is owned. */
968973
=== added file 'Percona-Server/storage/innobase/include/log0online.h'
--- Percona-Server/storage/innobase/include/log0online.h 1970-01-01 00:00:00 +0000
+++ Percona-Server/storage/innobase/include/log0online.h 2012-08-22 13:19:13 +0000
@@ -0,0 +1,51 @@
1/*****************************************************************************
2
3Copyright (c) 2011-2012, Percona Inc. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15Place, Suite 330, Boston, MA 02111-1307 USA
16
17*****************************************************************************/
18
19/**************************************************//**
20@file include/log0online.h
21Online database log parsing for changed page tracking
22*******************************************************/
23
24#ifndef log0online_h
25#define log0online_h
26
27#include "univ.i"
28
29/*********************************************************************//**
30Initializes the online log following subsytem. */
31UNIV_INTERN
32void
33log_online_read_init();
34/*===================*/
35
36/*********************************************************************//**
37Shuts down the online log following subsystem. */
38UNIV_INTERN
39void
40log_online_read_shutdown();
41/*=======================*/
42
43/*********************************************************************//**
44Reads and parses the redo log up to last checkpoint LSN to build the changed
45page bitmap which is then written to disk. */
46UNIV_INTERN
47void
48log_online_follow_redo_log();
49/*=========================*/
50
51#endif
052
=== modified file 'Percona-Server/storage/innobase/include/log0recv.h'
--- Percona-Server/storage/innobase/include/log0recv.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/include/log0recv.h 2012-08-22 13:19:13 +0000
@@ -32,6 +32,28 @@
32#include "hash0hash.h"32#include "hash0hash.h"
33#include "log0log.h"33#include "log0log.h"
3434
35/******************************************************//**
36Checks the 4-byte checksum to the trailer checksum field of a log
37block. We also accept a log block in the old format before
38InnoDB-3.23.52 where the checksum field contains the log block number.
39@return TRUE if ok, or if the log block may be in the format of InnoDB
40version predating 3.23.52 */
41UNIV_INTERN
42ibool
43log_block_checksum_is_ok_or_old_format(
44/*===================================*/
45 const byte* block); /*!< in: pointer to a log block */
46
47/*******************************************************//**
48Calculates the new value for lsn when more data is added to the log. */
49UNIV_INTERN
50ib_uint64_t
51recv_calc_lsn_on_data_add(
52/*======================*/
53 ib_uint64_t lsn, /*!< in: old lsn */
54 ib_uint64_t len); /*!< in: this many bytes of data is
55 added, log block headers not included */
56
35#ifdef UNIV_HOTBACKUP57#ifdef UNIV_HOTBACKUP
36extern ibool recv_replay_file_ops;58extern ibool recv_replay_file_ops;
3759
@@ -182,6 +204,21 @@
182void204void
183recv_recovery_rollback_active(void);205recv_recovery_rollback_active(void);
184/*===============================*/206/*===============================*/
207
208/*******************************************************************//**
209Tries to parse a single log record and returns its length.
210@return length of the record, or 0 if the record was not complete */
211UNIV_INTERN
212ulint
213recv_parse_log_rec(
214/*===============*/
215 byte* ptr, /*!< in: pointer to a buffer */
216 byte* end_ptr,/*!< in: pointer to the buffer end */
217 byte* type, /*!< out: type */
218 ulint* space, /*!< out: space id */
219 ulint* page_no,/*!< out: page number */
220 byte** body); /*!< out: log record body start */
221
185/*******************************************************//**222/*******************************************************//**
186Scans log from a buffer and stores new log data to the parsing buffer.223Scans log from a buffer and stores new log data to the parsing buffer.
187Parses and hashes the log records if new data found. Unless224Parses and hashes the log records if new data found. Unless
188225
=== modified file 'Percona-Server/storage/innobase/include/os0file.h'
--- Percona-Server/storage/innobase/include/os0file.h 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/include/os0file.h 2012-08-22 13:19:13 +0000
@@ -197,6 +197,7 @@
197extern mysql_pfs_key_t innodb_file_data_key;197extern mysql_pfs_key_t innodb_file_data_key;
198extern mysql_pfs_key_t innodb_file_log_key;198extern mysql_pfs_key_t innodb_file_log_key;
199extern mysql_pfs_key_t innodb_file_temp_key;199extern mysql_pfs_key_t innodb_file_temp_key;
200extern mysql_pfs_key_t innodb_file_bmp_key;
200201
201/* Following four macros are instumentations to register202/* Following four macros are instumentations to register
202various file I/O operations with performance schema.203various file I/O operations with performance schema.
@@ -867,6 +868,14 @@
867/*============*/868/*============*/
868 FILE* file); /*!< in: file to be truncated */869 FILE* file); /*!< in: file to be truncated */
869/***********************************************************************//**870/***********************************************************************//**
871Truncates a file at the specified position.
872@return TRUE if success */
873UNIV_INTERN
874ibool
875os_file_set_eof_at(
876 os_file_t file, /*!< in: handle to a file */
877 ib_uint64_t new_len);/*!< in: new file length */
878/***********************************************************************//**
870NOTE! Use the corresponding macro os_file_flush(), not directly this function!879NOTE! Use the corresponding macro os_file_flush(), not directly this function!
871Flushes the write buffers of a given file to the disk.880Flushes the write buffers of a given file to the disk.
872@return TRUE if success */881@return TRUE if success */
873882
=== modified file 'Percona-Server/storage/innobase/include/os0sync.h'
--- Percona-Server/storage/innobase/include/os0sync.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/include/os0sync.h 2012-08-22 13:19:13 +0000
@@ -265,7 +265,11 @@
265265
266#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)266#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
267267
268#define HAVE_ATOMIC_BUILTINS268# define HAVE_ATOMIC_BUILTINS
269
270# ifdef HAVE_IB_GCC_ATOMIC_BUILTINS_64
271# define HAVE_ATOMIC_BUILTINS_64
272# endif
269273
270/**********************************************************//**274/**********************************************************//**
271Returns true if swapped, ptr is pointer to target, old_val is value to275Returns true if swapped, ptr is pointer to target, old_val is value to
@@ -304,6 +308,9 @@
304# define os_atomic_increment_ulint(ptr, amount) \308# define os_atomic_increment_ulint(ptr, amount) \
305 os_atomic_increment(ptr, amount)309 os_atomic_increment(ptr, amount)
306310
311# define os_atomic_increment_uint64(ptr, amount) \
312 os_atomic_increment(ptr, amount)
313
307/**********************************************************//**314/**********************************************************//**
308Returns the old value of *ptr, atomically sets *ptr to new_val */315Returns the old value of *ptr, atomically sets *ptr to new_val */
309316
@@ -312,12 +319,13 @@
312319
313#elif defined(HAVE_IB_SOLARIS_ATOMICS)320#elif defined(HAVE_IB_SOLARIS_ATOMICS)
314321
315#define HAVE_ATOMIC_BUILTINS322# define HAVE_ATOMIC_BUILTINS
323# define HAVE_ATOMIC_BUILTINS_64
316324
317/* If not compiling with GCC or GCC doesn't support the atomic325/* If not compiling with GCC or GCC doesn't support the atomic
318intrinsics and running on Solaris >= 10 use Solaris atomics */326intrinsics and running on Solaris >= 10 use Solaris atomics */
319327
320#include <atomic.h>328# include <atomic.h>
321329
322/**********************************************************//**330/**********************************************************//**
323Returns true if swapped, ptr is pointer to target, old_val is value to331Returns true if swapped, ptr is pointer to target, old_val is value to
@@ -357,6 +365,9 @@
357# define os_atomic_increment_ulint(ptr, amount) \365# define os_atomic_increment_ulint(ptr, amount) \
358 atomic_add_long_nv(ptr, amount)366 atomic_add_long_nv(ptr, amount)
359367
368# define os_atomic_increment_uint64(ptr, amount) \
369 atomic_add_64_nv(ptr, amount)
370
360/**********************************************************//**371/**********************************************************//**
361Returns the old value of *ptr, atomically sets *ptr to new_val */372Returns the old value of *ptr, atomically sets *ptr to new_val */
362373
@@ -365,7 +376,11 @@
365376
366#elif defined(HAVE_WINDOWS_ATOMICS)377#elif defined(HAVE_WINDOWS_ATOMICS)
367378
368#define HAVE_ATOMIC_BUILTINS379# define HAVE_ATOMIC_BUILTINS
380
381# ifndef _WIN32
382# define HAVE_ATOMIC_BUILTINS_64
383# endif
369384
370/* On Windows, use Windows atomics / interlocked */385/* On Windows, use Windows atomics / interlocked */
371# ifdef _WIN64386# ifdef _WIN64
@@ -403,6 +418,11 @@
403# define os_atomic_increment_ulint(ptr, amount) \418# define os_atomic_increment_ulint(ptr, amount) \
404 ((ulint) (win_xchg_and_add(ptr, amount) + amount))419 ((ulint) (win_xchg_and_add(ptr, amount) + amount))
405420
421# define os_atomic_increment_uint64(ptr, amount) \
422 ((ib_uint64_t) (InterlockedExchangeAdd64( \
423 (ib_int64_t*) ptr, \
424 (ib_int64_t) amount) + amount))
425
406/**********************************************************//**426/**********************************************************//**
407Returns the old value of *ptr, atomically sets *ptr to new_val.427Returns the old value of *ptr, atomically sets *ptr to new_val.
408InterlockedExchange() operates on LONG, and the LONG will be428InterlockedExchange() operates on LONG, and the LONG will be
409429
=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
--- Percona-Server/storage/innobase/include/srv0srv.h 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/include/srv0srv.h 2012-08-22 13:19:13 +0000
@@ -66,6 +66,14 @@
66/* The error monitor thread waits on this event. */66/* The error monitor thread waits on this event. */
67extern os_event_t srv_error_event;67extern os_event_t srv_error_event;
6868
69/* This event is set on checkpoint completion to wake the redo log parser
70thread */
71extern os_event_t srv_checkpoint_completed_event;
72
73/* This event is set on the online redo log following thread exit to signal
74that the (slow) shutdown may proceed */
75extern os_event_t srv_redo_log_thread_finished_event;
76
69/* If the last data file is auto-extended, we add this many pages to it77/* If the last data file is auto-extended, we add this many pages to it
70at a time */78at a time */
71#define SRV_AUTO_EXTEND_INCREMENT \79#define SRV_AUTO_EXTEND_INCREMENT \
@@ -133,6 +141,8 @@
133141
134extern ibool srv_recovery_stats;142extern ibool srv_recovery_stats;
135143
144extern my_bool srv_track_changed_pages;
145
136extern ibool srv_auto_extend_last_data_file;146extern ibool srv_auto_extend_last_data_file;
137extern ulint srv_last_file_size_max;147extern ulint srv_last_file_size_max;
138extern char** srv_log_group_home_dirs;148extern char** srv_log_group_home_dirs;
@@ -399,6 +409,7 @@
399extern mysql_pfs_key_t srv_monitor_thread_key;409extern mysql_pfs_key_t srv_monitor_thread_key;
400extern mysql_pfs_key_t srv_master_thread_key;410extern mysql_pfs_key_t srv_master_thread_key;
401extern mysql_pfs_key_t srv_purge_thread_key;411extern mysql_pfs_key_t srv_purge_thread_key;
412extern mysql_pfs_key_t srv_log_tracking_thread_key;
402413
403/* This macro register the current thread and its key with performance414/* This macro register the current thread and its key with performance
404schema */415schema */
@@ -694,6 +705,15 @@
694 void* arg); /*!< in: a dummy parameter required by705 void* arg); /*!< in: a dummy parameter required by
695 os_thread_create */706 os_thread_create */
696/******************************************************************//**707/******************************************************************//**
708A thread which follows the redo log and outputs the changed page bitmap.
709@return a dummy value */
710UNIV_INTERN
711os_thread_ret_t
712srv_redo_log_follow_thread(
713/*=======================*/
714 void* arg); /*!< in: a dummy parameter required by
715 os_thread_create */
716/******************************************************************//**
697Outputs to a file the output of the InnoDB Monitor.717Outputs to a file the output of the InnoDB Monitor.
698@return FALSE if not all information printed718@return FALSE if not all information printed
699due to failure to obtain necessary mutex */719due to failure to obtain necessary mutex */
700720
=== modified file 'Percona-Server/storage/innobase/include/ut0rbt.h'
--- Percona-Server/storage/innobase/include/ut0rbt.h 2010-09-27 17:08:12 +0000
+++ Percona-Server/storage/innobase/include/ut0rbt.h 2012-08-22 13:19:13 +0000
@@ -116,6 +116,10 @@
116/* Compare a key with the node value (t is tree, k is key, n is node)*/116/* Compare a key with the node value (t is tree, k is key, n is node)*/
117#define rbt_compare(t, k, n) (t->compare(k, n->value))117#define rbt_compare(t, k, n) (t->compare(k, n->value))
118118
119/* Node size. FIXME: name might clash, but currently it does not, so for easier
120 maintenance do not rename it for now. */
121#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
122
119/**********************************************************************//**123/**********************************************************************//**
120Free an instance of a red black tree */124Free an instance of a red black tree */
121UNIV_INTERN125UNIV_INTERN
@@ -187,6 +191,17 @@
187 ib_rbt_bound_t* parent, /*!< in: parent */191 ib_rbt_bound_t* parent, /*!< in: parent */
188 const void* value); /*!< in: this value is copied192 const void* value); /*!< in: this value is copied
189 to the node */193 to the node */
194/****************************************************************//**
195Add a new caller-provided node to tree at the specified position.
196The node must have its key fields initialized correctly.
197@return added node */
198UNIV_INTERN
199const ib_rbt_node_t*
200rbt_add_preallocated_node(
201/*======================*/
202 ib_rbt_t* tree, /*!< in: rb tree */
203 ib_rbt_bound_t* parent, /*!< in: parent */
204 ib_rbt_node_t* node); /*!< in: node */
190/**********************************************************************//**205/**********************************************************************//**
191Return the left most data node in the tree206Return the left most data node in the tree
192@return left most node */207@return left most node */
@@ -273,6 +288,13 @@
273rbt_clear(288rbt_clear(
274/*======*/289/*======*/
275 ib_rbt_t* tree); /*!< in: rb tree */290 ib_rbt_t* tree); /*!< in: rb tree */
291/****************************************************************//**
292Clear the tree without deleting and freeing its nodes. */
293UNIV_INTERN
294void
295rbt_reset(
296/*======*/
297 ib_rbt_t* tree); /*!< in: rb tree */
276/**********************************************************************//**298/**********************************************************************//**
277Merge the node from dst into src. Return the number of nodes merged.299Merge the node from dst into src. Return the number of nodes merged.
278@return no. of recs merged */300@return no. of recs merged */
279301
=== modified file 'Percona-Server/storage/innobase/log/log0log.c'
--- Percona-Server/storage/innobase/log/log0log.c 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/log/log0log.c 2012-08-22 13:19:13 +0000
@@ -214,6 +214,54 @@
214 return(lsn);214 return(lsn);
215}215}
216216
217/****************************************************************//**
218Safely reads the log_sys->tracked_lsn value. Uses atomic operations
219if available, otherwise this field is protected with the log system
220mutex. The writer counterpart function is log_set_tracked_lsn() in
221log0online.c.
222
223@return log_sys->tracked_lsn value. */
224UNIV_INLINE
225ib_uint64_t
226log_get_tracked_lsn()
227{
228#ifdef HAVE_ATOMIC_BUILTINS_64
229 return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
230#else
231 ut_ad(mutex_own(&(log_sys->mutex)));
232 return log_sys->tracked_lsn;
233#endif
234}
235
236/****************************************************************//**
237Checks if the log groups have a big enough margin of free space in
238so that a new log entry can be written without overwriting log data
239that is not read by the changed page bitmap thread.
240@return TRUE if there is not enough free space. */
241static
242ibool
243log_check_tracking_margin(
244 ulint lsn_advance) /*!< in: an upper limit on how much log data we
245 plan to write. If zero, the margin will be
246 checked for the already-written log. */
247{
248 ib_uint64_t tracked_lsn;
249 ulint tracked_lsn_age;
250
251 if (!srv_track_changed_pages) {
252 return FALSE;
253 }
254
255 ut_ad(mutex_own(&(log_sys->mutex)));
256
257 tracked_lsn = log_get_tracked_lsn();
258 tracked_lsn_age = log_sys->lsn - tracked_lsn;
259
260 /* The overwrite would happen when log_sys->log_group_capacity is
261 exceeded, but we use max_checkpoint_age for an extra safety margin. */
262 return tracked_lsn_age + lsn_advance > log_sys->max_checkpoint_age;
263}
264
217/************************************************************//**265/************************************************************//**
218Opens the log for log_write_low. The log must be closed with log_close and266Opens the log for log_write_low. The log must be closed with log_close and
219released with log_release.267released with log_release.
@@ -230,9 +278,7 @@
230 ulint archived_lsn_age;278 ulint archived_lsn_age;
231 ulint dummy;279 ulint dummy;
232#endif /* UNIV_LOG_ARCHIVE */280#endif /* UNIV_LOG_ARCHIVE */
233#ifdef UNIV_DEBUG
234 ulint count = 0;281 ulint count = 0;
235#endif /* UNIV_DEBUG */
236282
237 ut_a(len < log->buf_size / 2);283 ut_a(len < log->buf_size / 2);
238loop:284loop:
@@ -260,6 +306,19 @@
260 goto loop;306 goto loop;
261 }307 }
262308
309 if (log_check_tracking_margin(len_upper_limit) && (++count < 50)) {
310
311 /* This log write would violate the untracked LSN free space
312 margin. Limit this to 50 retries as there might be situations
313 where we have no choice but to proceed anyway, i.e. if the log
314 is about to be overflown, log tracking or not. */
315 mutex_exit(&(log->mutex));
316
317 os_thread_sleep(10000);
318
319 goto loop;
320 }
321
263#ifdef UNIV_LOG_ARCHIVE322#ifdef UNIV_LOG_ARCHIVE
264 if (log->archiving_state != LOG_ARCH_OFF) {323 if (log->archiving_state != LOG_ARCH_OFF) {
265324
@@ -398,6 +457,8 @@
398 ulint first_rec_group;457 ulint first_rec_group;
399 ib_uint64_t oldest_lsn;458 ib_uint64_t oldest_lsn;
400 ib_uint64_t lsn;459 ib_uint64_t lsn;
460 ib_uint64_t tracked_lsn;
461 ulint tracked_lsn_age;
401 log_t* log = log_sys;462 log_t* log = log_sys;
402 ib_uint64_t checkpoint_age;463 ib_uint64_t checkpoint_age;
403464
@@ -424,6 +485,19 @@
424 log->check_flush_or_checkpoint = TRUE;485 log->check_flush_or_checkpoint = TRUE;
425 }486 }
426487
488 if (srv_track_changed_pages) {
489
490 tracked_lsn = log_get_tracked_lsn();
491 tracked_lsn_age = lsn - tracked_lsn;
492
493 if (tracked_lsn_age >= log->log_group_capacity) {
494
495 fprintf(stderr, " InnoDB: Error: the age of the "
496 "oldest untracked record exceeds the log "
497 "group capacity!\n");
498 }
499 }
500
427 checkpoint_age = lsn - log->last_checkpoint_lsn;501 checkpoint_age = lsn - log->last_checkpoint_lsn;
428502
429 if (checkpoint_age >= log->log_group_capacity) {503 if (checkpoint_age >= log->log_group_capacity) {
@@ -891,6 +965,8 @@
891 log_sys->archiving_on = os_event_create(NULL);965 log_sys->archiving_on = os_event_create(NULL);
892#endif /* UNIV_LOG_ARCHIVE */966#endif /* UNIV_LOG_ARCHIVE */
893967
968 log_sys->tracked_lsn = 0;
969
894 /*----------------------------*/970 /*----------------------------*/
895971
896 log_block_init(log_sys->buf, log_sys->lsn);972 log_block_init(log_sys->buf, log_sys->lsn);
@@ -1740,6 +1816,12 @@
1740 }1816 }
17411817
1742 mutex_exit(&(log_sys->mutex));1818 mutex_exit(&(log_sys->mutex));
1819
1820 /* Wake the redo log watching thread to parse the log up to this
1821 checkpoint. */
1822 if (srv_track_changed_pages) {
1823 os_event_set(srv_checkpoint_completed_event);
1824 }
1743}1825}
17441826
1745/*******************************************************************//**1827/*******************************************************************//**
@@ -3086,6 +3168,15 @@
30863168
3087 log_checkpoint_margin();3169 log_checkpoint_margin();
30883170
3171 mutex_enter(&(log_sys->mutex));
3172 if (log_check_tracking_margin(0)) {
3173
3174 mutex_exit(&(log_sys->mutex));
3175 os_thread_sleep(10000);
3176 goto loop;
3177 }
3178 mutex_exit(&(log_sys->mutex));
3179
3089#ifdef UNIV_LOG_ARCHIVE3180#ifdef UNIV_LOG_ARCHIVE
3090 log_archive_margin();3181 log_archive_margin();
3091#endif /* UNIV_LOG_ARCHIVE */3182#endif /* UNIV_LOG_ARCHIVE */
@@ -3114,6 +3205,7 @@
3114/*=======================================*/3205/*=======================================*/
3115{3206{
3116 ib_uint64_t lsn;3207 ib_uint64_t lsn;
3208 ib_uint64_t tracked_lsn;
3117 ulint arch_log_no;3209 ulint arch_log_no;
3118 ibool server_busy;3210 ibool server_busy;
3119 ulint count = 0;3211 ulint count = 0;
@@ -3299,6 +3391,12 @@
3299 }3391 }
33003392
3301 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;3393 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
3394 /* Wake the log tracking thread which will then immediatelly
3395 quit because of srv_shutdown_state value */
3396 if (srv_track_changed_pages) {
3397 os_event_set(srv_checkpoint_completed_event);
3398 os_event_wait(srv_redo_log_thread_finished_event);
3399 }
3302 fil_close_all_files();3400 fil_close_all_files();
3303 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);3401 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
3304 return;3402 return;
@@ -3308,9 +3406,12 @@
33083406
3309 mutex_enter(&log_sys->mutex);3407 mutex_enter(&log_sys->mutex);
33103408
3409 tracked_lsn = log_get_tracked_lsn();
3410
3311 lsn = log_sys->lsn;3411 lsn = log_sys->lsn;
33123412
3313 if (lsn != log_sys->last_checkpoint_lsn3413 if (lsn != log_sys->last_checkpoint_lsn
3414 || (srv_track_changed_pages && (tracked_lsn != log_sys->last_checkpoint_lsn))
3314#ifdef UNIV_LOG_ARCHIVE3415#ifdef UNIV_LOG_ARCHIVE
3315 || (srv_log_archive_on3416 || (srv_log_archive_on
3316 && lsn != log_sys->archived_lsn + LOG_BLOCK_HDR_SIZE)3417 && lsn != log_sys->archived_lsn + LOG_BLOCK_HDR_SIZE)
@@ -3368,6 +3469,11 @@
33683469
3369 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;3470 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
33703471
3472 /* Signal the log following thread to quit */
3473 if (srv_track_changed_pages) {
3474 os_event_set(srv_checkpoint_completed_event);
3475 }
3476
3371 /* Make some checks that the server really is quiet */3477 /* Make some checks that the server really is quiet */
3372 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);3478 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
33733479
@@ -3388,6 +3494,10 @@
33883494
3389 fil_flush_file_spaces(FIL_TABLESPACE);3495 fil_flush_file_spaces(FIL_TABLESPACE);
33903496
3497 if (srv_track_changed_pages) {
3498 os_event_wait(srv_redo_log_thread_finished_event);
3499 }
3500
3391 fil_close_all_files();3501 fil_close_all_files();
33923502
3393 /* Make some checks that the server really is quiet */3503 /* Make some checks that the server really is quiet */
@@ -3514,6 +3624,18 @@
3514 ((log_sys->n_log_ios - log_sys->n_log_ios_old)3624 ((log_sys->n_log_ios - log_sys->n_log_ios_old)
3515 / time_elapsed));3625 / time_elapsed));
35163626
3627 if (srv_track_changed_pages) {
3628
3629 /* The maximum tracked LSN age is equal to the maximum
3630 checkpoint age */
3631 fprintf(file,
3632 "Log tracking enabled\n"
3633 "Log tracked up to %llu\n"
3634 "Max tracked LSN age %lu\n",
3635 log_get_tracked_lsn(),
3636 log_sys->max_checkpoint_age);
3637 }
3638
3517 log_sys->n_log_ios_old = log_sys->n_log_ios;3639 log_sys->n_log_ios_old = log_sys->n_log_ios;
3518 log_sys->last_printout_time = current_time;3640 log_sys->last_printout_time = current_time;
35193641
35203642
=== added file 'Percona-Server/storage/innobase/log/log0online.c'
--- Percona-Server/storage/innobase/log/log0online.c 1970-01-01 00:00:00 +0000
+++ Percona-Server/storage/innobase/log/log0online.c 2012-08-22 13:19:13 +0000
@@ -0,0 +1,927 @@
1/*****************************************************************************
2
3Copyright (c) 2011-2012 Percona Inc. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15Place, Suite 330, Boston, MA 02111-1307 USA
16
17*****************************************************************************/
18
19/**************************************************//**
20@file log/log0online.c
21Online database log parsing for changed page tracking
22
23*******************************************************/
24
25#include "log0online.h"
26
27#include "my_dbug.h"
28
29#include "log0recv.h"
30#include "mach0data.h"
31#include "mtr0log.h"
32#include "os0file.h"
33#include "srv0srv.h"
34#include "srv0start.h"
35#include "trx0sys.h"
36#include "ut0rbt.h"
37
38enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };
39
40/** Log parsing and bitmap output data structure */
41struct log_bitmap_struct {
42 byte read_buf[FOLLOW_SCAN_SIZE];
43 /*!< log read buffer */
44 byte parse_buf[RECV_PARSING_BUF_SIZE];
45 /*!< log parse buffer */
46 byte* parse_buf_end; /*!< parse buffer position where the
47 next read log data should be copied to.
48 If the previous log records were fully
49 parsed, it points to the start,
50 otherwise points immediatelly past the
51 end of the incomplete log record. */
52 char* out_name; /*!< the file name for bitmap output */
53 os_file_t out; /*!< the bitmap output file */
54 ib_uint64_t out_offset; /*!< the next write position in the
55 bitmap output file */
56 ib_uint64_t start_lsn; /*!< the LSN of the next unparsed
57 record and the start of the next LSN
58 interval to be parsed. */
59 ib_uint64_t end_lsn; /*!< the end of the LSN interval to be
60 parsed, equal to the next checkpoint
61 LSN at the time of parse */
62 ib_uint64_t next_parse_lsn; /*!< the LSN of the next unparsed
63 record in the current parse */
64 ib_rbt_t* modified_pages; /*!< the current modified page set,
65 organized as the RB-tree with the keys
66 of (space, 4KB-block-start-page-id)
67 pairs */
68 ib_rbt_node_t* page_free_list; /*!< Singly-linked list of freed nodes
69 of modified_pages tree for later
70 reuse. Nodes are linked through
71 ib_rbt_node_t.left as this field has
72 both the correct type and the tree does
73 not mind its overwrite during
74 rbt_next() tree traversal. */
75};
76
77/* The log parsing and bitmap output struct instance */
78static struct log_bitmap_struct* log_bmp_sys;
79
80/* File name stem for modified page bitmaps */
81static const char* modified_page_stem = "ib_modified_log.";
82
83/* On server startup with empty database srv_start_lsn == 0, in
84which case the first LSN of actual log records will be this. */
85#define MIN_TRACKED_LSN ((LOG_START_LSN) + (LOG_BLOCK_HDR_SIZE))
86
87/** The bitmap file block size in bytes. All writes will be multiples of this.
88 */
89enum {
90 MODIFIED_PAGE_BLOCK_SIZE = 4096
91};
92
93
94/** Offsets in a file bitmap block */
95enum {
96 MODIFIED_PAGE_IS_LAST_BLOCK = 0,/* 1 if last block in the current
97 write, 0 otherwise. */
98 MODIFIED_PAGE_START_LSN = 4, /* The starting tracked LSN of this and
99 other blocks in the same write */
100 MODIFIED_PAGE_END_LSN = 12, /* The ending tracked LSN of this and
101 other blocks in the same write */
102 MODIFIED_PAGE_SPACE_ID = 20, /* The space ID of tracked pages in
103 this block */
104 MODIFIED_PAGE_1ST_PAGE_ID = 24, /* The page ID of the first tracked
105 page in this block */
106 MODIFIED_PAGE_BLOCK_UNUSED_1 = 28,/* Unused in order to align the start
107 of bitmap at 8 byte boundary */
108 MODIFIED_PAGE_BLOCK_BITMAP = 32,/* Start of the bitmap itself */
109 MODIFIED_PAGE_BLOCK_UNUSED_2 = MODIFIED_PAGE_BLOCK_SIZE - 8,
110 /* Unused in order to align the end of
111 bitmap at 8 byte boundary */
112 MODIFIED_PAGE_BLOCK_CHECKSUM = MODIFIED_PAGE_BLOCK_SIZE - 4
113 /* The checksum of the current block */
114};
115
116/** Length of the bitmap data in a block in bytes */
117enum { MODIFIED_PAGE_BLOCK_BITMAP_LEN
118 = MODIFIED_PAGE_BLOCK_UNUSED_2 - MODIFIED_PAGE_BLOCK_BITMAP };
119
120/** Length of the bitmap data in a block in page ids */
121enum { MODIFIED_PAGE_BLOCK_ID_COUNT = MODIFIED_PAGE_BLOCK_BITMAP_LEN * 8 };
122
123/****************************************************************//**
124Provide a comparisson function for the RB-tree tree (space,
125block_start_page) pairs. Actual implementation does not matter as
126long as the ordering is full.
127@return -1 if p1 < p2, 0 if p1 == p2, 1 if p1 > p2
128*/
129static
130int
131log_online_compare_bmp_keys(
132/*========================*/
133 const void* p1, /*!<in: 1st key to compare */
134 const void* p2) /*!<in: 2nd key to compare */
135{
136 const byte *k1 = (const byte *)p1;
137 const byte *k2 = (const byte *)p2;
138
139 ulint k1_space = mach_read_from_4(k1 + MODIFIED_PAGE_SPACE_ID);
140 ulint k2_space = mach_read_from_4(k2 + MODIFIED_PAGE_SPACE_ID);
141 if (k1_space == k2_space) {
142 ulint k1_start_page
143 = mach_read_from_4(k1 + MODIFIED_PAGE_1ST_PAGE_ID);
144 ulint k2_start_page
145 = mach_read_from_4(k2 + MODIFIED_PAGE_1ST_PAGE_ID);
146 return k1_start_page < k2_start_page
147 ? -1 : k1_start_page > k2_start_page ? 1 : 0;
148 }
149 return k1_space < k2_space ? -1 : 1;
150}
151
152/****************************************************************//**
153Set a bit for tracked page in the bitmap. Expand the bitmap tree as
154necessary. */
155static
156void
157log_online_set_page_bit(
158/*====================*/
159 ulint space, /*!<in: log record space id */
160 ulint page_no)/*!<in: log record page id */
161{
162 ulint block_start_page;
163 ulint block_pos;
164 uint bit_pos;
165 ib_rbt_bound_t tree_search_pos;
166 byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
167 byte *page_ptr;
168
169 ut_a(space != ULINT_UNDEFINED);
170 ut_a(page_no != ULINT_UNDEFINED);
171
172 block_start_page = page_no / MODIFIED_PAGE_BLOCK_ID_COUNT
173 * MODIFIED_PAGE_BLOCK_ID_COUNT;
174 block_pos = block_start_page ? (page_no % block_start_page / 8)
175 : (page_no / 8);
176 bit_pos = page_no % 8;
177
178 mach_write_to_4(search_page + MODIFIED_PAGE_SPACE_ID, space);
179 mach_write_to_4(search_page + MODIFIED_PAGE_1ST_PAGE_ID,
180 block_start_page);
181
182 if (!rbt_search(log_bmp_sys->modified_pages, &tree_search_pos,
183 search_page)) {
184 page_ptr = rbt_value(byte, tree_search_pos.last);
185 }
186 else {
187 ib_rbt_node_t *new_node;
188
189 if (log_bmp_sys->page_free_list) {
190 new_node = log_bmp_sys->page_free_list;
191 log_bmp_sys->page_free_list = new_node->left;
192 }
193 else {
194 new_node = ut_malloc(SIZEOF_NODE(
195 log_bmp_sys->modified_pages));
196 }
197 memset(new_node, 0, SIZEOF_NODE(log_bmp_sys->modified_pages));
198
199 page_ptr = rbt_value(byte, new_node);
200 mach_write_to_4(page_ptr + MODIFIED_PAGE_SPACE_ID, space);
201 mach_write_to_4(page_ptr + MODIFIED_PAGE_1ST_PAGE_ID,
202 block_start_page);
203
204 rbt_add_preallocated_node(log_bmp_sys->modified_pages,
205 &tree_search_pos, new_node);
206 }
207 page_ptr[MODIFIED_PAGE_BLOCK_BITMAP + block_pos] |= (1U << bit_pos);
208}
209
210/****************************************************************//**
211Calculate a bitmap block checksum. Algorithm borrowed from
212log_block_calc_checksum.
213@return checksum */
214UNIV_INLINE
215ulint
216log_online_calc_checksum(
217/*=====================*/
218 const byte* block) /*!<in: bitmap block */
219{
220 ulint sum;
221 ulint sh;
222 ulint i;
223
224 sum = 1;
225 sh = 0;
226
227 for (i = 0; i < MODIFIED_PAGE_BLOCK_CHECKSUM; i++) {
228
229 ulint b = block[i];
230 sum &= 0x7FFFFFFFUL;
231 sum += b;
232 sum += b << sh;
233 sh++;
234 if (sh > 24) {
235 sh = 0;
236 }
237 }
238
239 return sum;
240}
241
242/****************************************************************//**
243Get the last tracked fully LSN from the bitmap file by reading
244backwards untile a correct end page is found. Detects incomplete
245writes and corrupted data. Sets the start output position for the
246written bitmap data.
247@return the last fully tracked LSN */
248static
249ib_uint64_t
250log_online_read_last_tracked_lsn()
251/*==============================*/
252{
253 byte page[MODIFIED_PAGE_BLOCK_SIZE];
254 ib_uint64_t read_offset = log_bmp_sys->out_offset;
255 /* Initialize these to nonequal values so that file size == 0 case with
256 zero loop repetitions is handled correctly */
257 ulint checksum = 0;
258 ulint actual_checksum = !checksum;
259 ibool is_last_page = FALSE;
260 ib_uint64_t result;
261
262 ut_ad(log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE == 0);
263
264 while (checksum != actual_checksum && read_offset > 0 && !is_last_page)
265 {
266
267 ulint offset_low, offset_high;
268 ibool success;
269
270 read_offset -= MODIFIED_PAGE_BLOCK_SIZE;
271 offset_high = (ulint)(read_offset >> 32);
272 offset_low = (ulint)(read_offset & 0xFFFFFFFF);
273
274 success = os_file_read(log_bmp_sys->out, page, offset_low,
275 offset_high, MODIFIED_PAGE_BLOCK_SIZE);
276 if (!success) {
277
278 /* The following call prints an error message */
279 os_file_get_last_error(TRUE);
280 /* Here and below assume that bitmap file names do not
281 contain apostrophes, thus no need for
282 ut_print_filename(). */
283 fprintf(stderr, "InnoDB: Warning: failed reading "
284 "changed page bitmap file \'%s\'\n",
285 log_bmp_sys->out_name);
286 return MIN_TRACKED_LSN;
287 }
288
289 is_last_page
290 = mach_read_from_4(page + MODIFIED_PAGE_IS_LAST_BLOCK);
291 checksum = mach_read_from_4(page
292 + MODIFIED_PAGE_BLOCK_CHECKSUM);
293 actual_checksum = log_online_calc_checksum(page);
294 if (checksum != actual_checksum) {
295
296 fprintf(stderr, "InnoDB: Warning: corruption "
297 "detected in \'%s\' at offset %llu\n",
298 log_bmp_sys->out_name, read_offset);
299 }
300
301 };
302
303 if (UNIV_LIKELY(checksum == actual_checksum && is_last_page)) {
304
305 log_bmp_sys->out_offset = read_offset
306 + MODIFIED_PAGE_BLOCK_SIZE;
307 result = mach_read_from_8(page + MODIFIED_PAGE_END_LSN);
308 }
309 else {
310 log_bmp_sys->out_offset = read_offset;
311 result = 0;
312 }
313
314 /* Truncate the output file to discard the corrupted bitmap data, if
315 any */
316 if (!os_file_set_eof_at(log_bmp_sys->out,
317 log_bmp_sys->out_offset)) {
318 fprintf(stderr, "InnoDB: Warning: failed truncating "
319 "changed page bitmap file \'%s\' to %llu bytes\n",
320 log_bmp_sys->out_name, log_bmp_sys->out_offset);
321 result = 0;
322 }
323 return result;
324}
325
326/****************************************************************//**
327Safely write the log_sys->tracked_lsn value. Uses atomic operations
328if available, otherwise this field is protected with the log system
329mutex. The reader counterpart function is log_get_tracked_lsn() in
330log0log.c. */
331UNIV_INLINE
332void
333log_set_tracked_lsn(
334/*================*/
335 ib_uint64_t tracked_lsn) /*!<in: new value */
336{
337#ifdef HAVE_ATOMIC_BUILTINS_64
338 /* Single writer, no data race here */
339 ib_uint64_t old_value
340 = os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
341 (void) os_atomic_increment_uint64(&log_sys->tracked_lsn,
342 tracked_lsn - old_value);
343#else
344 mutex_enter(&log_sys->mutex);
345 log_sys->tracked_lsn = tracked_lsn;
346 mutex_exit(&log_sys->mutex);
347#endif
348}
349
350/****************************************************************//**
351Diagnose a gap in tracked LSN range on server startup due to crash or
352very fast shutdown and try to close it by tracking the data
353immediatelly, if possible. */
354static
355void
356log_online_track_missing_on_startup(
357/*================================*/
358 ib_uint64_t last_tracked_lsn, /*!<in: last tracked LSN read
359 from the bitmap file */
360 ib_uint64_t tracking_start_lsn) /*!<in: last checkpoint LSN of
361 the current server startup */
362{
363 ut_ad(last_tracked_lsn != tracking_start_lsn);
364
365 fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but "
366 "last checkpoint LSN is %llu. This might be due to a server "
367 "crash or a very fast shutdown. ", log_bmp_sys->out_name,
368 last_tracked_lsn, tracking_start_lsn);
369
370 /* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty
371 bitmap file, handle this too. */
372 last_tracked_lsn = ut_max(last_tracked_lsn, MIN_TRACKED_LSN);
373
374 /* See if we can fully recover the missing interval */
375 if (log_sys->lsn - last_tracked_lsn < log_sys->log_group_capacity) {
376
377 fprintf(stderr,
378 "Reading the log to advance the last tracked LSN.\n");
379
380 log_bmp_sys->start_lsn = last_tracked_lsn;
381 log_set_tracked_lsn(log_bmp_sys->start_lsn);
382 log_online_follow_redo_log();
383 ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn);
384
385 fprintf(stderr,
386 "InnoDB: continuing tracking changed pages from LSN "
387 "%llu\n", log_bmp_sys->end_lsn);
388 }
389 else {
390 fprintf(stderr,
391 "The age of last tracked LSN exceeds log capacity, "
392 "tracking-based incremental backups will work only "
393 "from the higher LSN!\n");
394
395 log_bmp_sys->end_lsn = log_bmp_sys->start_lsn
396 = tracking_start_lsn;
397 log_set_tracked_lsn(log_bmp_sys->start_lsn);
398
399 fprintf(stderr,
400 "InnoDB: starting tracking changed pages from LSN "
401 "%llu\n", log_bmp_sys->end_lsn);
402 }
403}
404
405/*********************************************************************//**
406Initialize the online log following subsytem. */
407UNIV_INTERN
408void
409log_online_read_init()
410/*==================*/
411{
412 char buf[FN_REFLEN];
413 ibool success;
414 ib_uint64_t tracking_start_lsn
415 = ut_max(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
416
417 /* Assert (could be compile-time assert) that bitmap data start and end
418 in a bitmap block is 8-byte aligned */
419 ut_a(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0);
420 ut_a(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0);
421
422 log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));
423
424 ut_snprintf(buf, FN_REFLEN, "%s%s%d", srv_data_home,
425 modified_page_stem, 1);
426 log_bmp_sys->out_name = ut_malloc(strlen(buf) + 1);
427 ut_strcpy(log_bmp_sys->out_name, buf);
428
429 log_bmp_sys->modified_pages = rbt_create(MODIFIED_PAGE_BLOCK_SIZE,
430 log_online_compare_bmp_keys);
431 log_bmp_sys->page_free_list = NULL;
432
433 log_bmp_sys->out
434 = os_file_create_simple_no_error_handling
435 (innodb_file_bmp_key, log_bmp_sys->out_name, OS_FILE_OPEN,
436 OS_FILE_READ_WRITE, &success);
437
438 if (!success) {
439
440 /* New file, tracking from scratch */
441 log_bmp_sys->out
442 = os_file_create_simple_no_error_handling
443 (innodb_file_bmp_key, log_bmp_sys->out_name,
444 OS_FILE_CREATE, OS_FILE_READ_WRITE, &success);
445 if (!success) {
446
447 /* The following call prints an error message */
448 os_file_get_last_error(TRUE);
449 fprintf(stderr,
450 "InnoDB: Error: Cannot create \'%s\'\n",
451 log_bmp_sys->out_name);
452 exit(1);
453 }
454
455 log_bmp_sys->out_offset = 0;
456 }
457 else {
458
459 /* Old file, read last tracked LSN and continue from there */
460 ulint size_low;
461 ulint size_high;
462 ib_uint64_t last_tracked_lsn;
463
464 success = os_file_get_size(log_bmp_sys->out, &size_low,
465 &size_high);
466 ut_a(success);
467
468 log_bmp_sys->out_offset
469 = ((ib_uint64_t)size_high << 32) | size_low;
470
471 if (log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE != 0) {
472
473 fprintf(stderr,
474 "InnoDB: Warning: truncated block detected "
475 "in \'%s\' at offset %llu\n",
476 log_bmp_sys->out_name,
477 log_bmp_sys->out_offset);
478 log_bmp_sys->out_offset -=
479 log_bmp_sys->out_offset
480 % MODIFIED_PAGE_BLOCK_SIZE;
481 }
482
483 last_tracked_lsn = log_online_read_last_tracked_lsn();
484
485 if (last_tracked_lsn < tracking_start_lsn) {
486
487 log_online_track_missing_on_startup(last_tracked_lsn,
488 tracking_start_lsn);
489 return;
490 }
491
492 if (last_tracked_lsn > tracking_start_lsn) {
493
494 fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' "
495 "is %llu, but last checkpoint LSN is %llu. "
496 "The tracking-based incremental backups will "
497 "work only from the latter LSN!\n",
498 log_bmp_sys->out_name, last_tracked_lsn,
499 tracking_start_lsn);
500 }
501
502 }
503
504 fprintf(stderr, "InnoDB: starting tracking changed pages from "
505 "LSN %llu\n", tracking_start_lsn);
506 log_bmp_sys->start_lsn = tracking_start_lsn;
507 log_set_tracked_lsn(tracking_start_lsn);
508}
509
510/*********************************************************************//**
511Shut down the online log following subsystem. */
512UNIV_INTERN
513void
514log_online_read_shutdown()
515/*======================*/
516{
517 ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list;
518
519 os_file_close(log_bmp_sys->out);
520
521 rbt_free(log_bmp_sys->modified_pages);
522
523 while (free_list_node) {
524 ib_rbt_node_t *next = free_list_node->left;
525 ut_free(free_list_node);
526 free_list_node = next;
527 }
528
529 ut_free(log_bmp_sys->out_name);
530 ut_free(log_bmp_sys);
531}
532
533/*********************************************************************//**
534For the given minilog record type determine if the record has (space; page)
535associated with it.
536@return TRUE if the record has (space; page) in it */
537static
538ibool
539log_online_rec_has_page(
540/*====================*/
541 byte type) /*!<in: the minilog record type */
542{
543 return type != MLOG_MULTI_REC_END && type != MLOG_DUMMY_RECORD;
544}
545
546/*********************************************************************//**
547Check if a page field for a given log record type actually contains a page
548id. It does not for file operations and MLOG_LSN.
549@return TRUE if page field contains actual page id, FALSE otherwise */
550static
551ibool
552log_online_rec_page_means_page(
553/*===========================*/
554 byte type) /*!<in: log record type */
555{
556 return log_online_rec_has_page(type)
557#ifdef UNIV_LOG_LSN_DEBUG
558 && type != MLOG_LSN
559#endif
560 && type != MLOG_FILE_CREATE
561 && type != MLOG_FILE_RENAME
562 && type != MLOG_FILE_DELETE
563 && type != MLOG_FILE_CREATE2;
564}
565
566/*********************************************************************//**
567Parse the log data in the parse buffer for the (space, page) pairs and add
568them to the modified page set as necessary. Removes the fully-parsed records
569from the buffer. If an incomplete record is found, moves it to the end of the
570buffer. */
571static
572void
573log_online_parse_redo_log()
574/*=======================*/
575{
576 byte *ptr = log_bmp_sys->parse_buf;
577 byte *end = log_bmp_sys->parse_buf_end;
578
579 ulint len = 0;
580
581 while (ptr != end
582 && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
583
584 byte type;
585 ulint space;
586 ulint page_no;
587 byte* body;
588
589 /* recv_sys is not initialized, so on corrupt log we will
590 SIGSEGV. But the log of a live database should not be
591 corrupt. */
592 len = recv_parse_log_rec(ptr, end, &type, &space, &page_no,
593 &body);
594 if (len > 0) {
595
596 if (log_online_rec_page_means_page(type)
597 && (space != TRX_DOUBLEWRITE_SPACE)) {
598
599 ut_a(len >= 3);
600 log_online_set_page_bit(space, page_no);
601 }
602
603 ptr += len;
604 ut_ad(ptr <= end);
605 log_bmp_sys->next_parse_lsn
606 = recv_calc_lsn_on_data_add
607 (log_bmp_sys->next_parse_lsn, len);
608 }
609 else {
610
611 /* Incomplete log record. Shift it to the
612 beginning of the parse buffer and leave it to be
613 completed on the next read. */
614 ut_memmove(log_bmp_sys->parse_buf, ptr, end - ptr);
615 log_bmp_sys->parse_buf_end
616 = log_bmp_sys->parse_buf + (end - ptr);
617 ptr = end;
618 }
619 }
620
621 if (len > 0) {
622
623 log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
624 }
625}
626
627/*********************************************************************//**
628Check the log block checksum.
629@return TRUE if the log block checksum is OK, FALSE otherwise. */
630static
631ibool
632log_online_is_valid_log_seg(
633/*========================*/
634 const byte* log_block) /*!< in: read log data */
635{
636 ibool checksum_is_ok
637 = log_block_checksum_is_ok_or_old_format(log_block);
638
639 if (!checksum_is_ok) {
640
641 fprintf(stderr,
642 "InnoDB Error: log block checksum mismatch"
643 "expected %lu, calculated checksum %lu\n",
644 (ulong) log_block_get_checksum(log_block),
645 (ulong) log_block_calc_checksum(log_block));
646 }
647
648 return checksum_is_ok;
649}
650
651/*********************************************************************//**
652Copy new log data to the parse buffer while skipping log block header,
653trailer and already parsed data. */
654static
655void
656log_online_add_to_parse_buf(
657/*========================*/
658 const byte* log_block, /*!< in: read log data */
659 ulint data_len, /*!< in: length of read log data */
660 ulint skip_len) /*!< in: how much of log data to
661 skip */
662{
663 ulint start_offset = skip_len ? skip_len : LOG_BLOCK_HDR_SIZE;
664 ulint end_offset
665 = (data_len == OS_FILE_LOG_BLOCK_SIZE)
666 ? data_len - LOG_BLOCK_TRL_SIZE
667 : data_len;
668 ulint actual_data_len = (end_offset >= start_offset)
669 ? end_offset - start_offset : 0;
670
671 ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,
672 actual_data_len);
673
674 log_bmp_sys->parse_buf_end += actual_data_len;
675
676 ut_a(log_bmp_sys->parse_buf_end - log_bmp_sys->parse_buf
677 <= RECV_PARSING_BUF_SIZE);
678}
679
680/*********************************************************************//**
681Parse the log block: first copies the read log data to the parse buffer while
682skipping log block header, trailer and already parsed data. Then it actually
683parses the log to add to the modified page bitmap. */
684static
685void
686log_online_parse_redo_log_block(
687/*============================*/
688 const byte* log_block, /*!< in: read log data */
689 ulint skip_already_parsed_len) /*!< in: how many bytes of
690 log data should be skipped as
691 they were parsed before */
692{
693 ulint block_data_len;
694
695 block_data_len = log_block_get_data_len(log_block);
696
697 ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0
698 || block_data_len < OS_FILE_LOG_BLOCK_SIZE);
699
700 log_online_add_to_parse_buf(log_block, block_data_len,
701 skip_already_parsed_len);
702 log_online_parse_redo_log();
703}
704
705/*********************************************************************//**
706Read and parse one redo log chunk and updates the modified page bitmap. */
707static
708void
709log_online_follow_log_seg(
710/*======================*/
711 log_group_t* group, /*!< in: the log group to use */
712 ib_uint64_t block_start_lsn, /*!< in: the LSN to read from */
713 ib_uint64_t block_end_lsn) /*!< in: the LSN to read to */
714{
715 /* Pointer to the current OS_FILE_LOG_BLOCK-sized chunk of the read log
716 data to parse */
717 byte* log_block = log_bmp_sys->read_buf;
718 byte* log_block_end = log_bmp_sys->read_buf
719 + (block_end_lsn - block_start_lsn);
720
721 mutex_enter(&log_sys->mutex);
722 log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,
723 group, block_start_lsn, block_end_lsn);
724 mutex_exit(&log_sys->mutex);
725
726 while (log_block < log_block_end
727 && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
728
729 /* How many bytes of log data should we skip in the current log
730 block. Skipping is necessary because we round down the next
731 parse LSN thus it is possible to read the already-processed log
732 data many times */
733 ulint skip_already_parsed_len = 0;
734
735 if (!log_online_is_valid_log_seg(log_block)) {
736 break;
737 }
738
739 if ((block_start_lsn <= log_bmp_sys->next_parse_lsn)
740 && (block_start_lsn + OS_FILE_LOG_BLOCK_SIZE
741 > log_bmp_sys->next_parse_lsn)) {
742
743 /* The next parse LSN is inside the current block, skip
744 data preceding it. */
745 skip_already_parsed_len
746 = log_bmp_sys->next_parse_lsn
747 - block_start_lsn;
748 }
749 else {
750
751 /* If the next parse LSN is not inside the current
752 block, then the only option is that we have processed
753 ahead already. */
754 ut_a(block_start_lsn > log_bmp_sys->next_parse_lsn);
755 }
756
757 /* TODO: merge the copying to the parse buf code with
758 skip_already_len calculations */
759 log_online_parse_redo_log_block(log_block,
760 skip_already_parsed_len);
761
762 log_block += OS_FILE_LOG_BLOCK_SIZE;
763 block_start_lsn += OS_FILE_LOG_BLOCK_SIZE;
764 }
765
766 return;
767}
768
769/*********************************************************************//**
770Read and parse the redo log in a given group in FOLLOW_SCAN_SIZE-sized
771chunks and updates the modified page bitmap. */
772static
773void
774log_online_follow_log_group(
775/*========================*/
776 log_group_t* group, /*!< in: the log group to use */
777 ib_uint64_t contiguous_lsn) /*!< in: the LSN of log block start
778 containing the log_parse_start_lsn */
779{
780 ib_uint64_t block_start_lsn = contiguous_lsn;
781 ib_uint64_t block_end_lsn;
782
783 log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;
784 log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
785
786 do {
787 block_end_lsn = block_start_lsn + FOLLOW_SCAN_SIZE;
788
789 log_online_follow_log_seg(group, block_start_lsn,
790 block_end_lsn);
791
792 /* Next parse LSN can become higher than the last read LSN
793 only in the case when the read LSN falls right on the block
794 boundary, in which case next parse lsn is bumped to the actual
795 data LSN on the next (not yet read) block. This assert is
796 slightly conservative. */
797 ut_a(log_bmp_sys->next_parse_lsn
798 <= block_end_lsn + LOG_BLOCK_HDR_SIZE
799 + LOG_BLOCK_TRL_SIZE);
800
801 block_start_lsn = block_end_lsn;
802 } while (block_end_lsn < log_bmp_sys->end_lsn);
803
804 /* Assert that the last read log record is a full one */
805 ut_a(log_bmp_sys->parse_buf_end == log_bmp_sys->parse_buf);
806}
807
808/*********************************************************************//**
809Write, flush one bitmap block to disk and advance the output position if
810successful. */
811static
812void
813log_online_write_bitmap_page(
814/*=========================*/
815 const byte *block) /*!< in: block to write */
816{
817 ibool success;
818
819 success = os_file_write(log_bmp_sys->out_name,log_bmp_sys->out,
820 block,
821 (ulint)(log_bmp_sys->out_offset & 0xFFFFFFFF),
822 (ulint)(log_bmp_sys->out_offset << 32),
823 MODIFIED_PAGE_BLOCK_SIZE);
824 if (UNIV_UNLIKELY(!success)) {
825
826 /* The following call prints an error message */
827 os_file_get_last_error(TRUE);
828 fprintf(stderr, "InnoDB: Error: failed writing changed page "
829 "bitmap file \'%s\'\n", log_bmp_sys->out_name);
830 return;
831 }
832
833 success = os_file_flush(log_bmp_sys->out, FALSE);
834 if (UNIV_UNLIKELY(!success)) {
835
836 /* The following call prints an error message */
837 os_file_get_last_error(TRUE);
838 fprintf(stderr, "InnoDB: Error: failed flushing "
839 "changed page bitmap file \'%s\'\n",
840 log_bmp_sys->out_name);
841 return;
842 }
843
844 log_bmp_sys->out_offset += MODIFIED_PAGE_BLOCK_SIZE;
845}
846
847/*********************************************************************//**
848Append the current changed page bitmap to the bitmap file. Clears the
849bitmap tree and recycles its nodes to the free list. */
850static
851void
852log_online_write_bitmap()
853/*=====================*/
854{
855 ib_rbt_node_t *bmp_tree_node;
856 const ib_rbt_node_t *last_bmp_tree_node;
857
858 bmp_tree_node = (ib_rbt_node_t *)
859 rbt_first(log_bmp_sys->modified_pages);
860 last_bmp_tree_node = rbt_last(log_bmp_sys->modified_pages);
861
862 while (bmp_tree_node) {
863
864 byte *page = rbt_value(byte, bmp_tree_node);
865
866 if (bmp_tree_node == last_bmp_tree_node) {
867 mach_write_to_4(page + MODIFIED_PAGE_IS_LAST_BLOCK, 1);
868 }
869
870 mach_write_to_8(page + MODIFIED_PAGE_START_LSN,
871 log_bmp_sys->start_lsn);
872 mach_write_to_8(page + MODIFIED_PAGE_END_LSN,
873 log_bmp_sys->end_lsn);
874 mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM,
875 log_online_calc_checksum(page));
876
877 log_online_write_bitmap_page(page);
878
879 bmp_tree_node->left = log_bmp_sys->page_free_list;
880 log_bmp_sys->page_free_list = bmp_tree_node;
881
882 bmp_tree_node = (ib_rbt_node_t*)
883 rbt_next(log_bmp_sys->modified_pages, bmp_tree_node);
884 }
885
886 rbt_reset(log_bmp_sys->modified_pages);
887}
888
889/*********************************************************************//**
890Read and parse the redo log up to last checkpoint LSN to build the changed
891page bitmap which is then written to disk. */
892UNIV_INTERN
893void
894log_online_follow_redo_log()
895/*========================*/
896{
897 ib_uint64_t contiguous_start_lsn;
898 log_group_t* group;
899
900 /* Grab the LSN of the last checkpoint, we will parse up to it */
901 mutex_enter(&(log_sys->mutex));
902 log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn;
903 mutex_exit(&(log_sys->mutex));
904
905 if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {
906 return;
907 }
908
909 group = UT_LIST_GET_FIRST(log_sys->log_groups);
910 ut_a(group);
911
912 contiguous_start_lsn = ut_uint64_align_down(log_bmp_sys->start_lsn,
913 OS_FILE_LOG_BLOCK_SIZE);
914
915 while (group) {
916 log_online_follow_log_group(group, contiguous_start_lsn);
917 group = UT_LIST_GET_NEXT(log_groups, group);
918 }
919
920 /* A crash injection site that ensures last checkpoint LSN > last
921 tracked LSN, so that LSN tracking for this interval is tested. */
922 DBUG_EXECUTE_IF("crash_before_bitmap_write", DBUG_SUICIDE(););
923
924 log_online_write_bitmap();
925 log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;
926 log_set_tracked_lsn(log_bmp_sys->start_lsn);
927}
0928
=== modified file 'Percona-Server/storage/innobase/log/log0recv.c'
--- Percona-Server/storage/innobase/log/log0recv.c 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/log/log0recv.c 2012-08-22 13:19:13 +0000
@@ -850,7 +850,7 @@
850InnoDB-3.23.52 where the checksum field contains the log block number.850InnoDB-3.23.52 where the checksum field contains the log block number.
851@return TRUE if ok, or if the log block may be in the format of InnoDB851@return TRUE if ok, or if the log block may be in the format of InnoDB
852version predating 3.23.52 */852version predating 3.23.52 */
853static853UNIV_INTERN
854ibool854ibool
855log_block_checksum_is_ok_or_old_format(855log_block_checksum_is_ok_or_old_format(
856/*===================================*/856/*===================================*/
@@ -2095,7 +2095,7 @@
2095/*******************************************************************//**2095/*******************************************************************//**
2096Tries to parse a single log record and returns its length.2096Tries to parse a single log record and returns its length.
2097@return length of the record, or 0 if the record was not complete */2097@return length of the record, or 0 if the record was not complete */
2098static2098UNIV_INTERN
2099ulint2099ulint
2100recv_parse_log_rec(2100recv_parse_log_rec(
2101/*===============*/2101/*===============*/
@@ -2166,7 +2166,7 @@
21662166
2167/*******************************************************//**2167/*******************************************************//**
2168Calculates the new value for lsn when more data is added to the log. */2168Calculates the new value for lsn when more data is added to the log. */
2169static2169UNIV_INTERN
2170ib_uint64_t2170ib_uint64_t
2171recv_calc_lsn_on_data_add(2171recv_calc_lsn_on_data_add(
2172/*======================*/2172/*======================*/
@@ -3562,6 +3562,8 @@
3562 log_sys->archived_lsn = log_sys->lsn;3562 log_sys->archived_lsn = log_sys->lsn;
3563#endif /* UNIV_LOG_ARCHIVE */3563#endif /* UNIV_LOG_ARCHIVE */
35643564
3565 log_sys->tracked_lsn = log_sys->lsn;
3566
3565 log_block_init(log_sys->buf, log_sys->lsn);3567 log_block_init(log_sys->buf, log_sys->lsn);
3566 log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);3568 log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
35673569
35683570
=== modified file 'Percona-Server/storage/innobase/os/os0file.c'
--- Percona-Server/storage/innobase/os/os0file.c 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/os/os0file.c 2012-08-22 13:19:13 +0000
@@ -154,6 +154,7 @@
154UNIV_INTERN mysql_pfs_key_t innodb_file_data_key;154UNIV_INTERN mysql_pfs_key_t innodb_file_data_key;
155UNIV_INTERN mysql_pfs_key_t innodb_file_log_key;155UNIV_INTERN mysql_pfs_key_t innodb_file_log_key;
156UNIV_INTERN mysql_pfs_key_t innodb_file_temp_key;156UNIV_INTERN mysql_pfs_key_t innodb_file_temp_key;
157UNIV_INTERN mysql_pfs_key_t innodb_file_bmp_key;
157#endif /* UNIV_PFS_IO */158#endif /* UNIV_PFS_IO */
158159
159/** The asynchronous i/o array slot structure */160/** The asynchronous i/o array slot structure */
@@ -2046,6 +2047,25 @@
2046#endif /* __WIN__ */2047#endif /* __WIN__ */
2047}2048}
20482049
2050/***********************************************************************//**
2051Truncates a file at the specified position.
2052@return TRUE if success */
2053UNIV_INTERN
2054ibool
2055os_file_set_eof_at(
2056 os_file_t file, /*!< in: handle to a file */
2057 ib_uint64_t new_len)/*!< in: new file length */
2058{
2059#ifdef __WIN__
2060 /* TODO: untested! */
2061 return(!_chsize_s(file, new_len));
2062#else
2063 /* TODO: works only with -D_FILE_OFFSET_BITS=64 ? */
2064 return(!ftruncate(file, new_len));
2065#endif
2066}
2067
2068
2049#ifndef __WIN__2069#ifndef __WIN__
2050/***********************************************************************//**2070/***********************************************************************//**
2051Wrapper to fsync(2) that retries the call on some errors.2071Wrapper to fsync(2) that retries the call on some errors.
20522072
=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.c'
--- Percona-Server/storage/innobase/srv/srv0srv.c 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/srv/srv0srv.c 2012-08-22 13:19:13 +0000
@@ -67,6 +67,7 @@
67#include "mem0pool.h"67#include "mem0pool.h"
68#include "sync0sync.h"68#include "sync0sync.h"
69#include "que0que.h"69#include "que0que.h"
70#include "log0online.h"
70#include "log0recv.h"71#include "log0recv.h"
71#include "pars0pars.h"72#include "pars0pars.h"
72#include "usr0sess.h"73#include "usr0sess.h"
@@ -176,6 +177,8 @@
176177
177UNIV_INTERN ibool srv_recovery_stats = FALSE;178UNIV_INTERN ibool srv_recovery_stats = FALSE;
178179
180UNIV_INTERN my_bool srv_track_changed_pages = TRUE;
181
179/* if TRUE, then we auto-extend the last data file */182/* if TRUE, then we auto-extend the last data file */
180UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;183UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;
181/* if != 0, this tells the max size auto-extending may increase the184/* if != 0, this tells the max size auto-extending may increase the
@@ -769,6 +772,10 @@
769772
770UNIV_INTERN os_event_t srv_lock_timeout_thread_event;773UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
771774
775UNIV_INTERN os_event_t srv_checkpoint_completed_event;
776
777UNIV_INTERN os_event_t srv_redo_log_thread_finished_event;
778
772UNIV_INTERN srv_sys_t* srv_sys = NULL;779UNIV_INTERN srv_sys_t* srv_sys = NULL;
773780
774/* padding to prevent other memory update hotspots from residing on781/* padding to prevent other memory update hotspots from residing on
@@ -1107,6 +1114,9 @@
11071114
1108 srv_lock_timeout_thread_event = os_event_create(NULL);1115 srv_lock_timeout_thread_event = os_event_create(NULL);
11091116
1117 srv_checkpoint_completed_event = os_event_create(NULL);
1118 srv_redo_log_thread_finished_event = os_event_create(NULL);
1119
1110 for (i = 0; i < SRV_MASTER + 1; i++) {1120 for (i = 0; i < SRV_MASTER + 1; i++) {
1111 srv_n_threads_active[i] = 0;1121 srv_n_threads_active[i] = 0;
1112 srv_n_threads[i] = 0;1122 srv_n_threads[i] = 0;
@@ -3031,6 +3041,46 @@
3031 }3041 }
3032}3042}
30333043
3044/******************************************************************//**
3045A thread which follows the redo log and outputs the changed page bitmap.
3046@return a dummy value */
3047os_thread_ret_t
3048srv_redo_log_follow_thread(
3049/*=======================*/
3050 void* arg __attribute__((unused))) /*!< in: a dummy parameter
3051 required by
3052 os_thread_create */
3053{
3054#ifdef UNIV_DEBUG_THREAD_CREATION
3055 fprintf(stderr, "Redo log follower thread starts, id %lu\n",
3056 os_thread_pf(os_thread_get_curr_id()));
3057#endif
3058
3059#ifdef UNIV_PFS_THREAD
3060 pfs_register_thread(srv_log_tracking_thread_key);
3061#endif
3062
3063 my_thread_init();
3064
3065 do {
3066 os_event_wait(srv_checkpoint_completed_event);
3067 os_event_reset(srv_checkpoint_completed_event);
3068
3069 if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
3070 log_online_follow_redo_log();
3071 }
3072
3073 } while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE);
3074
3075 log_online_read_shutdown();
3076 os_event_set(srv_redo_log_thread_finished_event);
3077
3078 my_thread_end();
3079 os_thread_exit(NULL);
3080
3081 OS_THREAD_DUMMY_RETURN;
3082}
3083
3034/*******************************************************************//**3084/*******************************************************************//**
3035Tells the InnoDB server that there has been activity in the database3085Tells the InnoDB server that there has been activity in the database
3036and wakes up the master thread if it is suspended (not sleeping). Used3086and wakes up the master thread if it is suspended (not sleeping). Used
30373087
=== modified file 'Percona-Server/storage/innobase/srv/srv0start.c'
--- Percona-Server/storage/innobase/srv/srv0start.c 2012-06-05 10:36:15 +0000
+++ Percona-Server/storage/innobase/srv/srv0start.c 2012-08-22 13:19:13 +0000
@@ -51,6 +51,7 @@
51#include "rem0rec.h"51#include "rem0rec.h"
52#include "mtr0mtr.h"52#include "mtr0mtr.h"
53#include "log0log.h"53#include "log0log.h"
54#include "log0online.h"
54#include "log0recv.h"55#include "log0recv.h"
55#include "page0page.h"56#include "page0page.h"
56#include "page0cur.h"57#include "page0cur.h"
@@ -121,9 +122,9 @@
121static os_file_t files[1000];122static os_file_t files[1000];
122123
123/** io_handler_thread parameters for thread identification */124/** io_handler_thread parameters for thread identification */
124static ulint n[SRV_MAX_N_IO_THREADS + 7];125static ulint n[SRV_MAX_N_IO_THREADS + 8];
125/** io_handler_thread identifiers */126/** io_handler_thread identifiers */
126static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7];127static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 8];
127128
128/** We use this mutex to test the return value of pthread_mutex_trylock129/** We use this mutex to test the return value of pthread_mutex_trylock
129 on successful locking. HP-UX does NOT return 0, though Linux et al do. */130 on successful locking. HP-UX does NOT return 0, though Linux et al do. */
@@ -145,6 +146,7 @@
145UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key;146UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key;
146UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;147UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
147UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;148UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;
149UNIV_INTERN mysql_pfs_key_t srv_log_tracking_thread_key;
148#endif /* UNIV_PFS_THREAD */150#endif /* UNIV_PFS_THREAD */
149151
150/*********************************************************************//**152/*********************************************************************//**
@@ -2034,6 +2036,19 @@
2034 if (srv_auto_lru_dump && srv_blocking_lru_restore)2036 if (srv_auto_lru_dump && srv_blocking_lru_restore)
2035 buf_LRU_file_restore();2037 buf_LRU_file_restore();
20362038
2039 if (srv_track_changed_pages) {
2040
2041 /* Initialize the log tracking subsystem here to block
2042 server startup until it's completed due to the potential
2043 need to re-read previous server run's log. */
2044 log_online_read_init();
2045
2046 /* Create the thread that follows the redo log to output the
2047 changed page bitmap */
2048 os_thread_create(&srv_redo_log_follow_thread, NULL,
2049 thread_ids + 6 + SRV_MAX_N_IO_THREADS);
2050 }
2051
2037 srv_is_being_started = FALSE;2052 srv_is_being_started = FALSE;
20382053
2039 err = dict_create_or_check_foreign_constraint_tables();2054 err = dict_create_or_check_foreign_constraint_tables();
20402055
=== modified file 'Percona-Server/storage/innobase/ut/ut0rbt.c'
--- Percona-Server/storage/innobase/ut/ut0rbt.c 2010-04-19 15:44:15 +0000
+++ Percona-Server/storage/innobase/ut/ut0rbt.c 2012-08-22 13:19:13 +0000
@@ -55,7 +55,6 @@
55#endif55#endif
5656
57#define ROOT(t) (t->root->left)57#define ROOT(t) (t->root->left)
58#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
5958
60/**********************************************************************//**59/**********************************************************************//**
61Print out the sub-tree recursively. */60Print out the sub-tree recursively. */
@@ -834,6 +833,21 @@
834 node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree));833 node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree));
835834
836 memcpy(node->value, value, tree->sizeof_value);835 memcpy(node->value, value, tree->sizeof_value);
836 return(rbt_add_preallocated_node(tree, parent, node));
837}
838
839/****************************************************************//**
840Add a new caller-provided node to tree at the specified position.
841The node must have its key fields initialized correctly.
842@return added node */
843UNIV_INTERN
844const ib_rbt_node_t*
845rbt_add_preallocated_node(
846/*======================*/
847 ib_rbt_t* tree, /*!< in: rb tree */
848 ib_rbt_bound_t* parent, /*!< in: parent */
849 ib_rbt_node_t* node) /*!< in: node */
850{
837 node->parent = node->left = node->right = tree->nil;851 node->parent = node->left = node->right = tree->nil;
838852
839 /* If tree is empty */853 /* If tree is empty */
@@ -842,7 +856,7 @@
842 }856 }
843857
844 /* Append the node, the hope here is that the caller knows858 /* Append the node, the hope here is that the caller knows
845 what s/he is doing. */859 what s/he is doing. */
846 rbt_tree_add_child(tree, parent, node);860 rbt_tree_add_child(tree, parent, node);
847 rbt_balance_tree(tree, node);861 rbt_balance_tree(tree, node);
848862
@@ -854,6 +868,7 @@
854 return(node);868 return(node);
855}869}
856870
871
857/**********************************************************************//**872/**********************************************************************//**
858Find a matching node in the rb tree.873Find a matching node in the rb tree.
859@return NULL if not found else the node where key was found */874@return NULL if not found else the node where key was found */
@@ -1142,7 +1157,17 @@
1142 ib_rbt_t* tree) /*!< in: rb tree */1157 ib_rbt_t* tree) /*!< in: rb tree */
1143{1158{
1144 rbt_free_node(ROOT(tree), tree->nil);1159 rbt_free_node(ROOT(tree), tree->nil);
1160 rbt_reset(tree);
1161}
11451162
1163/****************************************************************//**
1164Clear the tree without deleting and freeing its nodes. */
1165UNIV_INTERN
1166void
1167rbt_reset(
1168/*======*/
1169 ib_rbt_t* tree) /*!< in: rb tree */
1170{
1146 tree->n_nodes = 0;1171 tree->n_nodes = 0;
1147 tree->root->left = tree->root->right = tree->nil;1172 tree->root->left = tree->root->right = tree->nil;
1148}1173}
11491174
=== removed directory 'doc'
=== removed file 'doc/Makefile'
--- doc/Makefile 2012-08-22 13:19:13 +0000
+++ doc/Makefile 1970-01-01 00:00:00 +0000
@@ -1,145 +0,0 @@
1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS =
6SPHINXBUILD = sphinx-build
7PAPER =
8BUILDDIR = build
9
10# Internal variables.
11PAPEROPT_a4 = -D latex_paper_size=a4
12PAPEROPT_letter = -D latex_paper_size=letter
13ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
14
15.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
16
17help:
18 @echo "Please use \`make <target>' where <target> is one of"
19 @echo " html to make standalone HTML files"
20 @echo " offhtml to make standalone HTML files without fetching fresh percona-them files"
21 @echo " dirhtml to make HTML files named index.html in directories"
22 @echo " singlehtml to make a single large HTML file"
23 @echo " pickle to make pickle files"
24 @echo " json to make JSON files"
25 @echo " htmlhelp to make HTML files and a HTML help project"
26 @echo " qthelp to make HTML files and a qthelp project"
27 @echo " devhelp to make HTML files and a Devhelp project"
28 @echo " epub to make an epub"
29 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
30 @echo " latexpdf to make LaTeX files and run them through pdflatex"
31 @echo " text to make text files"
32 @echo " man to make manual pages"
33 @echo " changes to make an overview of all changed/added/deprecated items"
34 @echo " linkcheck to check all external links for integrity"
35 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
36
37clean:
38 -rm -rf $(BUILDDIR)/*
39
40html:
41 @echo "Downloading percona-theme ..."
42 @wget -O percona-theme.tar.gz http://percona.com/docs/theme/percona-server/5.5
43 @echo "Extracting theme."
44 @tar -zxf percona-theme.tar.gz
45 @rm -rf source/percona-theme
46 @mv percona-theme source/percona-theme
47 @rm percona-theme.tar.gz
48 @echo "Building html doc"
49
50 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
51 @echo
52 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
53
54dirhtml:
55 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
56 @echo
57 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
58
59offhtml:
60 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
61 @echo
62 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
63
64singlehtml:
65 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
66 @echo
67 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
68
69pickle:
70 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
71 @echo
72 @echo "Build finished; now you can process the pickle files."
73
74json:
75 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
76 @echo
77 @echo "Build finished; now you can process the JSON files."
78
79htmlhelp:
80 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
81 @echo
82 @echo "Build finished; now you can run HTML Help Workshop with the" \
83 ".hhp project file in $(BUILDDIR)/htmlhelp."
84
85qthelp:
86 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
87 @echo
88 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
89 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PerconaServer.qhcp"
91 @echo "To view the help file:"
92 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PerconaServer.qhc"
93
94devhelp:
95 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
96 @echo
97 @echo "Build finished."
98 @echo "To view the help file:"
99 @echo "# mkdir -p $$HOME/.local/share/devhelp/PerconaServer"
100 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PerconaServer"
101 @echo "# devhelp"
102
103epub:
104 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
105 @echo
106 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
107
108latex:
109 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
110 @echo
111 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
112 @echo "Run \`make' in that directory to run these through (pdf)latex" \
113 "(use \`make latexpdf' here to do that automatically)."
114
115latexpdf:
116 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
117 @echo "Running LaTeX files through pdflatex..."
118 make -C $(BUILDDIR)/latex all-pdf
119 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
120
121text:
122 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
123 @echo
124 @echo "Build finished. The text files are in $(BUILDDIR)/text."
125
126man:
127 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
128 @echo
129 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
130
131changes:
132 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
133 @echo
134 @echo "The overview file is in $(BUILDDIR)/changes."
135
136linkcheck:
137 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
138 @echo
139 @echo "Link check complete; look for any errors in the above output " \
140 "or in $(BUILDDIR)/linkcheck/output.txt."
141
142doctest:
143 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
144 @echo "Testing of doctests in the sources finished, look at the " \
145 "results in $(BUILDDIR)/doctest/output.txt."
1460
=== removed file 'doc/make.bat'
--- doc/make.bat 2011-09-20 07:03:00 +0000
+++ doc/make.bat 1970-01-01 00:00:00 +0000
@@ -1,170 +0,0 @@
1@ECHO OFF
2
3REM Command file for Sphinx documentation
4
5if "%SPHINXBUILD%" == "" (
6 set SPHINXBUILD=sphinx-build
7)
8set BUILDDIR=build
9set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
10if NOT "%PAPER%" == "" (
11 set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
12)
13
14if "%1" == "" goto help
15
16if "%1" == "help" (
17 :help
18 echo.Please use `make ^<target^>` where ^<target^> is one of
19 echo. html to make standalone HTML files
20 echo. dirhtml to make HTML files named index.html in directories
21 echo. singlehtml to make a single large HTML file
22 echo. pickle to make pickle files
23 echo. json to make JSON files
24 echo. htmlhelp to make HTML files and a HTML help project
25 echo. qthelp to make HTML files and a qthelp project
26 echo. devhelp to make HTML files and a Devhelp project
27 echo. epub to make an epub
28 echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
29 echo. text to make text files
30 echo. man to make manual pages
31 echo. changes to make an overview over all changed/added/deprecated items
32 echo. linkcheck to check all external links for integrity
33 echo. doctest to run all doctests embedded in the documentation if enabled
34 goto end
35)
36
37if "%1" == "clean" (
38 for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
39 del /q /s %BUILDDIR%\*
40 goto end
41)
42
43if "%1" == "html" (
44 %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
45 if errorlevel 1 exit /b 1
46 echo.
47 echo.Build finished. The HTML pages are in %BUILDDIR%/html.
48 goto end
49)
50
51if "%1" == "dirhtml" (
52 %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
53 if errorlevel 1 exit /b 1
54 echo.
55 echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
56 goto end
57)
58
59if "%1" == "singlehtml" (
60 %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
61 if errorlevel 1 exit /b 1
62 echo.
63 echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
64 goto end
65)
66
67if "%1" == "pickle" (
68 %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
69 if errorlevel 1 exit /b 1
70 echo.
71 echo.Build finished; now you can process the pickle files.
72 goto end
73)
74
75if "%1" == "json" (
76 %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
77 if errorlevel 1 exit /b 1
78 echo.
79 echo.Build finished; now you can process the JSON files.
80 goto end
81)
82
83if "%1" == "htmlhelp" (
84 %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
85 if errorlevel 1 exit /b 1
86 echo.
87 echo.Build finished; now you can run HTML Help Workshop with the ^
88.hhp project file in %BUILDDIR%/htmlhelp.
89 goto end
90)
91
92if "%1" == "qthelp" (
93 %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
94 if errorlevel 1 exit /b 1
95 echo.
96 echo.Build finished; now you can run "qcollectiongenerator" with the ^
97.qhcp project file in %BUILDDIR%/qthelp, like this:
98 echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PerconaServer.qhcp
99 echo.To view the help file:
100 echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PerconaServer.ghc
101 goto end
102)
103
104if "%1" == "devhelp" (
105 %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
106 if errorlevel 1 exit /b 1
107 echo.
108 echo.Build finished.
109 goto end
110)
111
112if "%1" == "epub" (
113 %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
114 if errorlevel 1 exit /b 1
115 echo.
116 echo.Build finished. The epub file is in %BUILDDIR%/epub.
117 goto end
118)
119
120if "%1" == "latex" (
121 %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
122 if errorlevel 1 exit /b 1
123 echo.
124 echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
125 goto end
126)
127
128if "%1" == "text" (
129 %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
130 if errorlevel 1 exit /b 1
131 echo.
132 echo.Build finished. The text files are in %BUILDDIR%/text.
133 goto end
134)
135
136if "%1" == "man" (
137 %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
138 if errorlevel 1 exit /b 1
139 echo.
140 echo.Build finished. The manual pages are in %BUILDDIR%/man.
141 goto end
142)
143
144if "%1" == "changes" (
145 %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
146 if errorlevel 1 exit /b 1
147 echo.
148 echo.The overview file is in %BUILDDIR%/changes.
149 goto end
150)
151
152if "%1" == "linkcheck" (
153 %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
154 if errorlevel 1 exit /b 1
155 echo.
156 echo.Link check complete; look for any errors in the above output ^
157or in %BUILDDIR%/linkcheck/output.txt.
158 goto end
159)
160
161if "%1" == "doctest" (
162 %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
163 if errorlevel 1 exit /b 1
164 echo.
165 echo.Testing of doctests in the sources finished, look at the ^
166results in %BUILDDIR%/doctest/output.txt.
167 goto end
168)
169
170:end
1710
=== removed directory 'doc/source'
=== removed directory 'doc/source/_static'
=== removed directory 'doc/source/_templates'
=== removed file 'doc/source/compatibility.rst'
--- doc/source/compatibility.rst 2012-02-24 09:51:35 +0000
+++ doc/source/compatibility.rst 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1.. _compatibility:
2
3==============================================================
4Options that make XtraDB tablespaces not compatible with MySQL
5==============================================================
6
7Fast checksums
8==============
9
10Enabling :variable:`innodb_fast_checksum` will use more CPU-efficient algorithm, based on 4-byte words which can be beneficial for some workloads. Once enabled, turning it off will require table to be dump/imported again, since |Percona Server| will fail to start on data files created when :variable:`innodb_fast_checksums` was enabled.
11
12In case you've migrated from |Percona Server| to |MySQL| you could get the "corrupted checksum" error message. In order to recover that table you'll need to:
13
14 1) Reinstall Percona Server to read your tables that were created with fast checksums.
15 2) Dump the tables (or temporarily convert them to MyISAM).
16 3) Install stock MySQL (or at least disable fast checksums).
17 4) Restore the InnoDB tables (or convert back from MyISAM).
18
19Page sizes other than 16KiB
20===========================
21
22This is controlled by variable :variable:`innodb_page_size`. Changing the page size for an existing database is not supported. Table will need to be dumped/imported again if compatibility with |MySQL| is required.
23
24Relocation of the doublewrite buffer
25====================================
26
27Variable :variable:`innodb_doublewrite_file` provides an option to put the buffer on a dedicated disk in order to parallelize I/O activity on the buffer and on the tablespace. Only in case of crash recovery this variable cannot be changed, in all other cases it can be turned on/off without breaking the compatibility.
280
=== removed file 'doc/source/conf.py'
--- doc/source/conf.py 2012-08-22 13:19:13 +0000
+++ doc/source/conf.py 1970-01-01 00:00:00 +0000
@@ -1,268 +0,0 @@
1# -*- coding: utf-8 -*-
2#
3# Percona Server documentation build configuration file, created by
4# sphinx-quickstart on Mon Aug 8 01:24:46 2011.
5#
6# This file is execfile()d with the current directory set to its containing dir.
7#
8# Note that not all possible configuration values are present in this
9# autogenerated file.
10#
11# All configuration values have a default; values that are commented out
12# serve to show the default.
13
14import sys, os
15
16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the
18# documentation root, use os.path.abspath to make it absolute, like shown here.
19#sys.path.insert(0, os.path.abspath('.'))
20
21sys.path.append(os.path.abspath('ext'))
22
23# -- General configuration -----------------------------------------------------
24
25# If your documentation needs a minimal Sphinx version, state it here.
26#needs_sphinx = '1.0'
27
28# Add any Sphinx extension module names here, as strings. They can be extensions
29# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo',
31 'sphinx.ext.coverage', 'sphinx.ext.ifconfig',
32 'sphinx.ext.extlinks', 'psdom']
33
34# Add any paths that contain templates here, relative to this directory.
35templates_path = ['_templates']
36
37# The suffix of source filenames.
38source_suffix = '.rst'
39
40# The encoding of source files.
41#source_encoding = 'utf-8-sig'
42
43# The master toctree document.
44master_doc = 'index'
45
46# General information about the project.
47project = u'Percona Server'
48copyright = u'2011-2012, Percona Inc'
49
50# The version info for the project you're documenting, acts as replacement for
51# |version| and |release|, also used in various other places throughout the
52# built documents.
53#
54# The short X.Y version.
55version = '5.5'
56# The full version, including alpha/beta/rc tags.
57release = '5.5.25a-27.1'
58
59# The language for content autogenerated by Sphinx. Refer to documentation
60# for a list of supported languages.
61#language = None
62
63# There are two options for replacing |today|: either, you set today to some
64# non-false value, then it is used:
65#today = ''
66# Else, today_fmt is used as the format for a strftime call.
67#today_fmt = '%B %d, %Y'
68
69# List of patterns, relative to source directory, that match files and
70# directories to ignore when looking for source files.
71exclude_patterns = []
72
73# The reST default role (used for this markup: `text`) to use for all documents.
74#default_role = None
75
76primary_domain = 'psdom'
77
78# If true, '()' will be appended to :func: etc. cross-reference text.
79#add_function_parentheses = True
80
81# If true, the current module name will be prepended to all description
82# unit titles (such as .. function::).
83#add_module_names = True
84
85# If true, sectionauthor and moduleauthor directives will be shown in the
86# output. They are ignored by default.
87#show_authors = False
88
89# The name of the Pygments (syntax highlighting) style to use.
90pygments_style = 'sphinx'
91
92rst_prolog = '''
93.. |check| replace:: ``|[[---CHECK---]]|``
94
95.. |xtrabackup| replace:: :program:`xtrabackup`
96
97.. |innobackupex| replace:: :program:`innobackupex`
98
99.. |XtraDB| replace:: *XtraDB*
100
101.. |Jenkins| replace:: :term:`Jenkins`
102
103.. |InnoDB| replace:: *InnoDB*
104
105.. |MyISAM| replace:: *MyISAM*
106
107.. |LSN| replace:: *LSN*
108
109.. |XtraBackup| replace:: *XtraBackup*
110
111.. |Percona Server| replace:: *Percona Server*
112
113.. |Percona| replace:: *Percona*
114
115.. |MySQL| replace:: *MySQL*
116
117.. |Drizzle| replace:: *Drizzle*
118
119.. |MariaDB| replace:: *MariaDB*
120
121.. |tar4ibd| replace:: :program:`tar4ibd`
122
123.. |tar| replace:: :program:`tar`
124
125'''
126
127# A list of ignored prefixes for module index sorting.
128#modindex_common_prefix = []
129
130extlinks = {'bug': ('https://bugs.launchpad.net/percona-server/+bug/%s',
131 '#')}
132
133
134# -- Options for HTML output ---------------------------------------------------
135
136# The theme to use for HTML and HTML Help pages. See the documentation for
137# a list of builtin themes.
138html_theme = 'percona-theme'
139
140# Theme options are theme-specific and customize the look and feel of a theme
141# further. For a list of options available for each theme, see the
142# documentation.
143#html_theme_options = {}
144
145# Add any paths that contain custom themes here, relative to this directory.
146html_theme_path = ['.', './percona-theme']
147
148# The name for this set of Sphinx documents. If None, it defaults to
149# "<project> v<release> documentation".
150html_title = 'Percona Server 5.5 Documentation'
151
152# A shorter title for the navigation bar. Default is the same as html_title.
153html_short_title = 'Percona Server 5.5'
154
155# The name of an image file (relative to this directory) to place at the top
156# of the sidebar.
157html_logo = 'percona-server-logo.jpg'
158
159# The name of an image file (within the static path) to use as favicon of the
160# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
161# pixels large.
162#html_favicon = None
163
164# Add any paths that contain custom static files (such as style sheets) here,
165# relative to this directory. They are copied after the builtin static files,
166# so a file named "default.css" will overwrite the builtin "default.css".
167html_static_path = ['_static']
168
169# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
170# using the given strftime format.
171#html_last_updated_fmt = '%b %d, %Y'
172
173# If true, SmartyPants will be used to convert quotes and dashes to
174# typographically correct entities.
175#html_use_smartypants = True
176
177# Custom sidebar templates, maps document names to template names.
178#html_sidebars = {}
179
180# Additional templates that should be rendered to pages, maps page names to
181# template names.
182#html_additional_pages = {}
183
184# If false, no module index is generated.
185#html_domain_indices = True
186
187# If false, no index is generated.
188#html_use_index = True
189
190# If true, the index is split into individual pages for each letter.
191#html_split_index = False
192
193# If true, links to the reST sources are added to the pages.
194#html_show_sourcelink = True
195
196# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
197#html_show_sphinx = True
198
199# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
200#html_show_copyright = True
201
202# If true, an OpenSearch description file will be output, and all pages will
203# contain a <link> tag referring to it. The value of this option must be the
204# base URL from which the finished HTML is served.
205#html_use_opensearch = ''
206
207# This is the file name suffix for HTML files (e.g. ".xhtml").
208#html_file_suffix = None
209
210# Output file base name for HTML help builder.
211htmlhelp_basename = 'PerconaServer55doc'
212
213
214# -- Options for LaTeX output --------------------------------------------------
215
216# The paper size ('letter' or 'a4').
217#latex_paper_size = 'letter'
218
219# The font size ('10pt', '11pt' or '12pt').
220#latex_font_size = '10pt'
221
222# Grouping the document tree into LaTeX files. List of tuples
223# (source start file, target name, title, author, documentclass [howto/manual]).
224latex_documents = [
225 ('index', 'PerconaServer-5.5.tex', u'Percona Server Documentation',
226 u'Percona Inc', 'manual'),
227]
228
229# The name of an image file (relative to this directory) to place at the top of
230# the title page.
231#latex_logo = None
232
233# For "manual" documents, if this is true, then toplevel headings are parts,
234# not chapters.
235#latex_use_parts = False
236
237# If true, show page references after internal links.
238#latex_show_pagerefs = False
239
240# If true, show URL addresses after external links.
241#latex_show_urls = False
242
243# Additional stuff for the LaTeX preamble.
244#latex_preamble = ''
245
246# Documents to append as an appendix to all manuals.
247#latex_appendices = []
248
249# If false, no module index is generated.
250#latex_domain_indices = True
251
252
253# -- Options for manual page output --------------------------------------------
254
255# One entry per manual page. List of tuples
256# (source start file, name, description, authors, manual section).
257man_pages = [
258 ('index', 'perconaserver55', u'Percona Server 5.5 Documentation',
259 [u'Percona Inc'], 1)
260]
261
262
263# Example configuration for intersphinx: refer to the Python standard library.
264intersphinx_mapping = {
265 'ps51' : ('http://www.percona.com/doc/percona-server/5.1/', None),
266 'xtrabackup' : ('http://www.percona.com/doc/percona-xtrabackup', None),
267 'ptoolkit' : ('http://www.percona.com/doc/percona-toolkit/2.0/', None)
268 }
2690
=== removed file 'doc/source/development.rst'
--- doc/source/development.rst 2012-01-27 08:36:38 +0000
+++ doc/source/development.rst 1970-01-01 00:00:00 +0000
@@ -1,266 +0,0 @@
1=============================
2Development of Percona Server
3=============================
4
5|Percona Server| is an open source project to produce a distribution
6of the |MySQL| server with improved performance, scalability and
7diagnostics.
8
9Submitting Changes
10==================
11This process is very much modeled on what is being used by
12`Drizzle <http://www.drizzle.org>`_. The Drizzle project went through
13several iterations and refinements before settling on this process. It
14has been found to both keep trunk in a constant state of stability
15(allowing for a release at any time) and minimizing wasted time by
16developers due to broken code from somebody else interfering with their day.
17
18You should also be familiar with our |Jenkins| setup.
19
20Overview
21~~~~~~~~
22At Percona we use `Bazaar <http://www.bazaar-vcs.org>`_ for source
23control and `launchpad <http://www.launchpad.net>`_ for both
24code hosting and release management.
25
26Changes to our software projects could be because of a new feature
27(blueprint) or fixing a bug (bug). Projects such as refactoring could
28be classed as a blueprint or a bug depending on the scope of the work.
29
30Blueprints and bugs are targeted to specific milestones (releases). A
31milestone is part of a series - e.g. 1.6 is a series in Percona
32XtraBackup and 1.6.1, 1.6.2 and 1.6.3 are milestones in the 1.6 series.
33
34Code is proposed for merging in the form of merge requests on launchpad.
35
36Some software (such as Percona Xtrabackup) we maintain both a
37development branch and a stable branch. For example: Xtrabackup 1.6 is
38the current stable series, and changes that should make it into bugfix
39releases of 1.6 should be proposed for the 1.6 tree. However, most new
40features or more invasive (or smaller) bug fixes should be targeted to
41the next release, currently 1.7. If submitting something to 1.6, you
42should also propose a branch that has these changes merged to the
43development release (1.7). This way somebody else doesn't have to
44attempt to merge your code and we get to run any extra tests that may
45be in the tree (and check compatibility with all platforms).
46
47For Percona Server, we have two current bzr branches on which
48development occurs: 5.1 and 5.5. As Percona Server is not a
49traditional project, instead being a set of patches against an
50existing product, these two branches are not related. That is, we do
51not merge from one to the other. To have your changes in both, you
52must propose two branches: one for 5.1 version of patch and one for
535.5.
54
55Making a change to a project
56~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57In this case we're going to use percona-xtrabackup as an
58example. workflow is similar for Percona Server, but patch will need
59to be modified both in 5.1 and 5.5 branches.
60
61* ``bzr branch lp:percona-xtrabackup featureX`` (where 'featureX' is a
62 sensible name for the task at hand)
63* (developer makes changes in featureX, testing locally)
64* Developer pushes to ``lp:~username/percona-xtrabackup/featureX``
65* When the developer thinks the branch may be ready to be merged, they
66 will run the branch through param build.
67* If there are any build or test failures, developer fixes them (in
68 the case of failing tests in trunk... no more tests should
69 fail. Eventually all tests will pass in trunk)
70* Developer can then submit a merge proposal to lp:percona-xtrabackup,
71 referencing URL for the param build showing that build and test
72 passes
73* Code undergoes review
74* Once code is accepted, it can be merged (see other section)
75
76If the change also applies to a stable release (e.g. 1.6) then changes
77should be made on a branch of 1.6 and merged to a branch of trunk. In
78this case there should be two branches run through param build and two
79merge proposals (one for 1.6 and one with the changes merged to
80trunk). This prevents somebody else having to guess how to merge your
81changes.
82
83Merging approved branches
84~~~~~~~~~~~~~~~~~~~~~~~~~
85
86Before code hits trunk, it goes through a "staging" branch, where some
87extra tests may be run (e.g. valgrind) along with testing that all
88branches behave well together (build and test) before pushing to
89trunk.
90
91To ensure quality, **DO NOT push directly to trunk!** everything must go through adequate testing first. This ensures that at any point trunk is in a releasable state.
92
93Please note that **ALL changes must go through staging first** This is to ensure that several approved merge requests do not interact badly with each
94other.
95
96* Merge captain (for lack of a better term for the person merging
97 approved code into trunk) may collate several approved branches that
98 have individually passed param-build as run by the original
99 developers.
100
101 * Workflow would look something like this:
102
103 * ``bzr branch lp:percona-xtrabackup staging``
104 * ``bzr merge lp:~user/percona-xtrabackup/featureX``
105 * ``bzr commit -m "merge feature X"``
106 * ``bzr merge lp:~user/percona-xtrabackup/featureY``
107 * ``bzr commit -m "merge feature Y"``
108 * ``bzr push --overwrite lp:percona-xtrabackup/staging'``
109 * Run ``lp:percona-xtrabackup/staging`` through param build (in
110 future, we'll likely have a Jenkins job specifically for this)
111 * If build succeeds, ``bzr push lp:percona-server`` (and branches
112 will be automatically marked as 'merged'.. although bug reports
113 will need to be manually changed to 'Fix Released')
114 * If build or test fails, attempt to find which branch may be the
115 cause, and repeat process but without that branch.
116
117* Any failing branch will be set to 'Work in Progress' with a 'Needs
118 fixing' review with the URL of the build in jenkins where the
119 failure occured. This will allow developers to fix their code.
120
121Resubmitting a merge request
122~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123
124In the event of a merge request being marked as 'Work In Progress' due
125to build/test failures when merging, the developer should fix up the
126branch, run through param build and then 'Resubmit' the merge
127proposal.
128
129There is a link on launchpad to resubmit the merge proposal, this means it appears in the list of merge requests to review again rather than off in the "work in progress" section.
130
131
132Percona Server
133~~~~~~~~~~~~~~
134
135The same process for Percona Server, but we have different branches (and merge requests) for 5.1 and 5.5 series.
136
137Upgrading MySQL base version
138~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139
140* Same process as other modifications.
141* create local branch
142* make changes
143* param build
144* merge request
145
146We will need some human processes to ensure that we do not merge extra
147things during the time when base MySQL version is being updated to
148avoid making life harder for the person doing the update.
149
150
151
152Making a release
153================
154
155* ``bzr branch lp:project release-project-VERSION``
156* build packages
157* perform any final tests (as we transition, this will already have
158 been done by jenkins)
159* ``bzr tag project-version``
160* merge request back to lp:project including the tag (TODO: write
161 exact bzr commands for this)
162
163This way anybody can easily check out an old release by just using bzr
164to branch the specific tag.
165
166Jenkins
167=======
168
169Our Jenkins instance uses a mixture of VMs on physical hosts that
170Percona runs and Virtual Machines in Amazon EC2 that are launched on
171demand.
172
173Basic Concepts
174~~~~~~~~~~~~~~
175We have some jobs that are activated based on source control changes
176(new commits in a bzr repository). We have some that are "param
177build" - that is, a user specifies parameters for the build (e.g. the
178bzr tree). A param-build allows developers to ensure their branch
179compiles and passes tests on all supported platforms *before*
180submitting a merge request. This helps us maintain the quality of the
181main bzr branches and not block other developers work.
182
183Jenkins is a Master/Slave system and the jenkins master schedules the
184builds across available machines (and may launch new VMs in EC2 to
185meet demand).
186
187Most of our jobs are what's known as "matrix builds". That is, a job
188that will be run with several different configurations of the project
189(e.g. release, debug) across several platforms (e.g. on a host
190matching the label of "centos5-32" and a host matching label of
191"ubuntu-natty-32bit"). Matrix builds show a table of lights to
192indicate their status. Clicking "build now" on one of these queues up
193builds for all of the combinations.
194
195We have some integration of our regression test suites (currently
196xtrabackup) with Jenkins ability to parse JUnitXML, presenting a nice
197user interface to any test failures.
198
199Because building some projects is non-trivial, in order to not
200duplicate the list of compile instructions for each job, we use
201template builds. You'll see builds such as percona-xtrabackup-template
202which is a disabled job, but all current xtrabackup jobs point to it
203for the commands to build and run the test suite.
204
205Percona Xtrabackup
206~~~~~~~~~~~~~~~~~~
207
208`<http://jenkins.percona.com/view/Percona%20Xtrabackup/>`_
209
210We currently build both xtrabackup 1.6 and xtrabackup trunk (will become 1.7).
211
212There are param-builds for 1.6 and trunk too. These should be run for each merge request (and before any collection of merged branches is pushed to trunk)
213
214Percona Server
215~~~~~~~~~~~~~~
216
217We have separate jobs for Percona Server 5.1 and Percona Server 5.5 due to the different build systems that MySQL 5.1 and 5.5 use.
218
219The ``mysql-test-run.pl`` test suite is integrated with Jenkins through `subunit <http://launchpad.net/subunit>`_ and ``subunit2junitxml`` allowing us to easily see which tests passed/failed on any particular test run.
220
221Percona Server 5.1
222------------------
223
224`<http://jenkins.percona.com/view/Percona%20Server%205.1/>`_
225
226We have trunk and param jobs. We also have a valgrind job that will run after a successful trunk build.
227
228Percona Server 5.5
229------------------
230
231`<http://jenkins.percona.com/view/Percona%20Server%205.5/>`_
232
233Similar to 5.1, but for PS5.5 instead.
234
235MySQL Builds
236~~~~~~~~~~~~
237
238`<http://jenkins.percona.com/view/MySQL/>`_
239
240I've set up a few jobs in Jenkins that should help us predict the future
241for Percona Server. Namely, if upstream MySQL may cause us any problems.
242
243I wanted to see if some test failures were possibly upstream, so I set
244up two jobs:
245
246`<http://jenkins.percona.com/view/MySQL/job/mysql-5.1-url-param/>`_
247`<http://jenkins.percona.com/view/MySQL/job/mysql-5.5-url-param/>`_
248
249both of which ask for a URL to a MySQL source tarball and then do a full
250build and test across the platforms we have in jenkins.
251
252But my next thought was that we could try and do this *before* the
253source tarballs come out - hopefully then being able to have MySQL
254release source tarballs that do in fact pass build and test everywhere
255where we're wanting to support Percona Server.
256
257`<http://jenkins.percona.com/view/MySQL/job/mysql-5.1-trunk/>`_
258`<http://jenkins.percona.com/view/MySQL/job/mysql-5.5-trunk/>`_
259
260are scheduled to just try once per week (we can change the frequency if
261we want to) to build and test from the MySQL bzr trees.
262
263I also have a valgrind build (same configuration as for Percona Server) to help us see if there's any new valgrind warnings (or missed suppressions).
264
265I'm hoping that these jobs will help us catch any future problems before
266they become our problem. (e.g. we can easily see that the sporadic test failures we see in Percona Server are actually in upstream MySQL).
2670
=== removed directory 'doc/source/diagnostics'
=== removed file 'doc/source/diagnostics/index_info_schema_tables.rst'
--- doc/source/diagnostics/index_info_schema_tables.rst 2011-10-07 23:38:41 +0000
+++ doc/source/diagnostics/index_info_schema_tables.rst 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
1.. _index_info_schema_tables:
2
3========================================
4 Index of ``INFORMATION_SCHEMA`` Tables
5========================================
6
7This is a list of the ``INFORMATION_SCHEMA TABLES`` that exist in |Percona Server| with |XtraDB|. The entry for each table points to the page in the documentation where it's described.
8
9 * :table:`GLOBAL_TEMPORARY_TABLES`
10
11 * :table:`INNODB_CMP`
12
13 * :table:`INNODB_CMP_RESET`
14
15 * :table:`INNODB_CMPMEM`
16
17 * :table:`INNODB_CMPMEM_RESET`
18
19 * :table:`INNODB_INDEX_STATS`
20
21 * :table:`INNODB_LOCK_WAITS`
22
23 * :table:`INNODB_LOCKS`
24
25 * :table:`INNODB_RSEG`
26
27 * :table:`INNODB_TABLE_STATS`
28
29 * :table:`INNODB_TRX`
30
31 * :table:`PROCESSLIST`
32
33 * :table:`QUERY_RESPONSE_TIME`
34
35 * :table:`TEMPORARY_TABLES`
36
37
380
=== removed file 'doc/source/diagnostics/innodb_deadlock_count.rst'
--- doc/source/diagnostics/innodb_deadlock_count.rst 2012-07-18 06:25:14 +0000
+++ doc/source/diagnostics/innodb_deadlock_count.rst 1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
1.. _innodb_deadlocks_page:
2
3==========================
4 Count |InnoDB| Deadlocks
5==========================
6
7When running a transactional application you have to live with deadlocks. They are not problematic as long as they do not occur too frequently. The standard ``SHOW ENGINE INNODB STATUS`` gives information on the latest deadlocks but it is not very useful when you want to know the total number of deadlocks or the number of deadlocks per unit of time.
8
9This change adds a status variable that keeps track of the number of deadlocks since the server startup, opening the way to a better knowledge of your deadlocks.
10
11This feature was provided by Eric Bergen under BSD license (see `InnoDB Deadlock Count Patch <http://ebergen.net/wordpress/2009/08/27/innodb-deadlock-count-patch/>`_).
12
13It adds a new global status variable (:variable:`innodb_deadlocks`) showing the number of deadlocks.*
14
15You can use it with ``SHOW GLOBAL STATUS``, e.g.: ::
16
17 mysql> SHOW GLOBAL STATUS LIKE 'innodb_deadlocks';
18 +------------------+-------+
19 | Variable_name | Value |
20 +------------------+-------+
21 | innodb_deadlocks | 323 |
22 +------------------+-------+
23
24or with ``INFORMATION_SCHEMA``, e.g.: ::
25
26 mysql> SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_deadlocks';
27 +----------------+
28 | VARIABLE_VALUE |
29 +----------------+
30 | 323 |
31 +----------------+
32
33A deadlock will occur when at least two transactions are mutually waiting for the other to finish, thus creating a circular dependency that lasts until something breaks it. |InnoDB| is quite good at detecting deadlocks and generally returns an error instantly. Most transactional systems have no way to prevent deadlocks from occurring and must be designed to handle them, for instance by retrying the transaction that failed.
34
35
36Version Specific Information
37============================
38
39 * 5.5.8-20.0:
40 Full functionality available.
41
42Status Variables
43================
44
45One new status variable was introduced by this feature.
46
47.. variable:: innodb_deadlocks
48
49 :vartype: LONG
50 :scope: Global
51
52
53Related Reading
54===============
55
56 * `Original post by Eric Bergen <http://ebergen.net/wordpress/2009/08/27/|InnoDB|-deadlock-count-patch/>`_
57
580
=== removed file 'doc/source/diagnostics/innodb_show_lock_names.rst'
--- doc/source/diagnostics/innodb_show_lock_names.rst 2011-10-07 23:38:41 +0000
+++ doc/source/diagnostics/innodb_show_lock_names.rst 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1.. _innodb_show_lock_names:
2
3=================
4 Show Lock Names
5=================
6
7This feature is curently undocumented except for the following example.
8
9Example: ::
10
11 mysql> show mutex status;
12 +--------+---------------------------+---------------+
13 | Type | Name | Status |
14 +--------+---------------------------+---------------+
15 | InnoDB | &rseg->mutex | os_waits=210 |
16 | InnoDB | &dict_sys->mutex | os_waits=3 |
17 | InnoDB | &trx_doublewrite->mutex | os_waits=1 |
18 | InnoDB | &log_sys->mutex | os_waits=1197 |
19 | InnoDB | &LRU_list_mutex | os_waits=2 |
20 | InnoDB | &fil_system->mutex | os_waits=5 |
21 | InnoDB | &kernel_mutex | os_waits=242 |
22 | InnoDB | &new_index->lock | os_waits=2 |
23 | InnoDB | &new_index->lock | os_waits=415 |
24 .....
250
=== removed file 'doc/source/diagnostics/innodb_show_status.rst'
--- doc/source/diagnostics/innodb_show_status.rst 2012-07-18 06:25:14 +0000
+++ doc/source/diagnostics/innodb_show_status.rst 1970-01-01 00:00:00 +0000
@@ -1,475 +0,0 @@
1.. _innodb_show_status:
2
3======================
4 Show |InnoDB| Status
5======================
6
7This feature reorganizes the output of ``SHOW ENGINE INNODB STATUS`` for a better readability and prints the amount of memory used by the internal hash tables. In addition, new variables are available to control the output.
8
9This feature modified the ``SHOW ENGINE INNODB STATUS`` command as follows:
10
11 * ``TRANSACTION`` section was moved to the end of the output, so that important information is not overlooked when the there is a large amount of it.
12
13 * Added two variables to control ``SHOW ENGINE INNODB STATUS`` information presented (bugfix for `#29123 <http://bugs.mysql.com/bug.php?id=29126>`_):
14
15 * :variable:`innodb_show_verbose_locks` - Whether to show records locked
16
17 * :variable:`innodb_show_locks_held` - Number of locks held to print for each |InnoDB| transaction
18
19 * Added extended information about |InnoDB| internal hash table sizes (in bytes) in the ``BUFFER POOL AND MEMORY`` section; also added buffer pool size in bytes.
20
21 * Added additional LOG section information (beginning in release 5.5.8-20.0).
22
23Version Specific Information
24============================
25
26 * 5.5.8-20.0
27 Added status variables showing information from ``SHOW ENGINE INNODB STATUS``.
28
29 * 5.5.8-20.0
30 Added additional information in the LOG section.
31
32 * 5.5.10-20.1:
33 Renamed status variable :variable:`innodb_row_lock_numbers` to :variable:`innodb_current_row_locks`.
34
35Other Information
36=================
37
38 * Author / Origin:
39 Baron Schwartz, http://lists.mysql.com/internals/35174
40
41
42System Variables
43================
44
45.. variable:: innodb_show_verbose_locks
46
47 :cli: Yes
48 :conf: Yes
49 :scope: Global
50 :dyn: Yes
51 :vartype: ULONG
52 :default: 0
53 :range: 0 - 1
54
55Specifies to show records locked in ``SHOW ENGINE INNODB STATUS``. The default is 0, which means only the higher-level information about the lock (which table and index is locked, etc.) is printed. If set to 1, then traditional |InnoDB| behavior is enabled: the records that are locked are dumped to the output.
56
57.. variable:: innodb_show_locks_held
58
59 :cli: Yes
60 :conf: Yes
61 :scope: Global
62 :dyn: Yes
63 :vartype: ULONG
64 :default: 10
65 :range: 0 - 1000
66
67Specifies the number of locks held to print for each |InnoDB| transaction in ``SHOW ENGINE INNODB STATUS``.
68
69
70Status Variables
71================
72
73The status variables here contain information available in the output of ``SHOW ENGINE INNODB STATUS``, organized by the sections ``SHOW ENGINE INNODB STATUS`` displays. If you are familiar with the output of ``SHOW ENGINE INNODB STATUS``, you will probably already recognize the information these variables contain.
74
75
76BACKGROUND THREAD
77-----------------
78
79The following variables contain information in the BACKGROUND THREAD section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is:
80
81 Insert an example of BACKGROUND THREAD section output here.
82
83.. variable:: innodb_master_thread_1_second_loops
84
85 :version 5.5.8-20.0: Introduced.
86 :vartype: Numeric
87 :scope: Global
88
89.. variable:: innodb_master_thread_10_second_loops
90
91 :version 5.5.8-20.0: Introduced.
92 :vartype: Numeric
93 :scope: Global
94
95.. variable:: innodb_master_thread_background_loops
96
97 :version 5.5.8-20.0: Introduced.
98 :vartype: Numeric
99 :scope: Global
100
101.. variable:: innodb_master_thread_main_flush_loops
102
103 :version 5.5.8-20.0: Introduced.
104 :vartype: Numeric
105 :scope: Global
106
107.. variable:: innodb_master_thread_sleeps
108
109 :version 5.5.8-20.0: Introduced.
110 :vartype: Numeric
111 :scope: Global
112
113.. variable:: innodb_background_log_sync
114
115 :version 5.5.8-20.0: Introduced.
116 :vartype: Numeric
117 :scope: Global
118
119SEMAPHORES
120----------
121
122The following variables contain information in the SEMAPHORES section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
123
124 ----------
125 SEMAPHORES
126 ----------
127 OS WAIT ARRAY INFO: reservation count 9664, signal count 11182
128 Mutex spin waits 20599, rounds 223821, OS waits 4479
129 RW-shared spins 5155, OS waits 1678; RW-excl spins 5632, OS waits 2592
130 Spin rounds per wait: 10.87 mutex, 15.01 RW-shared, 27.19 RW-excl
131
132.. variable:: innodb_mutex_os_waits
133
134 :version 5.5.8-20.0: Introduced.
135 :vartype: Numeric
136 :scope: Global
137
138.. variable:: innodb_mutex_spin_rounds
139
140 :version 5.5.8-20.0: Introduced.
141 :vartype: Numeric
142 :scope: Global
143
144.. variable:: innodb_mutex_spin_waits
145
146 :version 5.5.8-20.0: Introduced.
147 :vartype: Numeric
148 :scope: Global
149
150.. variable:: innodb_s_lock_os_waits
151
152 :version 5.5.8-20.0: Introduced.
153 :vartype: Numeric
154 :scope: Global
155
156.. variable:: innodb_s_lock_spin_rounds
157
158 :version 5.5.8-20.0: Introduced.
159 :vartype: Numeric
160 :scope: Global
161
162.. variable:: innodb_s_lock_spin_waits
163
164 :version 5.5.8-20.0: Introduced.
165 :vartype: Numeric
166 :scope: Global
167
168.. variable:: innodb_x_lock_os_waits
169
170 :version 5.5.8-20.0: Introduced.
171 :vartype: Numeric
172 :scope: Global
173
174.. variable:: innodb_x_lock_spin_rounds
175
176 :version 5.5.8-20.0: Introduced.
177 :vartype: Numeric
178 :scope: Global
179
180.. variable:: innodb_x_lock_spin_waits
181
182 :version 5.5.8-20.0: Introduced.
183 :vartype: Numeric
184 :scope: Global
185
186INSERT BUFFER AND ADAPTIVE HASH INDEX
187-------------------------------------
188
189The following variables contain information in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
190
191 -------------------------------------
192 INSERT BUFFER AND ADAPTIVE HASH INDEX
193 -------------------------------------
194 Ibuf: size 1, free list len 6089, seg size 6091,
195 44497 inserts, 44497 merged recs, 8734 merges
196 Hash table size 276707, node heap has 1 buffer(s)
197 0.00 hash searches/s, 0.00 non-hash searches/s
198
199.. variable:: innodb_ibuf_discarded_delete_marks
200
201 :version 5.5.8-20.0: Introduced.
202 :vartype: Numeric
203 :scope: Global
204
205.. variable:: innodb_ibuf_discarded_deletes
206
207 :version 5.5.8-20.0: Introduced.
208 :vartype: Numeric
209 :scope: Global
210
211.. variable:: innodb_ibuf_discarded_inserts
212
213 :version 5.5.8-20.0: Introduced.
214 :vartype: Numeric
215 :scope: Global
216
217.. variable:: innodb_ibuf_free_list
218
219 :version 5.5.8-20.0: Introduced.
220 :vartype: Numeric
221 :scope: Global
222
223.. variable:: innodb_ibuf_merged_delete_marks
224
225 :version 5.5.8-20.0: Introduced.
226 :vartype: Numeric
227 :scope: Global
228
229.. variable:: innodb_ibuf_merged_deletes
230
231 :version 5.5.8-20.0: Introduced.
232 :vartype: Numeric
233 :scope: Global
234
235.. variable:: innodb_ibuf_merged_inserts
236
237 :version 5.5.8-20.0: Introduced.
238 :vartype: Numeric
239 :scope: Global
240
241.. variable:: innodb_ibuf_merges
242
243 :version 5.5.8-20.0: Introduced.
244 :vartype: Numeric
245 :scope: Global
246
247.. variable:: innodb_ibuf_segment_size
248
249 :version 5.5.8-20.0: Introduced.
250 :vartype: Numeric
251 :scope: Global
252
253.. variable:: innodb_ibuf_size
254
255 :version 5.5.8-20.0: Introduced.
256 :vartype: Numeric
257 :scope: Global
258
259.. variable:: innodb_adaptive_hash_cells
260
261 :version 5.5.8-20.0: Introduced.
262 :vartype: Numeric
263 :scope: Global
264
265.. variable:: innodb_adaptive_hash_heap_buffers
266
267 :version 5.5.8-20.0: Introduced.
268 :vartype: Numeric
269 :scope: Global
270
271.. variable:: innodb_adaptive_hash_hash_searches
272
273 :version 5.5.8-20.0: Introduced.
274 :vartype: Numeric
275 :scope: Global
276
277.. variable:: innodb_adaptive_hash_non_hash_searches
278
279 :version 5.5.8-20.0: Introduced.
280 :vartype: Numeric
281 :scope: Global
282
283LOG
284---
285
286The following variables contain information in the LOG section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
287
288 ---
289 LOG
290 ---
291 Log sequence number 28219393219
292 Log flushed up to 28219393219
293 Last checkpoint at 28212583337
294 Max checkpoint age 7782360
295 Checkpoint age target 7539162
296 Modified age 6809882
297 Checkpoint age 6809882
298 0 pending log writes, 0 pending chkp writes
299 8570 log i/o's done, 2000.00 log i/o's/second
300
301.. variable:: innodb_lsn_current
302
303 :version 5.5.8-20.0: Introduced.
304 :vartype: Numeric
305 :scope: Global
306
307.. variable:: innodb_lsn_flushed
308
309 :version 5.5.8-20.0: Introduced.
310 :vartype: Numeric
311 :scope: Global
312
313.. variable:: innodb_lsn_last_checkpoint
314
315 :version 5.5.8-20.0: Introduced.
316 :vartype: Numeric
317 :scope: Global
318
319.. variable:: innodb_checkpoint_age
320
321 :version 5.5.8-20.0: Introduced.
322 :vartype: Numeric
323 :scope: Global
324
325.. variable:: innodb_checkpoint_max_age
326
327 :version 5.5.8-20.0: Introduced.
328 :vartype: Numeric
329 :scope: Global
330
331.. variable:: innodb_checkpoint_target_age
332
333 :version 5.5.8-20.0: Introduced.
334 :vartype: Numeric
335 :scope: Global
336
337BUFFER POOL AND MEMORY
338----------------------
339
340The following variables contain information in the BUFFER POOL AND MEMORY section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
341
342 ----------------------
343 BUFFER POOL AND MEMORY
344 ----------------------
345 Total memory allocated 137625600; in additional pool allocated 0
346 Internal hash tables (constant factor + variable factor)
347 Adaptive hash index 3774352 (2213656 + 1560696)
348 Page hash 139144
349 Dictionary cache 629811 (554864 + 74947)
350 File system 83536 (82672 + 864)
351 Lock system 380792 (332872 + 47920)
352 Recovery system 0 (0 + 0)
353 Threads 84040 (82696 + 1344)
354 Dictionary memory allocated 74947
355 Buffer pool size 8192
356 Buffer pool size, bytes 134217728
357 Free buffers 0
358 Database pages 8095
359 Old database pages 2968
360 Modified db pages 5914
361 Pending reads 0
362 Pending writes: LRU 0, flush list 129, single page 0
363 Pages made young 372084, not young 0
364 2546000.00 youngs/s, 0.00 non-youngs/s
365 Pages read 103356, created 154787, written 979572
366 469000.00 reads/s, 78000.00 creates/s, 138000.00 writes/s
367 Buffer pool hit rate 994 / 1000, young-making rate 34 / 1000 not 0 / 1000
368 Pages read ahead 0.00/s, evicted without access 15000.00/s
369
370.. variable:: innodb_mem_adaptive_hash
371
372 :version 5.5.8-20.0: Introduced.
373 :vartype: Numeric
374 :scope: Global
375
376.. variable:: innodb_mem_dictionary
377
378 :version 5.5.8-20.0: Introduced.
379 :vartype: Numeric
380 :scope: Global
381
382.. variable:: innodb_mem_total
383
384 :version 5.5.8-20.0: Introduced.
385 :vartype: Numeric
386 :scope: Global
387
388.. variable:: innodb_buffer_pool_pages_LRU_flushed
389
390 :version 5.5.8-20.0: Introduced.
391 :vartype: Numeric
392 :scope: Global
393
394.. variable:: innodb_buffer_pool_pages_made_not_young
395
396 :version 5.5.8-20.0: Introduced.
397 :vartype: Numeric
398 :scope: Global
399
400.. variable:: innodb_buffer_pool_pages_made_young
401
402 :version 5.5.8-20.0: Introduced.
403 :vartype: Numeric
404 :scope: Global
405
406.. variable:: innodb_buffer_pool_pages_old
407
408 :version 5.5.8-20.0: Introduced.
409 :vartype: Numeric
410 :scope: Global
411
412TRANSACTIONS
413------------
414
415The following variables contain information in the TRANSACTIONS section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
416
417 ------------
418 TRANSACTIONS
419 ------------
420 Trx id counter F561FD
421 Purge done for trx's n:o < F561EB undo n:o < 0
422 History list length 19
423 LIST OF TRANSACTIONS FOR EACH SESSION:
424 ---TRANSACTION 0, not started, process no 993, OS thread id 140213152634640
425 mysql thread id 15933, query id 32109 localhost root
426 show engine innodb status
427 ---TRANSACTION F561FC, ACTIVE 29 sec, process no 993, OS thread id 140213152769808 updating or deleting
428 mysql tables in use 1, locked 1
429
430.. variable:: innodb_history_list_length
431
432 :version 5.5.8-20.0: Introduced.
433 :vartype: Numeric
434 :scope: Global
435
436.. variable:: innodb_max_trx_id
437
438 :version 5.5.8-20.0: Introduced.
439 :vartype: Numeric
440 :scope: Global
441
442.. variable:: innodb_oldest_view_low_limit_trx_id
443
444 :version 5.5.8-20.0: Introduced.
445 :vartype: Numeric
446 :scope: Global
447
448.. variable:: innodb_purge_trx_id
449
450 :version 5.5.8-20.0: Introduced.
451 :vartype: Numeric
452 :scope: Global
453
454.. variable:: innodb_purge_undo_no
455
456 :version 5.5.8-20.0: Introduced.
457 :vartype: Numeric
458 :scope: Global
459
460.. variable:: innodb_current_row_locks
461
462 :version 5.5.8-20.0: Introduced.
463 :version 5.5.10-20.1: Renamed.
464 :vartype: Numeric
465 :scope: Global
466
467 This variable was named :variable:`innodb_row_lock_numbers` in release 5.5.8-20.0.
468
469
470Other reading
471=============
472
473 * `SHOW INNODB STATUS walk through <http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/>`_
474
475 * `Table locks in SHOW INNODB STATUS <http://www.mysqlperformanceblog.com/2010/06/08/table-locks-in-show-innodb-status/>`_
4760
=== removed file 'doc/source/diagnostics/innodb_stats.rst'
--- doc/source/diagnostics/innodb_stats.rst 2012-06-19 13:40:59 +0000
+++ doc/source/diagnostics/innodb_stats.rst 1970-01-01 00:00:00 +0000
@@ -1,157 +0,0 @@
1.. _innodb_stats:
2
3=====================
4 |InnoDB| Statistics
5=====================
6
7This feature provides new startup options (control method and collection of index statistics estimation) and information schema views to confirm the statistics.
8
9This implements the fix for `MySQL Bug #30423 <http://bugs.mysql.com/bug.php?id=30423>`_.
10
11Version Specific Information
12============================
13
14 * 5.5.8-20.0:
15 Renamed three fields in table ``INNODB_INDEX_STATS``.
16
17
18System Variables
19================
20
21Four new system variables were introduced by this feature.
22
23.. variable:: innodb_stats_method
24
25 :cli: YES
26 :configfile: YES
27 :scope: GLOBAL
28 :dyn: YES
29 :type: STRING
30 :default: ``nulls_equal``
31 :allowed: ``nulls_equal``, ``nulls_unequal``, ``nulls_ignored``
32
33The values and meanings are almost same to ``myisam_stats_method`` option of native |MySQL| (``nulls_equal``, ``nulls_unequal``, ``nulls_ignored``). But |InnoDB| doesn't have several patterns of statistics currently. So, though this option able to be changed dynamically, we need re-calculate statistics to change the method for the table.
34
35(reference: `MyISAM Index Statistics Collection <http://dev.mysql.com/doc/refman/5.1/en/myisam-index-statistics.html>`_)
36
37**Note:** Beginning in release 5.1.56-12.7, a variable with the same and functionality was implemented in the upstream |InnoDB|.
38
39.. variable:: innodb_stats_auto_update
40
41 :type: BOOLEAN
42 :default: 1
43
44|InnoDB| updates the each index statistics automatically (many updates were done, some information_schema is accessed, table monitor, etc.). Setting this option 0 can stop these automatic recalculation of the statistics except for “first open” and “ANALYZE TABLE command”.
45
46
47.. variable:: innodb_stats_update_need_lock
48
49 :type: BOOLEAN
50 :default: 1
51
52If you meet contention of ``&dict_operation_lock``, setting 0 reduces the contention. But 0 disables to update ``Data_free:`` of ``SHOW TABLE STATUS``.
53
54
55.. variable:: innodb_use_sys_stats_table
56
57 :type: BOOLEAN
58 :default: 0
59
60
61If this option is enabled, |XtraDB| uses the ``SYS_STATS`` system table to store statistics of table indexes. Also, when |InnoDB| opens a table for the first time, it loads the statistics from ``SYS_STATS`` instead of sampling index pages. If you use a high ``stats_sample_pages`` value, the first open of a table is expensive. In such a case, this option will help. Intended behavior is to never update statistics unless an explicit ``ANALYZE TABLE`` is issued.
62
63INFORMATION_SCHEMA Tables
64=========================
65
66Two new tables were introduced by this feature.
67
68.. table:: INFORMATION_SCHEMA.INNODB_TABLE_STATS
69
70 Shows table statistics information of dictionary cached.
71
72 :column table_schema: Database name of the table.
73 :column table_name: Table name.
74 :column rows: estimated number of all rows.
75 :column clust_size: cluster index (table/primary key) size in number of pages.
76 :column other_size: Other index (non primary key) size in number of pages.
77 :column modified: Internal counter to judge whether statistics recalculation should be done.
78
79If the value of modified column exceeds “rows / 16” or 2000000000, the statistics recalculation is done when ``innodb_stats_auto_update == 1``. We can estimate the oldness of the statistics by this value.
80
81.. table:: INFORMATION_SCHEMA.INNODB_INDEX_STATS
82
83 Shows index statistics information of dictionary cached.
84
85 :column table_schema: Database name of the table.
86 :column table_name: Table name.
87 :column index_name: Index name.
88 :column fields: How many fields the index key has. (it is internal structure of |InnoDB|, it may be larger than the ``CREATE TABLE``).
89 :column rows_per_key: Estimate rows per 1 key value. ([1 column value], [2 columns value], [3 columns value], ...).
90 :column index_total_pages: Number of index pages.
91 :column index_leaf_pages: Number of leaf pages.
92
93In releases before 5.5.8-20.0, these fields had different names:
94
95 * ``rows_per_key`` was ``row_per_keys``
96
97 * ``index_total_pages`` was ``index_size``
98
99 * ``index_leaf_pages`` was ``leaf_pages``
100
101Example
102=======
103
104This example uses the same data to Bug #30423 of |MySQL|.
105
106``[innodb_stats_method = nulls_equal (default behavior of |InnoDB|)]`` ::
107
108 mysql> explain SELECT COUNT(*), 0 FROM orgs2 orgs LEFT JOIN sa_opportunities2 sa_opportunities ON orgs.org_id=sa_opportunities.org_id LEFT JOIN contacts2 contacts ON orgs.org_id=contacts.org_id;
109 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
110 | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
111 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
112 | 1 | SIMPLE | orgs | index | NULL | orgs$org_id | 4 | NULL | 128 | Using index |
113 | 1 | SIMPLE | sa_opportunities | ref | sa_opp$org_id | sa_opp$org_id | 5 | test2.orgs.org_id | 5751 | Using index |
114 | 1 | SIMPLE | contacts | ref | contacts$org_id | contacts$org_id | 5 | test2.orgs.org_id | 23756 | Using index |
115 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
116 3 rows in set (0.00 sec)
117
118``[innodb_stats_method = nulls_unequal or nulls_ignored]`` ::
119
120 mysql> explain SELECT COUNT(*), 0 FROM orgs2 orgs LEFT JOIN sa_opportunities2 sa_opportunities ON orgs.org_id=sa_opportunities.org_id LEFT JOIN contacts2 contacts ON orgs.org_id=contacts.org_id;
121 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
122 | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
123 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
124 | 1 | SIMPLE | orgs | index | NULL | orgs$org_id | 4 | NULL | 128 | Using index |
125 | 1 | SIMPLE | sa_opportunities | ref | sa_opp$org_id | sa_opp$org_id | 5 | test2.orgs.org_id | 1 | Using index |
126 | 1 | SIMPLE | contacts | ref | contacts$org_id | contacts$org_id | 5 | test2.orgs.org_id | 1 | Using index |
127 +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
128 3 rows in set (0.00 sec)
129 <example of information_schema>
130
131 mysql> select * from information_schema.innodb_table_stats;
132 +------------------------+-------+------------+------------+----------+
133 | table_name | rows | clust_size | other_size | modified |
134 +------------------------+-------+------------+------------+----------+
135 | test/sa_opportunities2 | 11175 | 21 | 11 | 0 |
136 | test/orgs2 | 128 | 1 | 0 | 0 |
137 | test/contacts2 | 47021 | 97 | 97 | 0 |
138 +------------------------+-------+------------+------------+----------+
139 3 rows in set (0.00 sec)
140
141 mysql> select * from information_schema.innodb_index_stats;
142 +------------------------+-----------------+--------+--------------+------------+------------+
143 | table_name | index_name | fields | row_per_keys | index_size | leaf_pages |
144 +------------------------+-----------------+--------+--------------+------------+------------+
145 | test/sa_opportunities2 | GEN_CLUST_INDEX | 1 | 1 | 21 | 20 |
146 | test/sa_opportunities2 | sa_opp$org_id | 2 | 338, 1 | 11| 10 |
147 | test/orgs2 | orgs$org_id | 1 | 1 | 1 | 1 |
148 | test/contacts2 | GEN_CLUST_INDEX | 1 | 1 | 97 | 80 |
149 | test/contacts2 | contacts$org_id | 2 | 516, 0 | 97 | 37 |
150 +------------------------+-----------------+--------+--------------+------------+------------+
151 5 rows in set (0.00 sec)
152
153Other reading
154=============
155
156 * `InnoDB Table/Index stats <http://www.mysqlperformanceblog.com/2010/03/20/|InnoDB|-tableindex-stats/>`_
157
1580
=== removed file 'doc/source/diagnostics/misc_info_schema_tables.rst'
--- doc/source/diagnostics/misc_info_schema_tables.rst 2012-03-12 08:04:08 +0000
+++ doc/source/diagnostics/misc_info_schema_tables.rst 1970-01-01 00:00:00 +0000
@@ -1,135 +0,0 @@
1.. _misc_info_schema_tables:
2
3=================================
4 Misc. INFORMATION_SCHEMA Tables
5=================================
6
7This page lists the ``INFORMATION_SCHEMA`` tables added to standard |MySQL| by |Percona Server| that don't exist elsewhere in the documentation.
8
9Compressed pages in |InnoDB| tables
10===================================
11
12These tables hold information on compression and uncompression operations. Their contents is identical, but any read from :table:`INNODB_CMP_RESET` will reset all statistics on compression/uncompression.
13
14These tables were introduced by the |InnoDB| plugin and you can find the full documentation here.
15
16.. table:: INFORMATION_SCHEMA.INNODB_CMP
17
18 :column PAGE_SIZE: Page size for compressed pages (Bytes)
19 :column COMPRESS_OPS: Number of compression operations
20 :column COMPRESS_OPS_OK: Number of successful compression operations
21 :column COMPRESS_TIME: Time spent to compress pages (seconds)
22 :column UNCOMPRESS_OPS: Number of uncompression operations
23 :column UNCOMPRESS_TIME: Time spent to uncompress pages (seconds)
24
25.. table:: INFORMATION_SCHEMA.INNODB_CMP_RESET
26
27 :column PAGE_SIZE: Page size for compressed pages (Bytes)
28 :column COMPRESS_OPS: Number of compression operations
29 :column COMPRESS_OPS_OK: Number of successful compression operations
30 :column COMPRESS_TIME: Time spent to compress pages (seconds)
31 :column UNCOMPRESS_OPS: Number of uncompression operations
32 :column UNCOMPRESS_TIME: Time spent to uncompress pages (seconds)
33
34Compressed pages in |InnoDB| buffer pool
35========================================
36
37These tables hold information on compressed pages stored in memory in the buffer pool. Their contents is identical, but any read from INNODB_CMPMEM_RESET will reset all statistics on relocation operations.
38
39These tables were introduced by the |InnoDB| plugin and you can find the full documentation here.
40
41
42.. table:: INFORMATION_SCHEMA.INNODB_CMPMEM
43
44 :column PAGE_SIZE: Page size for compressed pages (Bytes)
45 :column PAGES_USED: Number of pages in use
46 :column PAGES_FREE: Number of free pages
47 :column RELOCATION_OPS: Number of relocation operations
48 :column RELOCATION_TIME: Time spent to relocate pages (Microseconds)
49
50.. table:: INFORMATION_SCHEMA.INNODB_CMPMEM_RESET
51
52 :column PAGE_SIZE: Page size for compressed pages (Bytes)
53 :column PAGES_USED: Number of pages in use
54 :column PAGES_FREE: Number of free pages
55 :column RELOCATION_OPS: Number of relocation operations
56 :column RELOCATION_TIME: Time spent to relocate pages (Microseconds)
57
58|InnoDB| transactions
59=====================
60
61.. table:: INFORMATION_SCHEMA.INNODB_LOCK_WAITS
62
63 :column REQUESTING_TRX_ID:
64 :column REQUESTED_LOCK_ID:
65 :column BLOCKING_TRX_ID:
66 :column BLOCKING_LOCK_ID:
67
68.. table:: INFORMATION_SCHEMA.INNODB_LOCKS
69
70 :column LOCK_ID: Internal unique lock ID
71 :column LOCK_TRX_ID: ID of the transaction holding the lock
72 :column LOCK_MODE: Mode of the lock (shared, exclusive, …)
73 :column LOCK_TYPE: ``RECORD`` for a record lock and ``TABLE`` for a table lock
74 :column LOCK_TABLE: Name of the table holding the lock
75 :column LOCK_INDEX: If lock type is ``RECORD``, name of the index
76 :column LOCK_SPACE: If lock type is ``RECORD``, tablespace id of the locked record
77 :column LOCK_PAGE: If lock type is ``RECORD``, page number of the locked record
78 :column LOCK_REC: If lock type is ``RECORD``, heap number of the locked record
79 :column LOCK_DATA: If lock type is ``RECORD``, primary key of the locked record
80
81This table contains information on each lock that is requested by any transaction and on each lock that is held by any transaction. You can get details about the transactions involved by joining INNODB_LOCKS with INNODB_TRX on TRX_ID.
82
83This table was introduced by the |InnoDB| plugin and you can find the full documentation here.
84
85.. table:: INFORMATION_SCHEMA.INNODB_TRX
86
87 :column TRX_ID: |InnoDB| internal unique transaction id
88 :column TRX_STATE: Execution state. Possible values are: ``Running``, ``Lock_wait``, ``Rolling_back``, ``Committing``
89 :column TRX_STARTED: Transaction start time
90 :column TRX_REQUESTED_LOCK_ID: Id of the lock the transaction has requested
91 :column TRX_WAIT_STARTED: Date and time when the transaction started waiting for a lock
92 :column TRX_WEIGHT: Weight of the transaction, ie approximate number of locked and modified rows
93 :column TRX_MYSQL_THREAD_ID: Thread id
94 :column TRX_QUERY: SQL query being executed
95
96This table holds information on every transaction running in the |InnoDB| kernel. Contrary to the output of SHOW |InnoDB| STATUS, it doesn't show information on idle transactions.
97
98This table was introduced by the |InnoDB| plugin and you can find the full documentation here.
99
100Temporary tables
101================
102
103 Only the temporary tables that were explicitly created with `CREATE TEMPORARY TABLE` or `ALTER TABLE` are shown, and not the ones created to process complex queries.
104
105.. table:: INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES
106
107 :column SESSION_ID: |MySQL| connection id
108 :column TABLE_SCHEMA: Schema in which the temporary table is created
109 :column TABLE_NAME: Name of the temporary table
110 :column ENGINE: Engine of the temporary table
111 :column NAME: Internal name of the temporary table
112 :column TABLE_ROWS: Number of rows of the temporary table
113 :column AVG_ROW_LENGTH: Average row length of the temporary table
114 :column DATA_LENGTH: Size of the data (Bytes)
115 :column INDEX_LENGTH: Size of the indexes (Bytes)
116 :column CREATE_TIME: Date and time of creation of the temporary table
117 :column UPDATE_TIME: Date and time of the latest update of the temporary table
118
119This table holds information on the temporary tables existing for all connections. You don't need the ``SUPER`` privilege to query this table.
120
121.. table:: INFORMATION_SCHEMA.TEMPORARY_TABLES
122
123 :column SESSION_ID: |MySQL| connection id
124 :column TABLE_SCHEMA: Schema in which the temporary table is created
125 :column TABLE_NAME: Name of the temporary table
126 :column ENGINE: Engine of the temporary table
127 :column NAME: Internal name of the temporary table
128 :column TABLE_ROWS: Number of rows of the temporary table
129 :column AVG_ROW_LENGTH: Average row length of the temporary table
130 :column DATA_LENGTH: Size of the data (Bytes)
131 :column INDEX_LENGTH: Size of the indexes (Bytes)
132 :column CREATE_TIME: Date and time of creation of the temporary table
133 :column UPDATE_TIME: Date and time of the latest update of the temporary table
134
135This table holds information on the temporary tables existing for the running connection.
1360
=== removed file 'doc/source/diagnostics/mysql_syslog.rst'
--- doc/source/diagnostics/mysql_syslog.rst 2012-06-04 13:39:55 +0000
+++ doc/source/diagnostics/mysql_syslog.rst 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
1.. _mysql_syslog:
2
3======================================
4 Log All Client Commands (``syslog``)
5======================================
6
7When enabled, this feature causes all commands run by the command line client to be logged to syslog. If you want to enable this option permanently, add it to the [mysql] group in my.cnf.
8
9Version Specific Information
10============================
11
12 * :rn:`5.5.8-20.0`:
13 Full functionality available.
14
15Other Information
16=================
17
18 * Author / Origin:
19 Percona
20
21Client Variables
22================
23
24.. variable:: syslog
25
26 :cli: Yes
27 :conf: Yes
28 :server: No
29 :scope: Global
30 :dyn: Yes
31 :vartype: Boolean
32 :default: OFF
33 :range: ON/OFF
34
35The variable enables (ON)/disables (OFF) logging to syslog.
36
37
38Other Reading
39=============
40
41 * http://en.wikipedia.org/wiki/Syslog
42
43 * http://tools.ietf.org/html/rfc5424
440
=== removed file 'doc/source/diagnostics/process_list.rst'
--- doc/source/diagnostics/process_list.rst 2011-10-07 23:38:41 +0000
+++ doc/source/diagnostics/process_list.rst 1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
1.. _process_list:
2
3=============
4Process List
5=============
6
7This page describes Percona changes to both the standard |MySQL| ``SHOW PROCESSLIST`` command and the standard |MySQL| ``INFORMATION_SCHEMA`` table ``PROCESSLIST``.
8
9The changes that have been made as of version 5.5 of the server are:
10
11 * ``SHOW PROCESSLIST`` command:
12
13 * added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
14
15 * ``PROCESSLIST`` table:
16
17 * added columns ``TIME_MS``, ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
18
19Version Specific Information
20============================
21
22 * 5.0.91-22:
23
24 * Added column ``TIME_MS`` to table ``PROCESSLIST``.
25
26 * 5.5.10-20.1:
27
28 * Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ`` to ``SHOW PROCESSLIST`` command.
29
30 * Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ`` to table ``PROCESSLIST``.
31
32INFORMATION_SCHEMA Tables
33=========================
34
35.. table:: INFORMATION_SCHEMA.PROCESSLIST
36
37 This table implements modifications to the standard |MySQL| ``INFORMATION_SCHEMA`` table ``PROCESSLIST``.
38
39 :column ID: The connection identifier.
40 :column USER: The |MySQL| user who issued the statement.
41 :column HOST: The host name of the client issuing the statement.
42 :column DB: The default database, if one is selected, otherwise NULL.
43 :column COMMAND: The type of command the thread is executing.
44 :column TIME: The time in seconds that the thread has been in its current state.
45 :column STATE: An action, event, or state that indicates what the thread is doing.
46 :column INFO: The statement that the thread is executing, or NULL if it is not executing any statement.
47 :column TIME_MS: The time in milliseconds that the thread has been in its current state.
48 :column ROWS_EXAMINED: The number of rows examined by the statement being executed.
49 :column ROWS_SENT: The number of rows sent by the statement being executed.
50 :column ROWS_READ: The number of rows read by the statement being executed.
51 :version 5.0.91-22: Added column ``TIME_MS``
52 :version 5.5.10-20.1: Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
53
54
55Example Output
56==============
57
58``SHOW PROCESSLIST`` Command: ::
59
60 mysql> show processlist;
61 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
62 | Id | User | Host | db | Command | Time | State | Info | ROWS_SENT | ROWS_EXAMINED | ROWS_READ |
63 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
64 | 2 | root | localhost | test | Query | 0 | NULL | SHOW PROCESSLIST | 0 | 0 | 1 |
65 | 14 | root | localhost | test | Query | 0 | User lock | SELECT GET_LOCK(``t``,1000) | 0 | 0 | 1 |
66 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
67
68Table :table:`PROCESSLIST`: ::
69
70 mysql> select * from information_schema.PROCESSLIST;
71 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
72 | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | TIME_MS | ROWS_EXAMINED | ROWS_SENT | ROWS_READ |
73 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
74 | 14 | root | localhost | test | Query | 0 | User lock | SELECT GET_LOCK(``t``,1000) | 1 | 0 | 0 | 1 |
75 | 2 | root | localhost | test | Query | 0 | executing | SELECT * from INFORMATION_SCHEMA.PROCESSLIST | 0 | 0 | 0 | 1 |
76 +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
77
78
790
=== removed file 'doc/source/diagnostics/response_time_distribution.rst'
--- doc/source/diagnostics/response_time_distribution.rst 2012-02-13 08:49:21 +0000
+++ doc/source/diagnostics/response_time_distribution.rst 1970-01-01 00:00:00 +0000
@@ -1,266 +0,0 @@
1.. _response_time_distribution:
2
3============================
4 Response Time Distribution
5============================
6
7The slow query log provides exact information about queries that take a long time to execute. However, sometimes there are a large number of queries that each take a very short amount of time to execute. This feature provides a tool for analyzing that information by counting and displaying the number of queries according to the the length of time they took to execute. The user can define time intervals that divide the range 0 to positive infinity into smaller intervals and then collect the number of commands whose execution times fall into each of those intervals.
8
9Note that in a replication environment, the server will not take into account *any* queries executed by the slave's SQL thread (whether they are slow or not) for the time distribution unless the log_slow_slave_statements variable is set.
10
11The feature isn't implemented in all versions of the server. The variable :variable:`have_response_time_distribution` indicates whether or not it is implemented in the server you are running.
12
13Each interval is described as: ::
14
15(range_base ^ n; range_base ^ (n+1)]
16
17The range_base is some positive number (see Limitations). The interval is defined as the difference between two nearby powers of the range base.
18
19For example, if the range base=10, we have the following intervals: ::
20
21 (0; 10 ^ -6], (10 ^ -6; 10 ^ -5], (10 ^ -5; 10 ^ -4], ..., (10 ^ -1; 10 ^1], (10^1; 10^2]...(10^7; positive infinity]
22
23or ::
24
25 (0; 0.000001], (0.000001; 0.000010], (0.000010; 0.000100], ..., (0.100000; 1.0]; (1.0; 10.0]...(1000000; positive infinity]
26
27For each interval, a count is made of the queries with execution times that fell into that interval.
28
29You can select the range of the intervals by changing the range base. For example, for base range=2 we have the following intervals: ::
30
31 (0; 2 ^ -19], (2 ^ -19; 2 ^ -18], (2 ^ -18; 2 ^ -17], ..., (2 ^ -1; 2 ^1], (2 ^ 1; 2 ^ 2]...(2 ^ 25; positive infinity]
32
33or ::
34
35 (0; 0.000001], (0.000001, 0.000003], ..., (0.25; 0.5], (0.5; 2], (2; 4]...(8388608; positive infinity]
36
37Small numbers look strange (i.e., don't look like powers of 2), because we lose precision on division when the ranges are calculated at runtime. In the resulting table, you look at the high boundary of the range.
38
39For example, you may see: ::
40
41 +----------------+-------+------------+
42 | time | count | total |
43 +----------------+-------+------------|
44 | 0.000001 | 0 | 0.000000 |
45 | 0.000010 | 17 | 0.000094 |
46 | 0.000100 | 4301 | 0.236555 |
47 | 0.001000 | 1499 | 0.824450 |
48 | 0.010000 | 14851 | 81.680502 |
49 | 0.100000 | 8066 | 443.635693 |
50 | 1.000000 | 0 | 0.000000 |
51 | 10.000000 | 0 | 0.000000 |
52 | 100.000000 | 1 | 55.937094 |
53 | 1000.000000 | 0 | 0.000000 |
54 | 10000.000000 | 0 | 0.000000 |
55 | 100000.000000 | 0 | 0.000000 |
56 | 1000000.000000 | 0 | 0.000000 |
57 | TOO LONG QUERY | 0 | 0.000000 |
58 +----------------+-------+------------+
59
60This means there were: ::
61
62 * 17 queries with 0.000001 < query execution time < = 0.000010 seconds; total execution time of the 17 queries = 0.000094 seconds
63
64 * 4301 queries with 0.000010 < query execution time < = 0.000100 seconds; total execution time of the 4301 queries = 0.236555 seconds
65
66 * 1499 queries with 0.000100 < query execution time < = 0.001000 seconds; total execution time of the 1499 queries = 0.824450 seconds
67
68 * 14851 queries with 0.001000 < query execution time < = 0.010000 seconds; total execution time of the 14851 queries = 81.680502 seconds
69
70 * 8066 queries with 0.010000 < query execution time < = 0.100000 seconds; total execution time of the 8066 queries = 443.635693 seconds
71
72 * 1 query with 10.000000 < query execution time < = 100.0000 seconds; total execution time of the 1 query = 55.937094 seconds
73
74Usage
75=====
76
77SELECT
78------
79
80You can get the distribution using the query: ::
81
82 > SELECT * from INFORMATION_SCHEMA.QUERY_RESPONSE_TIME
83 time count total
84 0.000001 0 0.000000
85 0.000010 0 0.000000
86 0.000100 1 0.000072
87 0.001000 0 0.000000
88 0.010000 0 0.000000
89 0.100000 0 0.000000
90 1.000000 0 0.000000
91 10.000000 8 47.268416
92 100.000000 0 0.000000
93 1000.000000 0 0.000000
94 10000.000000 0 0.000000
95 100000.000000 0 0.000000
96 1000000.000000 0 0.000000
97 TOO LONG QUERY 0 0.000000
98
99You can write a complex query like: ::
100
101 SELECT c.count, c.time,
102 (SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
103 (SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
104 (SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
105 FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
106
107**Note:** If :variable:`query_response_time_stats` is ON, the execution times for these two ``SELECT`` queries will also be collected.
108
109SHOW
110----
111
112Also, you can use this syntax: ::
113
114 > SHOW QUERY_RESPONSE_TIME;
115 time count total
116 0.000001 0 0.000000
117 0.000010 0 0.000000
118 0.000100 1 0.000072
119 0.001000 0 0.000000
120 0.010000 0 0.000000
121 0.100000 0 0.000000
122 1.000000 0 0.000000
123 10.000000 8 47.268416
124 100.000000 0 0.000000
125 1000.000000 0 0.000000
126 10000.000000 0 0.000000
127 100000.000000 0 0.000000
128 1000000.000000 0 0.000000
129 TOO LONG QUERY 0 0.000000
130
131**Note:** The execution time for the SHOW query will also be collected.
132
133FLUSH
134-----
135
136Flushing can be done with: ::
137
138 FLUSH QUERY_RESPONSE_TIME;
139
140``FLUSH`` does two things:
141
142 * Clears the collected times from the :table:`QUERY_RESPONSE_TIME` table
143
144 * Reads the value of :variable:`query_response_time_range_base` and uses it to set the range base for the table
145
146**Note:** The execution time for the ``FLUSH`` query will also be collected.
147
148Stored procedures
149-----------------
150
151Stored procedure calls count as single query.
152
153Collect time point
154------------------
155
156Time is collected after query execution completes (before clearing data structures).
157
158Limitations
159===========
160
161 * ``String width for seconds``
162
163 * Value: 7
164
165 * Compile-time variable: ``QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH``
166
167 * ``String width for microseconds``
168
169 * Value: 6
170
171 * Compile-time variable: ``QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH``
172
173 * Minimum range base
174
175 * Value: 2
176
177 * Compile-time variable: ``QUERY_RESPONSE_TIME_MINIMUM_BASE``
178
179 * Minimum range base
180
181 * Value: 1000
182
183 * Compile-time variable: ``QUERY_RESPONSE_TIME_MAXIMUM_BASE``
184
185 * Minimum time interval
186
187 * Value: 1 microsecond
188
189 * Maximum time interval
190
191 * Value: 9999999 seconds
192
193Version Specific Information
194============================
195
196 * 5.5.8-20.0:
197 Introduced variable variable:`have_response_time_distribution`.
198
199 * 5.5.8-20.0:
200 Introduced variable variable:`query_response_time_stats`.
201
202System Variables
203================
204
205.. variable:: have_response_time_distribution
206
207 :version 5.5.8-20.0: Introduced.
208 :scope: Global
209 :dyn: No
210 :vartype: Boolean
211 :default: YES
212 :range: YES/NO
213
214Contains the value YES if the server you're running supports this feature; contains NO if the feature is not supported. It is enabled by default.
215
216
217.. variable:: query_response_time_range_base
218
219 :cli: Yes
220 :conf: Yes
221 :scope: Global
222 :dyn: Yes
223 :vartype: Numeric
224 :default: 10
225 :range: 2-1000
226
227Sets up the logarithm base for the scale.
228
229**Note:** The variable takes effect only after this command has been executed: ::
230
231 FLUSH QUERY_RESPONSE_TIME;
232
233.. variable:: query_response_time_stats
234
235 :version 5.5.8-20.0: Introduced.
236 :cli: Yes
237 :conf: Yes
238 :scope: Global
239 :dyn: Yes
240 :vartype: Boolean
241 :default: OFF
242 :range: ON/OFF
243
244This variable enables and disables collection of query times if the feature is available in the server that's running. If the value of variable :variable:`have_response_time_distribution` is YES, then you can enable collection of query times by setting this variable to ON using ``SET GLOBAL``.
245
246 Prior to release 5.5.8-20.0, this variable was named :variable:`enable_query_response_time_stats`.
247
248
249INFORMATION_SCHEMA Tables
250=========================
251
252.. table:: INFORMATION_SCHEMA.QUERY_RESPONSE_TIME
253
254 :column VARCHAR TIME:
255 :column INT(11) COUNT:
256 :column VARCHAR TOTAL:
257
258Implementation Details
259======================
260
261Implementation details on this feature are provided here.
262
263Related Reading
264===============
265
266 * `Blueprint about Response Time Distribution <https://blueprints.launchpad.net/percona-server/+spec/response-time-distribution>`_
2670
=== removed file 'doc/source/diagnostics/show_engines.rst'
--- doc/source/diagnostics/show_engines.rst 2012-02-13 08:49:21 +0000
+++ doc/source/diagnostics/show_engines.rst 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1.. _show_engines:
2
3======================
4 Show Storage Engines
5======================
6
7This feature changes the comment field displayed when the ``SHOW STORAGE ENGINES`` command is executed and |XtraDB| is the storage engine.
8
9Before the Change: ::
10
11 mysql> show storage engines;
12 +------------+---------+----------------------------------------------------------------+--------------+------+------------+
13 | Engine | Support | Comment | Transactions | XA | Savepoints |
14 +------------+---------+----------------------------------------------------------------+--------------+------+------------+
15 | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
16 ...
17 +------------+---------+----------------------------------------------------------------+--------------+------+------------+
18
19After the Change: ::
20
21 mysql> show storage engines;
22 +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
23 | Engine | Support | Comment | Transactions | XA | Savepoints |
24 +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
25 | InnoDB | YES | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
26 ...
27 +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
28
29Version-Specific Information
30============================
31
32 * 5.5.8-20.0:
33 Full functionality available.
34
35Other Information
36=================
37
38 * Author / Origin:
39 Percona
40
410
=== removed file 'doc/source/diagnostics/slow_extended_55.rst'
--- doc/source/diagnostics/slow_extended_55.rst 2012-08-03 08:58:37 +0000
+++ doc/source/diagnostics/slow_extended_55.rst 1970-01-01 00:00:00 +0000
@@ -1,376 +0,0 @@
1.. _slow_extended_55:
2
3================
4 Slow Query Log
5================
6
7This feature adds microsecond time resolution and additional statistics to the slow query log output. It lets you enable or disable the slow query log at runtime, adds logging for the slave SQL thread, and adds fine-grained control over what and how much to log into the slow query log.
8
9The ability to log queries with microsecond precision is essential for measuring the work the |MySQL| server performs. The standard slow query log in |MySQL| 5.0 has only 1-second granularity, which is too coarse for all but the slowest queries. |MySQL| 5.1 has microsecond resolution, but does not have the extra information about query execution that is included in the |Percona Server|.
10
11You can use Percona-Toolkit's pt-query-digest tool to aggregate similar queries together and report on those that consume the most execution time.
12
13
14Version Specific Information
15============================
16
17 * 5.5.8-20.0:
18 Added values ``profiling`` and ``profiling_use_getrusage`` to variable log_slow_verbosity.
19
20 * 5.5.10-20.1:
21 * Renamed variable :variable:`slow_query_log_timestamp_always` to :variable:`slow_query_log_timestamp_always`.
22
23 * Renamed variable :variable:`slow_query_log_microseconds_timestamp` to :variable:`slow_query_log_timestamp_precision`.
24
25 * Renamed variable :variable:`use_global_log_slow_control` to :variable:`slow_query_log_use_global_control`.
26
27Other Information
28=================
29
30 * Author / Origin:
31 Maciej Dobrzanski, Percona
32
33System Variables
34================
35
36.. variable:: log_slow_filter
37
38 :cli: Yes
39 :conf: Yes
40 :scope: Global, Session
41 :dyn: Yes
42
43Filters the slow log by the query's execution plan. The value is a comma-delimited string, and can contain any combination of the following values:
44
45 * ``qc_miss``:
46 The query was not found in the query cache.
47
48 * ``full_scan``:
49 The query performed a full table scan.
50
51 * ``full_join``:
52 The query performed a full join (a join without indexes).
53
54 * ``tmp_table``:
55 The query created an implicit internal temporary table.
56
57 * ``tmp_table_on_disk``:
58 The query``s temporary table was stored on disk.
59
60 * ``filesort``:
61 The query used a filesort.
62
63 * ``filesort_on_disk``:
64 The filesort was performed on disk.
65
66Values are OR'ed together. If the string is empty, then the filter is disabled. If it is not empty, then queries will only be logged to the slow log if their execution plan matches one of the types of plans present in the filter.
67
68For example, to log only queries that perform a full table scan, set the value to ``full_scan``. To log only queries that use on-disk temporary storage for intermediate results, set the value to ``tmp_table_on_disk,filesort_on_disk``.
69
70.. variable:: log_slow_rate_type
71
72 :cli: Yes
73 :conf: Yes
74 :scope: Global
75 :dyn: Yes
76 :vartype: Enumerated
77 :default: ``session``
78 :range: ``session``, ``query``
79
80Specifies semantic of :variable:`log_slow_rate_limit` - ``session`` or ``query``.
81
82.. variable:: log_slow_rate_limit
83
84 :cli: Yes
85 :conf: Yes
86 :scope: Global, session
87 :dyn: Yes
88
89Behavior of this variable depends from :variable:`log_slow_rate_type`.
90
91Specifies that only a fraction of ``session/query`` should be logged. Logging is enabled for every nth ``session/query``. By default, n is 1, so logging is enabled for every ``session/query``. Please note: when :variable:`log_slow_rate_type` is ``session`` rate limiting is disabled for the replication thread.
92
93Logging all queries might consume I/O bandwidth and cause the log file to grow large.
94 * When :variable:`log_slow_rate_type` is ``session``, this option lets you log full sessions, so you have complete records of sessions for later analysis; but you can rate-limit the number of sessions that are logged. Note that this feature will not work well if your application uses any type of connection pooling or persistent connections. Note that you change :variable:`log_slow_rate_limit` in ``session`` mode, you should reconnect for get effect.
95
96 * When :variable:`log_slow_rate_type` is ``query``, this option lets you log just some queries for later analysis. For example, if you set the value to 100, then one percent of queries will be logged.
97
98Note that every query has global unique ``query_id`` and every connection can has it own (session) :variable:`log_slow_rate_limit`.
99Decision "log or no" calculated in following manner:
100
101 * if ``log_slow_rate_limit`` is 0 - log every query
102
103 * If ``log_slow_rate_limit`` > 0 - log query when (``query_id`` % ``log_slow_rate_limit``) is zero.
104
105This allows flexible setup logging behavior.
106
107For example, if you set the value to 100, then one percent of ``sessions/queries`` will be logged.
108
109.. variable:: log_slow_slave_statements
110
111 :cli: Yes
112 :conf: Yes
113 :scope: Global, session
114 :dyn: Yes (in 5.1 releases only)
115
116Specifies that queries replayed by the slave SQL thread on a |MySQL| slave will be logged. The standard |MySQL| server will not log any queries executed by the slave's SQL thread.
117
118To start the logging from the slave thread, you should change the global value: set global :variable:`log_slow_slave_statements` ``=ON``; and then execute: ``STOP SLAVE; START SLAVE;``. This will destroy and recreate the slave SQL thread, so it will see the newly set global value.
119
120To stop the logging from the slave thread, you should just change the global value: set global :variable:`log_slow_slave_statements` ``=OFF``; the logging stops immediately.
121
122
123.. variable:: log_slow_sp_statements
124
125 :cli: Yes
126 :conf: Yes
127 :scope: Global
128 :dyn: Yes
129 :vartype: Boolean
130 :default: TRUE
131 :range: TRUE/FALSE
132
133If ``TRUE``, statements executed by stored procedures are logged to the slow if it is open.
134
135.. variable:: log_slow_verbosity
136
137 :cli: Yes
138 :conf: Yes
139 :scope: Global, session
140 :dyn: Yes
141 :version 5.5.8-20.0: Added ``profiling`` and ``profiling_use_getrusage``
142
143Specifies how much information to include in your slow log. The value is a comma-delimited string, and can contain any combination of the following values:
144
145 * ``microtime``:
146 Log queries with microsecond precision (mandatory).
147
148 * ``query_plan``:
149 Log information about the query``s execution plan (optional).
150
151 * ``innodb``:
152 Log |InnoDB| statistics (optional).
153
154 * ``full``:
155 Equivalent to all other values OR``ed together.
156
157 * ``profiling``:
158 Enables profiling of all queries in all connections.
159
160 * ``profiling_use_getrusage``:
161 Enables usage of the getrusage function.
162
163Values are OR``ed together.
164
165For example, to enable microsecond query timing and |InnoDB| statistics, set this option to ``microtime,innodb``. To turn all options on, set the option to ``full``.
166
167.. variable:: long_query_time
168
169 :cli: Yes
170 :conf: Yes
171 :scope: Global, session
172 :dyn: Yes
173
174Specifies the time threshold for filtering queries out of the slow query log. The unit of time is seconds. This option has the same meaning as in a standard |MySQL| server, with the following changes:
175
176The option accepts fractional values. If set to 0.5, for example, queries longer than 1/2 second will be logged.
177
178Before version 1.01 of this feature, the value was an integer, and the unit of time was microseconds, not seconds.
179
180.. variable:: slow_query_log_timestamp_always
181
182 :cli: Yes
183 :conf: Yes
184 :scope: Global
185 :dyn: Yes
186 :vartype: Boolean
187 :default: FALSE
188 :range: TRUE/FALSE
189 :version 5.5.10-20.1: Introduced (renamed from :variable:`log_slow_timestamp_every`)
190
191If ``TRUE``, a timestamp is printed on every slow log record. Multiple records may have the same time.
192
193**NOTE:** This variable has been renamed from log_slow_timestamp_every since 5.5.10-20.1.
194
195.. variable:: slow_query_log_timestamp_precision
196
197 :version 5.5.10-20.1: Introduced (renamed from ``slow_query_log_microseconds_timestamp``)
198 :cli: Yes
199 :conf: Yes
200 :scope: Global
201 :dyn: Yes
202 :vartype: Enumerated
203 :default: ``second``
204 :range: ``second``, ``microsecond``
205
206Normally, entries to the slow query log are in seconds precision, in this format: ::
207
208 # Time: 090402 9:23:36 # User@Host: XXX @ XXX [10.X.X.X]
209
210If :variable:`slow_query_log_timestamp_precision` ``=microsecond``, entries to the slow query log are in microsecond precision, in this format: ::
211
212 # Time: 090402 9:23:36.123456 # User@Host: XXX @ XXX [10.X.X.X]
213
214**NOTE:** This variable has been renamed from :variable:`slow_query_log_microseconds_timestamp` since 5.5.10-20.1.
215
216
217.. variable:: slow_query_log_use_global_control
218
219 :cli: Yes
220 :conf: Yes
221 :scope: Global
222 :dyn: Yes
223 :default: None
224 :version 5.5.10-20.1: Introduced (renamed from :variable:`log_slow_timestamp_every`)
225
226Specifies which variables have global scope instead of local. Value is a "flag" variable - you can specify multiple values separated by commas
227
228 * ``none``:
229 All variables use local scope
230
231 * ``log_slow_filter``:
232 Global variable :variable:`log_slow_filter` has effect (instead of local)
233
234 * ``log_slow_rate_limit``:
235 Global variable :variable:`log_slow_rate_limit` has effect (instead of local)
236
237 * ``log_slow_verbosity``:
238 Global variable :variable:`log_slow_verbosity` has effect (instead of local)
239
240 * ``long_query_time``:
241 Global variable :variable:`long_query_time` has effect (instead of local)
242
243 * ``min_examined_row_limit``:
244 Global variable ``min_examined_row_limit`` has effect (instead of local)
245
246 * ``all``
247 Global variables has effect (instead of local)
248
249**NOTE:** This variable has been renamed from :variable:`log_slow_timestamp_every` since 5.5.10-20.1.
250
251
252Other Information
253=================
254
255Changes to the Log Format
256-------------------------
257
258The feature adds more information to the slow log output. Here is a sample log entry: ::
259
260 # User@Host: mailboxer[mailboxer] @ [192.168.10.165]
261 # Thread_id: 11167745 Schema: board
262 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: Yes Disk_tmp_table: No
263 # Filesort: Yes Disk_filesort: No Merge_passes: 0
264 # Query_time: 0.000659 Lock_time: 0.000070 Rows_sent: 0 Rows_examined: 30 Rows_affected: 0 Rows_read: 30
265 # innodb_IO_r_ops: 1 innodb_IO_r_bytes: 16384 innodb_IO_r_wait: 0.028487
266 # innodb_rec_lock_wait: 0.000000 innodb_queue_wait: 0.000000
267 # innodb_pages_distinct: 5
268 select count(distinct author_id) from art87.article87 force index (forum_id) where forum_id = 240215 and thread_id = ``710575``
269
270Another example (:variable:`log_slow_verbosity` ``=profiling``): ::
271
272 # Query_time: 4.555235 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0 Rows_read: 1
273 # Profile_starting: 4.554799 Profile_starting_cpu: 0.000000 Profile_checking_permissions: 0.000095 Profile_checking_permissions_cpu: 0.000000 Profile_Opening_tables: 0.000088 Profile_Opening_tables_cpu: 0.000000 Profile_init: 0.000056 Profile_init_cpu: 0.000000 Profile_optimizing: 0.000046 Profile_optimizing_cpu: 0.000000 Profile_executing: 0.000098 Profile_executing_cpu: 0.000000 Profile_end: 0.000049 Profile_end_cpu: 0.000000 Profile_query_end: 0.000045 Profile_query_end_cpu: 0.000000 Profile_freeing_items: 0.000084 Profile_freeing_items_cpu: 0.000000 Profile_logging_slow_query: 0.000045 Profile_logging_slow_query_cpu: 0.000000
274 # Profile_total: 4.555405 Profile_total_cpu: 0.000000
275 insert into teee4 select * from teee4 limit 10000000;
276
277Connection and Schema Identifier
278--------------------------------
279
280Each slow log entry now contains a connection identifier, so you can trace all the queries coming from a single connection. This is the same value that is shown in the Id column in ``SHOW FULL PROCESSLIST`` or returned from the ``CONNECTION_ID()`` function.
281
282Each entry also contains a schema name, so you can trace all the queries whose default database was set to a particular schema. ::
283
284 # Thread_id: 11167745 Schema: board
285
286Microsecond Time Resolution and Extra Row Information
287-----------------------------------------------------
288
289This is the original functionality offered by the ``microslow`` feature. ``Query_time`` and ``Lock_time`` are logged with microsecond resolution.
290
291The feature also adds information about how many rows were examined for ``SELECT`` queries, and how many were analyzed and affected for ``UPDATE``, ``DELETE``, and ``INSERT`` queries, ::
292
293 # Query_time: 0.000659 Lock_time: 0.000070 Rows_sent: 0 Rows_examined: 30 Rows_affected: 0 Rows_read: 30
294
295Values and context:
296
297 * ``Rows_examined``:
298 Number of rows scanned - ``SELECT``
299
300 * ``Rows_affected``:
301 Number of rows changed - ``UPDATE``, ``DELETE``, ``INSERT``
302
303 * ``Rows_read``:
304 Number of rows read - ``UPDATE``, ``DELETE``, ``INSERT``
305
306Memory Footprint
307----------------
308
309The feature provides information about the amount of bytes sent for the result of the query and the number of temporary tables created for its execution - differentiated by whether they were created on memory or on disk - with the total number of bytes used by them. ::
310
311 # Bytes_sent: 8053 Tmp_tables: 1 Tmp_disk_tables: 0 Tmp_table_sizes: 950528
312
313Values and context:
314
315 * ``Bytes_sent``:
316 The amount of bytes sent for the result of the query
317
318 * ``Tmp_tables``:
319 Number of temporary tables created on memory for the query
320
321 * ``Tmp_disk_tables``:
322 Number of temporary tables created on disk for the query
323
324 * ``Tmp_table_sizes``:
325 Total Size in bytes for all temporary tables used in the query
326
327
328Query Plan Information
329----------------------
330
331Each query can be executed in various ways. For example, it may use indexes or do a full table scan, or a temporary table may be needed. These are the things that you can usually see by running ``EXPLAIN`` on the query. The feature will now allow you to see the most important facts about the execution in the log file. ::
332
333 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: Yes Disk_tmp_table: No
334 # Filesort: Yes Disk_filesort: No Merge_passes: 0
335
336The values and their meanings are documented with the :variable:`log_slow_filter` option.
337
338|InnoDB| Usage Information
339--------------------------
340
341The final part of the output is the |InnoDB| usage statistics. |MySQL| currently shows many per-session statistics for operations with ``SHOW SESSION STATUS``, but that does not include those of |InnoDB|, which are always global and shared by all threads. This feature lets you see those values for a given query. ::
342
343 # innodb_IO_r_ops: 1 innodb_IO_r_bytes: 16384 innodb_IO_r_wait: 0.028487
344 # innodb_rec_lock_wait: 0.000000 innodb_queue_wait: 0.000000
345 # innodb_pages_distinct: 5
346
347Values:
348
349 * ``innodb_IO_r_ops``:
350 Counts the number of page read operations scheduled. The actual number of read operations may be different, but since this can be done asynchronously, there is no good way to measure it.
351
352 * ``innodb_IO_r_bytes``:
353 Similar to innodb_IO_r_ops, but the unit is bytes.
354
355 * ``innodb_IO_r_wait``:
356 Shows how long (in seconds) it took |InnoDB| to actually read the data from storage.
357
358 * ``innodb_rec_lock_wait``:
359 Shows how long (in seconds) the query waited for row locks.
360
361 * ``innodb_queue_wait``:
362 Shows how long (in seconds) the query spent either waiting to enter the |InnoDB| queue or inside that queue waiting for execution.
363
364 * ``innodb_pages_distinct``:
365 Counts approximately the number of unique pages the query accessed. The approximation is based on a small hash array representing the entire buffer pool, because it could take a lot of memory to map all the pages. The inaccuracy grows with the number of pages accessed by a query, because there is a higher probability of hash collisions.
366
367If the query did not use |InnoDB| tables, that information is written into the log instead of the above statistics.
368
369Related Reading
370===============
371
372 * `Impact of logging on MySQL's performance <http://www.mysqlperformanceblog.com/2009/02/10/impact-of-logging-on-mysql%E2%80%99s-performance/>`_
373
374 * `log_slow_filter Usage <http://www.mysqlperformanceblog.com/2008/09/22/finding-what-created_tmp_disk_tables-with-log_slow_filter/>`_
375
376 * `Blueprint in Launchpad <https://blueprints.launchpad.net/percona-server/+spec/microseconds-in-query-log>`_
3770
=== removed file 'doc/source/diagnostics/thread_based_profiling.rst'
--- doc/source/diagnostics/thread_based_profiling.rst 2012-07-18 08:43:52 +0000
+++ doc/source/diagnostics/thread_based_profiling.rst 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1.. _thread_based_profiling:
2
3=========================
4 Thread Based Profiling
5=========================
6
7|Percona Server| now uses thread based profiling by default, instead of process based profiling. This was implemented because with process based profiling, threads on the server, other than the one being profiled, can affect the profiling information.
8
9Thread based profiling is using the information provided by the kernel `getrusage <http://kernel.org/doc/man-pages/online/pages/man2/getrusage.2.html>`_ function. Since the 2.6.26 kernel version, thread based resource usage is available with the **RUSAGE_THREAD**. This means that the thread based profiling will be used if you're running the 2.6.26 kernel or newer, or if the **RUSAGE_THREAD** has been ported back.
10
11This feature is enabled by default if your system supports it, in other cases it uses process based profiling.
12
13Version Specific Information
14============================
15
16 * :rn:`5.5.25a-27.1`:
17 Thread based profiling introduced
180
=== removed file 'doc/source/diagnostics/user_stats.rst'
--- doc/source/diagnostics/user_stats.rst 2012-05-21 16:25:24 +0000
+++ doc/source/diagnostics/user_stats.rst 1970-01-01 00:00:00 +0000
@@ -1,251 +0,0 @@
1.. _user_stats:
2
3=================
4 User Statistics
5=================
6
7This feature adds several ``INFORMATION_SCHEMA`` tables, several commands, and the userstat variable. The tables and commands can be used to understand the server activity better and identify the source of the load.
8
9The functionality is disabled by default, and must be enabled by setting ``userstat`` to ``ON``. It works by keeping several hash tables in memory. To avoid contention over global mutexes, each connection has its own local statistics, which are occasionally merged into the global statistics, and the local statistics are then reset to 0.
10
11
12Version Specific Information
13============================
14
15 * :rn:`5.5.10-20.1`:
16 Renamed variable :variable:`userstat_running` to :variable:`userstat`.
17 * :rn:`5.5.24-26.0`:
18 TOTAL_CONNECTIONS_SSL column has been added to CLIENT_STATISTICS, THREAD_STATISTICS and USER_STATISTICS tables
19
20Other Information
21=================
22
23 * Author/Origin:
24 *Google*; *Percona* added the ``INFORMATION_SCHEMA`` tables and the :variable:`userstat_running` variable.
25
26System Variables
27================
28
29.. variable:: userstat_running
30
31 :version 5.5.10-20.1: Renamed to :variable:`userstat`
32 :cli: Yes
33 :conf: Yes
34 :scope: Global
35 :dyn: Yes
36 :vartype: BOOLEAN
37 :default: OFF
38 :range: ON/OFF
39
40Enables or disables collection of statistics. The default is ``OFF``, meaning no statistics are gathered. This is to ensure that the statistics collection doesn't cause any extra load on the server unless desired.
41
42
43INFORMATION_SCHEMA Tables
44=========================
45
46.. table:: INFORMATION_SCHEMA.CLIENT_STATISTICS
47
48 :column CLIENT: The IP address or hostname from which the connection originated.
49 :column TOTAL_CONNECTIONS: The number of connections created for this client.
50 :column CONCURRENT_CONNECTIONS: The number of concurrent connections for this client.
51 :column CONNECTED_TIME: The cumulative number of seconds elapsed while there were connections from this client.
52 :column BUSY_TIME: The cumulative number of seconds there was activity on connections from this client.
53 :column CPU_TIME: The cumulative CPU time elapsed, in seconds, while servicing this client``s connections.
54 :column BYTES_RECEIVED: The number of bytes received from this client's connections.
55 :column BYTES_SENT: The number of bytes sent to this client's connections.
56 :column BINLOG_BYTES_WRITTEN: The number of bytes written to the binary log from this client's connections.
57 :column ROWS_FETCHED: The number of rows fetched by this client's connections.
58 :column ROWS_UPDATED: The number of rows updated by this client's connections.
59 :column TABLE_ROWS_READ: The number of rows read from tables by this client's connections. (It may be different from ``ROWS_FETCHED``.)
60 :column SELECT_COMMANDS: The number of ``SELECT`` commands executed from this client's connections.
61 :column UPDATE_COMMANDS: The number of ``UPDATE`` commands executed from this client's connections.
62 :column OTHER_COMMANDS: The number of other commands executed from this client's connections.
63 :column COMMIT_TRANSACTIONS: The number of ``COMMIT`` commands issued by this client's connections.
64 :column ROLLBACK_TRANSACTIONS: The number of ``ROLLBACK`` commands issued by this client's connections.
65 :column DENIED_CONNECTIONS: The number of connections denied to this client.
66 :column LOST_CONNECTIONS: The number of this client's connections that were terminated uncleanly.
67 :column ACCESS_DENIED: The number of times this client's connections issued commands that were denied.
68 :column EMPTY_QUERIES: The number of times this client's connections sent empty queries to the server.
69 :column TOTAL_CONNECTIONS_SSL: The number of times this client's connections connected using SSL to the server.
70
71
72This table holds statistics about client connections. The Percona version of the feature restricts this table's visibility to users who have the ``SUPER`` or ``PROCESS`` privilege.
73
74Example: ::
75
76 mysql> SELECT * FROM INFORMATION_SCHEMA.CLIENT_STATISTICS\G
77 *************************** 1. row ***************************
78 CLIENT: 10.1.12.30
79 TOTAL_CONNECTIONS: 20
80 CONCURRENT_CONNECTIONS: 0
81 CONNECTED_TIME: 0
82 BUSY_TIME: 93
83 CPU_TIME: 48
84 BYTES_RECEIVED: 5031
85 BYTES_SENT: 276926
86 BINLOG_BYTES_WRITTEN: 217
87 ROWS_FETCHED: 81
88 ROWS_UPDATED: 0
89 TABLE_ROWS_READ: 52836023
90 SELECT_COMMANDS: 26
91 UPDATE_COMMANDS: 1
92 OTHER_COMMANDS: 145
93 COMMIT_TRANSACTIONS: 1
94 ROLLBACK_TRANSACTIONS: 0
95 DENIED_CONNECTIONS: 0
96 LOST_CONNECTIONS: 0
97 ACCESS_DENIED: 0
98 EMPTY_QUERIES: 0
99 TOTAL_CONNECTIONS_SSL: 0
100
101
102.. table:: INFORMATION_SCHEMA.INDEX_STATISTICS
103
104 :column TABLE_SCHEMA: The schema (database) name.
105 :column TABLE_NAME: The table name.
106 :column INDEX_NAME: The index name (as visible in ``SHOW CREATE TABLE``).
107 :column ROWS_READ: The number of rows read from this index.
108
109This table shows statistics on index usage. An older version of the feature contained a single column that had the ``TABLE_SCHEMA``, ``TABLE_NAME`` and ``INDEX_NAME`` columns concatenated together. The |Percona| version of the feature separates these into three columns. Users can see entries only for tables to which they have ``SELECT`` access.
110
111This table makes it possible to do many things that were difficult or impossible previously. For example, you can use it to find unused indexes and generate DROP commands to remove them.
112
113Example: ::
114
115 mysql> SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS
116 WHERE TABLE_NAME='tables_priv';
117 +--------------+-----------------------+--------------------+-----------+
118 | TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
119 +--------------+-----------------------+--------------------+-----------+
120 | mysql | tables_priv | PRIMARY | 2 |
121 +--------------+-----------------------+--------------------+-----------+
122
123
124
125.. table:: INFORMATION_SCHEMA.TABLE_STATISTICS
126
127 :column TABLE_SCHEMA: The schema (database) name.
128 :column TABLE_NAME: The table name.
129 :column ROWS_READ: The number of rows read from the table.
130 :column ROWS_CHANGED: The number of rows changed in the table.
131 :column ROWS_CHANGED_X_INDEXES: The number of rows changed in the table, multiplied by the number of indexes changed.
132
133This table is similar in function to the ``INDEX_STATISTICS`` table.
134
135Example: ::
136
137 mysql> SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS
138 WHERE TABLE_NAME=``tables_priv``;
139 +--------------+-------------------------------+-----------+--------------+------------------------+
140 | TABLE_SCHEMA | TABLE_NAME | ROWS_READ | ROWS_CHANGED | ROWS_CHANGED_X_INDEXES |
141 +--------------+-------------------------------+-----------+--------------+------------------------+
142 | mysql | tables_priv | 2 | 0 | 0 |
143 +--------------+-------------------------------+-----------+--------------+------------------------+
144
145
146.. table:: INFORMATION_SCHEMA.THREAD_STATISTICS
147
148 :column THREAD_ID: int(21)
149 :column TOTAL_CONNECTIONS: int(21)
150 :column CONCURRENT_CONNECTIONS: int(21)
151 :column CONNECTED_TIME: int(21)
152 :column BUSY_TIME: int(21)
153 :column CPU_TIME: int(21)
154 :column BYTES_RECEIVED: int(21)
155 :column BYTES_SENT: int(21)
156 :column BINLOG_BYTES_WRITTEN: int(21)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches