Merge lp:~hrvojem/percona-server/bug898333 into lp:percona-server/5.5

Proposed by Hrvoje Matijakovic
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 210
Proposed branch: lp:~hrvojem/percona-server/bug898333
Merge into: lp:percona-server/5.5
Diff against target: 328 lines (+144/-90)
7 files modified
doc/source/conf.py (+2/-0)
doc/source/development.rst (+1/-11)
doc/source/glossary.rst (+21/-12)
doc/source/index.rst (+2/-1)
doc/source/management/innodb_extended_fast_index_creation.rst (+82/-0)
doc/source/performance/innodb_lazy_drop_table.rst (+36/-0)
doc/source/performance/innodb_purge_thread.rst (+0/-66)
To merge this branch: bzr merge lp:~hrvojem/percona-server/bug898333
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+90671@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Hrvoje,

Please remove this:

> +Delaying foreign key creation does not introduce any additional risks, as :command:`mysqldump` always prepends its output with ``SET FOREIGN_KEY_CHECKS=0`` anyway.

Since adding/dropping foreign keys forces table rebuilding, it doesn't make sense to delay them. I fixed this after the original docs were written.

Otherwise looks good to me.

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

OK to merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/source/conf.py'
--- doc/source/conf.py 2011-10-07 23:38:41 +0000
+++ doc/source/conf.py 2012-01-30 16:47:24 +0000
@@ -98,6 +98,8 @@
9898
99.. |XtraDB| replace:: *XtraDB*99.. |XtraDB| replace:: *XtraDB*
100100
101.. |Jenkins| replace:: :term:`Jenkins`
102
101.. |InnoDB| replace:: *InnoDB*103.. |InnoDB| replace:: *InnoDB*
102104
103.. |MyISAM| replace:: *MyISAM*105.. |MyISAM| replace:: *MyISAM*
104106
=== modified file 'doc/source/development.rst'
--- doc/source/development.rst 2012-01-25 14:53:47 +0000
+++ doc/source/development.rst 2012-01-30 16:47:24 +0000
@@ -15,7 +15,7 @@
15(allowing for a release at any time) and minimizing wasted time by15(allowing for a release at any time) and minimizing wasted time by
16developers due to broken code from somebody else interfering with their day.16developers due to broken code from somebody else interfering with their day.
1717
18You should also be familiar with our :ref:`Jenkin` setup.18You should also be familiar with our |Jenkins| setup.
1919
20Overview20Overview
21~~~~~~~~21~~~~~~~~
@@ -163,19 +163,9 @@
163This way anybody can easily check out an old release by just using bzr163This way anybody can easily check out an old release by just using bzr
164to branch the specific tag.164to branch the specific tag.
165165
166
167.. _Jenkin:
168
169Jenkins166Jenkins
170=======167=======
171168
172`Jenkins <http://www.jenkins-ci.org>`_ is a continuous integration
173system that we use to help ensure the continued quality of the
174software we produce. It helps us achieve the aims of:
175* no failed tests in trunk on any platform
176* aid developers in ensuring merge requests build and test on all platforms
177* no known performance regressions (without a damn good explanation)
178
179Our Jenkins instance uses a mixture of VMs on physical hosts that169Our Jenkins instance uses a mixture of VMs on physical hosts that
180Percona runs and Virtual Machines in Amazon EC2 that are launched on170Percona runs and Virtual Machines in Amazon EC2 that are launched on
181demand.171demand.
182172
=== modified file 'doc/source/glossary.rst'
--- doc/source/glossary.rst 2011-09-26 18:41:24 +0000
+++ doc/source/glossary.rst 2012-01-30 16:47:24 +0000
@@ -5,8 +5,9 @@
5.. glossary::5.. glossary::
66
7 ACID7 ACID
8 :term:`Atomicity` :term:`Consistency` :term:`Isolation`8 Set of properties that guarantee database transactions are
9 :term:`Durability`9 processed reliably. Stands for :term:`Atomicity`,
10 :term:`Consistency`, :term:`Isolation`, :term:`Durability`.
1011
11 Atomicity12 Atomicity
12 Atomicity means that database operations are applied following a13 Atomicity means that database operations are applied following a
@@ -20,21 +21,20 @@
20 Drizzle21 Drizzle
21 Drizzle: a database for the cloud.22 Drizzle: a database for the cloud.
2223
23 Drizzle is a community-driven open source project that is forked24 `Drizzle <http://www.drizzle.org/>`_ is a community-driven open source project that is forked
24 from the popular MySQL database. The Drizzle team has removed25 from the popular MySQL database. The Drizzle team has removed
25 non-essential code, re-factored the remaining code into a26 non-essential code, re-factored the remaining code into a
26 plugin-based architecture and modernized the code base moving to27 plugin-based architecture and modernized the code base moving to
27 C++.28 C++.
2829
29 Drizzle Charter30 Drizzle Charter
30 * A database optimized for Cloud infrastructure and Web applications.31 * A database optimized for Cloud infrastructure and Web applications.
31 * Design for massive concurrency on modern multi-cpu architecture32 * Design for massive concurrency on modern multi-cpu architecture
32 * Optimize memory for increased performance and parallelism33 * Optimize memory for increased performance and parallelism
33 * Open source, open community, open design34 * Open source, open community, open design Scope
34 Scope35 * Re-designed modular architecture providing plugins with defined APIs
35 * Re-designed modular architecture providing plugins with defined APIs36 * Simple design for ease of use and administration
36 * Simple design for ease of use and administration37 * Reliable, ACID transactional
37 * Reliable, ACID transactional
3838
39 Durability39 Durability
40 Once a transaction is committed, it will remain so.40 Once a transaction is committed, it will remain so.
@@ -56,6 +56,15 @@
56 :term:`MySQL` version 5.5, InnoDB became the default storage engine56 :term:`MySQL` version 5.5, InnoDB became the default storage engine
57 on all platforms.57 on all platforms.
5858
59 Jenkins
60 `Jenkins <http://www.jenkins-ci.org>`_ is a continuous integration
61 system that we use to help ensure the continued quality of the
62 software we produce. It helps us achieve the aims of:
63
64 * no failed tests in trunk on any platform,
65 * aid developers in ensuring merge requests build and test on all platforms,
66 * no known performance regressions (without a damn good explanation).
67
59 LSN68 LSN
60 Log Serial Number. A term used in relation to the :term:`InnoDB` or69 Log Serial Number. A term used in relation to the :term:`InnoDB` or
61 :term:`XtraDB` storage engines.70 :term:`XtraDB` storage engines.
6271
=== modified file 'doc/source/index.rst'
--- doc/source/index.rst 2012-01-10 00:08:02 +0000
+++ doc/source/index.rst 2012-01-30 16:47:24 +0000
@@ -69,7 +69,7 @@
69 :maxdepth: 169 :maxdepth: 1
70 :glob:70 :glob:
7171
72 performance/innodb_purge_thread72 performance/innodb_lazy_drop_table
73 performance/innodb_doublewrite_path73 performance/innodb_doublewrite_path
74 performance/query_cache_enhance74 performance/query_cache_enhance
75 performance/innodb_fast_checksum75 performance/innodb_fast_checksum
@@ -118,6 +118,7 @@
118 management/innodb_expand_import118 management/innodb_expand_import
119 management/innodb_lru_dump_restore119 management/innodb_lru_dump_restore
120 management/innodb_fast_index_creation120 management/innodb_fast_index_creation
121 management/innodb_extended_fast_index_creation
121 management/innodb_fast_index_renaming122 management/innodb_fast_index_renaming
122 management/sql_no_fcache123 management/sql_no_fcache
123 management/udf_maatkit124 management/udf_maatkit
124125
=== added file 'doc/source/management/innodb_extended_fast_index_creation.rst'
--- doc/source/management/innodb_extended_fast_index_creation.rst 1970-01-01 00:00:00 +0000
+++ doc/source/management/innodb_extended_fast_index_creation.rst 2012-01-30 16:47:24 +0000
@@ -0,0 +1,82 @@
1.. _extended_innodb_fast_index_creation:
2
3============================
4Extended Fast Index Creation
5============================
6
7Percona has implemented several changes related to |MySQL|'s fast index creation feature. This feature extends the ``ALTER TABLE`` command by adding a new clause that provides online index renaming capability, that is renaming indexes without rebuilding the whole table.
8
9Enabling Extended Fast Index Creation
10=====================================
11
12Fast index creation was implemented in |MySQL| as a way to speed up the process of adding or dropping indexes on tables with many rows. However, cases have been found in which fast index creation creates an inconsistency between |MySQL| and |InnoDB| data dictionaries.
13
14This feature implements a session variable that enables extended fast index creation. Besides optimizing DDL directly, :variable:`expand_fast_index_creation` may also optimize index access for subsequent DML statements because using it results in much less fragmented indexes.
15
16
17:command:`mysqldump`
18--------------------
19
20A new option, ``--innodb-optimize-keys``, was implemented in :command:`mysqldump`. It changes the way |InnoDB| tables are dumped, so that secondary and foreign keys are created after loading the data, thus taking advantage of fast index creation. More specifically:
21
22 * ``KEY``, ``UNIQUE KEY``, and ``CONSTRAINT`` clauses are omitted from ``CREATE TABLE`` statements corresponding to |InnoDB| tables.
23
24 * An additional ``ALTER TABLE`` is issued after dumping the data, in order to create the previously omitted keys.
25
26``ALTER TABLE``
27---------------
28
29When ``ALTER TABLE`` requires a table copy, secondary keys are now dropped and recreated later, after copying the data. The following restrictions apply:
30
31 * Only non-unique keys can be involved in this optimization.
32
33 * If the table contains foreign keys, or a foreign key is being added as a part of the current ``ALTER TABLE`` statement, the optimization is disabled for all keys.
34
35``OPTIMIZE TABLE``
36------------------
37
38Internally, ``OPTIMIZE TABLE`` is mapped to ``ALTER TABLE ... ENGINE=innodb`` for |InnoDB| tables. As a consequence, it now also benefits from fast index creation, with the same restrictions as for ``ALTER TABLE``.
39
40
41Caveats
42-------
43
44|InnoDB| fast index creation uses temporary files in tmpdir for all indexes being created. So make sure you have enough tmpdir space when using :variable:`expand_fast_index_creation`. It is a session variable, so you can temporarily switch it off if you are short on tmpdir space and/or don’t want this optimization to be used for a specific table.
45
46There’s also a number of cases when this optimization is not applicable:
47 * ``UNIQUE`` indexes in ``ALTER TABLE`` are ignored to enforce uniqueness where necessary when copying the data to a temporary table;
48
49 * ``ALTER TABLE`` and ``OPTIMIZE TABLE`` always process tables containing foreign keys as if :variable:`expand_fast_index_creation` is OFF to avoid dropping keys that are part of a FOREIGN KEY constraint;
50
51 * :command:`mysqldump --innodb-optimize-keys` ignores foreign keys because |InnoDB| requires a full table rebuild on foreign key changes. So adding them back with a separate ``ALTER TABLE`` after restoring the data from a dump would actually make the restore slower;
52
53 * :command:`mysqldump --innodb-optimize-keys` ignores indexes on ``AUTO_INCREMENT`` columns, because they must be indexed, so it is impossible to temporarily drop the corresponding index;
54
55 * :command:`mysqldump --innodb-optimize-keys` ignores the first UNIQUE index on non-nullable columns when the table has no ``PRIMARY KEY`` defined, because in this case |InnoDB| picks such an index as the clustered one.
56
57Version Specific Information
58============================
59
60 * 5.5.16-22.0
61 Variable :variable:`expand_fast_index_creation` implemented.
62 This variable is controling whether fast index creation optimizations made by Perocna are used.
63
64System Variables
65================
66
67.. variable:: expand_fast_index_creation
68
69 :cli: Yes
70 :conf: No
71 :scope: Local/Global
72 :dyn: Yes
73 :vartype: Boolean
74 :default: OFF
75 :range: ON/OFF
76
77Other Reading
78=============
79
80 * `Improved InnoDB fast index creation <http://www.mysqlperformanceblog.com/2011/11/06/improved-innodb-fast-index-creation/>`_
81 * `Thinking about running OPTIMIZE on your InnoDB Table? Stop! <http://www.mysqlperformanceblog.com/2010/12/09/thinking-about-running-optimize-on-your-innodb-table-stop/>`_
82
083
=== added file 'doc/source/performance/innodb_lazy_drop_table.rst'
--- doc/source/performance/innodb_lazy_drop_table.rst 1970-01-01 00:00:00 +0000
+++ doc/source/performance/innodb_lazy_drop_table.rst 2012-01-30 16:47:24 +0000
@@ -0,0 +1,36 @@
1.. _innodb_lazy_drop_table_page:
2
3======================
4Drop table performance
5======================
6
7When *innodb_file_per_table* is set to 1, doing a DROP TABLE can take a long time on servers with a large buffer pool, even on an empty |InnoDB| table. This is because InnoDB has to scan through the buffer pool to purge pages that belong to the corresponding tablespace. Furthermore, no other queries can start while that scan is in progress.
8
9This feature allows you to do "background table drop".
10
11Version Specific Information
12============================
13
14 * 5.5.10-20.1 Feature added.
15
16System Variables
17================
18
19.. variable:: innodb_lazy_drop_table
20
21 :cli: Yes
22 :conf: Yes
23 :scope: Global
24 :dyn: Yes
25 :vartype: BOOL
26 :default: FALSE
27 :range: TRUE/FALSE
28
29When this option is ON, XtraDB optimizes that process by only marking the pages corresponding to the tablespace being deleted. It defers the actual work of evicting those pages until it needs to find some free pages in the buffer pool.
30
31When this option is OFF, the usual behavior for dropping tables is in effect.
32
33Related Reading
34===============
35
36 * Drop table performance `blog post <http://www.mysqlperformanceblog.com/2011/04/20/drop-table-performance/>`_.
037
=== removed file 'doc/source/performance/innodb_purge_thread.rst'
--- doc/source/performance/innodb_purge_thread.rst 2011-10-07 23:38:41 +0000
+++ doc/source/performance/innodb_purge_thread.rst 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
1.. _innodb_purge_thread:
2
3========================
4 Dedicated Purge Thread
5========================
6
7With |InnoDB|, data modified by a transaction is written to an undo space in the main tablespace, so that the system can provide read consistency. When a transaction is finished, the corresponding area in the undo space is freed. But if there are so many transactions that the purge thread cannot free space quickly enough, the main tablespace will grow dramatically. This will make performance decrease severely and will possibly consume all the available space on disk. This feature lets you use a dedicated purge thread so that the purge activity will be much quicker. And even if the overall performance will decrease when the purge thread is enabled, performance will be more stable which is often highly desirable.
8
9Purge of the undo space is periodically done by the |InnoDB| main thread, along with other maintenance tasks. In most cases for an OLTP application, the transactions are small and short-running so the undo space can fit in memory in the buffer pool. The purge is then quick and efficient.
10
11But there are several reasons that can make the undo space grow very large and go to disk:
12
13 * long-running transactions
14
15 * transactions with lots of changes
16
17 * too many updates for the purge process to keep up
18
19 * In all cases performance will drop dramatically. In standard |InnoDB| it is difficult to find an efficient solution for this problem.
20
21You can now have one or several threads dedicated to the purge. This feature provides several benefits:
22
23 * more control over the purge process
24
25 * more stable performance (no more performance drops)
26
27 * the |InnoDB| main thread does not need to take care of the purge anymore
28
29But be aware that this feature comes at a cost: it reduces the overall performance because purging adds a non-negligible overhead. However we think it is better to have slightly worse but stable performance over time than to have better peak performance but unpredictable sharp drops.
30
31
32System Variables
33================
34
35The following system variable was introduced by this feature:
36
37.. variable:: innodb_use_purge_thread
38
39 :cli: Yes
40 :conf: Yes
41 :scope: Global
42 :dyn: No
43 :type: ULONG
44 :default: 0(~1.0.5), 1(1.0.6~)
45 :range: 0 - 32 (``UNIV_MAX_PARALLELISM``)
46
47Using a value greater than 1 is experimental!
48
49``UNIV_MAX_PARALLELISM`` is the maximum number of parallel threads in a parallelized operation
50
51Other Information
52=================
53
54With ``SHOW INNODB STATUS`` you can monitor the number of unpurged transactions: look at History list length in the ``TRANSACTIONS`` section. This counter increases when a transaction commits and decreases when the purge process removes old versions of rows.
55
56If this counter keeps increasing, it shows that the purge process cannot keep up, so you should use this option to create a dedicated purge thread.
57
58
59Other Reading
60=============
61
62 * `Tuning for heavy writing workloads <http://www.mysqlperformanceblog.com/2009/10/14/tuning-for-heavy-writing-workloads/>`_
63
64 * `Reasons for run-away main |InnoDB| tablespace <http://www.mysqlperformanceblog.com/2009/10/14/tuning-for-heavy-writing-workloads/>`_
65
66 * `Purge thread spiral of death <http://www.mysqlperformanceblog.com/2009/10/14/tuning-for-heavy-writing-workloads/>`_

Subscribers

People subscribed via source and target branches