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
1=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
2--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-09 06:49:56 +0000
3+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-22 13:19:13 +0000
4@@ -165,6 +165,7 @@
5 INNODB_THREAD_CONCURRENCY
6 INNODB_THREAD_CONCURRENCY_TIMER_BASED
7 INNODB_THREAD_SLEEP_DELAY
8+INNODB_TRACK_CHANGED_PAGES
9 INNODB_TRX_RSEG_N_SLOTS_DEBUG
10 INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
11 INNODB_USE_NATIVE_AIO
12
13=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
14--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-07 06:10:00 +0000
15+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-22 13:19:13 +0000
16@@ -161,6 +161,7 @@
17 INNODB_THREAD_CONCURRENCY
18 INNODB_THREAD_CONCURRENCY_TIMER_BASED
19 INNODB_THREAD_SLEEP_DELAY
20+INNODB_TRACK_CHANGED_PAGES
21 INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
22 INNODB_USE_NATIVE_AIO
23 INNODB_USE_SYS_MALLOC
24
25=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result'
26--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 1970-01-01 00:00:00 +0000
27+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-08-22 13:19:13 +0000
28@@ -0,0 +1,26 @@
29+DROP TABLE IF EXISTS t1, t2;
30+CREATE TABLE t1 (x INT) ENGINE=InnoDB;
31+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
32+INSERT INTO t1 SELECT x FROM t1;
33+INSERT INTO t1 SELECT x FROM t1;
34+INSERT INTO t1 SELECT x FROM t1;
35+INSERT INTO t1 SELECT x FROM t1;
36+INSERT INTO t1 SELECT x FROM t1;
37+INSERT INTO t1 SELECT x FROM t1;
38+INSERT INTO t1 SELECT x FROM t1;
39+INSERT INTO t1 SELECT x FROM t1;
40+INSERT INTO t1 SELECT x FROM t1;
41+INSERT INTO t1 SELECT x FROM t1;
42+INSERT INTO t1 SELECT x FROM t1;
43+INSERT INTO t1 SELECT x FROM t1;
44+CREATE TABLE t2 (x INT) ENGINE=InnoDB;
45+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
46+INSERT INTO t1 SELECT x FROM t1;
47+INSERT INTO t1 SELECT x FROM t1;
48+INSERT INTO t1 SELECT x FROM t1;
49+SET GLOBAL INNODB_FAST_SHUTDOWN=2;
50+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
51+call mtr.add_suppression("InnoDB: Warning: truncated block detected.*");
52+INSERT INTO t1 SELECT x FROM t1;
53+ERROR HY000: Lost connection to MySQL server during query
54+DROP TABLE t1, t2;
55
56=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result'
57--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 1970-01-01 00:00:00 +0000
58+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-08-22 13:19:13 +0000
59@@ -0,0 +1,6 @@
60+DROP TABLE IF EXISTS t1, t2;
61+CREATE TABLE t1 (x INT) ENGINE=InnoDB;
62+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
63+CREATE TABLE t2 (x INT) ENGINE=InnoDB;
64+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
65+DROP TABLE t1, t2;
66
67=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt'
68--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt 1970-01-01 00:00:00 +0000
69+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp-master.opt 2012-08-22 13:19:13 +0000
70@@ -0,0 +1,1 @@
71+--innodb_track_changed_pages=TRUE --innodb_log_file_size=5M --innodb_file_per_table --skip-stack-trace --skip-core-file
72
73=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test'
74--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 1970-01-01 00:00:00 +0000
75+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-08-22 13:19:13 +0000
76@@ -0,0 +1,126 @@
77+# Tests for the changed page tracking bitmap.
78+--source include/not_embedded.inc
79+--source include/not_crashrep.inc
80+--source include/have_debug.inc
81+--source include/have_innodb.inc
82+# Valgrind reports useless errors on very fast server shutdowns
83+--source include/not_valgrind.inc
84+
85+let $MYSQLD_DATADIR= `select @@datadir`;
86+let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log.1;
87+
88+--disable_warnings
89+DROP TABLE IF EXISTS t1, t2;
90+--enable_warnings
91+
92+# Create some log data, less than log capacity
93+CREATE TABLE t1 (x INT) ENGINE=InnoDB;
94+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
95+
96+# Check that the bitmap file has been created
97+file_exists $BITMAP_FILE;
98+
99+# Test that an empty existing bitmap file is handled properly when it's
100+# possible to re-read the entire missing range.
101+
102+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
103+--shutdown_server 10
104+--source include/wait_until_disconnected.inc
105+remove_file $BITMAP_FILE;
106+write_file $BITMAP_FILE;
107+EOF
108+--enable_reconnect
109+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
110+--source include/wait_until_connected_again.inc
111+
112+# TODO: check the tracked LSN range continuity once this info is exposed through
113+# INFORMATION_SCHEMA.
114+
115+# Create more log data, larger amount than the log group capacity. At the same time test second space id.
116+INSERT INTO t1 SELECT x FROM t1;
117+INSERT INTO t1 SELECT x FROM t1;
118+INSERT INTO t1 SELECT x FROM t1;
119+INSERT INTO t1 SELECT x FROM t1;
120+INSERT INTO t1 SELECT x FROM t1;
121+INSERT INTO t1 SELECT x FROM t1;
122+INSERT INTO t1 SELECT x FROM t1;
123+INSERT INTO t1 SELECT x FROM t1;
124+INSERT INTO t1 SELECT x FROM t1;
125+INSERT INTO t1 SELECT x FROM t1;
126+INSERT INTO t1 SELECT x FROM t1;
127+INSERT INTO t1 SELECT x FROM t1;
128+CREATE TABLE t2 (x INT) ENGINE=InnoDB;
129+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
130+
131+file_exists $BITMAP_FILE;
132+
133+# Restart the server to check that the bitmap file is properly read on the startup
134+# to resume tracking.
135+
136+# TODO: check the tracked LSN range continuity once this info is exposed through
137+# INFORMATION_SCHEMA.
138+--source include/restart_mysqld.inc
139+
140+file_exists $BITMAP_FILE;
141+
142+INSERT INTO t1 SELECT x FROM t1;
143+INSERT INTO t1 SELECT x FROM t1;
144+INSERT INTO t1 SELECT x FROM t1;
145+
146+# Restart the server again with the very fast shutdown
147+SET GLOBAL INNODB_FAST_SHUTDOWN=2;
148+
149+--source include/restart_mysqld.inc
150+
151+file_exists $BITMAP_FILE;
152+
153+# TODO: check the tracked LSN range continuity once this info is exposed through
154+# INFORMATION_SCHEMA.
155+
156+# Test that an empty existing bitmap file is handled properly when it's impossible to re-read the full missing range.
157+
158+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
159+--shutdown_server 10
160+--source include/wait_until_disconnected.inc
161+remove_file $BITMAP_FILE;
162+write_file $BITMAP_FILE;
163+EOF
164+--enable_reconnect
165+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
166+--source include/wait_until_connected_again.inc
167+
168+file_exists $BITMAP_FILE;
169+
170+# Create at least one more bitmap page on shutdown
171+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
172+
173+# Test that the bitmap file is read in block size multiples with junk at the end discarded
174+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
175+--shutdown_server 10
176+--source include/wait_until_disconnected.inc
177+append_file $BITMAP_FILE;
178+junk junk junk junk
179+EOF
180+--enable_reconnect
181+--exec echo "restart:-#d,crash_before_bitmap_write" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
182+--source include/wait_until_connected_again.inc
183+call mtr.add_suppression("InnoDB: Warning: truncated block detected.*");
184+
185+file_exists $BITMAP_FILE;
186+
187+# TODO: check the tracked LSN range continuity once this info is exposed through
188+# INFORMATION_SCHEMA.
189+
190+# Test crashing before writing of new bitmap data
191+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
192+--error 2013
193+INSERT INTO t1 SELECT x FROM t1;
194+--enable_reconnect
195+--source include/wait_until_connected_again.inc
196+
197+file_exists $BITMAP_FILE;
198+
199+# TODO: check the tracked LSN range continuity once this info is exposed through
200+# INFORMATION_SCHEMA.
201+
202+DROP TABLE t1, t2;
203
204=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt'
205--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt 1970-01-01 00:00:00 +0000
206+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart-master.opt 2012-08-22 13:19:13 +0000
207@@ -0,0 +1,1 @@
208+--innodb_track_changed_pages=TRUE --innodb-file-per-table
209
210=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test'
211--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 1970-01-01 00:00:00 +0000
212+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-08-22 13:19:13 +0000
213@@ -0,0 +1,21 @@
214+# Tests for the changed page tracking bitmap. A valgrindable subset of
215+# percona_changed_page_bmp test, which contains the full functional tests.
216+--source include/have_innodb.inc
217+
218+let $MYSQLD_DATADIR= `select @@datadir`;
219+let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log.1;
220+
221+--disable_warnings
222+DROP TABLE IF EXISTS t1, t2;
223+--enable_warnings
224+
225+# Create some log data with several space ids to have more than bitmap poge.
226+CREATE TABLE t1 (x INT) ENGINE=InnoDB;
227+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
228+CREATE TABLE t2 (x INT) ENGINE=InnoDB;
229+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
230+
231+# Check that the bitmap file has been created
232+file_exists $BITMAP_FILE;
233+
234+DROP TABLE t1, t2;
235
236=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result'
237--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result 1970-01-01 00:00:00 +0000
238+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result 2012-08-22 13:19:13 +0000
239@@ -0,0 +1,21 @@
240+SELECT COUNT(@@GLOBAL.innodb_track_changed_pages);
241+COUNT(@@GLOBAL.innodb_track_changed_pages)
242+1
243+SET @@GLOBAL.innodb_track_changed_pages=1;
244+ERROR HY000: Variable 'innodb_track_changed_pages' is a read only variable
245+SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
246+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
247+WHERE VARIABLE_NAME='innodb_track_changed_pages';
248+@@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
249+1
250+Warnings:
251+Warning 1292 Truncated incorrect DOUBLE value: 'OFF'
252+SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages;
253+@@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages
254+1
255+SELECT COUNT(@@SESSION.innodb_track_changed_pages);
256+ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable
257+SELECT COUNT(@@LOCAL.innodb_track_changed_pages);
258+ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable
259+SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages;
260+ERROR 42S22: Unknown column 'innodb_track_changed_pages' in 'field list'
261
262=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test'
263--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 1970-01-01 00:00:00 +0000
264+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 2012-08-22 13:19:13 +0000
265@@ -0,0 +1,21 @@
266+# Tests for innodb_track_changed_pages variable
267+
268+--source include/have_innodb.inc
269+
270+SELECT COUNT(@@GLOBAL.innodb_track_changed_pages);
271+
272+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
273+SET @@GLOBAL.innodb_track_changed_pages=1;
274+
275+SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE
276+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
277+WHERE VARIABLE_NAME='innodb_track_changed_pages';
278+
279+SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages;
280+
281+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
282+SELECT COUNT(@@SESSION.innodb_track_changed_pages);
283+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
284+SELECT COUNT(@@LOCAL.innodb_track_changed_pages);
285+--error ER_BAD_FIELD_ERROR
286+SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages;
287
288=== modified file 'Percona-Server/storage/innobase/CMakeLists.txt'
289--- Percona-Server/storage/innobase/CMakeLists.txt 2011-03-24 12:00:14 +0000
290+++ Percona-Server/storage/innobase/CMakeLists.txt 2012-08-22 13:19:13 +0000
291@@ -85,12 +85,41 @@
292 }"
293 HAVE_IB_GCC_ATOMIC_BUILTINS
294 )
295+ CHECK_C_SOURCE_RUNS(
296+ "
297+ #include <stdint.h>
298+ int main()
299+ {
300+ int64_t x, y, res;
301+
302+ x = 10;
303+ y = 123;
304+ res = __sync_bool_compare_and_swap(&x, x, y);
305+ if (!res || x != y) {
306+ return(1);
307+ }
308+
309+ x = 10;
310+ y = 123;
311+ res = __sync_add_and_fetch(&x, y);
312+ if (res != 123 + 10 || x != 123 + 10) {
313+ return(1);
314+ }
315+
316+ return(0);
317+ }"
318+ HAVE_IB_GCC_ATOMIC_BUILTINS_64
319+ )
320 ENDIF()
321
322 IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
323 ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
324 ENDIF()
325
326+IF(HAVE_IB_GCC_ATOMIC_BUILTINS_64)
327+ ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS_64=1)
328+ENDIF()
329+
330 # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
331 IF(NOT CMAKE_CROSSCOMPILING)
332 CHECK_C_SOURCE_RUNS(
333@@ -227,7 +256,7 @@
334 ibuf/ibuf0ibuf.c
335 pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
336 lock/lock0lock.c lock/lock0iter.c
337- log/log0log.c log/log0recv.c
338+ log/log0log.c log/log0recv.c log/log0online.c
339 mach/mach0data.c
340 mem/mem0mem.c mem/mem0pool.c
341 mtr/mtr0log.c mtr/mtr0mtr.c
342
343=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
344--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-07 06:10:00 +0000
345+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-22 13:19:13 +0000
346@@ -361,7 +361,8 @@
347 {&srv_error_monitor_thread_key, "srv_error_monitor_thread", 0},
348 {&srv_monitor_thread_key, "srv_monitor_thread", 0},
349 {&srv_master_thread_key, "srv_master_thread", 0},
350- {&srv_purge_thread_key, "srv_purge_thread", 0}
351+ {&srv_purge_thread_key, "srv_purge_thread", 0},
352+ {&srv_log_tracking_thread_key, "srv_redo_log_follow_thread", 0}
353 };
354 # endif /* UNIV_PFS_THREAD */
355
356@@ -371,7 +372,8 @@
357 static PSI_file_info all_innodb_files[] = {
358 {&innodb_file_data_key, "innodb_data_file", 0},
359 {&innodb_file_log_key, "innodb_log_file", 0},
360- {&innodb_file_temp_key, "innodb_temp_file", 0}
361+ {&innodb_file_temp_key, "innodb_temp_file", 0},
362+ {&innodb_file_bmp_key, "innodb_bmp_file", 0}
363 };
364 # endif /* UNIV_PFS_IO */
365 #endif /* HAVE_PSI_INTERFACE */
366@@ -12658,6 +12660,11 @@
367 "NULLS_UNEQUAL and NULLS_IGNORED",
368 NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);
369
370+static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages,
371+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
372+ "Track the redo log for changed pages and output a changed page bitmap",
373+ NULL, NULL, FALSE);
374+
375 #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
376 static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
377 PLUGIN_VAR_RQCMDARG,
378@@ -12942,6 +12949,7 @@
379 MYSQL_SYSVAR(use_sys_malloc),
380 MYSQL_SYSVAR(use_native_aio),
381 MYSQL_SYSVAR(change_buffering),
382+ MYSQL_SYSVAR(track_changed_pages),
383 #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
384 MYSQL_SYSVAR(change_buffering_debug),
385 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
386
387=== modified file 'Percona-Server/storage/innobase/include/log0log.h'
388--- Percona-Server/storage/innobase/include/log0log.h 2012-08-07 06:10:00 +0000
389+++ Percona-Server/storage/innobase/include/log0log.h 2012-08-22 13:19:13 +0000
390@@ -962,6 +962,11 @@
391 become signaled */
392 /* @} */
393 #endif /* UNIV_LOG_ARCHIVE */
394+ ib_uint64_t tracked_lsn; /*!< log tracking has advanced to this
395+ lsn. Field accessed atomically where
396+ 64-bit atomic ops are supported,
397+ protected by the log sys mutex
398+ otherwise. */
399 };
400
401 /** Test if flush order mutex is owned. */
402
403=== added file 'Percona-Server/storage/innobase/include/log0online.h'
404--- Percona-Server/storage/innobase/include/log0online.h 1970-01-01 00:00:00 +0000
405+++ Percona-Server/storage/innobase/include/log0online.h 2012-08-22 13:19:13 +0000
406@@ -0,0 +1,51 @@
407+/*****************************************************************************
408+
409+Copyright (c) 2011-2012, Percona Inc. All Rights Reserved.
410+
411+This program is free software; you can redistribute it and/or modify it under
412+the terms of the GNU General Public License as published by the Free Software
413+Foundation; version 2 of the License.
414+
415+This program is distributed in the hope that it will be useful, but WITHOUT
416+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
417+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
418+
419+You should have received a copy of the GNU General Public License along with
420+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
421+Place, Suite 330, Boston, MA 02111-1307 USA
422+
423+*****************************************************************************/
424+
425+/**************************************************//**
426+@file include/log0online.h
427+Online database log parsing for changed page tracking
428+*******************************************************/
429+
430+#ifndef log0online_h
431+#define log0online_h
432+
433+#include "univ.i"
434+
435+/*********************************************************************//**
436+Initializes the online log following subsytem. */
437+UNIV_INTERN
438+void
439+log_online_read_init();
440+/*===================*/
441+
442+/*********************************************************************//**
443+Shuts down the online log following subsystem. */
444+UNIV_INTERN
445+void
446+log_online_read_shutdown();
447+/*=======================*/
448+
449+/*********************************************************************//**
450+Reads and parses the redo log up to last checkpoint LSN to build the changed
451+page bitmap which is then written to disk. */
452+UNIV_INTERN
453+void
454+log_online_follow_redo_log();
455+/*=========================*/
456+
457+#endif
458
459=== modified file 'Percona-Server/storage/innobase/include/log0recv.h'
460--- Percona-Server/storage/innobase/include/log0recv.h 2012-05-10 07:49:14 +0000
461+++ Percona-Server/storage/innobase/include/log0recv.h 2012-08-22 13:19:13 +0000
462@@ -32,6 +32,28 @@
463 #include "hash0hash.h"
464 #include "log0log.h"
465
466+/******************************************************//**
467+Checks the 4-byte checksum to the trailer checksum field of a log
468+block. We also accept a log block in the old format before
469+InnoDB-3.23.52 where the checksum field contains the log block number.
470+@return TRUE if ok, or if the log block may be in the format of InnoDB
471+version predating 3.23.52 */
472+UNIV_INTERN
473+ibool
474+log_block_checksum_is_ok_or_old_format(
475+/*===================================*/
476+ const byte* block); /*!< in: pointer to a log block */
477+
478+/*******************************************************//**
479+Calculates the new value for lsn when more data is added to the log. */
480+UNIV_INTERN
481+ib_uint64_t
482+recv_calc_lsn_on_data_add(
483+/*======================*/
484+ ib_uint64_t lsn, /*!< in: old lsn */
485+ ib_uint64_t len); /*!< in: this many bytes of data is
486+ added, log block headers not included */
487+
488 #ifdef UNIV_HOTBACKUP
489 extern ibool recv_replay_file_ops;
490
491@@ -182,6 +204,21 @@
492 void
493 recv_recovery_rollback_active(void);
494 /*===============================*/
495+
496+/*******************************************************************//**
497+Tries to parse a single log record and returns its length.
498+@return length of the record, or 0 if the record was not complete */
499+UNIV_INTERN
500+ulint
501+recv_parse_log_rec(
502+/*===============*/
503+ byte* ptr, /*!< in: pointer to a buffer */
504+ byte* end_ptr,/*!< in: pointer to the buffer end */
505+ byte* type, /*!< out: type */
506+ ulint* space, /*!< out: space id */
507+ ulint* page_no,/*!< out: page number */
508+ byte** body); /*!< out: log record body start */
509+
510 /*******************************************************//**
511 Scans log from a buffer and stores new log data to the parsing buffer.
512 Parses and hashes the log records if new data found. Unless
513
514=== modified file 'Percona-Server/storage/innobase/include/os0file.h'
515--- Percona-Server/storage/innobase/include/os0file.h 2012-08-07 06:10:00 +0000
516+++ Percona-Server/storage/innobase/include/os0file.h 2012-08-22 13:19:13 +0000
517@@ -197,6 +197,7 @@
518 extern mysql_pfs_key_t innodb_file_data_key;
519 extern mysql_pfs_key_t innodb_file_log_key;
520 extern mysql_pfs_key_t innodb_file_temp_key;
521+extern mysql_pfs_key_t innodb_file_bmp_key;
522
523 /* Following four macros are instumentations to register
524 various file I/O operations with performance schema.
525@@ -867,6 +868,14 @@
526 /*============*/
527 FILE* file); /*!< in: file to be truncated */
528 /***********************************************************************//**
529+Truncates a file at the specified position.
530+@return TRUE if success */
531+UNIV_INTERN
532+ibool
533+os_file_set_eof_at(
534+ os_file_t file, /*!< in: handle to a file */
535+ ib_uint64_t new_len);/*!< in: new file length */
536+/***********************************************************************//**
537 NOTE! Use the corresponding macro os_file_flush(), not directly this function!
538 Flushes the write buffers of a given file to the disk.
539 @return TRUE if success */
540
541=== modified file 'Percona-Server/storage/innobase/include/os0sync.h'
542--- Percona-Server/storage/innobase/include/os0sync.h 2012-05-10 07:49:14 +0000
543+++ Percona-Server/storage/innobase/include/os0sync.h 2012-08-22 13:19:13 +0000
544@@ -265,7 +265,11 @@
545
546 #if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
547
548-#define HAVE_ATOMIC_BUILTINS
549+# define HAVE_ATOMIC_BUILTINS
550+
551+# ifdef HAVE_IB_GCC_ATOMIC_BUILTINS_64
552+# define HAVE_ATOMIC_BUILTINS_64
553+# endif
554
555 /**********************************************************//**
556 Returns true if swapped, ptr is pointer to target, old_val is value to
557@@ -304,6 +308,9 @@
558 # define os_atomic_increment_ulint(ptr, amount) \
559 os_atomic_increment(ptr, amount)
560
561+# define os_atomic_increment_uint64(ptr, amount) \
562+ os_atomic_increment(ptr, amount)
563+
564 /**********************************************************//**
565 Returns the old value of *ptr, atomically sets *ptr to new_val */
566
567@@ -312,12 +319,13 @@
568
569 #elif defined(HAVE_IB_SOLARIS_ATOMICS)
570
571-#define HAVE_ATOMIC_BUILTINS
572+# define HAVE_ATOMIC_BUILTINS
573+# define HAVE_ATOMIC_BUILTINS_64
574
575 /* If not compiling with GCC or GCC doesn't support the atomic
576 intrinsics and running on Solaris >= 10 use Solaris atomics */
577
578-#include <atomic.h>
579+# include <atomic.h>
580
581 /**********************************************************//**
582 Returns true if swapped, ptr is pointer to target, old_val is value to
583@@ -357,6 +365,9 @@
584 # define os_atomic_increment_ulint(ptr, amount) \
585 atomic_add_long_nv(ptr, amount)
586
587+# define os_atomic_increment_uint64(ptr, amount) \
588+ atomic_add_64_nv(ptr, amount)
589+
590 /**********************************************************//**
591 Returns the old value of *ptr, atomically sets *ptr to new_val */
592
593@@ -365,7 +376,11 @@
594
595 #elif defined(HAVE_WINDOWS_ATOMICS)
596
597-#define HAVE_ATOMIC_BUILTINS
598+# define HAVE_ATOMIC_BUILTINS
599+
600+# ifndef _WIN32
601+# define HAVE_ATOMIC_BUILTINS_64
602+# endif
603
604 /* On Windows, use Windows atomics / interlocked */
605 # ifdef _WIN64
606@@ -403,6 +418,11 @@
607 # define os_atomic_increment_ulint(ptr, amount) \
608 ((ulint) (win_xchg_and_add(ptr, amount) + amount))
609
610+# define os_atomic_increment_uint64(ptr, amount) \
611+ ((ib_uint64_t) (InterlockedExchangeAdd64( \
612+ (ib_int64_t*) ptr, \
613+ (ib_int64_t) amount) + amount))
614+
615 /**********************************************************//**
616 Returns the old value of *ptr, atomically sets *ptr to new_val.
617 InterlockedExchange() operates on LONG, and the LONG will be
618
619=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
620--- Percona-Server/storage/innobase/include/srv0srv.h 2012-08-07 06:10:00 +0000
621+++ Percona-Server/storage/innobase/include/srv0srv.h 2012-08-22 13:19:13 +0000
622@@ -66,6 +66,14 @@
623 /* The error monitor thread waits on this event. */
624 extern os_event_t srv_error_event;
625
626+/* This event is set on checkpoint completion to wake the redo log parser
627+thread */
628+extern os_event_t srv_checkpoint_completed_event;
629+
630+/* This event is set on the online redo log following thread exit to signal
631+that the (slow) shutdown may proceed */
632+extern os_event_t srv_redo_log_thread_finished_event;
633+
634 /* If the last data file is auto-extended, we add this many pages to it
635 at a time */
636 #define SRV_AUTO_EXTEND_INCREMENT \
637@@ -133,6 +141,8 @@
638
639 extern ibool srv_recovery_stats;
640
641+extern my_bool srv_track_changed_pages;
642+
643 extern ibool srv_auto_extend_last_data_file;
644 extern ulint srv_last_file_size_max;
645 extern char** srv_log_group_home_dirs;
646@@ -399,6 +409,7 @@
647 extern mysql_pfs_key_t srv_monitor_thread_key;
648 extern mysql_pfs_key_t srv_master_thread_key;
649 extern mysql_pfs_key_t srv_purge_thread_key;
650+extern mysql_pfs_key_t srv_log_tracking_thread_key;
651
652 /* This macro register the current thread and its key with performance
653 schema */
654@@ -694,6 +705,15 @@
655 void* arg); /*!< in: a dummy parameter required by
656 os_thread_create */
657 /******************************************************************//**
658+A thread which follows the redo log and outputs the changed page bitmap.
659+@return a dummy value */
660+UNIV_INTERN
661+os_thread_ret_t
662+srv_redo_log_follow_thread(
663+/*=======================*/
664+ void* arg); /*!< in: a dummy parameter required by
665+ os_thread_create */
666+/******************************************************************//**
667 Outputs to a file the output of the InnoDB Monitor.
668 @return FALSE if not all information printed
669 due to failure to obtain necessary mutex */
670
671=== modified file 'Percona-Server/storage/innobase/include/ut0rbt.h'
672--- Percona-Server/storage/innobase/include/ut0rbt.h 2010-09-27 17:08:12 +0000
673+++ Percona-Server/storage/innobase/include/ut0rbt.h 2012-08-22 13:19:13 +0000
674@@ -116,6 +116,10 @@
675 /* Compare a key with the node value (t is tree, k is key, n is node)*/
676 #define rbt_compare(t, k, n) (t->compare(k, n->value))
677
678+/* Node size. FIXME: name might clash, but currently it does not, so for easier
679+ maintenance do not rename it for now. */
680+#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
681+
682 /**********************************************************************//**
683 Free an instance of a red black tree */
684 UNIV_INTERN
685@@ -187,6 +191,17 @@
686 ib_rbt_bound_t* parent, /*!< in: parent */
687 const void* value); /*!< in: this value is copied
688 to the node */
689+/****************************************************************//**
690+Add a new caller-provided node to tree at the specified position.
691+The node must have its key fields initialized correctly.
692+@return added node */
693+UNIV_INTERN
694+const ib_rbt_node_t*
695+rbt_add_preallocated_node(
696+/*======================*/
697+ ib_rbt_t* tree, /*!< in: rb tree */
698+ ib_rbt_bound_t* parent, /*!< in: parent */
699+ ib_rbt_node_t* node); /*!< in: node */
700 /**********************************************************************//**
701 Return the left most data node in the tree
702 @return left most node */
703@@ -273,6 +288,13 @@
704 rbt_clear(
705 /*======*/
706 ib_rbt_t* tree); /*!< in: rb tree */
707+/****************************************************************//**
708+Clear the tree without deleting and freeing its nodes. */
709+UNIV_INTERN
710+void
711+rbt_reset(
712+/*======*/
713+ ib_rbt_t* tree); /*!< in: rb tree */
714 /**********************************************************************//**
715 Merge the node from dst into src. Return the number of nodes merged.
716 @return no. of recs merged */
717
718=== modified file 'Percona-Server/storage/innobase/log/log0log.c'
719--- Percona-Server/storage/innobase/log/log0log.c 2012-05-10 07:49:14 +0000
720+++ Percona-Server/storage/innobase/log/log0log.c 2012-08-22 13:19:13 +0000
721@@ -214,6 +214,54 @@
722 return(lsn);
723 }
724
725+/****************************************************************//**
726+Safely reads the log_sys->tracked_lsn value. Uses atomic operations
727+if available, otherwise this field is protected with the log system
728+mutex. The writer counterpart function is log_set_tracked_lsn() in
729+log0online.c.
730+
731+@return log_sys->tracked_lsn value. */
732+UNIV_INLINE
733+ib_uint64_t
734+log_get_tracked_lsn()
735+{
736+#ifdef HAVE_ATOMIC_BUILTINS_64
737+ return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
738+#else
739+ ut_ad(mutex_own(&(log_sys->mutex)));
740+ return log_sys->tracked_lsn;
741+#endif
742+}
743+
744+/****************************************************************//**
745+Checks if the log groups have a big enough margin of free space in
746+so that a new log entry can be written without overwriting log data
747+that is not read by the changed page bitmap thread.
748+@return TRUE if there is not enough free space. */
749+static
750+ibool
751+log_check_tracking_margin(
752+ ulint lsn_advance) /*!< in: an upper limit on how much log data we
753+ plan to write. If zero, the margin will be
754+ checked for the already-written log. */
755+{
756+ ib_uint64_t tracked_lsn;
757+ ulint tracked_lsn_age;
758+
759+ if (!srv_track_changed_pages) {
760+ return FALSE;
761+ }
762+
763+ ut_ad(mutex_own(&(log_sys->mutex)));
764+
765+ tracked_lsn = log_get_tracked_lsn();
766+ tracked_lsn_age = log_sys->lsn - tracked_lsn;
767+
768+ /* The overwrite would happen when log_sys->log_group_capacity is
769+ exceeded, but we use max_checkpoint_age for an extra safety margin. */
770+ return tracked_lsn_age + lsn_advance > log_sys->max_checkpoint_age;
771+}
772+
773 /************************************************************//**
774 Opens the log for log_write_low. The log must be closed with log_close and
775 released with log_release.
776@@ -230,9 +278,7 @@
777 ulint archived_lsn_age;
778 ulint dummy;
779 #endif /* UNIV_LOG_ARCHIVE */
780-#ifdef UNIV_DEBUG
781 ulint count = 0;
782-#endif /* UNIV_DEBUG */
783
784 ut_a(len < log->buf_size / 2);
785 loop:
786@@ -260,6 +306,19 @@
787 goto loop;
788 }
789
790+ if (log_check_tracking_margin(len_upper_limit) && (++count < 50)) {
791+
792+ /* This log write would violate the untracked LSN free space
793+ margin. Limit this to 50 retries as there might be situations
794+ where we have no choice but to proceed anyway, i.e. if the log
795+ is about to be overflown, log tracking or not. */
796+ mutex_exit(&(log->mutex));
797+
798+ os_thread_sleep(10000);
799+
800+ goto loop;
801+ }
802+
803 #ifdef UNIV_LOG_ARCHIVE
804 if (log->archiving_state != LOG_ARCH_OFF) {
805
806@@ -398,6 +457,8 @@
807 ulint first_rec_group;
808 ib_uint64_t oldest_lsn;
809 ib_uint64_t lsn;
810+ ib_uint64_t tracked_lsn;
811+ ulint tracked_lsn_age;
812 log_t* log = log_sys;
813 ib_uint64_t checkpoint_age;
814
815@@ -424,6 +485,19 @@
816 log->check_flush_or_checkpoint = TRUE;
817 }
818
819+ if (srv_track_changed_pages) {
820+
821+ tracked_lsn = log_get_tracked_lsn();
822+ tracked_lsn_age = lsn - tracked_lsn;
823+
824+ if (tracked_lsn_age >= log->log_group_capacity) {
825+
826+ fprintf(stderr, " InnoDB: Error: the age of the "
827+ "oldest untracked record exceeds the log "
828+ "group capacity!\n");
829+ }
830+ }
831+
832 checkpoint_age = lsn - log->last_checkpoint_lsn;
833
834 if (checkpoint_age >= log->log_group_capacity) {
835@@ -891,6 +965,8 @@
836 log_sys->archiving_on = os_event_create(NULL);
837 #endif /* UNIV_LOG_ARCHIVE */
838
839+ log_sys->tracked_lsn = 0;
840+
841 /*----------------------------*/
842
843 log_block_init(log_sys->buf, log_sys->lsn);
844@@ -1740,6 +1816,12 @@
845 }
846
847 mutex_exit(&(log_sys->mutex));
848+
849+ /* Wake the redo log watching thread to parse the log up to this
850+ checkpoint. */
851+ if (srv_track_changed_pages) {
852+ os_event_set(srv_checkpoint_completed_event);
853+ }
854 }
855
856 /*******************************************************************//**
857@@ -3086,6 +3168,15 @@
858
859 log_checkpoint_margin();
860
861+ mutex_enter(&(log_sys->mutex));
862+ if (log_check_tracking_margin(0)) {
863+
864+ mutex_exit(&(log_sys->mutex));
865+ os_thread_sleep(10000);
866+ goto loop;
867+ }
868+ mutex_exit(&(log_sys->mutex));
869+
870 #ifdef UNIV_LOG_ARCHIVE
871 log_archive_margin();
872 #endif /* UNIV_LOG_ARCHIVE */
873@@ -3114,6 +3205,7 @@
874 /*=======================================*/
875 {
876 ib_uint64_t lsn;
877+ ib_uint64_t tracked_lsn;
878 ulint arch_log_no;
879 ibool server_busy;
880 ulint count = 0;
881@@ -3299,6 +3391,12 @@
882 }
883
884 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
885+ /* Wake the log tracking thread which will then immediatelly
886+ quit because of srv_shutdown_state value */
887+ if (srv_track_changed_pages) {
888+ os_event_set(srv_checkpoint_completed_event);
889+ os_event_wait(srv_redo_log_thread_finished_event);
890+ }
891 fil_close_all_files();
892 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
893 return;
894@@ -3308,9 +3406,12 @@
895
896 mutex_enter(&log_sys->mutex);
897
898+ tracked_lsn = log_get_tracked_lsn();
899+
900 lsn = log_sys->lsn;
901
902 if (lsn != log_sys->last_checkpoint_lsn
903+ || (srv_track_changed_pages && (tracked_lsn != log_sys->last_checkpoint_lsn))
904 #ifdef UNIV_LOG_ARCHIVE
905 || (srv_log_archive_on
906 && lsn != log_sys->archived_lsn + LOG_BLOCK_HDR_SIZE)
907@@ -3368,6 +3469,11 @@
908
909 srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
910
911+ /* Signal the log following thread to quit */
912+ if (srv_track_changed_pages) {
913+ os_event_set(srv_checkpoint_completed_event);
914+ }
915+
916 /* Make some checks that the server really is quiet */
917 ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
918
919@@ -3388,6 +3494,10 @@
920
921 fil_flush_file_spaces(FIL_TABLESPACE);
922
923+ if (srv_track_changed_pages) {
924+ os_event_wait(srv_redo_log_thread_finished_event);
925+ }
926+
927 fil_close_all_files();
928
929 /* Make some checks that the server really is quiet */
930@@ -3514,6 +3624,18 @@
931 ((log_sys->n_log_ios - log_sys->n_log_ios_old)
932 / time_elapsed));
933
934+ if (srv_track_changed_pages) {
935+
936+ /* The maximum tracked LSN age is equal to the maximum
937+ checkpoint age */
938+ fprintf(file,
939+ "Log tracking enabled\n"
940+ "Log tracked up to %llu\n"
941+ "Max tracked LSN age %lu\n",
942+ log_get_tracked_lsn(),
943+ log_sys->max_checkpoint_age);
944+ }
945+
946 log_sys->n_log_ios_old = log_sys->n_log_ios;
947 log_sys->last_printout_time = current_time;
948
949
950=== added file 'Percona-Server/storage/innobase/log/log0online.c'
951--- Percona-Server/storage/innobase/log/log0online.c 1970-01-01 00:00:00 +0000
952+++ Percona-Server/storage/innobase/log/log0online.c 2012-08-22 13:19:13 +0000
953@@ -0,0 +1,927 @@
954+/*****************************************************************************
955+
956+Copyright (c) 2011-2012 Percona Inc. All Rights Reserved.
957+
958+This program is free software; you can redistribute it and/or modify it under
959+the terms of the GNU General Public License as published by the Free Software
960+Foundation; version 2 of the License.
961+
962+This program is distributed in the hope that it will be useful, but WITHOUT
963+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
964+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
965+
966+You should have received a copy of the GNU General Public License along with
967+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
968+Place, Suite 330, Boston, MA 02111-1307 USA
969+
970+*****************************************************************************/
971+
972+/**************************************************//**
973+@file log/log0online.c
974+Online database log parsing for changed page tracking
975+
976+*******************************************************/
977+
978+#include "log0online.h"
979+
980+#include "my_dbug.h"
981+
982+#include "log0recv.h"
983+#include "mach0data.h"
984+#include "mtr0log.h"
985+#include "os0file.h"
986+#include "srv0srv.h"
987+#include "srv0start.h"
988+#include "trx0sys.h"
989+#include "ut0rbt.h"
990+
991+enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };
992+
993+/** Log parsing and bitmap output data structure */
994+struct log_bitmap_struct {
995+ byte read_buf[FOLLOW_SCAN_SIZE];
996+ /*!< log read buffer */
997+ byte parse_buf[RECV_PARSING_BUF_SIZE];
998+ /*!< log parse buffer */
999+ byte* parse_buf_end; /*!< parse buffer position where the
1000+ next read log data should be copied to.
1001+ If the previous log records were fully
1002+ parsed, it points to the start,
1003+ otherwise points immediatelly past the
1004+ end of the incomplete log record. */
1005+ char* out_name; /*!< the file name for bitmap output */
1006+ os_file_t out; /*!< the bitmap output file */
1007+ ib_uint64_t out_offset; /*!< the next write position in the
1008+ bitmap output file */
1009+ ib_uint64_t start_lsn; /*!< the LSN of the next unparsed
1010+ record and the start of the next LSN
1011+ interval to be parsed. */
1012+ ib_uint64_t end_lsn; /*!< the end of the LSN interval to be
1013+ parsed, equal to the next checkpoint
1014+ LSN at the time of parse */
1015+ ib_uint64_t next_parse_lsn; /*!< the LSN of the next unparsed
1016+ record in the current parse */
1017+ ib_rbt_t* modified_pages; /*!< the current modified page set,
1018+ organized as the RB-tree with the keys
1019+ of (space, 4KB-block-start-page-id)
1020+ pairs */
1021+ ib_rbt_node_t* page_free_list; /*!< Singly-linked list of freed nodes
1022+ of modified_pages tree for later
1023+ reuse. Nodes are linked through
1024+ ib_rbt_node_t.left as this field has
1025+ both the correct type and the tree does
1026+ not mind its overwrite during
1027+ rbt_next() tree traversal. */
1028+};
1029+
1030+/* The log parsing and bitmap output struct instance */
1031+static struct log_bitmap_struct* log_bmp_sys;
1032+
1033+/* File name stem for modified page bitmaps */
1034+static const char* modified_page_stem = "ib_modified_log.";
1035+
1036+/* On server startup with empty database srv_start_lsn == 0, in
1037+which case the first LSN of actual log records will be this. */
1038+#define MIN_TRACKED_LSN ((LOG_START_LSN) + (LOG_BLOCK_HDR_SIZE))
1039+
1040+/** The bitmap file block size in bytes. All writes will be multiples of this.
1041+ */
1042+enum {
1043+ MODIFIED_PAGE_BLOCK_SIZE = 4096
1044+};
1045+
1046+
1047+/** Offsets in a file bitmap block */
1048+enum {
1049+ MODIFIED_PAGE_IS_LAST_BLOCK = 0,/* 1 if last block in the current
1050+ write, 0 otherwise. */
1051+ MODIFIED_PAGE_START_LSN = 4, /* The starting tracked LSN of this and
1052+ other blocks in the same write */
1053+ MODIFIED_PAGE_END_LSN = 12, /* The ending tracked LSN of this and
1054+ other blocks in the same write */
1055+ MODIFIED_PAGE_SPACE_ID = 20, /* The space ID of tracked pages in
1056+ this block */
1057+ MODIFIED_PAGE_1ST_PAGE_ID = 24, /* The page ID of the first tracked
1058+ page in this block */
1059+ MODIFIED_PAGE_BLOCK_UNUSED_1 = 28,/* Unused in order to align the start
1060+ of bitmap at 8 byte boundary */
1061+ MODIFIED_PAGE_BLOCK_BITMAP = 32,/* Start of the bitmap itself */
1062+ MODIFIED_PAGE_BLOCK_UNUSED_2 = MODIFIED_PAGE_BLOCK_SIZE - 8,
1063+ /* Unused in order to align the end of
1064+ bitmap at 8 byte boundary */
1065+ MODIFIED_PAGE_BLOCK_CHECKSUM = MODIFIED_PAGE_BLOCK_SIZE - 4
1066+ /* The checksum of the current block */
1067+};
1068+
1069+/** Length of the bitmap data in a block in bytes */
1070+enum { MODIFIED_PAGE_BLOCK_BITMAP_LEN
1071+ = MODIFIED_PAGE_BLOCK_UNUSED_2 - MODIFIED_PAGE_BLOCK_BITMAP };
1072+
1073+/** Length of the bitmap data in a block in page ids */
1074+enum { MODIFIED_PAGE_BLOCK_ID_COUNT = MODIFIED_PAGE_BLOCK_BITMAP_LEN * 8 };
1075+
1076+/****************************************************************//**
1077+Provide a comparisson function for the RB-tree tree (space,
1078+block_start_page) pairs. Actual implementation does not matter as
1079+long as the ordering is full.
1080+@return -1 if p1 < p2, 0 if p1 == p2, 1 if p1 > p2
1081+*/
1082+static
1083+int
1084+log_online_compare_bmp_keys(
1085+/*========================*/
1086+ const void* p1, /*!<in: 1st key to compare */
1087+ const void* p2) /*!<in: 2nd key to compare */
1088+{
1089+ const byte *k1 = (const byte *)p1;
1090+ const byte *k2 = (const byte *)p2;
1091+
1092+ ulint k1_space = mach_read_from_4(k1 + MODIFIED_PAGE_SPACE_ID);
1093+ ulint k2_space = mach_read_from_4(k2 + MODIFIED_PAGE_SPACE_ID);
1094+ if (k1_space == k2_space) {
1095+ ulint k1_start_page
1096+ = mach_read_from_4(k1 + MODIFIED_PAGE_1ST_PAGE_ID);
1097+ ulint k2_start_page
1098+ = mach_read_from_4(k2 + MODIFIED_PAGE_1ST_PAGE_ID);
1099+ return k1_start_page < k2_start_page
1100+ ? -1 : k1_start_page > k2_start_page ? 1 : 0;
1101+ }
1102+ return k1_space < k2_space ? -1 : 1;
1103+}
1104+
1105+/****************************************************************//**
1106+Set a bit for tracked page in the bitmap. Expand the bitmap tree as
1107+necessary. */
1108+static
1109+void
1110+log_online_set_page_bit(
1111+/*====================*/
1112+ ulint space, /*!<in: log record space id */
1113+ ulint page_no)/*!<in: log record page id */
1114+{
1115+ ulint block_start_page;
1116+ ulint block_pos;
1117+ uint bit_pos;
1118+ ib_rbt_bound_t tree_search_pos;
1119+ byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
1120+ byte *page_ptr;
1121+
1122+ ut_a(space != ULINT_UNDEFINED);
1123+ ut_a(page_no != ULINT_UNDEFINED);
1124+
1125+ block_start_page = page_no / MODIFIED_PAGE_BLOCK_ID_COUNT
1126+ * MODIFIED_PAGE_BLOCK_ID_COUNT;
1127+ block_pos = block_start_page ? (page_no % block_start_page / 8)
1128+ : (page_no / 8);
1129+ bit_pos = page_no % 8;
1130+
1131+ mach_write_to_4(search_page + MODIFIED_PAGE_SPACE_ID, space);
1132+ mach_write_to_4(search_page + MODIFIED_PAGE_1ST_PAGE_ID,
1133+ block_start_page);
1134+
1135+ if (!rbt_search(log_bmp_sys->modified_pages, &tree_search_pos,
1136+ search_page)) {
1137+ page_ptr = rbt_value(byte, tree_search_pos.last);
1138+ }
1139+ else {
1140+ ib_rbt_node_t *new_node;
1141+
1142+ if (log_bmp_sys->page_free_list) {
1143+ new_node = log_bmp_sys->page_free_list;
1144+ log_bmp_sys->page_free_list = new_node->left;
1145+ }
1146+ else {
1147+ new_node = ut_malloc(SIZEOF_NODE(
1148+ log_bmp_sys->modified_pages));
1149+ }
1150+ memset(new_node, 0, SIZEOF_NODE(log_bmp_sys->modified_pages));
1151+
1152+ page_ptr = rbt_value(byte, new_node);
1153+ mach_write_to_4(page_ptr + MODIFIED_PAGE_SPACE_ID, space);
1154+ mach_write_to_4(page_ptr + MODIFIED_PAGE_1ST_PAGE_ID,
1155+ block_start_page);
1156+
1157+ rbt_add_preallocated_node(log_bmp_sys->modified_pages,
1158+ &tree_search_pos, new_node);
1159+ }
1160+ page_ptr[MODIFIED_PAGE_BLOCK_BITMAP + block_pos] |= (1U << bit_pos);
1161+}
1162+
1163+/****************************************************************//**
1164+Calculate a bitmap block checksum. Algorithm borrowed from
1165+log_block_calc_checksum.
1166+@return checksum */
1167+UNIV_INLINE
1168+ulint
1169+log_online_calc_checksum(
1170+/*=====================*/
1171+ const byte* block) /*!<in: bitmap block */
1172+{
1173+ ulint sum;
1174+ ulint sh;
1175+ ulint i;
1176+
1177+ sum = 1;
1178+ sh = 0;
1179+
1180+ for (i = 0; i < MODIFIED_PAGE_BLOCK_CHECKSUM; i++) {
1181+
1182+ ulint b = block[i];
1183+ sum &= 0x7FFFFFFFUL;
1184+ sum += b;
1185+ sum += b << sh;
1186+ sh++;
1187+ if (sh > 24) {
1188+ sh = 0;
1189+ }
1190+ }
1191+
1192+ return sum;
1193+}
1194+
1195+/****************************************************************//**
1196+Get the last tracked fully LSN from the bitmap file by reading
1197+backwards untile a correct end page is found. Detects incomplete
1198+writes and corrupted data. Sets the start output position for the
1199+written bitmap data.
1200+@return the last fully tracked LSN */
1201+static
1202+ib_uint64_t
1203+log_online_read_last_tracked_lsn()
1204+/*==============================*/
1205+{
1206+ byte page[MODIFIED_PAGE_BLOCK_SIZE];
1207+ ib_uint64_t read_offset = log_bmp_sys->out_offset;
1208+ /* Initialize these to nonequal values so that file size == 0 case with
1209+ zero loop repetitions is handled correctly */
1210+ ulint checksum = 0;
1211+ ulint actual_checksum = !checksum;
1212+ ibool is_last_page = FALSE;
1213+ ib_uint64_t result;
1214+
1215+ ut_ad(log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE == 0);
1216+
1217+ while (checksum != actual_checksum && read_offset > 0 && !is_last_page)
1218+ {
1219+
1220+ ulint offset_low, offset_high;
1221+ ibool success;
1222+
1223+ read_offset -= MODIFIED_PAGE_BLOCK_SIZE;
1224+ offset_high = (ulint)(read_offset >> 32);
1225+ offset_low = (ulint)(read_offset & 0xFFFFFFFF);
1226+
1227+ success = os_file_read(log_bmp_sys->out, page, offset_low,
1228+ offset_high, MODIFIED_PAGE_BLOCK_SIZE);
1229+ if (!success) {
1230+
1231+ /* The following call prints an error message */
1232+ os_file_get_last_error(TRUE);
1233+ /* Here and below assume that bitmap file names do not
1234+ contain apostrophes, thus no need for
1235+ ut_print_filename(). */
1236+ fprintf(stderr, "InnoDB: Warning: failed reading "
1237+ "changed page bitmap file \'%s\'\n",
1238+ log_bmp_sys->out_name);
1239+ return MIN_TRACKED_LSN;
1240+ }
1241+
1242+ is_last_page
1243+ = mach_read_from_4(page + MODIFIED_PAGE_IS_LAST_BLOCK);
1244+ checksum = mach_read_from_4(page
1245+ + MODIFIED_PAGE_BLOCK_CHECKSUM);
1246+ actual_checksum = log_online_calc_checksum(page);
1247+ if (checksum != actual_checksum) {
1248+
1249+ fprintf(stderr, "InnoDB: Warning: corruption "
1250+ "detected in \'%s\' at offset %llu\n",
1251+ log_bmp_sys->out_name, read_offset);
1252+ }
1253+
1254+ };
1255+
1256+ if (UNIV_LIKELY(checksum == actual_checksum && is_last_page)) {
1257+
1258+ log_bmp_sys->out_offset = read_offset
1259+ + MODIFIED_PAGE_BLOCK_SIZE;
1260+ result = mach_read_from_8(page + MODIFIED_PAGE_END_LSN);
1261+ }
1262+ else {
1263+ log_bmp_sys->out_offset = read_offset;
1264+ result = 0;
1265+ }
1266+
1267+ /* Truncate the output file to discard the corrupted bitmap data, if
1268+ any */
1269+ if (!os_file_set_eof_at(log_bmp_sys->out,
1270+ log_bmp_sys->out_offset)) {
1271+ fprintf(stderr, "InnoDB: Warning: failed truncating "
1272+ "changed page bitmap file \'%s\' to %llu bytes\n",
1273+ log_bmp_sys->out_name, log_bmp_sys->out_offset);
1274+ result = 0;
1275+ }
1276+ return result;
1277+}
1278+
1279+/****************************************************************//**
1280+Safely write the log_sys->tracked_lsn value. Uses atomic operations
1281+if available, otherwise this field is protected with the log system
1282+mutex. The reader counterpart function is log_get_tracked_lsn() in
1283+log0log.c. */
1284+UNIV_INLINE
1285+void
1286+log_set_tracked_lsn(
1287+/*================*/
1288+ ib_uint64_t tracked_lsn) /*!<in: new value */
1289+{
1290+#ifdef HAVE_ATOMIC_BUILTINS_64
1291+ /* Single writer, no data race here */
1292+ ib_uint64_t old_value
1293+ = os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
1294+ (void) os_atomic_increment_uint64(&log_sys->tracked_lsn,
1295+ tracked_lsn - old_value);
1296+#else
1297+ mutex_enter(&log_sys->mutex);
1298+ log_sys->tracked_lsn = tracked_lsn;
1299+ mutex_exit(&log_sys->mutex);
1300+#endif
1301+}
1302+
1303+/****************************************************************//**
1304+Diagnose a gap in tracked LSN range on server startup due to crash or
1305+very fast shutdown and try to close it by tracking the data
1306+immediatelly, if possible. */
1307+static
1308+void
1309+log_online_track_missing_on_startup(
1310+/*================================*/
1311+ ib_uint64_t last_tracked_lsn, /*!<in: last tracked LSN read
1312+ from the bitmap file */
1313+ ib_uint64_t tracking_start_lsn) /*!<in: last checkpoint LSN of
1314+ the current server startup */
1315+{
1316+ ut_ad(last_tracked_lsn != tracking_start_lsn);
1317+
1318+ fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but "
1319+ "last checkpoint LSN is %llu. This might be due to a server "
1320+ "crash or a very fast shutdown. ", log_bmp_sys->out_name,
1321+ last_tracked_lsn, tracking_start_lsn);
1322+
1323+ /* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty
1324+ bitmap file, handle this too. */
1325+ last_tracked_lsn = ut_max(last_tracked_lsn, MIN_TRACKED_LSN);
1326+
1327+ /* See if we can fully recover the missing interval */
1328+ if (log_sys->lsn - last_tracked_lsn < log_sys->log_group_capacity) {
1329+
1330+ fprintf(stderr,
1331+ "Reading the log to advance the last tracked LSN.\n");
1332+
1333+ log_bmp_sys->start_lsn = last_tracked_lsn;
1334+ log_set_tracked_lsn(log_bmp_sys->start_lsn);
1335+ log_online_follow_redo_log();
1336+ ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn);
1337+
1338+ fprintf(stderr,
1339+ "InnoDB: continuing tracking changed pages from LSN "
1340+ "%llu\n", log_bmp_sys->end_lsn);
1341+ }
1342+ else {
1343+ fprintf(stderr,
1344+ "The age of last tracked LSN exceeds log capacity, "
1345+ "tracking-based incremental backups will work only "
1346+ "from the higher LSN!\n");
1347+
1348+ log_bmp_sys->end_lsn = log_bmp_sys->start_lsn
1349+ = tracking_start_lsn;
1350+ log_set_tracked_lsn(log_bmp_sys->start_lsn);
1351+
1352+ fprintf(stderr,
1353+ "InnoDB: starting tracking changed pages from LSN "
1354+ "%llu\n", log_bmp_sys->end_lsn);
1355+ }
1356+}
1357+
1358+/*********************************************************************//**
1359+Initialize the online log following subsytem. */
1360+UNIV_INTERN
1361+void
1362+log_online_read_init()
1363+/*==================*/
1364+{
1365+ char buf[FN_REFLEN];
1366+ ibool success;
1367+ ib_uint64_t tracking_start_lsn
1368+ = ut_max(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
1369+
1370+ /* Assert (could be compile-time assert) that bitmap data start and end
1371+ in a bitmap block is 8-byte aligned */
1372+ ut_a(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0);
1373+ ut_a(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0);
1374+
1375+ log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));
1376+
1377+ ut_snprintf(buf, FN_REFLEN, "%s%s%d", srv_data_home,
1378+ modified_page_stem, 1);
1379+ log_bmp_sys->out_name = ut_malloc(strlen(buf) + 1);
1380+ ut_strcpy(log_bmp_sys->out_name, buf);
1381+
1382+ log_bmp_sys->modified_pages = rbt_create(MODIFIED_PAGE_BLOCK_SIZE,
1383+ log_online_compare_bmp_keys);
1384+ log_bmp_sys->page_free_list = NULL;
1385+
1386+ log_bmp_sys->out
1387+ = os_file_create_simple_no_error_handling
1388+ (innodb_file_bmp_key, log_bmp_sys->out_name, OS_FILE_OPEN,
1389+ OS_FILE_READ_WRITE, &success);
1390+
1391+ if (!success) {
1392+
1393+ /* New file, tracking from scratch */
1394+ log_bmp_sys->out
1395+ = os_file_create_simple_no_error_handling
1396+ (innodb_file_bmp_key, log_bmp_sys->out_name,
1397+ OS_FILE_CREATE, OS_FILE_READ_WRITE, &success);
1398+ if (!success) {
1399+
1400+ /* The following call prints an error message */
1401+ os_file_get_last_error(TRUE);
1402+ fprintf(stderr,
1403+ "InnoDB: Error: Cannot create \'%s\'\n",
1404+ log_bmp_sys->out_name);
1405+ exit(1);
1406+ }
1407+
1408+ log_bmp_sys->out_offset = 0;
1409+ }
1410+ else {
1411+
1412+ /* Old file, read last tracked LSN and continue from there */
1413+ ulint size_low;
1414+ ulint size_high;
1415+ ib_uint64_t last_tracked_lsn;
1416+
1417+ success = os_file_get_size(log_bmp_sys->out, &size_low,
1418+ &size_high);
1419+ ut_a(success);
1420+
1421+ log_bmp_sys->out_offset
1422+ = ((ib_uint64_t)size_high << 32) | size_low;
1423+
1424+ if (log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE != 0) {
1425+
1426+ fprintf(stderr,
1427+ "InnoDB: Warning: truncated block detected "
1428+ "in \'%s\' at offset %llu\n",
1429+ log_bmp_sys->out_name,
1430+ log_bmp_sys->out_offset);
1431+ log_bmp_sys->out_offset -=
1432+ log_bmp_sys->out_offset
1433+ % MODIFIED_PAGE_BLOCK_SIZE;
1434+ }
1435+
1436+ last_tracked_lsn = log_online_read_last_tracked_lsn();
1437+
1438+ if (last_tracked_lsn < tracking_start_lsn) {
1439+
1440+ log_online_track_missing_on_startup(last_tracked_lsn,
1441+ tracking_start_lsn);
1442+ return;
1443+ }
1444+
1445+ if (last_tracked_lsn > tracking_start_lsn) {
1446+
1447+ fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' "
1448+ "is %llu, but last checkpoint LSN is %llu. "
1449+ "The tracking-based incremental backups will "
1450+ "work only from the latter LSN!\n",
1451+ log_bmp_sys->out_name, last_tracked_lsn,
1452+ tracking_start_lsn);
1453+ }
1454+
1455+ }
1456+
1457+ fprintf(stderr, "InnoDB: starting tracking changed pages from "
1458+ "LSN %llu\n", tracking_start_lsn);
1459+ log_bmp_sys->start_lsn = tracking_start_lsn;
1460+ log_set_tracked_lsn(tracking_start_lsn);
1461+}
1462+
1463+/*********************************************************************//**
1464+Shut down the online log following subsystem. */
1465+UNIV_INTERN
1466+void
1467+log_online_read_shutdown()
1468+/*======================*/
1469+{
1470+ ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list;
1471+
1472+ os_file_close(log_bmp_sys->out);
1473+
1474+ rbt_free(log_bmp_sys->modified_pages);
1475+
1476+ while (free_list_node) {
1477+ ib_rbt_node_t *next = free_list_node->left;
1478+ ut_free(free_list_node);
1479+ free_list_node = next;
1480+ }
1481+
1482+ ut_free(log_bmp_sys->out_name);
1483+ ut_free(log_bmp_sys);
1484+}
1485+
1486+/*********************************************************************//**
1487+For the given minilog record type determine if the record has (space; page)
1488+associated with it.
1489+@return TRUE if the record has (space; page) in it */
1490+static
1491+ibool
1492+log_online_rec_has_page(
1493+/*====================*/
1494+ byte type) /*!<in: the minilog record type */
1495+{
1496+ return type != MLOG_MULTI_REC_END && type != MLOG_DUMMY_RECORD;
1497+}
1498+
1499+/*********************************************************************//**
1500+Check if a page field for a given log record type actually contains a page
1501+id. It does not for file operations and MLOG_LSN.
1502+@return TRUE if page field contains actual page id, FALSE otherwise */
1503+static
1504+ibool
1505+log_online_rec_page_means_page(
1506+/*===========================*/
1507+ byte type) /*!<in: log record type */
1508+{
1509+ return log_online_rec_has_page(type)
1510+#ifdef UNIV_LOG_LSN_DEBUG
1511+ && type != MLOG_LSN
1512+#endif
1513+ && type != MLOG_FILE_CREATE
1514+ && type != MLOG_FILE_RENAME
1515+ && type != MLOG_FILE_DELETE
1516+ && type != MLOG_FILE_CREATE2;
1517+}
1518+
1519+/*********************************************************************//**
1520+Parse the log data in the parse buffer for the (space, page) pairs and add
1521+them to the modified page set as necessary. Removes the fully-parsed records
1522+from the buffer. If an incomplete record is found, moves it to the end of the
1523+buffer. */
1524+static
1525+void
1526+log_online_parse_redo_log()
1527+/*=======================*/
1528+{
1529+ byte *ptr = log_bmp_sys->parse_buf;
1530+ byte *end = log_bmp_sys->parse_buf_end;
1531+
1532+ ulint len = 0;
1533+
1534+ while (ptr != end
1535+ && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
1536+
1537+ byte type;
1538+ ulint space;
1539+ ulint page_no;
1540+ byte* body;
1541+
1542+ /* recv_sys is not initialized, so on corrupt log we will
1543+ SIGSEGV. But the log of a live database should not be
1544+ corrupt. */
1545+ len = recv_parse_log_rec(ptr, end, &type, &space, &page_no,
1546+ &body);
1547+ if (len > 0) {
1548+
1549+ if (log_online_rec_page_means_page(type)
1550+ && (space != TRX_DOUBLEWRITE_SPACE)) {
1551+
1552+ ut_a(len >= 3);
1553+ log_online_set_page_bit(space, page_no);
1554+ }
1555+
1556+ ptr += len;
1557+ ut_ad(ptr <= end);
1558+ log_bmp_sys->next_parse_lsn
1559+ = recv_calc_lsn_on_data_add
1560+ (log_bmp_sys->next_parse_lsn, len);
1561+ }
1562+ else {
1563+
1564+ /* Incomplete log record. Shift it to the
1565+ beginning of the parse buffer and leave it to be
1566+ completed on the next read. */
1567+ ut_memmove(log_bmp_sys->parse_buf, ptr, end - ptr);
1568+ log_bmp_sys->parse_buf_end
1569+ = log_bmp_sys->parse_buf + (end - ptr);
1570+ ptr = end;
1571+ }
1572+ }
1573+
1574+ if (len > 0) {
1575+
1576+ log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
1577+ }
1578+}
1579+
1580+/*********************************************************************//**
1581+Check the log block checksum.
1582+@return TRUE if the log block checksum is OK, FALSE otherwise. */
1583+static
1584+ibool
1585+log_online_is_valid_log_seg(
1586+/*========================*/
1587+ const byte* log_block) /*!< in: read log data */
1588+{
1589+ ibool checksum_is_ok
1590+ = log_block_checksum_is_ok_or_old_format(log_block);
1591+
1592+ if (!checksum_is_ok) {
1593+
1594+ fprintf(stderr,
1595+ "InnoDB Error: log block checksum mismatch"
1596+ "expected %lu, calculated checksum %lu\n",
1597+ (ulong) log_block_get_checksum(log_block),
1598+ (ulong) log_block_calc_checksum(log_block));
1599+ }
1600+
1601+ return checksum_is_ok;
1602+}
1603+
1604+/*********************************************************************//**
1605+Copy new log data to the parse buffer while skipping log block header,
1606+trailer and already parsed data. */
1607+static
1608+void
1609+log_online_add_to_parse_buf(
1610+/*========================*/
1611+ const byte* log_block, /*!< in: read log data */
1612+ ulint data_len, /*!< in: length of read log data */
1613+ ulint skip_len) /*!< in: how much of log data to
1614+ skip */
1615+{
1616+ ulint start_offset = skip_len ? skip_len : LOG_BLOCK_HDR_SIZE;
1617+ ulint end_offset
1618+ = (data_len == OS_FILE_LOG_BLOCK_SIZE)
1619+ ? data_len - LOG_BLOCK_TRL_SIZE
1620+ : data_len;
1621+ ulint actual_data_len = (end_offset >= start_offset)
1622+ ? end_offset - start_offset : 0;
1623+
1624+ ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,
1625+ actual_data_len);
1626+
1627+ log_bmp_sys->parse_buf_end += actual_data_len;
1628+
1629+ ut_a(log_bmp_sys->parse_buf_end - log_bmp_sys->parse_buf
1630+ <= RECV_PARSING_BUF_SIZE);
1631+}
1632+
1633+/*********************************************************************//**
1634+Parse the log block: first copies the read log data to the parse buffer while
1635+skipping log block header, trailer and already parsed data. Then it actually
1636+parses the log to add to the modified page bitmap. */
1637+static
1638+void
1639+log_online_parse_redo_log_block(
1640+/*============================*/
1641+ const byte* log_block, /*!< in: read log data */
1642+ ulint skip_already_parsed_len) /*!< in: how many bytes of
1643+ log data should be skipped as
1644+ they were parsed before */
1645+{
1646+ ulint block_data_len;
1647+
1648+ block_data_len = log_block_get_data_len(log_block);
1649+
1650+ ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0
1651+ || block_data_len < OS_FILE_LOG_BLOCK_SIZE);
1652+
1653+ log_online_add_to_parse_buf(log_block, block_data_len,
1654+ skip_already_parsed_len);
1655+ log_online_parse_redo_log();
1656+}
1657+
1658+/*********************************************************************//**
1659+Read and parse one redo log chunk and updates the modified page bitmap. */
1660+static
1661+void
1662+log_online_follow_log_seg(
1663+/*======================*/
1664+ log_group_t* group, /*!< in: the log group to use */
1665+ ib_uint64_t block_start_lsn, /*!< in: the LSN to read from */
1666+ ib_uint64_t block_end_lsn) /*!< in: the LSN to read to */
1667+{
1668+ /* Pointer to the current OS_FILE_LOG_BLOCK-sized chunk of the read log
1669+ data to parse */
1670+ byte* log_block = log_bmp_sys->read_buf;
1671+ byte* log_block_end = log_bmp_sys->read_buf
1672+ + (block_end_lsn - block_start_lsn);
1673+
1674+ mutex_enter(&log_sys->mutex);
1675+ log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,
1676+ group, block_start_lsn, block_end_lsn);
1677+ mutex_exit(&log_sys->mutex);
1678+
1679+ while (log_block < log_block_end
1680+ && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
1681+
1682+ /* How many bytes of log data should we skip in the current log
1683+ block. Skipping is necessary because we round down the next
1684+ parse LSN thus it is possible to read the already-processed log
1685+ data many times */
1686+ ulint skip_already_parsed_len = 0;
1687+
1688+ if (!log_online_is_valid_log_seg(log_block)) {
1689+ break;
1690+ }
1691+
1692+ if ((block_start_lsn <= log_bmp_sys->next_parse_lsn)
1693+ && (block_start_lsn + OS_FILE_LOG_BLOCK_SIZE
1694+ > log_bmp_sys->next_parse_lsn)) {
1695+
1696+ /* The next parse LSN is inside the current block, skip
1697+ data preceding it. */
1698+ skip_already_parsed_len
1699+ = log_bmp_sys->next_parse_lsn
1700+ - block_start_lsn;
1701+ }
1702+ else {
1703+
1704+ /* If the next parse LSN is not inside the current
1705+ block, then the only option is that we have processed
1706+ ahead already. */
1707+ ut_a(block_start_lsn > log_bmp_sys->next_parse_lsn);
1708+ }
1709+
1710+ /* TODO: merge the copying to the parse buf code with
1711+ skip_already_len calculations */
1712+ log_online_parse_redo_log_block(log_block,
1713+ skip_already_parsed_len);
1714+
1715+ log_block += OS_FILE_LOG_BLOCK_SIZE;
1716+ block_start_lsn += OS_FILE_LOG_BLOCK_SIZE;
1717+ }
1718+
1719+ return;
1720+}
1721+
1722+/*********************************************************************//**
1723+Read and parse the redo log in a given group in FOLLOW_SCAN_SIZE-sized
1724+chunks and updates the modified page bitmap. */
1725+static
1726+void
1727+log_online_follow_log_group(
1728+/*========================*/
1729+ log_group_t* group, /*!< in: the log group to use */
1730+ ib_uint64_t contiguous_lsn) /*!< in: the LSN of log block start
1731+ containing the log_parse_start_lsn */
1732+{
1733+ ib_uint64_t block_start_lsn = contiguous_lsn;
1734+ ib_uint64_t block_end_lsn;
1735+
1736+ log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;
1737+ log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
1738+
1739+ do {
1740+ block_end_lsn = block_start_lsn + FOLLOW_SCAN_SIZE;
1741+
1742+ log_online_follow_log_seg(group, block_start_lsn,
1743+ block_end_lsn);
1744+
1745+ /* Next parse LSN can become higher than the last read LSN
1746+ only in the case when the read LSN falls right on the block
1747+ boundary, in which case next parse lsn is bumped to the actual
1748+ data LSN on the next (not yet read) block. This assert is
1749+ slightly conservative. */
1750+ ut_a(log_bmp_sys->next_parse_lsn
1751+ <= block_end_lsn + LOG_BLOCK_HDR_SIZE
1752+ + LOG_BLOCK_TRL_SIZE);
1753+
1754+ block_start_lsn = block_end_lsn;
1755+ } while (block_end_lsn < log_bmp_sys->end_lsn);
1756+
1757+ /* Assert that the last read log record is a full one */
1758+ ut_a(log_bmp_sys->parse_buf_end == log_bmp_sys->parse_buf);
1759+}
1760+
1761+/*********************************************************************//**
1762+Write, flush one bitmap block to disk and advance the output position if
1763+successful. */
1764+static
1765+void
1766+log_online_write_bitmap_page(
1767+/*=========================*/
1768+ const byte *block) /*!< in: block to write */
1769+{
1770+ ibool success;
1771+
1772+ success = os_file_write(log_bmp_sys->out_name,log_bmp_sys->out,
1773+ block,
1774+ (ulint)(log_bmp_sys->out_offset & 0xFFFFFFFF),
1775+ (ulint)(log_bmp_sys->out_offset << 32),
1776+ MODIFIED_PAGE_BLOCK_SIZE);
1777+ if (UNIV_UNLIKELY(!success)) {
1778+
1779+ /* The following call prints an error message */
1780+ os_file_get_last_error(TRUE);
1781+ fprintf(stderr, "InnoDB: Error: failed writing changed page "
1782+ "bitmap file \'%s\'\n", log_bmp_sys->out_name);
1783+ return;
1784+ }
1785+
1786+ success = os_file_flush(log_bmp_sys->out, FALSE);
1787+ if (UNIV_UNLIKELY(!success)) {
1788+
1789+ /* The following call prints an error message */
1790+ os_file_get_last_error(TRUE);
1791+ fprintf(stderr, "InnoDB: Error: failed flushing "
1792+ "changed page bitmap file \'%s\'\n",
1793+ log_bmp_sys->out_name);
1794+ return;
1795+ }
1796+
1797+ log_bmp_sys->out_offset += MODIFIED_PAGE_BLOCK_SIZE;
1798+}
1799+
1800+/*********************************************************************//**
1801+Append the current changed page bitmap to the bitmap file. Clears the
1802+bitmap tree and recycles its nodes to the free list. */
1803+static
1804+void
1805+log_online_write_bitmap()
1806+/*=====================*/
1807+{
1808+ ib_rbt_node_t *bmp_tree_node;
1809+ const ib_rbt_node_t *last_bmp_tree_node;
1810+
1811+ bmp_tree_node = (ib_rbt_node_t *)
1812+ rbt_first(log_bmp_sys->modified_pages);
1813+ last_bmp_tree_node = rbt_last(log_bmp_sys->modified_pages);
1814+
1815+ while (bmp_tree_node) {
1816+
1817+ byte *page = rbt_value(byte, bmp_tree_node);
1818+
1819+ if (bmp_tree_node == last_bmp_tree_node) {
1820+ mach_write_to_4(page + MODIFIED_PAGE_IS_LAST_BLOCK, 1);
1821+ }
1822+
1823+ mach_write_to_8(page + MODIFIED_PAGE_START_LSN,
1824+ log_bmp_sys->start_lsn);
1825+ mach_write_to_8(page + MODIFIED_PAGE_END_LSN,
1826+ log_bmp_sys->end_lsn);
1827+ mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM,
1828+ log_online_calc_checksum(page));
1829+
1830+ log_online_write_bitmap_page(page);
1831+
1832+ bmp_tree_node->left = log_bmp_sys->page_free_list;
1833+ log_bmp_sys->page_free_list = bmp_tree_node;
1834+
1835+ bmp_tree_node = (ib_rbt_node_t*)
1836+ rbt_next(log_bmp_sys->modified_pages, bmp_tree_node);
1837+ }
1838+
1839+ rbt_reset(log_bmp_sys->modified_pages);
1840+}
1841+
1842+/*********************************************************************//**
1843+Read and parse the redo log up to last checkpoint LSN to build the changed
1844+page bitmap which is then written to disk. */
1845+UNIV_INTERN
1846+void
1847+log_online_follow_redo_log()
1848+/*========================*/
1849+{
1850+ ib_uint64_t contiguous_start_lsn;
1851+ log_group_t* group;
1852+
1853+ /* Grab the LSN of the last checkpoint, we will parse up to it */
1854+ mutex_enter(&(log_sys->mutex));
1855+ log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn;
1856+ mutex_exit(&(log_sys->mutex));
1857+
1858+ if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {
1859+ return;
1860+ }
1861+
1862+ group = UT_LIST_GET_FIRST(log_sys->log_groups);
1863+ ut_a(group);
1864+
1865+ contiguous_start_lsn = ut_uint64_align_down(log_bmp_sys->start_lsn,
1866+ OS_FILE_LOG_BLOCK_SIZE);
1867+
1868+ while (group) {
1869+ log_online_follow_log_group(group, contiguous_start_lsn);
1870+ group = UT_LIST_GET_NEXT(log_groups, group);
1871+ }
1872+
1873+ /* A crash injection site that ensures last checkpoint LSN > last
1874+ tracked LSN, so that LSN tracking for this interval is tested. */
1875+ DBUG_EXECUTE_IF("crash_before_bitmap_write", DBUG_SUICIDE(););
1876+
1877+ log_online_write_bitmap();
1878+ log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;
1879+ log_set_tracked_lsn(log_bmp_sys->start_lsn);
1880+}
1881
1882=== modified file 'Percona-Server/storage/innobase/log/log0recv.c'
1883--- Percona-Server/storage/innobase/log/log0recv.c 2012-05-10 07:49:14 +0000
1884+++ Percona-Server/storage/innobase/log/log0recv.c 2012-08-22 13:19:13 +0000
1885@@ -850,7 +850,7 @@
1886 InnoDB-3.23.52 where the checksum field contains the log block number.
1887 @return TRUE if ok, or if the log block may be in the format of InnoDB
1888 version predating 3.23.52 */
1889-static
1890+UNIV_INTERN
1891 ibool
1892 log_block_checksum_is_ok_or_old_format(
1893 /*===================================*/
1894@@ -2095,7 +2095,7 @@
1895 /*******************************************************************//**
1896 Tries to parse a single log record and returns its length.
1897 @return length of the record, or 0 if the record was not complete */
1898-static
1899+UNIV_INTERN
1900 ulint
1901 recv_parse_log_rec(
1902 /*===============*/
1903@@ -2166,7 +2166,7 @@
1904
1905 /*******************************************************//**
1906 Calculates the new value for lsn when more data is added to the log. */
1907-static
1908+UNIV_INTERN
1909 ib_uint64_t
1910 recv_calc_lsn_on_data_add(
1911 /*======================*/
1912@@ -3562,6 +3562,8 @@
1913 log_sys->archived_lsn = log_sys->lsn;
1914 #endif /* UNIV_LOG_ARCHIVE */
1915
1916+ log_sys->tracked_lsn = log_sys->lsn;
1917+
1918 log_block_init(log_sys->buf, log_sys->lsn);
1919 log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
1920
1921
1922=== modified file 'Percona-Server/storage/innobase/os/os0file.c'
1923--- Percona-Server/storage/innobase/os/os0file.c 2012-08-07 06:10:00 +0000
1924+++ Percona-Server/storage/innobase/os/os0file.c 2012-08-22 13:19:13 +0000
1925@@ -154,6 +154,7 @@
1926 UNIV_INTERN mysql_pfs_key_t innodb_file_data_key;
1927 UNIV_INTERN mysql_pfs_key_t innodb_file_log_key;
1928 UNIV_INTERN mysql_pfs_key_t innodb_file_temp_key;
1929+UNIV_INTERN mysql_pfs_key_t innodb_file_bmp_key;
1930 #endif /* UNIV_PFS_IO */
1931
1932 /** The asynchronous i/o array slot structure */
1933@@ -2046,6 +2047,25 @@
1934 #endif /* __WIN__ */
1935 }
1936
1937+/***********************************************************************//**
1938+Truncates a file at the specified position.
1939+@return TRUE if success */
1940+UNIV_INTERN
1941+ibool
1942+os_file_set_eof_at(
1943+ os_file_t file, /*!< in: handle to a file */
1944+ ib_uint64_t new_len)/*!< in: new file length */
1945+{
1946+#ifdef __WIN__
1947+ /* TODO: untested! */
1948+ return(!_chsize_s(file, new_len));
1949+#else
1950+ /* TODO: works only with -D_FILE_OFFSET_BITS=64 ? */
1951+ return(!ftruncate(file, new_len));
1952+#endif
1953+}
1954+
1955+
1956 #ifndef __WIN__
1957 /***********************************************************************//**
1958 Wrapper to fsync(2) that retries the call on some errors.
1959
1960=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.c'
1961--- Percona-Server/storage/innobase/srv/srv0srv.c 2012-05-10 07:49:14 +0000
1962+++ Percona-Server/storage/innobase/srv/srv0srv.c 2012-08-22 13:19:13 +0000
1963@@ -67,6 +67,7 @@
1964 #include "mem0pool.h"
1965 #include "sync0sync.h"
1966 #include "que0que.h"
1967+#include "log0online.h"
1968 #include "log0recv.h"
1969 #include "pars0pars.h"
1970 #include "usr0sess.h"
1971@@ -176,6 +177,8 @@
1972
1973 UNIV_INTERN ibool srv_recovery_stats = FALSE;
1974
1975+UNIV_INTERN my_bool srv_track_changed_pages = TRUE;
1976+
1977 /* if TRUE, then we auto-extend the last data file */
1978 UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;
1979 /* if != 0, this tells the max size auto-extending may increase the
1980@@ -769,6 +772,10 @@
1981
1982 UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
1983
1984+UNIV_INTERN os_event_t srv_checkpoint_completed_event;
1985+
1986+UNIV_INTERN os_event_t srv_redo_log_thread_finished_event;
1987+
1988 UNIV_INTERN srv_sys_t* srv_sys = NULL;
1989
1990 /* padding to prevent other memory update hotspots from residing on
1991@@ -1107,6 +1114,9 @@
1992
1993 srv_lock_timeout_thread_event = os_event_create(NULL);
1994
1995+ srv_checkpoint_completed_event = os_event_create(NULL);
1996+ srv_redo_log_thread_finished_event = os_event_create(NULL);
1997+
1998 for (i = 0; i < SRV_MASTER + 1; i++) {
1999 srv_n_threads_active[i] = 0;
2000 srv_n_threads[i] = 0;
2001@@ -3031,6 +3041,46 @@
2002 }
2003 }
2004
2005+/******************************************************************//**
2006+A thread which follows the redo log and outputs the changed page bitmap.
2007+@return a dummy value */
2008+os_thread_ret_t
2009+srv_redo_log_follow_thread(
2010+/*=======================*/
2011+ void* arg __attribute__((unused))) /*!< in: a dummy parameter
2012+ required by
2013+ os_thread_create */
2014+{
2015+#ifdef UNIV_DEBUG_THREAD_CREATION
2016+ fprintf(stderr, "Redo log follower thread starts, id %lu\n",
2017+ os_thread_pf(os_thread_get_curr_id()));
2018+#endif
2019+
2020+#ifdef UNIV_PFS_THREAD
2021+ pfs_register_thread(srv_log_tracking_thread_key);
2022+#endif
2023+
2024+ my_thread_init();
2025+
2026+ do {
2027+ os_event_wait(srv_checkpoint_completed_event);
2028+ os_event_reset(srv_checkpoint_completed_event);
2029+
2030+ if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
2031+ log_online_follow_redo_log();
2032+ }
2033+
2034+ } while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE);
2035+
2036+ log_online_read_shutdown();
2037+ os_event_set(srv_redo_log_thread_finished_event);
2038+
2039+ my_thread_end();
2040+ os_thread_exit(NULL);
2041+
2042+ OS_THREAD_DUMMY_RETURN;
2043+}
2044+
2045 /*******************************************************************//**
2046 Tells the InnoDB server that there has been activity in the database
2047 and wakes up the master thread if it is suspended (not sleeping). Used
2048
2049=== modified file 'Percona-Server/storage/innobase/srv/srv0start.c'
2050--- Percona-Server/storage/innobase/srv/srv0start.c 2012-06-05 10:36:15 +0000
2051+++ Percona-Server/storage/innobase/srv/srv0start.c 2012-08-22 13:19:13 +0000
2052@@ -51,6 +51,7 @@
2053 #include "rem0rec.h"
2054 #include "mtr0mtr.h"
2055 #include "log0log.h"
2056+#include "log0online.h"
2057 #include "log0recv.h"
2058 #include "page0page.h"
2059 #include "page0cur.h"
2060@@ -121,9 +122,9 @@
2061 static os_file_t files[1000];
2062
2063 /** io_handler_thread parameters for thread identification */
2064-static ulint n[SRV_MAX_N_IO_THREADS + 7];
2065+static ulint n[SRV_MAX_N_IO_THREADS + 8];
2066 /** io_handler_thread identifiers */
2067-static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7];
2068+static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 8];
2069
2070 /** We use this mutex to test the return value of pthread_mutex_trylock
2071 on successful locking. HP-UX does NOT return 0, though Linux et al do. */
2072@@ -145,6 +146,7 @@
2073 UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key;
2074 UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
2075 UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;
2076+UNIV_INTERN mysql_pfs_key_t srv_log_tracking_thread_key;
2077 #endif /* UNIV_PFS_THREAD */
2078
2079 /*********************************************************************//**
2080@@ -2034,6 +2036,19 @@
2081 if (srv_auto_lru_dump && srv_blocking_lru_restore)
2082 buf_LRU_file_restore();
2083
2084+ if (srv_track_changed_pages) {
2085+
2086+ /* Initialize the log tracking subsystem here to block
2087+ server startup until it's completed due to the potential
2088+ need to re-read previous server run's log. */
2089+ log_online_read_init();
2090+
2091+ /* Create the thread that follows the redo log to output the
2092+ changed page bitmap */
2093+ os_thread_create(&srv_redo_log_follow_thread, NULL,
2094+ thread_ids + 6 + SRV_MAX_N_IO_THREADS);
2095+ }
2096+
2097 srv_is_being_started = FALSE;
2098
2099 err = dict_create_or_check_foreign_constraint_tables();
2100
2101=== modified file 'Percona-Server/storage/innobase/ut/ut0rbt.c'
2102--- Percona-Server/storage/innobase/ut/ut0rbt.c 2010-04-19 15:44:15 +0000
2103+++ Percona-Server/storage/innobase/ut/ut0rbt.c 2012-08-22 13:19:13 +0000
2104@@ -55,7 +55,6 @@
2105 #endif
2106
2107 #define ROOT(t) (t->root->left)
2108-#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
2109
2110 /**********************************************************************//**
2111 Print out the sub-tree recursively. */
2112@@ -834,6 +833,21 @@
2113 node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree));
2114
2115 memcpy(node->value, value, tree->sizeof_value);
2116+ return(rbt_add_preallocated_node(tree, parent, node));
2117+}
2118+
2119+/****************************************************************//**
2120+Add a new caller-provided node to tree at the specified position.
2121+The node must have its key fields initialized correctly.
2122+@return added node */
2123+UNIV_INTERN
2124+const ib_rbt_node_t*
2125+rbt_add_preallocated_node(
2126+/*======================*/
2127+ ib_rbt_t* tree, /*!< in: rb tree */
2128+ ib_rbt_bound_t* parent, /*!< in: parent */
2129+ ib_rbt_node_t* node) /*!< in: node */
2130+{
2131 node->parent = node->left = node->right = tree->nil;
2132
2133 /* If tree is empty */
2134@@ -842,7 +856,7 @@
2135 }
2136
2137 /* Append the node, the hope here is that the caller knows
2138- what s/he is doing. */
2139+ what s/he is doing. */
2140 rbt_tree_add_child(tree, parent, node);
2141 rbt_balance_tree(tree, node);
2142
2143@@ -854,6 +868,7 @@
2144 return(node);
2145 }
2146
2147+
2148 /**********************************************************************//**
2149 Find a matching node in the rb tree.
2150 @return NULL if not found else the node where key was found */
2151@@ -1142,7 +1157,17 @@
2152 ib_rbt_t* tree) /*!< in: rb tree */
2153 {
2154 rbt_free_node(ROOT(tree), tree->nil);
2155+ rbt_reset(tree);
2156+}
2157
2158+/****************************************************************//**
2159+Clear the tree without deleting and freeing its nodes. */
2160+UNIV_INTERN
2161+void
2162+rbt_reset(
2163+/*======*/
2164+ ib_rbt_t* tree) /*!< in: rb tree */
2165+{
2166 tree->n_nodes = 0;
2167 tree->root->left = tree->root->right = tree->nil;
2168 }
2169
2170=== removed directory 'doc'
2171=== removed file 'doc/Makefile'
2172--- doc/Makefile 2012-08-22 13:19:13 +0000
2173+++ doc/Makefile 1970-01-01 00:00:00 +0000
2174@@ -1,145 +0,0 @@
2175-# Makefile for Sphinx documentation
2176-#
2177-
2178-# You can set these variables from the command line.
2179-SPHINXOPTS =
2180-SPHINXBUILD = sphinx-build
2181-PAPER =
2182-BUILDDIR = build
2183-
2184-# Internal variables.
2185-PAPEROPT_a4 = -D latex_paper_size=a4
2186-PAPEROPT_letter = -D latex_paper_size=letter
2187-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
2188-
2189-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
2190-
2191-help:
2192- @echo "Please use \`make <target>' where <target> is one of"
2193- @echo " html to make standalone HTML files"
2194- @echo " offhtml to make standalone HTML files without fetching fresh percona-them files"
2195- @echo " dirhtml to make HTML files named index.html in directories"
2196- @echo " singlehtml to make a single large HTML file"
2197- @echo " pickle to make pickle files"
2198- @echo " json to make JSON files"
2199- @echo " htmlhelp to make HTML files and a HTML help project"
2200- @echo " qthelp to make HTML files and a qthelp project"
2201- @echo " devhelp to make HTML files and a Devhelp project"
2202- @echo " epub to make an epub"
2203- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
2204- @echo " latexpdf to make LaTeX files and run them through pdflatex"
2205- @echo " text to make text files"
2206- @echo " man to make manual pages"
2207- @echo " changes to make an overview of all changed/added/deprecated items"
2208- @echo " linkcheck to check all external links for integrity"
2209- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
2210-
2211-clean:
2212- -rm -rf $(BUILDDIR)/*
2213-
2214-html:
2215- @echo "Downloading percona-theme ..."
2216- @wget -O percona-theme.tar.gz http://percona.com/docs/theme/percona-server/5.5
2217- @echo "Extracting theme."
2218- @tar -zxf percona-theme.tar.gz
2219- @rm -rf source/percona-theme
2220- @mv percona-theme source/percona-theme
2221- @rm percona-theme.tar.gz
2222- @echo "Building html doc"
2223-
2224- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
2225- @echo
2226- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
2227-
2228-dirhtml:
2229- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
2230- @echo
2231- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
2232-
2233-offhtml:
2234- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
2235- @echo
2236- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
2237-
2238-singlehtml:
2239- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
2240- @echo
2241- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
2242-
2243-pickle:
2244- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
2245- @echo
2246- @echo "Build finished; now you can process the pickle files."
2247-
2248-json:
2249- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
2250- @echo
2251- @echo "Build finished; now you can process the JSON files."
2252-
2253-htmlhelp:
2254- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
2255- @echo
2256- @echo "Build finished; now you can run HTML Help Workshop with the" \
2257- ".hhp project file in $(BUILDDIR)/htmlhelp."
2258-
2259-qthelp:
2260- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
2261- @echo
2262- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
2263- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
2264- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PerconaServer.qhcp"
2265- @echo "To view the help file:"
2266- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PerconaServer.qhc"
2267-
2268-devhelp:
2269- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
2270- @echo
2271- @echo "Build finished."
2272- @echo "To view the help file:"
2273- @echo "# mkdir -p $$HOME/.local/share/devhelp/PerconaServer"
2274- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PerconaServer"
2275- @echo "# devhelp"
2276-
2277-epub:
2278- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
2279- @echo
2280- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
2281-
2282-latex:
2283- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
2284- @echo
2285- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
2286- @echo "Run \`make' in that directory to run these through (pdf)latex" \
2287- "(use \`make latexpdf' here to do that automatically)."
2288-
2289-latexpdf:
2290- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
2291- @echo "Running LaTeX files through pdflatex..."
2292- make -C $(BUILDDIR)/latex all-pdf
2293- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
2294-
2295-text:
2296- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
2297- @echo
2298- @echo "Build finished. The text files are in $(BUILDDIR)/text."
2299-
2300-man:
2301- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
2302- @echo
2303- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
2304-
2305-changes:
2306- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
2307- @echo
2308- @echo "The overview file is in $(BUILDDIR)/changes."
2309-
2310-linkcheck:
2311- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
2312- @echo
2313- @echo "Link check complete; look for any errors in the above output " \
2314- "or in $(BUILDDIR)/linkcheck/output.txt."
2315-
2316-doctest:
2317- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
2318- @echo "Testing of doctests in the sources finished, look at the " \
2319- "results in $(BUILDDIR)/doctest/output.txt."
2320
2321=== removed file 'doc/make.bat'
2322--- doc/make.bat 2011-09-20 07:03:00 +0000
2323+++ doc/make.bat 1970-01-01 00:00:00 +0000
2324@@ -1,170 +0,0 @@
2325-@ECHO OFF
2326-
2327-REM Command file for Sphinx documentation
2328-
2329-if "%SPHINXBUILD%" == "" (
2330- set SPHINXBUILD=sphinx-build
2331-)
2332-set BUILDDIR=build
2333-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
2334-if NOT "%PAPER%" == "" (
2335- set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
2336-)
2337-
2338-if "%1" == "" goto help
2339-
2340-if "%1" == "help" (
2341- :help
2342- echo.Please use `make ^<target^>` where ^<target^> is one of
2343- echo. html to make standalone HTML files
2344- echo. dirhtml to make HTML files named index.html in directories
2345- echo. singlehtml to make a single large HTML file
2346- echo. pickle to make pickle files
2347- echo. json to make JSON files
2348- echo. htmlhelp to make HTML files and a HTML help project
2349- echo. qthelp to make HTML files and a qthelp project
2350- echo. devhelp to make HTML files and a Devhelp project
2351- echo. epub to make an epub
2352- echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
2353- echo. text to make text files
2354- echo. man to make manual pages
2355- echo. changes to make an overview over all changed/added/deprecated items
2356- echo. linkcheck to check all external links for integrity
2357- echo. doctest to run all doctests embedded in the documentation if enabled
2358- goto end
2359-)
2360-
2361-if "%1" == "clean" (
2362- for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
2363- del /q /s %BUILDDIR%\*
2364- goto end
2365-)
2366-
2367-if "%1" == "html" (
2368- %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
2369- if errorlevel 1 exit /b 1
2370- echo.
2371- echo.Build finished. The HTML pages are in %BUILDDIR%/html.
2372- goto end
2373-)
2374-
2375-if "%1" == "dirhtml" (
2376- %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
2377- if errorlevel 1 exit /b 1
2378- echo.
2379- echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
2380- goto end
2381-)
2382-
2383-if "%1" == "singlehtml" (
2384- %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
2385- if errorlevel 1 exit /b 1
2386- echo.
2387- echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
2388- goto end
2389-)
2390-
2391-if "%1" == "pickle" (
2392- %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
2393- if errorlevel 1 exit /b 1
2394- echo.
2395- echo.Build finished; now you can process the pickle files.
2396- goto end
2397-)
2398-
2399-if "%1" == "json" (
2400- %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
2401- if errorlevel 1 exit /b 1
2402- echo.
2403- echo.Build finished; now you can process the JSON files.
2404- goto end
2405-)
2406-
2407-if "%1" == "htmlhelp" (
2408- %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
2409- if errorlevel 1 exit /b 1
2410- echo.
2411- echo.Build finished; now you can run HTML Help Workshop with the ^
2412-.hhp project file in %BUILDDIR%/htmlhelp.
2413- goto end
2414-)
2415-
2416-if "%1" == "qthelp" (
2417- %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
2418- if errorlevel 1 exit /b 1
2419- echo.
2420- echo.Build finished; now you can run "qcollectiongenerator" with the ^
2421-.qhcp project file in %BUILDDIR%/qthelp, like this:
2422- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PerconaServer.qhcp
2423- echo.To view the help file:
2424- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PerconaServer.ghc
2425- goto end
2426-)
2427-
2428-if "%1" == "devhelp" (
2429- %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
2430- if errorlevel 1 exit /b 1
2431- echo.
2432- echo.Build finished.
2433- goto end
2434-)
2435-
2436-if "%1" == "epub" (
2437- %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
2438- if errorlevel 1 exit /b 1
2439- echo.
2440- echo.Build finished. The epub file is in %BUILDDIR%/epub.
2441- goto end
2442-)
2443-
2444-if "%1" == "latex" (
2445- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
2446- if errorlevel 1 exit /b 1
2447- echo.
2448- echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
2449- goto end
2450-)
2451-
2452-if "%1" == "text" (
2453- %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
2454- if errorlevel 1 exit /b 1
2455- echo.
2456- echo.Build finished. The text files are in %BUILDDIR%/text.
2457- goto end
2458-)
2459-
2460-if "%1" == "man" (
2461- %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
2462- if errorlevel 1 exit /b 1
2463- echo.
2464- echo.Build finished. The manual pages are in %BUILDDIR%/man.
2465- goto end
2466-)
2467-
2468-if "%1" == "changes" (
2469- %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
2470- if errorlevel 1 exit /b 1
2471- echo.
2472- echo.The overview file is in %BUILDDIR%/changes.
2473- goto end
2474-)
2475-
2476-if "%1" == "linkcheck" (
2477- %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
2478- if errorlevel 1 exit /b 1
2479- echo.
2480- echo.Link check complete; look for any errors in the above output ^
2481-or in %BUILDDIR%/linkcheck/output.txt.
2482- goto end
2483-)
2484-
2485-if "%1" == "doctest" (
2486- %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
2487- if errorlevel 1 exit /b 1
2488- echo.
2489- echo.Testing of doctests in the sources finished, look at the ^
2490-results in %BUILDDIR%/doctest/output.txt.
2491- goto end
2492-)
2493-
2494-:end
2495
2496=== removed directory 'doc/source'
2497=== removed directory 'doc/source/_static'
2498=== removed directory 'doc/source/_templates'
2499=== removed file 'doc/source/compatibility.rst'
2500--- doc/source/compatibility.rst 2012-02-24 09:51:35 +0000
2501+++ doc/source/compatibility.rst 1970-01-01 00:00:00 +0000
2502@@ -1,27 +0,0 @@
2503-.. _compatibility:
2504-
2505-==============================================================
2506-Options that make XtraDB tablespaces not compatible with MySQL
2507-==============================================================
2508-
2509-Fast checksums
2510-==============
2511-
2512-Enabling :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.
2513-
2514-In 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:
2515-
2516- 1) Reinstall Percona Server to read your tables that were created with fast checksums.
2517- 2) Dump the tables (or temporarily convert them to MyISAM).
2518- 3) Install stock MySQL (or at least disable fast checksums).
2519- 4) Restore the InnoDB tables (or convert back from MyISAM).
2520-
2521-Page sizes other than 16KiB
2522-===========================
2523-
2524-This 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.
2525-
2526-Relocation of the doublewrite buffer
2527-====================================
2528-
2529-Variable :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.
2530
2531=== removed file 'doc/source/conf.py'
2532--- doc/source/conf.py 2012-08-22 13:19:13 +0000
2533+++ doc/source/conf.py 1970-01-01 00:00:00 +0000
2534@@ -1,268 +0,0 @@
2535-# -*- coding: utf-8 -*-
2536-#
2537-# Percona Server documentation build configuration file, created by
2538-# sphinx-quickstart on Mon Aug 8 01:24:46 2011.
2539-#
2540-# This file is execfile()d with the current directory set to its containing dir.
2541-#
2542-# Note that not all possible configuration values are present in this
2543-# autogenerated file.
2544-#
2545-# All configuration values have a default; values that are commented out
2546-# serve to show the default.
2547-
2548-import sys, os
2549-
2550-# If extensions (or modules to document with autodoc) are in another directory,
2551-# add these directories to sys.path here. If the directory is relative to the
2552-# documentation root, use os.path.abspath to make it absolute, like shown here.
2553-#sys.path.insert(0, os.path.abspath('.'))
2554-
2555-sys.path.append(os.path.abspath('ext'))
2556-
2557-# -- General configuration -----------------------------------------------------
2558-
2559-# If your documentation needs a minimal Sphinx version, state it here.
2560-#needs_sphinx = '1.0'
2561-
2562-# Add any Sphinx extension module names here, as strings. They can be extensions
2563-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2564-extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo',
2565- 'sphinx.ext.coverage', 'sphinx.ext.ifconfig',
2566- 'sphinx.ext.extlinks', 'psdom']
2567-
2568-# Add any paths that contain templates here, relative to this directory.
2569-templates_path = ['_templates']
2570-
2571-# The suffix of source filenames.
2572-source_suffix = '.rst'
2573-
2574-# The encoding of source files.
2575-#source_encoding = 'utf-8-sig'
2576-
2577-# The master toctree document.
2578-master_doc = 'index'
2579-
2580-# General information about the project.
2581-project = u'Percona Server'
2582-copyright = u'2011-2012, Percona Inc'
2583-
2584-# The version info for the project you're documenting, acts as replacement for
2585-# |version| and |release|, also used in various other places throughout the
2586-# built documents.
2587-#
2588-# The short X.Y version.
2589-version = '5.5'
2590-# The full version, including alpha/beta/rc tags.
2591-release = '5.5.25a-27.1'
2592-
2593-# The language for content autogenerated by Sphinx. Refer to documentation
2594-# for a list of supported languages.
2595-#language = None
2596-
2597-# There are two options for replacing |today|: either, you set today to some
2598-# non-false value, then it is used:
2599-#today = ''
2600-# Else, today_fmt is used as the format for a strftime call.
2601-#today_fmt = '%B %d, %Y'
2602-
2603-# List of patterns, relative to source directory, that match files and
2604-# directories to ignore when looking for source files.
2605-exclude_patterns = []
2606-
2607-# The reST default role (used for this markup: `text`) to use for all documents.
2608-#default_role = None
2609-
2610-primary_domain = 'psdom'
2611-
2612-# If true, '()' will be appended to :func: etc. cross-reference text.
2613-#add_function_parentheses = True
2614-
2615-# If true, the current module name will be prepended to all description
2616-# unit titles (such as .. function::).
2617-#add_module_names = True
2618-
2619-# If true, sectionauthor and moduleauthor directives will be shown in the
2620-# output. They are ignored by default.
2621-#show_authors = False
2622-
2623-# The name of the Pygments (syntax highlighting) style to use.
2624-pygments_style = 'sphinx'
2625-
2626-rst_prolog = '''
2627-.. |check| replace:: ``|[[---CHECK---]]|``
2628-
2629-.. |xtrabackup| replace:: :program:`xtrabackup`
2630-
2631-.. |innobackupex| replace:: :program:`innobackupex`
2632-
2633-.. |XtraDB| replace:: *XtraDB*
2634-
2635-.. |Jenkins| replace:: :term:`Jenkins`
2636-
2637-.. |InnoDB| replace:: *InnoDB*
2638-
2639-.. |MyISAM| replace:: *MyISAM*
2640-
2641-.. |LSN| replace:: *LSN*
2642-
2643-.. |XtraBackup| replace:: *XtraBackup*
2644-
2645-.. |Percona Server| replace:: *Percona Server*
2646-
2647-.. |Percona| replace:: *Percona*
2648-
2649-.. |MySQL| replace:: *MySQL*
2650-
2651-.. |Drizzle| replace:: *Drizzle*
2652-
2653-.. |MariaDB| replace:: *MariaDB*
2654-
2655-.. |tar4ibd| replace:: :program:`tar4ibd`
2656-
2657-.. |tar| replace:: :program:`tar`
2658-
2659-'''
2660-
2661-# A list of ignored prefixes for module index sorting.
2662-#modindex_common_prefix = []
2663-
2664-extlinks = {'bug': ('https://bugs.launchpad.net/percona-server/+bug/%s',
2665- '#')}
2666-
2667-
2668-# -- Options for HTML output ---------------------------------------------------
2669-
2670-# The theme to use for HTML and HTML Help pages. See the documentation for
2671-# a list of builtin themes.
2672-html_theme = 'percona-theme'
2673-
2674-# Theme options are theme-specific and customize the look and feel of a theme
2675-# further. For a list of options available for each theme, see the
2676-# documentation.
2677-#html_theme_options = {}
2678-
2679-# Add any paths that contain custom themes here, relative to this directory.
2680-html_theme_path = ['.', './percona-theme']
2681-
2682-# The name for this set of Sphinx documents. If None, it defaults to
2683-# "<project> v<release> documentation".
2684-html_title = 'Percona Server 5.5 Documentation'
2685-
2686-# A shorter title for the navigation bar. Default is the same as html_title.
2687-html_short_title = 'Percona Server 5.5'
2688-
2689-# The name of an image file (relative to this directory) to place at the top
2690-# of the sidebar.
2691-html_logo = 'percona-server-logo.jpg'
2692-
2693-# The name of an image file (within the static path) to use as favicon of the
2694-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
2695-# pixels large.
2696-#html_favicon = None
2697-
2698-# Add any paths that contain custom static files (such as style sheets) here,
2699-# relative to this directory. They are copied after the builtin static files,
2700-# so a file named "default.css" will overwrite the builtin "default.css".
2701-html_static_path = ['_static']
2702-
2703-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
2704-# using the given strftime format.
2705-#html_last_updated_fmt = '%b %d, %Y'
2706-
2707-# If true, SmartyPants will be used to convert quotes and dashes to
2708-# typographically correct entities.
2709-#html_use_smartypants = True
2710-
2711-# Custom sidebar templates, maps document names to template names.
2712-#html_sidebars = {}
2713-
2714-# Additional templates that should be rendered to pages, maps page names to
2715-# template names.
2716-#html_additional_pages = {}
2717-
2718-# If false, no module index is generated.
2719-#html_domain_indices = True
2720-
2721-# If false, no index is generated.
2722-#html_use_index = True
2723-
2724-# If true, the index is split into individual pages for each letter.
2725-#html_split_index = False
2726-
2727-# If true, links to the reST sources are added to the pages.
2728-#html_show_sourcelink = True
2729-
2730-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
2731-#html_show_sphinx = True
2732-
2733-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
2734-#html_show_copyright = True
2735-
2736-# If true, an OpenSearch description file will be output, and all pages will
2737-# contain a <link> tag referring to it. The value of this option must be the
2738-# base URL from which the finished HTML is served.
2739-#html_use_opensearch = ''
2740-
2741-# This is the file name suffix for HTML files (e.g. ".xhtml").
2742-#html_file_suffix = None
2743-
2744-# Output file base name for HTML help builder.
2745-htmlhelp_basename = 'PerconaServer55doc'
2746-
2747-
2748-# -- Options for LaTeX output --------------------------------------------------
2749-
2750-# The paper size ('letter' or 'a4').
2751-#latex_paper_size = 'letter'
2752-
2753-# The font size ('10pt', '11pt' or '12pt').
2754-#latex_font_size = '10pt'
2755-
2756-# Grouping the document tree into LaTeX files. List of tuples
2757-# (source start file, target name, title, author, documentclass [howto/manual]).
2758-latex_documents = [
2759- ('index', 'PerconaServer-5.5.tex', u'Percona Server Documentation',
2760- u'Percona Inc', 'manual'),
2761-]
2762-
2763-# The name of an image file (relative to this directory) to place at the top of
2764-# the title page.
2765-#latex_logo = None
2766-
2767-# For "manual" documents, if this is true, then toplevel headings are parts,
2768-# not chapters.
2769-#latex_use_parts = False
2770-
2771-# If true, show page references after internal links.
2772-#latex_show_pagerefs = False
2773-
2774-# If true, show URL addresses after external links.
2775-#latex_show_urls = False
2776-
2777-# Additional stuff for the LaTeX preamble.
2778-#latex_preamble = ''
2779-
2780-# Documents to append as an appendix to all manuals.
2781-#latex_appendices = []
2782-
2783-# If false, no module index is generated.
2784-#latex_domain_indices = True
2785-
2786-
2787-# -- Options for manual page output --------------------------------------------
2788-
2789-# One entry per manual page. List of tuples
2790-# (source start file, name, description, authors, manual section).
2791-man_pages = [
2792- ('index', 'perconaserver55', u'Percona Server 5.5 Documentation',
2793- [u'Percona Inc'], 1)
2794-]
2795-
2796-
2797-# Example configuration for intersphinx: refer to the Python standard library.
2798-intersphinx_mapping = {
2799- 'ps51' : ('http://www.percona.com/doc/percona-server/5.1/', None),
2800- 'xtrabackup' : ('http://www.percona.com/doc/percona-xtrabackup', None),
2801- 'ptoolkit' : ('http://www.percona.com/doc/percona-toolkit/2.0/', None)
2802- }
2803
2804=== removed file 'doc/source/development.rst'
2805--- doc/source/development.rst 2012-01-27 08:36:38 +0000
2806+++ doc/source/development.rst 1970-01-01 00:00:00 +0000
2807@@ -1,266 +0,0 @@
2808-=============================
2809-Development of Percona Server
2810-=============================
2811-
2812-|Percona Server| is an open source project to produce a distribution
2813-of the |MySQL| server with improved performance, scalability and
2814-diagnostics.
2815-
2816-Submitting Changes
2817-==================
2818-This process is very much modeled on what is being used by
2819-`Drizzle <http://www.drizzle.org>`_. The Drizzle project went through
2820-several iterations and refinements before settling on this process. It
2821-has been found to both keep trunk in a constant state of stability
2822-(allowing for a release at any time) and minimizing wasted time by
2823-developers due to broken code from somebody else interfering with their day.
2824-
2825-You should also be familiar with our |Jenkins| setup.
2826-
2827-Overview
2828-~~~~~~~~
2829-At Percona we use `Bazaar <http://www.bazaar-vcs.org>`_ for source
2830-control and `launchpad <http://www.launchpad.net>`_ for both
2831-code hosting and release management.
2832-
2833-Changes to our software projects could be because of a new feature
2834-(blueprint) or fixing a bug (bug). Projects such as refactoring could
2835-be classed as a blueprint or a bug depending on the scope of the work.
2836-
2837-Blueprints and bugs are targeted to specific milestones (releases). A
2838-milestone is part of a series - e.g. 1.6 is a series in Percona
2839-XtraBackup and 1.6.1, 1.6.2 and 1.6.3 are milestones in the 1.6 series.
2840-
2841-Code is proposed for merging in the form of merge requests on launchpad.
2842-
2843-Some software (such as Percona Xtrabackup) we maintain both a
2844-development branch and a stable branch. For example: Xtrabackup 1.6 is
2845-the current stable series, and changes that should make it into bugfix
2846-releases of 1.6 should be proposed for the 1.6 tree. However, most new
2847-features or more invasive (or smaller) bug fixes should be targeted to
2848-the next release, currently 1.7. If submitting something to 1.6, you
2849-should also propose a branch that has these changes merged to the
2850-development release (1.7). This way somebody else doesn't have to
2851-attempt to merge your code and we get to run any extra tests that may
2852-be in the tree (and check compatibility with all platforms).
2853-
2854-For Percona Server, we have two current bzr branches on which
2855-development occurs: 5.1 and 5.5. As Percona Server is not a
2856-traditional project, instead being a set of patches against an
2857-existing product, these two branches are not related. That is, we do
2858-not merge from one to the other. To have your changes in both, you
2859-must propose two branches: one for 5.1 version of patch and one for
2860-5.5.
2861-
2862-Making a change to a project
2863-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2864-In this case we're going to use percona-xtrabackup as an
2865-example. workflow is similar for Percona Server, but patch will need
2866-to be modified both in 5.1 and 5.5 branches.
2867-
2868-* ``bzr branch lp:percona-xtrabackup featureX`` (where 'featureX' is a
2869- sensible name for the task at hand)
2870-* (developer makes changes in featureX, testing locally)
2871-* Developer pushes to ``lp:~username/percona-xtrabackup/featureX``
2872-* When the developer thinks the branch may be ready to be merged, they
2873- will run the branch through param build.
2874-* If there are any build or test failures, developer fixes them (in
2875- the case of failing tests in trunk... no more tests should
2876- fail. Eventually all tests will pass in trunk)
2877-* Developer can then submit a merge proposal to lp:percona-xtrabackup,
2878- referencing URL for the param build showing that build and test
2879- passes
2880-* Code undergoes review
2881-* Once code is accepted, it can be merged (see other section)
2882-
2883-If the change also applies to a stable release (e.g. 1.6) then changes
2884-should be made on a branch of 1.6 and merged to a branch of trunk. In
2885-this case there should be two branches run through param build and two
2886-merge proposals (one for 1.6 and one with the changes merged to
2887-trunk). This prevents somebody else having to guess how to merge your
2888-changes.
2889-
2890-Merging approved branches
2891-~~~~~~~~~~~~~~~~~~~~~~~~~
2892-
2893-Before code hits trunk, it goes through a "staging" branch, where some
2894-extra tests may be run (e.g. valgrind) along with testing that all
2895-branches behave well together (build and test) before pushing to
2896-trunk.
2897-
2898-To 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.
2899-
2900-Please note that **ALL changes must go through staging first** This is to ensure that several approved merge requests do not interact badly with each
2901-other.
2902-
2903-* Merge captain (for lack of a better term for the person merging
2904- approved code into trunk) may collate several approved branches that
2905- have individually passed param-build as run by the original
2906- developers.
2907-
2908- * Workflow would look something like this:
2909-
2910- * ``bzr branch lp:percona-xtrabackup staging``
2911- * ``bzr merge lp:~user/percona-xtrabackup/featureX``
2912- * ``bzr commit -m "merge feature X"``
2913- * ``bzr merge lp:~user/percona-xtrabackup/featureY``
2914- * ``bzr commit -m "merge feature Y"``
2915- * ``bzr push --overwrite lp:percona-xtrabackup/staging'``
2916- * Run ``lp:percona-xtrabackup/staging`` through param build (in
2917- future, we'll likely have a Jenkins job specifically for this)
2918- * If build succeeds, ``bzr push lp:percona-server`` (and branches
2919- will be automatically marked as 'merged'.. although bug reports
2920- will need to be manually changed to 'Fix Released')
2921- * If build or test fails, attempt to find which branch may be the
2922- cause, and repeat process but without that branch.
2923-
2924-* Any failing branch will be set to 'Work in Progress' with a 'Needs
2925- fixing' review with the URL of the build in jenkins where the
2926- failure occured. This will allow developers to fix their code.
2927-
2928-Resubmitting a merge request
2929-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2930-
2931-In the event of a merge request being marked as 'Work In Progress' due
2932-to build/test failures when merging, the developer should fix up the
2933-branch, run through param build and then 'Resubmit' the merge
2934-proposal.
2935-
2936-There 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.
2937-
2938-
2939-Percona Server
2940-~~~~~~~~~~~~~~
2941-
2942-The same process for Percona Server, but we have different branches (and merge requests) for 5.1 and 5.5 series.
2943-
2944-Upgrading MySQL base version
2945-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2946-
2947-* Same process as other modifications.
2948-* create local branch
2949-* make changes
2950-* param build
2951-* merge request
2952-
2953-We will need some human processes to ensure that we do not merge extra
2954-things during the time when base MySQL version is being updated to
2955-avoid making life harder for the person doing the update.
2956-
2957-
2958-
2959-Making a release
2960-================
2961-
2962-* ``bzr branch lp:project release-project-VERSION``
2963-* build packages
2964-* perform any final tests (as we transition, this will already have
2965- been done by jenkins)
2966-* ``bzr tag project-version``
2967-* merge request back to lp:project including the tag (TODO: write
2968- exact bzr commands for this)
2969-
2970-This way anybody can easily check out an old release by just using bzr
2971-to branch the specific tag.
2972-
2973-Jenkins
2974-=======
2975-
2976-Our Jenkins instance uses a mixture of VMs on physical hosts that
2977-Percona runs and Virtual Machines in Amazon EC2 that are launched on
2978-demand.
2979-
2980-Basic Concepts
2981-~~~~~~~~~~~~~~
2982-We have some jobs that are activated based on source control changes
2983-(new commits in a bzr repository). We have some that are "param
2984-build" - that is, a user specifies parameters for the build (e.g. the
2985-bzr tree). A param-build allows developers to ensure their branch
2986-compiles and passes tests on all supported platforms *before*
2987-submitting a merge request. This helps us maintain the quality of the
2988-main bzr branches and not block other developers work.
2989-
2990-Jenkins is a Master/Slave system and the jenkins master schedules the
2991-builds across available machines (and may launch new VMs in EC2 to
2992-meet demand).
2993-
2994-Most of our jobs are what's known as "matrix builds". That is, a job
2995-that will be run with several different configurations of the project
2996-(e.g. release, debug) across several platforms (e.g. on a host
2997-matching the label of "centos5-32" and a host matching label of
2998-"ubuntu-natty-32bit"). Matrix builds show a table of lights to
2999-indicate their status. Clicking "build now" on one of these queues up
3000-builds for all of the combinations.
3001-
3002-We have some integration of our regression test suites (currently
3003-xtrabackup) with Jenkins ability to parse JUnitXML, presenting a nice
3004-user interface to any test failures.
3005-
3006-Because building some projects is non-trivial, in order to not
3007-duplicate the list of compile instructions for each job, we use
3008-template builds. You'll see builds such as percona-xtrabackup-template
3009-which is a disabled job, but all current xtrabackup jobs point to it
3010-for the commands to build and run the test suite.
3011-
3012-Percona Xtrabackup
3013-~~~~~~~~~~~~~~~~~~
3014-
3015-`<http://jenkins.percona.com/view/Percona%20Xtrabackup/>`_
3016-
3017-We currently build both xtrabackup 1.6 and xtrabackup trunk (will become 1.7).
3018-
3019-There 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)
3020-
3021-Percona Server
3022-~~~~~~~~~~~~~~
3023-
3024-We 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.
3025-
3026-The ``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.
3027-
3028-Percona Server 5.1
3029-------------------
3030-
3031-`<http://jenkins.percona.com/view/Percona%20Server%205.1/>`_
3032-
3033-We have trunk and param jobs. We also have a valgrind job that will run after a successful trunk build.
3034-
3035-Percona Server 5.5
3036-------------------
3037-
3038-`<http://jenkins.percona.com/view/Percona%20Server%205.5/>`_
3039-
3040-Similar to 5.1, but for PS5.5 instead.
3041-
3042-MySQL Builds
3043-~~~~~~~~~~~~
3044-
3045-`<http://jenkins.percona.com/view/MySQL/>`_
3046-
3047-I've set up a few jobs in Jenkins that should help us predict the future
3048-for Percona Server. Namely, if upstream MySQL may cause us any problems.
3049-
3050-I wanted to see if some test failures were possibly upstream, so I set
3051-up two jobs:
3052-
3053-`<http://jenkins.percona.com/view/MySQL/job/mysql-5.1-url-param/>`_
3054-`<http://jenkins.percona.com/view/MySQL/job/mysql-5.5-url-param/>`_
3055-
3056-both of which ask for a URL to a MySQL source tarball and then do a full
3057-build and test across the platforms we have in jenkins.
3058-
3059-But my next thought was that we could try and do this *before* the
3060-source tarballs come out - hopefully then being able to have MySQL
3061-release source tarballs that do in fact pass build and test everywhere
3062-where we're wanting to support Percona Server.
3063-
3064-`<http://jenkins.percona.com/view/MySQL/job/mysql-5.1-trunk/>`_
3065-`<http://jenkins.percona.com/view/MySQL/job/mysql-5.5-trunk/>`_
3066-
3067-are scheduled to just try once per week (we can change the frequency if
3068-we want to) to build and test from the MySQL bzr trees.
3069-
3070-I 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).
3071-
3072-I'm hoping that these jobs will help us catch any future problems before
3073-they become our problem. (e.g. we can easily see that the sporadic test failures we see in Percona Server are actually in upstream MySQL).
3074
3075=== removed directory 'doc/source/diagnostics'
3076=== removed file 'doc/source/diagnostics/index_info_schema_tables.rst'
3077--- doc/source/diagnostics/index_info_schema_tables.rst 2011-10-07 23:38:41 +0000
3078+++ doc/source/diagnostics/index_info_schema_tables.rst 1970-01-01 00:00:00 +0000
3079@@ -1,37 +0,0 @@
3080-.. _index_info_schema_tables:
3081-
3082-========================================
3083- Index of ``INFORMATION_SCHEMA`` Tables
3084-========================================
3085-
3086-This 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.
3087-
3088- * :table:`GLOBAL_TEMPORARY_TABLES`
3089-
3090- * :table:`INNODB_CMP`
3091-
3092- * :table:`INNODB_CMP_RESET`
3093-
3094- * :table:`INNODB_CMPMEM`
3095-
3096- * :table:`INNODB_CMPMEM_RESET`
3097-
3098- * :table:`INNODB_INDEX_STATS`
3099-
3100- * :table:`INNODB_LOCK_WAITS`
3101-
3102- * :table:`INNODB_LOCKS`
3103-
3104- * :table:`INNODB_RSEG`
3105-
3106- * :table:`INNODB_TABLE_STATS`
3107-
3108- * :table:`INNODB_TRX`
3109-
3110- * :table:`PROCESSLIST`
3111-
3112- * :table:`QUERY_RESPONSE_TIME`
3113-
3114- * :table:`TEMPORARY_TABLES`
3115-
3116-
3117
3118=== removed file 'doc/source/diagnostics/innodb_deadlock_count.rst'
3119--- doc/source/diagnostics/innodb_deadlock_count.rst 2012-07-18 06:25:14 +0000
3120+++ doc/source/diagnostics/innodb_deadlock_count.rst 1970-01-01 00:00:00 +0000
3121@@ -1,57 +0,0 @@
3122-.. _innodb_deadlocks_page:
3123-
3124-==========================
3125- Count |InnoDB| Deadlocks
3126-==========================
3127-
3128-When 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.
3129-
3130-This 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.
3131-
3132-This 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/>`_).
3133-
3134-It adds a new global status variable (:variable:`innodb_deadlocks`) showing the number of deadlocks.*
3135-
3136-You can use it with ``SHOW GLOBAL STATUS``, e.g.: ::
3137-
3138- mysql> SHOW GLOBAL STATUS LIKE 'innodb_deadlocks';
3139- +------------------+-------+
3140- | Variable_name | Value |
3141- +------------------+-------+
3142- | innodb_deadlocks | 323 |
3143- +------------------+-------+
3144-
3145-or with ``INFORMATION_SCHEMA``, e.g.: ::
3146-
3147- mysql> SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_deadlocks';
3148- +----------------+
3149- | VARIABLE_VALUE |
3150- +----------------+
3151- | 323 |
3152- +----------------+
3153-
3154-A 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.
3155-
3156-
3157-Version Specific Information
3158-============================
3159-
3160- * 5.5.8-20.0:
3161- Full functionality available.
3162-
3163-Status Variables
3164-================
3165-
3166-One new status variable was introduced by this feature.
3167-
3168-.. variable:: innodb_deadlocks
3169-
3170- :vartype: LONG
3171- :scope: Global
3172-
3173-
3174-Related Reading
3175-===============
3176-
3177- * `Original post by Eric Bergen <http://ebergen.net/wordpress/2009/08/27/|InnoDB|-deadlock-count-patch/>`_
3178-
3179
3180=== removed file 'doc/source/diagnostics/innodb_show_lock_names.rst'
3181--- doc/source/diagnostics/innodb_show_lock_names.rst 2011-10-07 23:38:41 +0000
3182+++ doc/source/diagnostics/innodb_show_lock_names.rst 1970-01-01 00:00:00 +0000
3183@@ -1,24 +0,0 @@
3184-.. _innodb_show_lock_names:
3185-
3186-=================
3187- Show Lock Names
3188-=================
3189-
3190-This feature is curently undocumented except for the following example.
3191-
3192-Example: ::
3193-
3194- mysql> show mutex status;
3195- +--------+---------------------------+---------------+
3196- | Type | Name | Status |
3197- +--------+---------------------------+---------------+
3198- | InnoDB | &rseg->mutex | os_waits=210 |
3199- | InnoDB | &dict_sys->mutex | os_waits=3 |
3200- | InnoDB | &trx_doublewrite->mutex | os_waits=1 |
3201- | InnoDB | &log_sys->mutex | os_waits=1197 |
3202- | InnoDB | &LRU_list_mutex | os_waits=2 |
3203- | InnoDB | &fil_system->mutex | os_waits=5 |
3204- | InnoDB | &kernel_mutex | os_waits=242 |
3205- | InnoDB | &new_index->lock | os_waits=2 |
3206- | InnoDB | &new_index->lock | os_waits=415 |
3207- .....
3208
3209=== removed file 'doc/source/diagnostics/innodb_show_status.rst'
3210--- doc/source/diagnostics/innodb_show_status.rst 2012-07-18 06:25:14 +0000
3211+++ doc/source/diagnostics/innodb_show_status.rst 1970-01-01 00:00:00 +0000
3212@@ -1,475 +0,0 @@
3213-.. _innodb_show_status:
3214-
3215-======================
3216- Show |InnoDB| Status
3217-======================
3218-
3219-This 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.
3220-
3221-This feature modified the ``SHOW ENGINE INNODB STATUS`` command as follows:
3222-
3223- * ``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.
3224-
3225- * Added two variables to control ``SHOW ENGINE INNODB STATUS`` information presented (bugfix for `#29123 <http://bugs.mysql.com/bug.php?id=29126>`_):
3226-
3227- * :variable:`innodb_show_verbose_locks` - Whether to show records locked
3228-
3229- * :variable:`innodb_show_locks_held` - Number of locks held to print for each |InnoDB| transaction
3230-
3231- * 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.
3232-
3233- * Added additional LOG section information (beginning in release 5.5.8-20.0).
3234-
3235-Version Specific Information
3236-============================
3237-
3238- * 5.5.8-20.0
3239- Added status variables showing information from ``SHOW ENGINE INNODB STATUS``.
3240-
3241- * 5.5.8-20.0
3242- Added additional information in the LOG section.
3243-
3244- * 5.5.10-20.1:
3245- Renamed status variable :variable:`innodb_row_lock_numbers` to :variable:`innodb_current_row_locks`.
3246-
3247-Other Information
3248-=================
3249-
3250- * Author / Origin:
3251- Baron Schwartz, http://lists.mysql.com/internals/35174
3252-
3253-
3254-System Variables
3255-================
3256-
3257-.. variable:: innodb_show_verbose_locks
3258-
3259- :cli: Yes
3260- :conf: Yes
3261- :scope: Global
3262- :dyn: Yes
3263- :vartype: ULONG
3264- :default: 0
3265- :range: 0 - 1
3266-
3267-Specifies 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.
3268-
3269-.. variable:: innodb_show_locks_held
3270-
3271- :cli: Yes
3272- :conf: Yes
3273- :scope: Global
3274- :dyn: Yes
3275- :vartype: ULONG
3276- :default: 10
3277- :range: 0 - 1000
3278-
3279-Specifies the number of locks held to print for each |InnoDB| transaction in ``SHOW ENGINE INNODB STATUS``.
3280-
3281-
3282-Status Variables
3283-================
3284-
3285-The 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.
3286-
3287-
3288-BACKGROUND THREAD
3289------------------
3290-
3291-The following variables contain information in the BACKGROUND THREAD section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is:
3292-
3293- Insert an example of BACKGROUND THREAD section output here.
3294-
3295-.. variable:: innodb_master_thread_1_second_loops
3296-
3297- :version 5.5.8-20.0: Introduced.
3298- :vartype: Numeric
3299- :scope: Global
3300-
3301-.. variable:: innodb_master_thread_10_second_loops
3302-
3303- :version 5.5.8-20.0: Introduced.
3304- :vartype: Numeric
3305- :scope: Global
3306-
3307-.. variable:: innodb_master_thread_background_loops
3308-
3309- :version 5.5.8-20.0: Introduced.
3310- :vartype: Numeric
3311- :scope: Global
3312-
3313-.. variable:: innodb_master_thread_main_flush_loops
3314-
3315- :version 5.5.8-20.0: Introduced.
3316- :vartype: Numeric
3317- :scope: Global
3318-
3319-.. variable:: innodb_master_thread_sleeps
3320-
3321- :version 5.5.8-20.0: Introduced.
3322- :vartype: Numeric
3323- :scope: Global
3324-
3325-.. variable:: innodb_background_log_sync
3326-
3327- :version 5.5.8-20.0: Introduced.
3328- :vartype: Numeric
3329- :scope: Global
3330-
3331-SEMAPHORES
3332-----------
3333-
3334-The following variables contain information in the SEMAPHORES section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
3335-
3336- ----------
3337- SEMAPHORES
3338- ----------
3339- OS WAIT ARRAY INFO: reservation count 9664, signal count 11182
3340- Mutex spin waits 20599, rounds 223821, OS waits 4479
3341- RW-shared spins 5155, OS waits 1678; RW-excl spins 5632, OS waits 2592
3342- Spin rounds per wait: 10.87 mutex, 15.01 RW-shared, 27.19 RW-excl
3343-
3344-.. variable:: innodb_mutex_os_waits
3345-
3346- :version 5.5.8-20.0: Introduced.
3347- :vartype: Numeric
3348- :scope: Global
3349-
3350-.. variable:: innodb_mutex_spin_rounds
3351-
3352- :version 5.5.8-20.0: Introduced.
3353- :vartype: Numeric
3354- :scope: Global
3355-
3356-.. variable:: innodb_mutex_spin_waits
3357-
3358- :version 5.5.8-20.0: Introduced.
3359- :vartype: Numeric
3360- :scope: Global
3361-
3362-.. variable:: innodb_s_lock_os_waits
3363-
3364- :version 5.5.8-20.0: Introduced.
3365- :vartype: Numeric
3366- :scope: Global
3367-
3368-.. variable:: innodb_s_lock_spin_rounds
3369-
3370- :version 5.5.8-20.0: Introduced.
3371- :vartype: Numeric
3372- :scope: Global
3373-
3374-.. variable:: innodb_s_lock_spin_waits
3375-
3376- :version 5.5.8-20.0: Introduced.
3377- :vartype: Numeric
3378- :scope: Global
3379-
3380-.. variable:: innodb_x_lock_os_waits
3381-
3382- :version 5.5.8-20.0: Introduced.
3383- :vartype: Numeric
3384- :scope: Global
3385-
3386-.. variable:: innodb_x_lock_spin_rounds
3387-
3388- :version 5.5.8-20.0: Introduced.
3389- :vartype: Numeric
3390- :scope: Global
3391-
3392-.. variable:: innodb_x_lock_spin_waits
3393-
3394- :version 5.5.8-20.0: Introduced.
3395- :vartype: Numeric
3396- :scope: Global
3397-
3398-INSERT BUFFER AND ADAPTIVE HASH INDEX
3399--------------------------------------
3400-
3401-The 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: ::
3402-
3403- -------------------------------------
3404- INSERT BUFFER AND ADAPTIVE HASH INDEX
3405- -------------------------------------
3406- Ibuf: size 1, free list len 6089, seg size 6091,
3407- 44497 inserts, 44497 merged recs, 8734 merges
3408- Hash table size 276707, node heap has 1 buffer(s)
3409- 0.00 hash searches/s, 0.00 non-hash searches/s
3410-
3411-.. variable:: innodb_ibuf_discarded_delete_marks
3412-
3413- :version 5.5.8-20.0: Introduced.
3414- :vartype: Numeric
3415- :scope: Global
3416-
3417-.. variable:: innodb_ibuf_discarded_deletes
3418-
3419- :version 5.5.8-20.0: Introduced.
3420- :vartype: Numeric
3421- :scope: Global
3422-
3423-.. variable:: innodb_ibuf_discarded_inserts
3424-
3425- :version 5.5.8-20.0: Introduced.
3426- :vartype: Numeric
3427- :scope: Global
3428-
3429-.. variable:: innodb_ibuf_free_list
3430-
3431- :version 5.5.8-20.0: Introduced.
3432- :vartype: Numeric
3433- :scope: Global
3434-
3435-.. variable:: innodb_ibuf_merged_delete_marks
3436-
3437- :version 5.5.8-20.0: Introduced.
3438- :vartype: Numeric
3439- :scope: Global
3440-
3441-.. variable:: innodb_ibuf_merged_deletes
3442-
3443- :version 5.5.8-20.0: Introduced.
3444- :vartype: Numeric
3445- :scope: Global
3446-
3447-.. variable:: innodb_ibuf_merged_inserts
3448-
3449- :version 5.5.8-20.0: Introduced.
3450- :vartype: Numeric
3451- :scope: Global
3452-
3453-.. variable:: innodb_ibuf_merges
3454-
3455- :version 5.5.8-20.0: Introduced.
3456- :vartype: Numeric
3457- :scope: Global
3458-
3459-.. variable:: innodb_ibuf_segment_size
3460-
3461- :version 5.5.8-20.0: Introduced.
3462- :vartype: Numeric
3463- :scope: Global
3464-
3465-.. variable:: innodb_ibuf_size
3466-
3467- :version 5.5.8-20.0: Introduced.
3468- :vartype: Numeric
3469- :scope: Global
3470-
3471-.. variable:: innodb_adaptive_hash_cells
3472-
3473- :version 5.5.8-20.0: Introduced.
3474- :vartype: Numeric
3475- :scope: Global
3476-
3477-.. variable:: innodb_adaptive_hash_heap_buffers
3478-
3479- :version 5.5.8-20.0: Introduced.
3480- :vartype: Numeric
3481- :scope: Global
3482-
3483-.. variable:: innodb_adaptive_hash_hash_searches
3484-
3485- :version 5.5.8-20.0: Introduced.
3486- :vartype: Numeric
3487- :scope: Global
3488-
3489-.. variable:: innodb_adaptive_hash_non_hash_searches
3490-
3491- :version 5.5.8-20.0: Introduced.
3492- :vartype: Numeric
3493- :scope: Global
3494-
3495-LOG
3496----
3497-
3498-The following variables contain information in the LOG section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
3499-
3500- ---
3501- LOG
3502- ---
3503- Log sequence number 28219393219
3504- Log flushed up to 28219393219
3505- Last checkpoint at 28212583337
3506- Max checkpoint age 7782360
3507- Checkpoint age target 7539162
3508- Modified age 6809882
3509- Checkpoint age 6809882
3510- 0 pending log writes, 0 pending chkp writes
3511- 8570 log i/o's done, 2000.00 log i/o's/second
3512-
3513-.. variable:: innodb_lsn_current
3514-
3515- :version 5.5.8-20.0: Introduced.
3516- :vartype: Numeric
3517- :scope: Global
3518-
3519-.. variable:: innodb_lsn_flushed
3520-
3521- :version 5.5.8-20.0: Introduced.
3522- :vartype: Numeric
3523- :scope: Global
3524-
3525-.. variable:: innodb_lsn_last_checkpoint
3526-
3527- :version 5.5.8-20.0: Introduced.
3528- :vartype: Numeric
3529- :scope: Global
3530-
3531-.. variable:: innodb_checkpoint_age
3532-
3533- :version 5.5.8-20.0: Introduced.
3534- :vartype: Numeric
3535- :scope: Global
3536-
3537-.. variable:: innodb_checkpoint_max_age
3538-
3539- :version 5.5.8-20.0: Introduced.
3540- :vartype: Numeric
3541- :scope: Global
3542-
3543-.. variable:: innodb_checkpoint_target_age
3544-
3545- :version 5.5.8-20.0: Introduced.
3546- :vartype: Numeric
3547- :scope: Global
3548-
3549-BUFFER POOL AND MEMORY
3550-----------------------
3551-
3552-The 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: ::
3553-
3554- ----------------------
3555- BUFFER POOL AND MEMORY
3556- ----------------------
3557- Total memory allocated 137625600; in additional pool allocated 0
3558- Internal hash tables (constant factor + variable factor)
3559- Adaptive hash index 3774352 (2213656 + 1560696)
3560- Page hash 139144
3561- Dictionary cache 629811 (554864 + 74947)
3562- File system 83536 (82672 + 864)
3563- Lock system 380792 (332872 + 47920)
3564- Recovery system 0 (0 + 0)
3565- Threads 84040 (82696 + 1344)
3566- Dictionary memory allocated 74947
3567- Buffer pool size 8192
3568- Buffer pool size, bytes 134217728
3569- Free buffers 0
3570- Database pages 8095
3571- Old database pages 2968
3572- Modified db pages 5914
3573- Pending reads 0
3574- Pending writes: LRU 0, flush list 129, single page 0
3575- Pages made young 372084, not young 0
3576- 2546000.00 youngs/s, 0.00 non-youngs/s
3577- Pages read 103356, created 154787, written 979572
3578- 469000.00 reads/s, 78000.00 creates/s, 138000.00 writes/s
3579- Buffer pool hit rate 994 / 1000, young-making rate 34 / 1000 not 0 / 1000
3580- Pages read ahead 0.00/s, evicted without access 15000.00/s
3581-
3582-.. variable:: innodb_mem_adaptive_hash
3583-
3584- :version 5.5.8-20.0: Introduced.
3585- :vartype: Numeric
3586- :scope: Global
3587-
3588-.. variable:: innodb_mem_dictionary
3589-
3590- :version 5.5.8-20.0: Introduced.
3591- :vartype: Numeric
3592- :scope: Global
3593-
3594-.. variable:: innodb_mem_total
3595-
3596- :version 5.5.8-20.0: Introduced.
3597- :vartype: Numeric
3598- :scope: Global
3599-
3600-.. variable:: innodb_buffer_pool_pages_LRU_flushed
3601-
3602- :version 5.5.8-20.0: Introduced.
3603- :vartype: Numeric
3604- :scope: Global
3605-
3606-.. variable:: innodb_buffer_pool_pages_made_not_young
3607-
3608- :version 5.5.8-20.0: Introduced.
3609- :vartype: Numeric
3610- :scope: Global
3611-
3612-.. variable:: innodb_buffer_pool_pages_made_young
3613-
3614- :version 5.5.8-20.0: Introduced.
3615- :vartype: Numeric
3616- :scope: Global
3617-
3618-.. variable:: innodb_buffer_pool_pages_old
3619-
3620- :version 5.5.8-20.0: Introduced.
3621- :vartype: Numeric
3622- :scope: Global
3623-
3624-TRANSACTIONS
3625-------------
3626-
3627-The following variables contain information in the TRANSACTIONS section of the output from ``SHOW ENGINE INNODB STATUS``. An example of that output is: ::
3628-
3629- ------------
3630- TRANSACTIONS
3631- ------------
3632- Trx id counter F561FD
3633- Purge done for trx's n:o < F561EB undo n:o < 0
3634- History list length 19
3635- LIST OF TRANSACTIONS FOR EACH SESSION:
3636- ---TRANSACTION 0, not started, process no 993, OS thread id 140213152634640
3637- mysql thread id 15933, query id 32109 localhost root
3638- show engine innodb status
3639- ---TRANSACTION F561FC, ACTIVE 29 sec, process no 993, OS thread id 140213152769808 updating or deleting
3640- mysql tables in use 1, locked 1
3641-
3642-.. variable:: innodb_history_list_length
3643-
3644- :version 5.5.8-20.0: Introduced.
3645- :vartype: Numeric
3646- :scope: Global
3647-
3648-.. variable:: innodb_max_trx_id
3649-
3650- :version 5.5.8-20.0: Introduced.
3651- :vartype: Numeric
3652- :scope: Global
3653-
3654-.. variable:: innodb_oldest_view_low_limit_trx_id
3655-
3656- :version 5.5.8-20.0: Introduced.
3657- :vartype: Numeric
3658- :scope: Global
3659-
3660-.. variable:: innodb_purge_trx_id
3661-
3662- :version 5.5.8-20.0: Introduced.
3663- :vartype: Numeric
3664- :scope: Global
3665-
3666-.. variable:: innodb_purge_undo_no
3667-
3668- :version 5.5.8-20.0: Introduced.
3669- :vartype: Numeric
3670- :scope: Global
3671-
3672-.. variable:: innodb_current_row_locks
3673-
3674- :version 5.5.8-20.0: Introduced.
3675- :version 5.5.10-20.1: Renamed.
3676- :vartype: Numeric
3677- :scope: Global
3678-
3679- This variable was named :variable:`innodb_row_lock_numbers` in release 5.5.8-20.0.
3680-
3681-
3682-Other reading
3683-=============
3684-
3685- * `SHOW INNODB STATUS walk through <http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/>`_
3686-
3687- * `Table locks in SHOW INNODB STATUS <http://www.mysqlperformanceblog.com/2010/06/08/table-locks-in-show-innodb-status/>`_
3688
3689=== removed file 'doc/source/diagnostics/innodb_stats.rst'
3690--- doc/source/diagnostics/innodb_stats.rst 2012-06-19 13:40:59 +0000
3691+++ doc/source/diagnostics/innodb_stats.rst 1970-01-01 00:00:00 +0000
3692@@ -1,157 +0,0 @@
3693-.. _innodb_stats:
3694-
3695-=====================
3696- |InnoDB| Statistics
3697-=====================
3698-
3699-This feature provides new startup options (control method and collection of index statistics estimation) and information schema views to confirm the statistics.
3700-
3701-This implements the fix for `MySQL Bug #30423 <http://bugs.mysql.com/bug.php?id=30423>`_.
3702-
3703-Version Specific Information
3704-============================
3705-
3706- * 5.5.8-20.0:
3707- Renamed three fields in table ``INNODB_INDEX_STATS``.
3708-
3709-
3710-System Variables
3711-================
3712-
3713-Four new system variables were introduced by this feature.
3714-
3715-.. variable:: innodb_stats_method
3716-
3717- :cli: YES
3718- :configfile: YES
3719- :scope: GLOBAL
3720- :dyn: YES
3721- :type: STRING
3722- :default: ``nulls_equal``
3723- :allowed: ``nulls_equal``, ``nulls_unequal``, ``nulls_ignored``
3724-
3725-The 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.
3726-
3727-(reference: `MyISAM Index Statistics Collection <http://dev.mysql.com/doc/refman/5.1/en/myisam-index-statistics.html>`_)
3728-
3729-**Note:** Beginning in release 5.1.56-12.7, a variable with the same and functionality was implemented in the upstream |InnoDB|.
3730-
3731-.. variable:: innodb_stats_auto_update
3732-
3733- :type: BOOLEAN
3734- :default: 1
3735-
3736-|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”.
3737-
3738-
3739-.. variable:: innodb_stats_update_need_lock
3740-
3741- :type: BOOLEAN
3742- :default: 1
3743-
3744-If you meet contention of ``&dict_operation_lock``, setting 0 reduces the contention. But 0 disables to update ``Data_free:`` of ``SHOW TABLE STATUS``.
3745-
3746-
3747-.. variable:: innodb_use_sys_stats_table
3748-
3749- :type: BOOLEAN
3750- :default: 0
3751-
3752-
3753-If 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.
3754-
3755-INFORMATION_SCHEMA Tables
3756-=========================
3757-
3758-Two new tables were introduced by this feature.
3759-
3760-.. table:: INFORMATION_SCHEMA.INNODB_TABLE_STATS
3761-
3762- Shows table statistics information of dictionary cached.
3763-
3764- :column table_schema: Database name of the table.
3765- :column table_name: Table name.
3766- :column rows: estimated number of all rows.
3767- :column clust_size: cluster index (table/primary key) size in number of pages.
3768- :column other_size: Other index (non primary key) size in number of pages.
3769- :column modified: Internal counter to judge whether statistics recalculation should be done.
3770-
3771-If 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.
3772-
3773-.. table:: INFORMATION_SCHEMA.INNODB_INDEX_STATS
3774-
3775- Shows index statistics information of dictionary cached.
3776-
3777- :column table_schema: Database name of the table.
3778- :column table_name: Table name.
3779- :column index_name: Index name.
3780- :column fields: How many fields the index key has. (it is internal structure of |InnoDB|, it may be larger than the ``CREATE TABLE``).
3781- :column rows_per_key: Estimate rows per 1 key value. ([1 column value], [2 columns value], [3 columns value], ...).
3782- :column index_total_pages: Number of index pages.
3783- :column index_leaf_pages: Number of leaf pages.
3784-
3785-In releases before 5.5.8-20.0, these fields had different names:
3786-
3787- * ``rows_per_key`` was ``row_per_keys``
3788-
3789- * ``index_total_pages`` was ``index_size``
3790-
3791- * ``index_leaf_pages`` was ``leaf_pages``
3792-
3793-Example
3794-=======
3795-
3796-This example uses the same data to Bug #30423 of |MySQL|.
3797-
3798-``[innodb_stats_method = nulls_equal (default behavior of |InnoDB|)]`` ::
3799-
3800- 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;
3801- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
3802- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
3803- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
3804- | 1 | SIMPLE | orgs | index | NULL | orgs$org_id | 4 | NULL | 128 | Using index |
3805- | 1 | SIMPLE | sa_opportunities | ref | sa_opp$org_id | sa_opp$org_id | 5 | test2.orgs.org_id | 5751 | Using index |
3806- | 1 | SIMPLE | contacts | ref | contacts$org_id | contacts$org_id | 5 | test2.orgs.org_id | 23756 | Using index |
3807- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+-------+-------------+
3808- 3 rows in set (0.00 sec)
3809-
3810-``[innodb_stats_method = nulls_unequal or nulls_ignored]`` ::
3811-
3812- 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;
3813- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
3814- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
3815- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
3816- | 1 | SIMPLE | orgs | index | NULL | orgs$org_id | 4 | NULL | 128 | Using index |
3817- | 1 | SIMPLE | sa_opportunities | ref | sa_opp$org_id | sa_opp$org_id | 5 | test2.orgs.org_id | 1 | Using index |
3818- | 1 | SIMPLE | contacts | ref | contacts$org_id | contacts$org_id | 5 | test2.orgs.org_id | 1 | Using index |
3819- +----+-------------+------------------+-------+-----------------+-----------------+---------+-------------------+------+-------------+
3820- 3 rows in set (0.00 sec)
3821- <example of information_schema>
3822-
3823- mysql> select * from information_schema.innodb_table_stats;
3824- +------------------------+-------+------------+------------+----------+
3825- | table_name | rows | clust_size | other_size | modified |
3826- +------------------------+-------+------------+------------+----------+
3827- | test/sa_opportunities2 | 11175 | 21 | 11 | 0 |
3828- | test/orgs2 | 128 | 1 | 0 | 0 |
3829- | test/contacts2 | 47021 | 97 | 97 | 0 |
3830- +------------------------+-------+------------+------------+----------+
3831- 3 rows in set (0.00 sec)
3832-
3833- mysql> select * from information_schema.innodb_index_stats;
3834- +------------------------+-----------------+--------+--------------+------------+------------+
3835- | table_name | index_name | fields | row_per_keys | index_size | leaf_pages |
3836- +------------------------+-----------------+--------+--------------+------------+------------+
3837- | test/sa_opportunities2 | GEN_CLUST_INDEX | 1 | 1 | 21 | 20 |
3838- | test/sa_opportunities2 | sa_opp$org_id | 2 | 338, 1 | 11| 10 |
3839- | test/orgs2 | orgs$org_id | 1 | 1 | 1 | 1 |
3840- | test/contacts2 | GEN_CLUST_INDEX | 1 | 1 | 97 | 80 |
3841- | test/contacts2 | contacts$org_id | 2 | 516, 0 | 97 | 37 |
3842- +------------------------+-----------------+--------+--------------+------------+------------+
3843- 5 rows in set (0.00 sec)
3844-
3845-Other reading
3846-=============
3847-
3848- * `InnoDB Table/Index stats <http://www.mysqlperformanceblog.com/2010/03/20/|InnoDB|-tableindex-stats/>`_
3849-
3850
3851=== removed file 'doc/source/diagnostics/misc_info_schema_tables.rst'
3852--- doc/source/diagnostics/misc_info_schema_tables.rst 2012-03-12 08:04:08 +0000
3853+++ doc/source/diagnostics/misc_info_schema_tables.rst 1970-01-01 00:00:00 +0000
3854@@ -1,135 +0,0 @@
3855-.. _misc_info_schema_tables:
3856-
3857-=================================
3858- Misc. INFORMATION_SCHEMA Tables
3859-=================================
3860-
3861-This page lists the ``INFORMATION_SCHEMA`` tables added to standard |MySQL| by |Percona Server| that don't exist elsewhere in the documentation.
3862-
3863-Compressed pages in |InnoDB| tables
3864-===================================
3865-
3866-These 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.
3867-
3868-These tables were introduced by the |InnoDB| plugin and you can find the full documentation here.
3869-
3870-.. table:: INFORMATION_SCHEMA.INNODB_CMP
3871-
3872- :column PAGE_SIZE: Page size for compressed pages (Bytes)
3873- :column COMPRESS_OPS: Number of compression operations
3874- :column COMPRESS_OPS_OK: Number of successful compression operations
3875- :column COMPRESS_TIME: Time spent to compress pages (seconds)
3876- :column UNCOMPRESS_OPS: Number of uncompression operations
3877- :column UNCOMPRESS_TIME: Time spent to uncompress pages (seconds)
3878-
3879-.. table:: INFORMATION_SCHEMA.INNODB_CMP_RESET
3880-
3881- :column PAGE_SIZE: Page size for compressed pages (Bytes)
3882- :column COMPRESS_OPS: Number of compression operations
3883- :column COMPRESS_OPS_OK: Number of successful compression operations
3884- :column COMPRESS_TIME: Time spent to compress pages (seconds)
3885- :column UNCOMPRESS_OPS: Number of uncompression operations
3886- :column UNCOMPRESS_TIME: Time spent to uncompress pages (seconds)
3887-
3888-Compressed pages in |InnoDB| buffer pool
3889-========================================
3890-
3891-These 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.
3892-
3893-These tables were introduced by the |InnoDB| plugin and you can find the full documentation here.
3894-
3895-
3896-.. table:: INFORMATION_SCHEMA.INNODB_CMPMEM
3897-
3898- :column PAGE_SIZE: Page size for compressed pages (Bytes)
3899- :column PAGES_USED: Number of pages in use
3900- :column PAGES_FREE: Number of free pages
3901- :column RELOCATION_OPS: Number of relocation operations
3902- :column RELOCATION_TIME: Time spent to relocate pages (Microseconds)
3903-
3904-.. table:: INFORMATION_SCHEMA.INNODB_CMPMEM_RESET
3905-
3906- :column PAGE_SIZE: Page size for compressed pages (Bytes)
3907- :column PAGES_USED: Number of pages in use
3908- :column PAGES_FREE: Number of free pages
3909- :column RELOCATION_OPS: Number of relocation operations
3910- :column RELOCATION_TIME: Time spent to relocate pages (Microseconds)
3911-
3912-|InnoDB| transactions
3913-=====================
3914-
3915-.. table:: INFORMATION_SCHEMA.INNODB_LOCK_WAITS
3916-
3917- :column REQUESTING_TRX_ID:
3918- :column REQUESTED_LOCK_ID:
3919- :column BLOCKING_TRX_ID:
3920- :column BLOCKING_LOCK_ID:
3921-
3922-.. table:: INFORMATION_SCHEMA.INNODB_LOCKS
3923-
3924- :column LOCK_ID: Internal unique lock ID
3925- :column LOCK_TRX_ID: ID of the transaction holding the lock
3926- :column LOCK_MODE: Mode of the lock (shared, exclusive, …)
3927- :column LOCK_TYPE: ``RECORD`` for a record lock and ``TABLE`` for a table lock
3928- :column LOCK_TABLE: Name of the table holding the lock
3929- :column LOCK_INDEX: If lock type is ``RECORD``, name of the index
3930- :column LOCK_SPACE: If lock type is ``RECORD``, tablespace id of the locked record
3931- :column LOCK_PAGE: If lock type is ``RECORD``, page number of the locked record
3932- :column LOCK_REC: If lock type is ``RECORD``, heap number of the locked record
3933- :column LOCK_DATA: If lock type is ``RECORD``, primary key of the locked record
3934-
3935-This 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.
3936-
3937-This table was introduced by the |InnoDB| plugin and you can find the full documentation here.
3938-
3939-.. table:: INFORMATION_SCHEMA.INNODB_TRX
3940-
3941- :column TRX_ID: |InnoDB| internal unique transaction id
3942- :column TRX_STATE: Execution state. Possible values are: ``Running``, ``Lock_wait``, ``Rolling_back``, ``Committing``
3943- :column TRX_STARTED: Transaction start time
3944- :column TRX_REQUESTED_LOCK_ID: Id of the lock the transaction has requested
3945- :column TRX_WAIT_STARTED: Date and time when the transaction started waiting for a lock
3946- :column TRX_WEIGHT: Weight of the transaction, ie approximate number of locked and modified rows
3947- :column TRX_MYSQL_THREAD_ID: Thread id
3948- :column TRX_QUERY: SQL query being executed
3949-
3950-This 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.
3951-
3952-This table was introduced by the |InnoDB| plugin and you can find the full documentation here.
3953-
3954-Temporary tables
3955-================
3956-
3957- 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.
3958-
3959-.. table:: INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES
3960-
3961- :column SESSION_ID: |MySQL| connection id
3962- :column TABLE_SCHEMA: Schema in which the temporary table is created
3963- :column TABLE_NAME: Name of the temporary table
3964- :column ENGINE: Engine of the temporary table
3965- :column NAME: Internal name of the temporary table
3966- :column TABLE_ROWS: Number of rows of the temporary table
3967- :column AVG_ROW_LENGTH: Average row length of the temporary table
3968- :column DATA_LENGTH: Size of the data (Bytes)
3969- :column INDEX_LENGTH: Size of the indexes (Bytes)
3970- :column CREATE_TIME: Date and time of creation of the temporary table
3971- :column UPDATE_TIME: Date and time of the latest update of the temporary table
3972-
3973-This table holds information on the temporary tables existing for all connections. You don't need the ``SUPER`` privilege to query this table.
3974-
3975-.. table:: INFORMATION_SCHEMA.TEMPORARY_TABLES
3976-
3977- :column SESSION_ID: |MySQL| connection id
3978- :column TABLE_SCHEMA: Schema in which the temporary table is created
3979- :column TABLE_NAME: Name of the temporary table
3980- :column ENGINE: Engine of the temporary table
3981- :column NAME: Internal name of the temporary table
3982- :column TABLE_ROWS: Number of rows of the temporary table
3983- :column AVG_ROW_LENGTH: Average row length of the temporary table
3984- :column DATA_LENGTH: Size of the data (Bytes)
3985- :column INDEX_LENGTH: Size of the indexes (Bytes)
3986- :column CREATE_TIME: Date and time of creation of the temporary table
3987- :column UPDATE_TIME: Date and time of the latest update of the temporary table
3988-
3989-This table holds information on the temporary tables existing for the running connection.
3990
3991=== removed file 'doc/source/diagnostics/mysql_syslog.rst'
3992--- doc/source/diagnostics/mysql_syslog.rst 2012-06-04 13:39:55 +0000
3993+++ doc/source/diagnostics/mysql_syslog.rst 1970-01-01 00:00:00 +0000
3994@@ -1,43 +0,0 @@
3995-.. _mysql_syslog:
3996-
3997-======================================
3998- Log All Client Commands (``syslog``)
3999-======================================
4000-
4001-When 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.
4002-
4003-Version Specific Information
4004-============================
4005-
4006- * :rn:`5.5.8-20.0`:
4007- Full functionality available.
4008-
4009-Other Information
4010-=================
4011-
4012- * Author / Origin:
4013- Percona
4014-
4015-Client Variables
4016-================
4017-
4018-.. variable:: syslog
4019-
4020- :cli: Yes
4021- :conf: Yes
4022- :server: No
4023- :scope: Global
4024- :dyn: Yes
4025- :vartype: Boolean
4026- :default: OFF
4027- :range: ON/OFF
4028-
4029-The variable enables (ON)/disables (OFF) logging to syslog.
4030-
4031-
4032-Other Reading
4033-=============
4034-
4035- * http://en.wikipedia.org/wiki/Syslog
4036-
4037- * http://tools.ietf.org/html/rfc5424
4038
4039=== removed file 'doc/source/diagnostics/process_list.rst'
4040--- doc/source/diagnostics/process_list.rst 2011-10-07 23:38:41 +0000
4041+++ doc/source/diagnostics/process_list.rst 1970-01-01 00:00:00 +0000
4042@@ -1,78 +0,0 @@
4043-.. _process_list:
4044-
4045-=============
4046-Process List
4047-=============
4048-
4049-This page describes Percona changes to both the standard |MySQL| ``SHOW PROCESSLIST`` command and the standard |MySQL| ``INFORMATION_SCHEMA`` table ``PROCESSLIST``.
4050-
4051-The changes that have been made as of version 5.5 of the server are:
4052-
4053- * ``SHOW PROCESSLIST`` command:
4054-
4055- * added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
4056-
4057- * ``PROCESSLIST`` table:
4058-
4059- * added columns ``TIME_MS``, ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
4060-
4061-Version Specific Information
4062-============================
4063-
4064- * 5.0.91-22:
4065-
4066- * Added column ``TIME_MS`` to table ``PROCESSLIST``.
4067-
4068- * 5.5.10-20.1:
4069-
4070- * Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ`` to ``SHOW PROCESSLIST`` command.
4071-
4072- * Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ`` to table ``PROCESSLIST``.
4073-
4074-INFORMATION_SCHEMA Tables
4075-=========================
4076-
4077-.. table:: INFORMATION_SCHEMA.PROCESSLIST
4078-
4079- This table implements modifications to the standard |MySQL| ``INFORMATION_SCHEMA`` table ``PROCESSLIST``.
4080-
4081- :column ID: The connection identifier.
4082- :column USER: The |MySQL| user who issued the statement.
4083- :column HOST: The host name of the client issuing the statement.
4084- :column DB: The default database, if one is selected, otherwise NULL.
4085- :column COMMAND: The type of command the thread is executing.
4086- :column TIME: The time in seconds that the thread has been in its current state.
4087- :column STATE: An action, event, or state that indicates what the thread is doing.
4088- :column INFO: The statement that the thread is executing, or NULL if it is not executing any statement.
4089- :column TIME_MS: The time in milliseconds that the thread has been in its current state.
4090- :column ROWS_EXAMINED: The number of rows examined by the statement being executed.
4091- :column ROWS_SENT: The number of rows sent by the statement being executed.
4092- :column ROWS_READ: The number of rows read by the statement being executed.
4093- :version 5.0.91-22: Added column ``TIME_MS``
4094- :version 5.5.10-20.1: Added columns ``ROWS_EXAMINED``, ``ROWS_SENT``, and ``ROWS_READ``
4095-
4096-
4097-Example Output
4098-==============
4099-
4100-``SHOW PROCESSLIST`` Command: ::
4101-
4102- mysql> show processlist;
4103- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
4104- | Id | User | Host | db | Command | Time | State | Info | ROWS_SENT | ROWS_EXAMINED | ROWS_READ |
4105- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
4106- | 2 | root | localhost | test | Query | 0 | NULL | SHOW PROCESSLIST | 0 | 0 | 1 |
4107- | 14 | root | localhost | test | Query | 0 | User lock | SELECT GET_LOCK(``t``,1000) | 0 | 0 | 1 |
4108- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+-----------+---------------+-----------+
4109-
4110-Table :table:`PROCESSLIST`: ::
4111-
4112- mysql> select * from information_schema.PROCESSLIST;
4113- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
4114- | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | TIME_MS | ROWS_EXAMINED | ROWS_SENT | ROWS_READ |
4115- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
4116- | 14 | root | localhost | test | Query | 0 | User lock | SELECT GET_LOCK(``t``,1000) | 1 | 0 | 0 | 1 |
4117- | 2 | root | localhost | test | Query | 0 | executing | SELECT * from INFORMATION_SCHEMA.PROCESSLIST | 0 | 0 | 0 | 1 |
4118- +------+-----------+-----------+--------+---------+------+------------+----------------------------------------------+----------+---------------+-----------+-----------+
4119-
4120-
4121
4122=== removed file 'doc/source/diagnostics/response_time_distribution.rst'
4123--- doc/source/diagnostics/response_time_distribution.rst 2012-02-13 08:49:21 +0000
4124+++ doc/source/diagnostics/response_time_distribution.rst 1970-01-01 00:00:00 +0000
4125@@ -1,266 +0,0 @@
4126-.. _response_time_distribution:
4127-
4128-============================
4129- Response Time Distribution
4130-============================
4131-
4132-The 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.
4133-
4134-Note 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.
4135-
4136-The 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.
4137-
4138-Each interval is described as: ::
4139-
4140-(range_base ^ n; range_base ^ (n+1)]
4141-
4142-The range_base is some positive number (see Limitations). The interval is defined as the difference between two nearby powers of the range base.
4143-
4144-For example, if the range base=10, we have the following intervals: ::
4145-
4146- (0; 10 ^ -6], (10 ^ -6; 10 ^ -5], (10 ^ -5; 10 ^ -4], ..., (10 ^ -1; 10 ^1], (10^1; 10^2]...(10^7; positive infinity]
4147-
4148-or ::
4149-
4150- (0; 0.000001], (0.000001; 0.000010], (0.000010; 0.000100], ..., (0.100000; 1.0]; (1.0; 10.0]...(1000000; positive infinity]
4151-
4152-For each interval, a count is made of the queries with execution times that fell into that interval.
4153-
4154-You can select the range of the intervals by changing the range base. For example, for base range=2 we have the following intervals: ::
4155-
4156- (0; 2 ^ -19], (2 ^ -19; 2 ^ -18], (2 ^ -18; 2 ^ -17], ..., (2 ^ -1; 2 ^1], (2 ^ 1; 2 ^ 2]...(2 ^ 25; positive infinity]
4157-
4158-or ::
4159-
4160- (0; 0.000001], (0.000001, 0.000003], ..., (0.25; 0.5], (0.5; 2], (2; 4]...(8388608; positive infinity]
4161-
4162-Small 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.
4163-
4164-For example, you may see: ::
4165-
4166- +----------------+-------+------------+
4167- | time | count | total |
4168- +----------------+-------+------------|
4169- | 0.000001 | 0 | 0.000000 |
4170- | 0.000010 | 17 | 0.000094 |
4171- | 0.000100 | 4301 | 0.236555 |
4172- | 0.001000 | 1499 | 0.824450 |
4173- | 0.010000 | 14851 | 81.680502 |
4174- | 0.100000 | 8066 | 443.635693 |
4175- | 1.000000 | 0 | 0.000000 |
4176- | 10.000000 | 0 | 0.000000 |
4177- | 100.000000 | 1 | 55.937094 |
4178- | 1000.000000 | 0 | 0.000000 |
4179- | 10000.000000 | 0 | 0.000000 |
4180- | 100000.000000 | 0 | 0.000000 |
4181- | 1000000.000000 | 0 | 0.000000 |
4182- | TOO LONG QUERY | 0 | 0.000000 |
4183- +----------------+-------+------------+
4184-
4185-This means there were: ::
4186-
4187- * 17 queries with 0.000001 < query execution time < = 0.000010 seconds; total execution time of the 17 queries = 0.000094 seconds
4188-
4189- * 4301 queries with 0.000010 < query execution time < = 0.000100 seconds; total execution time of the 4301 queries = 0.236555 seconds
4190-
4191- * 1499 queries with 0.000100 < query execution time < = 0.001000 seconds; total execution time of the 1499 queries = 0.824450 seconds
4192-
4193- * 14851 queries with 0.001000 < query execution time < = 0.010000 seconds; total execution time of the 14851 queries = 81.680502 seconds
4194-
4195- * 8066 queries with 0.010000 < query execution time < = 0.100000 seconds; total execution time of the 8066 queries = 443.635693 seconds
4196-
4197- * 1 query with 10.000000 < query execution time < = 100.0000 seconds; total execution time of the 1 query = 55.937094 seconds
4198-
4199-Usage
4200-=====
4201-
4202-SELECT
4203-------
4204-
4205-You can get the distribution using the query: ::
4206-
4207- > SELECT * from INFORMATION_SCHEMA.QUERY_RESPONSE_TIME
4208- time count total
4209- 0.000001 0 0.000000
4210- 0.000010 0 0.000000
4211- 0.000100 1 0.000072
4212- 0.001000 0 0.000000
4213- 0.010000 0 0.000000
4214- 0.100000 0 0.000000
4215- 1.000000 0 0.000000
4216- 10.000000 8 47.268416
4217- 100.000000 0 0.000000
4218- 1000.000000 0 0.000000
4219- 10000.000000 0 0.000000
4220- 100000.000000 0 0.000000
4221- 1000000.000000 0 0.000000
4222- TOO LONG QUERY 0 0.000000
4223-
4224-You can write a complex query like: ::
4225-
4226- SELECT c.count, c.time,
4227- (SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
4228- (SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
4229- (SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
4230- FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
4231-
4232-**Note:** If :variable:`query_response_time_stats` is ON, the execution times for these two ``SELECT`` queries will also be collected.
4233-
4234-SHOW
4235-----
4236-
4237-Also, you can use this syntax: ::
4238-
4239- > SHOW QUERY_RESPONSE_TIME;
4240- time count total
4241- 0.000001 0 0.000000
4242- 0.000010 0 0.000000
4243- 0.000100 1 0.000072
4244- 0.001000 0 0.000000
4245- 0.010000 0 0.000000
4246- 0.100000 0 0.000000
4247- 1.000000 0 0.000000
4248- 10.000000 8 47.268416
4249- 100.000000 0 0.000000
4250- 1000.000000 0 0.000000
4251- 10000.000000 0 0.000000
4252- 100000.000000 0 0.000000
4253- 1000000.000000 0 0.000000
4254- TOO LONG QUERY 0 0.000000
4255-
4256-**Note:** The execution time for the SHOW query will also be collected.
4257-
4258-FLUSH
4259------
4260-
4261-Flushing can be done with: ::
4262-
4263- FLUSH QUERY_RESPONSE_TIME;
4264-
4265-``FLUSH`` does two things:
4266-
4267- * Clears the collected times from the :table:`QUERY_RESPONSE_TIME` table
4268-
4269- * Reads the value of :variable:`query_response_time_range_base` and uses it to set the range base for the table
4270-
4271-**Note:** The execution time for the ``FLUSH`` query will also be collected.
4272-
4273-Stored procedures
4274------------------
4275-
4276-Stored procedure calls count as single query.
4277-
4278-Collect time point
4279-------------------
4280-
4281-Time is collected after query execution completes (before clearing data structures).
4282-
4283-Limitations
4284-===========
4285-
4286- * ``String width for seconds``
4287-
4288- * Value: 7
4289-
4290- * Compile-time variable: ``QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH``
4291-
4292- * ``String width for microseconds``
4293-
4294- * Value: 6
4295-
4296- * Compile-time variable: ``QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH``
4297-
4298- * Minimum range base
4299-
4300- * Value: 2
4301-
4302- * Compile-time variable: ``QUERY_RESPONSE_TIME_MINIMUM_BASE``
4303-
4304- * Minimum range base
4305-
4306- * Value: 1000
4307-
4308- * Compile-time variable: ``QUERY_RESPONSE_TIME_MAXIMUM_BASE``
4309-
4310- * Minimum time interval
4311-
4312- * Value: 1 microsecond
4313-
4314- * Maximum time interval
4315-
4316- * Value: 9999999 seconds
4317-
4318-Version Specific Information
4319-============================
4320-
4321- * 5.5.8-20.0:
4322- Introduced variable variable:`have_response_time_distribution`.
4323-
4324- * 5.5.8-20.0:
4325- Introduced variable variable:`query_response_time_stats`.
4326-
4327-System Variables
4328-================
4329-
4330-.. variable:: have_response_time_distribution
4331-
4332- :version 5.5.8-20.0: Introduced.
4333- :scope: Global
4334- :dyn: No
4335- :vartype: Boolean
4336- :default: YES
4337- :range: YES/NO
4338-
4339-Contains 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.
4340-
4341-
4342-.. variable:: query_response_time_range_base
4343-
4344- :cli: Yes
4345- :conf: Yes
4346- :scope: Global
4347- :dyn: Yes
4348- :vartype: Numeric
4349- :default: 10
4350- :range: 2-1000
4351-
4352-Sets up the logarithm base for the scale.
4353-
4354-**Note:** The variable takes effect only after this command has been executed: ::
4355-
4356- FLUSH QUERY_RESPONSE_TIME;
4357-
4358-.. variable:: query_response_time_stats
4359-
4360- :version 5.5.8-20.0: Introduced.
4361- :cli: Yes
4362- :conf: Yes
4363- :scope: Global
4364- :dyn: Yes
4365- :vartype: Boolean
4366- :default: OFF
4367- :range: ON/OFF
4368-
4369-This 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``.
4370-
4371- Prior to release 5.5.8-20.0, this variable was named :variable:`enable_query_response_time_stats`.
4372-
4373-
4374-INFORMATION_SCHEMA Tables
4375-=========================
4376-
4377-.. table:: INFORMATION_SCHEMA.QUERY_RESPONSE_TIME
4378-
4379- :column VARCHAR TIME:
4380- :column INT(11) COUNT:
4381- :column VARCHAR TOTAL:
4382-
4383-Implementation Details
4384-======================
4385-
4386-Implementation details on this feature are provided here.
4387-
4388-Related Reading
4389-===============
4390-
4391- * `Blueprint about Response Time Distribution <https://blueprints.launchpad.net/percona-server/+spec/response-time-distribution>`_
4392
4393=== removed file 'doc/source/diagnostics/show_engines.rst'
4394--- doc/source/diagnostics/show_engines.rst 2012-02-13 08:49:21 +0000
4395+++ doc/source/diagnostics/show_engines.rst 1970-01-01 00:00:00 +0000
4396@@ -1,40 +0,0 @@
4397-.. _show_engines:
4398-
4399-======================
4400- Show Storage Engines
4401-======================
4402-
4403-This feature changes the comment field displayed when the ``SHOW STORAGE ENGINES`` command is executed and |XtraDB| is the storage engine.
4404-
4405-Before the Change: ::
4406-
4407- mysql> show storage engines;
4408- +------------+---------+----------------------------------------------------------------+--------------+------+------------+
4409- | Engine | Support | Comment | Transactions | XA | Savepoints |
4410- +------------+---------+----------------------------------------------------------------+--------------+------+------------+
4411- | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
4412- ...
4413- +------------+---------+----------------------------------------------------------------+--------------+------+------------+
4414-
4415-After the Change: ::
4416-
4417- mysql> show storage engines;
4418- +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
4419- | Engine | Support | Comment | Transactions | XA | Savepoints |
4420- +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
4421- | InnoDB | YES | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
4422- ...
4423- +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
4424-
4425-Version-Specific Information
4426-============================
4427-
4428- * 5.5.8-20.0:
4429- Full functionality available.
4430-
4431-Other Information
4432-=================
4433-
4434- * Author / Origin:
4435- Percona
4436-
4437
4438=== removed file 'doc/source/diagnostics/slow_extended_55.rst'
4439--- doc/source/diagnostics/slow_extended_55.rst 2012-08-03 08:58:37 +0000
4440+++ doc/source/diagnostics/slow_extended_55.rst 1970-01-01 00:00:00 +0000
4441@@ -1,376 +0,0 @@
4442-.. _slow_extended_55:
4443-
4444-================
4445- Slow Query Log
4446-================
4447-
4448-This 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.
4449-
4450-The 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|.
4451-
4452-You can use Percona-Toolkit's pt-query-digest tool to aggregate similar queries together and report on those that consume the most execution time.
4453-
4454-
4455-Version Specific Information
4456-============================
4457-
4458- * 5.5.8-20.0:
4459- Added values ``profiling`` and ``profiling_use_getrusage`` to variable log_slow_verbosity.
4460-
4461- * 5.5.10-20.1:
4462- * Renamed variable :variable:`slow_query_log_timestamp_always` to :variable:`slow_query_log_timestamp_always`.
4463-
4464- * Renamed variable :variable:`slow_query_log_microseconds_timestamp` to :variable:`slow_query_log_timestamp_precision`.
4465-
4466- * Renamed variable :variable:`use_global_log_slow_control` to :variable:`slow_query_log_use_global_control`.
4467-
4468-Other Information
4469-=================
4470-
4471- * Author / Origin:
4472- Maciej Dobrzanski, Percona
4473-
4474-System Variables
4475-================
4476-
4477-.. variable:: log_slow_filter
4478-
4479- :cli: Yes
4480- :conf: Yes
4481- :scope: Global, Session
4482- :dyn: Yes
4483-
4484-Filters 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:
4485-
4486- * ``qc_miss``:
4487- The query was not found in the query cache.
4488-
4489- * ``full_scan``:
4490- The query performed a full table scan.
4491-
4492- * ``full_join``:
4493- The query performed a full join (a join without indexes).
4494-
4495- * ``tmp_table``:
4496- The query created an implicit internal temporary table.
4497-
4498- * ``tmp_table_on_disk``:
4499- The query``s temporary table was stored on disk.
4500-
4501- * ``filesort``:
4502- The query used a filesort.
4503-
4504- * ``filesort_on_disk``:
4505- The filesort was performed on disk.
4506-
4507-Values 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.
4508-
4509-For 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``.
4510-
4511-.. variable:: log_slow_rate_type
4512-
4513- :cli: Yes
4514- :conf: Yes
4515- :scope: Global
4516- :dyn: Yes
4517- :vartype: Enumerated
4518- :default: ``session``
4519- :range: ``session``, ``query``
4520-
4521-Specifies semantic of :variable:`log_slow_rate_limit` - ``session`` or ``query``.
4522-
4523-.. variable:: log_slow_rate_limit
4524-
4525- :cli: Yes
4526- :conf: Yes
4527- :scope: Global, session
4528- :dyn: Yes
4529-
4530-Behavior of this variable depends from :variable:`log_slow_rate_type`.
4531-
4532-Specifies 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.
4533-
4534-Logging all queries might consume I/O bandwidth and cause the log file to grow large.
4535- * 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.
4536-
4537- * 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.
4538-
4539-Note that every query has global unique ``query_id`` and every connection can has it own (session) :variable:`log_slow_rate_limit`.
4540-Decision "log or no" calculated in following manner:
4541-
4542- * if ``log_slow_rate_limit`` is 0 - log every query
4543-
4544- * If ``log_slow_rate_limit`` > 0 - log query when (``query_id`` % ``log_slow_rate_limit``) is zero.
4545-
4546-This allows flexible setup logging behavior.
4547-
4548-For example, if you set the value to 100, then one percent of ``sessions/queries`` will be logged.
4549-
4550-.. variable:: log_slow_slave_statements
4551-
4552- :cli: Yes
4553- :conf: Yes
4554- :scope: Global, session
4555- :dyn: Yes (in 5.1 releases only)
4556-
4557-Specifies 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.
4558-
4559-To 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.
4560-
4561-To 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.
4562-
4563-
4564-.. variable:: log_slow_sp_statements
4565-
4566- :cli: Yes
4567- :conf: Yes
4568- :scope: Global
4569- :dyn: Yes
4570- :vartype: Boolean
4571- :default: TRUE
4572- :range: TRUE/FALSE
4573-
4574-If ``TRUE``, statements executed by stored procedures are logged to the slow if it is open.
4575-
4576-.. variable:: log_slow_verbosity
4577-
4578- :cli: Yes
4579- :conf: Yes
4580- :scope: Global, session
4581- :dyn: Yes
4582- :version 5.5.8-20.0: Added ``profiling`` and ``profiling_use_getrusage``
4583-
4584-Specifies 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:
4585-
4586- * ``microtime``:
4587- Log queries with microsecond precision (mandatory).
4588-
4589- * ``query_plan``:
4590- Log information about the query``s execution plan (optional).
4591-
4592- * ``innodb``:
4593- Log |InnoDB| statistics (optional).
4594-
4595- * ``full``:
4596- Equivalent to all other values OR``ed together.
4597-
4598- * ``profiling``:
4599- Enables profiling of all queries in all connections.
4600-
4601- * ``profiling_use_getrusage``:
4602- Enables usage of the getrusage function.
4603-
4604-Values are OR``ed together.
4605-
4606-For 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``.
4607-
4608-.. variable:: long_query_time
4609-
4610- :cli: Yes
4611- :conf: Yes
4612- :scope: Global, session
4613- :dyn: Yes
4614-
4615-Specifies 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:
4616-
4617-The option accepts fractional values. If set to 0.5, for example, queries longer than 1/2 second will be logged.
4618-
4619-Before version 1.01 of this feature, the value was an integer, and the unit of time was microseconds, not seconds.
4620-
4621-.. variable:: slow_query_log_timestamp_always
4622-
4623- :cli: Yes
4624- :conf: Yes
4625- :scope: Global
4626- :dyn: Yes
4627- :vartype: Boolean
4628- :default: FALSE
4629- :range: TRUE/FALSE
4630- :version 5.5.10-20.1: Introduced (renamed from :variable:`log_slow_timestamp_every`)
4631-
4632-If ``TRUE``, a timestamp is printed on every slow log record. Multiple records may have the same time.
4633-
4634-**NOTE:** This variable has been renamed from log_slow_timestamp_every since 5.5.10-20.1.
4635-
4636-.. variable:: slow_query_log_timestamp_precision
4637-
4638- :version 5.5.10-20.1: Introduced (renamed from ``slow_query_log_microseconds_timestamp``)
4639- :cli: Yes
4640- :conf: Yes
4641- :scope: Global
4642- :dyn: Yes
4643- :vartype: Enumerated
4644- :default: ``second``
4645- :range: ``second``, ``microsecond``
4646-
4647-Normally, entries to the slow query log are in seconds precision, in this format: ::
4648-
4649- # Time: 090402 9:23:36 # User@Host: XXX @ XXX [10.X.X.X]
4650-
4651-If :variable:`slow_query_log_timestamp_precision` ``=microsecond``, entries to the slow query log are in microsecond precision, in this format: ::
4652-
4653- # Time: 090402 9:23:36.123456 # User@Host: XXX @ XXX [10.X.X.X]
4654-
4655-**NOTE:** This variable has been renamed from :variable:`slow_query_log_microseconds_timestamp` since 5.5.10-20.1.
4656-
4657-
4658-.. variable:: slow_query_log_use_global_control
4659-
4660- :cli: Yes
4661- :conf: Yes
4662- :scope: Global
4663- :dyn: Yes
4664- :default: None
4665- :version 5.5.10-20.1: Introduced (renamed from :variable:`log_slow_timestamp_every`)
4666-
4667-Specifies which variables have global scope instead of local. Value is a "flag" variable - you can specify multiple values separated by commas
4668-
4669- * ``none``:
4670- All variables use local scope
4671-
4672- * ``log_slow_filter``:
4673- Global variable :variable:`log_slow_filter` has effect (instead of local)
4674-
4675- * ``log_slow_rate_limit``:
4676- Global variable :variable:`log_slow_rate_limit` has effect (instead of local)
4677-
4678- * ``log_slow_verbosity``:
4679- Global variable :variable:`log_slow_verbosity` has effect (instead of local)
4680-
4681- * ``long_query_time``:
4682- Global variable :variable:`long_query_time` has effect (instead of local)
4683-
4684- * ``min_examined_row_limit``:
4685- Global variable ``min_examined_row_limit`` has effect (instead of local)
4686-
4687- * ``all``
4688- Global variables has effect (instead of local)
4689-
4690-**NOTE:** This variable has been renamed from :variable:`log_slow_timestamp_every` since 5.5.10-20.1.
4691-
4692-
4693-Other Information
4694-=================
4695-
4696-Changes to the Log Format
4697--------------------------
4698-
4699-The feature adds more information to the slow log output. Here is a sample log entry: ::
4700-
4701- # User@Host: mailboxer[mailboxer] @ [192.168.10.165]
4702- # Thread_id: 11167745 Schema: board
4703- # QC_Hit: No Full_scan: No Full_join: No Tmp_table: Yes Disk_tmp_table: No
4704- # Filesort: Yes Disk_filesort: No Merge_passes: 0
4705- # Query_time: 0.000659 Lock_time: 0.000070 Rows_sent: 0 Rows_examined: 30 Rows_affected: 0 Rows_read: 30
4706- # innodb_IO_r_ops: 1 innodb_IO_r_bytes: 16384 innodb_IO_r_wait: 0.028487
4707- # innodb_rec_lock_wait: 0.000000 innodb_queue_wait: 0.000000
4708- # innodb_pages_distinct: 5
4709- select count(distinct author_id) from art87.article87 force index (forum_id) where forum_id = 240215 and thread_id = ``710575``
4710-
4711-Another example (:variable:`log_slow_verbosity` ``=profiling``): ::
4712-
4713- # Query_time: 4.555235 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0 Rows_read: 1
4714- # 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
4715- # Profile_total: 4.555405 Profile_total_cpu: 0.000000
4716- insert into teee4 select * from teee4 limit 10000000;
4717-
4718-Connection and Schema Identifier
4719---------------------------------
4720-
4721-Each 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.
4722-
4723-Each entry also contains a schema name, so you can trace all the queries whose default database was set to a particular schema. ::
4724-
4725- # Thread_id: 11167745 Schema: board
4726-
4727-Microsecond Time Resolution and Extra Row Information
4728------------------------------------------------------
4729-
4730-This is the original functionality offered by the ``microslow`` feature. ``Query_time`` and ``Lock_time`` are logged with microsecond resolution.
4731-
4732-The 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, ::
4733-
4734- # Query_time: 0.000659 Lock_time: 0.000070 Rows_sent: 0 Rows_examined: 30 Rows_affected: 0 Rows_read: 30
4735-
4736-Values and context:
4737-
4738- * ``Rows_examined``:
4739- Number of rows scanned - ``SELECT``
4740-
4741- * ``Rows_affected``:
4742- Number of rows changed - ``UPDATE``, ``DELETE``, ``INSERT``
4743-
4744- * ``Rows_read``:
4745- Number of rows read - ``UPDATE``, ``DELETE``, ``INSERT``
4746-
4747-Memory Footprint
4748-----------------
4749-
4750-The 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. ::
4751-
4752- # Bytes_sent: 8053 Tmp_tables: 1 Tmp_disk_tables: 0 Tmp_table_sizes: 950528
4753-
4754-Values and context:
4755-
4756- * ``Bytes_sent``:
4757- The amount of bytes sent for the result of the query
4758-
4759- * ``Tmp_tables``:
4760- Number of temporary tables created on memory for the query
4761-
4762- * ``Tmp_disk_tables``:
4763- Number of temporary tables created on disk for the query
4764-
4765- * ``Tmp_table_sizes``:
4766- Total Size in bytes for all temporary tables used in the query
4767-
4768-
4769-Query Plan Information
4770-----------------------
4771-
4772-Each 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. ::
4773-
4774- # QC_Hit: No Full_scan: No Full_join: No Tmp_table: Yes Disk_tmp_table: No
4775- # Filesort: Yes Disk_filesort: No Merge_passes: 0
4776-
4777-The values and their meanings are documented with the :variable:`log_slow_filter` option.
4778-
4779-|InnoDB| Usage Information
4780---------------------------
4781-
4782-The 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. ::
4783-
4784- # innodb_IO_r_ops: 1 innodb_IO_r_bytes: 16384 innodb_IO_r_wait: 0.028487
4785- # innodb_rec_lock_wait: 0.000000 innodb_queue_wait: 0.000000
4786- # innodb_pages_distinct: 5
4787-
4788-Values:
4789-
4790- * ``innodb_IO_r_ops``:
4791- 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.
4792-
4793- * ``innodb_IO_r_bytes``:
4794- Similar to innodb_IO_r_ops, but the unit is bytes.
4795-
4796- * ``innodb_IO_r_wait``:
4797- Shows how long (in seconds) it took |InnoDB| to actually read the data from storage.
4798-
4799- * ``innodb_rec_lock_wait``:
4800- Shows how long (in seconds) the query waited for row locks.
4801-
4802- * ``innodb_queue_wait``:
4803- Shows how long (in seconds) the query spent either waiting to enter the |InnoDB| queue or inside that queue waiting for execution.
4804-
4805- * ``innodb_pages_distinct``:
4806- 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.
4807-
4808-If the query did not use |InnoDB| tables, that information is written into the log instead of the above statistics.
4809-
4810-Related Reading
4811-===============
4812-
4813- * `Impact of logging on MySQL's performance <http://www.mysqlperformanceblog.com/2009/02/10/impact-of-logging-on-mysql%E2%80%99s-performance/>`_
4814-
4815- * `log_slow_filter Usage <http://www.mysqlperformanceblog.com/2008/09/22/finding-what-created_tmp_disk_tables-with-log_slow_filter/>`_
4816-
4817- * `Blueprint in Launchpad <https://blueprints.launchpad.net/percona-server/+spec/microseconds-in-query-log>`_
4818
4819=== removed file 'doc/source/diagnostics/thread_based_profiling.rst'
4820--- doc/source/diagnostics/thread_based_profiling.rst 2012-07-18 08:43:52 +0000
4821+++ doc/source/diagnostics/thread_based_profiling.rst 1970-01-01 00:00:00 +0000
4822@@ -1,17 +0,0 @@
4823-.. _thread_based_profiling:
4824-
4825-=========================
4826- Thread Based Profiling
4827-=========================
4828-
4829-|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.
4830-
4831-Thread 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.
4832-
4833-This feature is enabled by default if your system supports it, in other cases it uses process based profiling.
4834-
4835-Version Specific Information
4836-============================
4837-
4838- * :rn:`5.5.25a-27.1`:
4839- Thread based profiling introduced
4840
4841=== removed file 'doc/source/diagnostics/user_stats.rst'
4842--- doc/source/diagnostics/user_stats.rst 2012-05-21 16:25:24 +0000
4843+++ doc/source/diagnostics/user_stats.rst 1970-01-01 00:00:00 +0000
4844@@ -1,251 +0,0 @@
4845-.. _user_stats:
4846-
4847-=================
4848- User Statistics
4849-=================
4850-
4851-This 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.
4852-
4853-The 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.
4854-
4855-
4856-Version Specific Information
4857-============================
4858-
4859- * :rn:`5.5.10-20.1`:
4860- Renamed variable :variable:`userstat_running` to :variable:`userstat`.
4861- * :rn:`5.5.24-26.0`:
4862- TOTAL_CONNECTIONS_SSL column has been added to CLIENT_STATISTICS, THREAD_STATISTICS and USER_STATISTICS tables
4863-
4864-Other Information
4865-=================
4866-
4867- * Author/Origin:
4868- *Google*; *Percona* added the ``INFORMATION_SCHEMA`` tables and the :variable:`userstat_running` variable.
4869-
4870-System Variables
4871-================
4872-
4873-.. variable:: userstat_running
4874-
4875- :version 5.5.10-20.1: Renamed to :variable:`userstat`
4876- :cli: Yes
4877- :conf: Yes
4878- :scope: Global
4879- :dyn: Yes
4880- :vartype: BOOLEAN
4881- :default: OFF
4882- :range: ON/OFF
4883-
4884-Enables 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.
4885-
4886-
4887-INFORMATION_SCHEMA Tables
4888-=========================
4889-
4890-.. table:: INFORMATION_SCHEMA.CLIENT_STATISTICS
4891-
4892- :column CLIENT: The IP address or hostname from which the connection originated.
4893- :column TOTAL_CONNECTIONS: The number of connections created for this client.
4894- :column CONCURRENT_CONNECTIONS: The number of concurrent connections for this client.
4895- :column CONNECTED_TIME: The cumulative number of seconds elapsed while there were connections from this client.
4896- :column BUSY_TIME: The cumulative number of seconds there was activity on connections from this client.
4897- :column CPU_TIME: The cumulative CPU time elapsed, in seconds, while servicing this client``s connections.
4898- :column BYTES_RECEIVED: The number of bytes received from this client's connections.
4899- :column BYTES_SENT: The number of bytes sent to this client's connections.
4900- :column BINLOG_BYTES_WRITTEN: The number of bytes written to the binary log from this client's connections.
4901- :column ROWS_FETCHED: The number of rows fetched by this client's connections.
4902- :column ROWS_UPDATED: The number of rows updated by this client's connections.
4903- :column TABLE_ROWS_READ: The number of rows read from tables by this client's connections. (It may be different from ``ROWS_FETCHED``.)
4904- :column SELECT_COMMANDS: The number of ``SELECT`` commands executed from this client's connections.
4905- :column UPDATE_COMMANDS: The number of ``UPDATE`` commands executed from this client's connections.
4906- :column OTHER_COMMANDS: The number of other commands executed from this client's connections.
4907- :column COMMIT_TRANSACTIONS: The number of ``COMMIT`` commands issued by this client's connections.
4908- :column ROLLBACK_TRANSACTIONS: The number of ``ROLLBACK`` commands issued by this client's connections.
4909- :column DENIED_CONNECTIONS: The number of connections denied to this client.
4910- :column LOST_CONNECTIONS: The number of this client's connections that were terminated uncleanly.
4911- :column ACCESS_DENIED: The number of times this client's connections issued commands that were denied.
4912- :column EMPTY_QUERIES: The number of times this client's connections sent empty queries to the server.
4913- :column TOTAL_CONNECTIONS_SSL: The number of times this client's connections connected using SSL to the server.
4914-
4915-
4916-This 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.
4917-
4918-Example: ::
4919-
4920- mysql> SELECT * FROM INFORMATION_SCHEMA.CLIENT_STATISTICS\G
4921- *************************** 1. row ***************************
4922- CLIENT: 10.1.12.30
4923- TOTAL_CONNECTIONS: 20
4924- CONCURRENT_CONNECTIONS: 0
4925- CONNECTED_TIME: 0
4926- BUSY_TIME: 93
4927- CPU_TIME: 48
4928- BYTES_RECEIVED: 5031
4929- BYTES_SENT: 276926
4930- BINLOG_BYTES_WRITTEN: 217
4931- ROWS_FETCHED: 81
4932- ROWS_UPDATED: 0
4933- TABLE_ROWS_READ: 52836023
4934- SELECT_COMMANDS: 26
4935- UPDATE_COMMANDS: 1
4936- OTHER_COMMANDS: 145
4937- COMMIT_TRANSACTIONS: 1
4938- ROLLBACK_TRANSACTIONS: 0
4939- DENIED_CONNECTIONS: 0
4940- LOST_CONNECTIONS: 0
4941- ACCESS_DENIED: 0
4942- EMPTY_QUERIES: 0
4943- TOTAL_CONNECTIONS_SSL: 0
4944-
4945-
4946-.. table:: INFORMATION_SCHEMA.INDEX_STATISTICS
4947-
4948- :column TABLE_SCHEMA: The schema (database) name.
4949- :column TABLE_NAME: The table name.
4950- :column INDEX_NAME: The index name (as visible in ``SHOW CREATE TABLE``).
4951- :column ROWS_READ: The number of rows read from this index.
4952-
4953-This 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.
4954-
4955-This 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.
4956-
4957-Example: ::
4958-
4959- mysql> SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS
4960- WHERE TABLE_NAME='tables_priv';
4961- +--------------+-----------------------+--------------------+-----------+
4962- | TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
4963- +--------------+-----------------------+--------------------+-----------+
4964- | mysql | tables_priv | PRIMARY | 2 |
4965- +--------------+-----------------------+--------------------+-----------+
4966-
4967-
4968-
4969-.. table:: INFORMATION_SCHEMA.TABLE_STATISTICS
4970-
4971- :column TABLE_SCHEMA: The schema (database) name.
4972- :column TABLE_NAME: The table name.
4973- :column ROWS_READ: The number of rows read from the table.
4974- :column ROWS_CHANGED: The number of rows changed in the table.
4975- :column ROWS_CHANGED_X_INDEXES: The number of rows changed in the table, multiplied by the number of indexes changed.
4976-
4977-This table is similar in function to the ``INDEX_STATISTICS`` table.
4978-
4979-Example: ::
4980-
4981- mysql> SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS
4982- WHERE TABLE_NAME=``tables_priv``;
4983- +--------------+-------------------------------+-----------+--------------+------------------------+
4984- | TABLE_SCHEMA | TABLE_NAME | ROWS_READ | ROWS_CHANGED | ROWS_CHANGED_X_INDEXES |
4985- +--------------+-------------------------------+-----------+--------------+------------------------+
4986- | mysql | tables_priv | 2 | 0 | 0 |
4987- +--------------+-------------------------------+-----------+--------------+------------------------+
4988-
4989-
4990-.. table:: INFORMATION_SCHEMA.THREAD_STATISTICS
4991-
4992- :column THREAD_ID: int(21)
4993- :column TOTAL_CONNECTIONS: int(21)
4994- :column CONCURRENT_CONNECTIONS: int(21)
4995- :column CONNECTED_TIME: int(21)
4996- :column BUSY_TIME: int(21)
4997- :column CPU_TIME: int(21)
4998- :column BYTES_RECEIVED: int(21)
4999- :column BYTES_SENT: int(21)
5000- :column BINLOG_BYTES_WRITTEN: int(21)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches