Adaptive hash index memory is incorrectly calculated in SHOW ENGINE INNODB STATUS and I_S
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Medium
|
Alexey Kopytov | ||
5.1 |
Invalid
|
Undecided
|
Unassigned | ||
5.5 |
Fix Released
|
Medium
|
Alexey Kopytov | ||
5.6 |
Fix Released
|
Medium
|
Alexey Kopytov |
Bug Description
XtraDB exposes the amount of memory allocated by the adaptive hash index structures in SHOW ENGINE INNODB STATUS (PS 5.5), the status variable Innodb_
In all cases the value is calculated as follows (with simplifications):
1. Get the number of cells in the first hash table and multiply it by the size of a cell.
2. Multiple value #1 by the number of adaptive hash index partitions.
3. Get the amount of heap memory allocated in the first hash table.
4. Multiple value #3 by the number of adaptive hash index partitions.
SHOW ENGINE INNODB STATUS in 5.5 and I_S table in 5.6 then show values #2 and #4 separately. And the status variable is always the sum of values #2 and #4.
The problem with #4 is that assumes all hash tables are uniformly filled. Which is not necessarily the case. Trivial example: multiple AHI partitions, but just one index using AHI. So depending on whether the hash table for that index happens to be in partition #0, we may get either much higher AHI memory than actually allocated, or much lower value than actually allocated.
Related branches
- Laurynas Biveinis (community): Approve
-
Diff: 1935 lines (+448/-373) (has conflicts)22 files modifiedPercona-Server/mysql-test/r/percona_bug1218330.result (+8/-0)
Percona-Server/mysql-test/t/percona_bug1218330-master.opt (+1/-0)
Percona-Server/mysql-test/t/percona_bug1218330.test (+42/-0)
Percona-Server/storage/innobase/btr/btr0cur.c (+6/-5)
Percona-Server/storage/innobase/btr/btr0sea.c (+119/-139)
Percona-Server/storage/innobase/buf/buf0buf.c (+1/-3)
Percona-Server/storage/innobase/dict/dict0boot.c (+8/-0)
Percona-Server/storage/innobase/dict/dict0dict.c (+3/-1)
Percona-Server/storage/innobase/dict/dict0load.c (+2/-0)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+11/-6)
Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c (+2/-0)
Percona-Server/storage/innobase/include/btr0sea.h (+36/-15)
Percona-Server/storage/innobase/include/btr0sea.ic (+67/-35)
Percona-Server/storage/innobase/include/btr0types.h (+6/-7)
Percona-Server/storage/innobase/include/buf0buf.h (+0/-1)
Percona-Server/storage/innobase/include/dict0mem.h (+4/-0)
Percona-Server/storage/innobase/include/trx0trx.h (+7/-5)
Percona-Server/storage/innobase/include/trx0trx.ic (+13/-0)
Percona-Server/storage/innobase/row/row0mysql.c (+6/-2)
Percona-Server/storage/innobase/row/row0sel.c (+36/-97)
Percona-Server/storage/innobase/srv/srv0srv.c (+64/-36)
Percona-Server/storage/innobase/trx/trx0trx.c (+6/-21)
- Laurynas Biveinis (community): Approve
-
Diff: 1957 lines (+482/-381)25 files modifiedPercona-Server/mysql-test/r/percona_bug1218330.result (+14/-0)
Percona-Server/mysql-test/t/percona_bug1218330-master.opt (+1/-0)
Percona-Server/mysql-test/t/percona_bug1218330.test (+72/-0)
Percona-Server/storage/innobase/btr/btr0cur.cc (+7/-7)
Percona-Server/storage/innobase/btr/btr0sea.cc (+109/-132)
Percona-Server/storage/innobase/buf/buf0buf.cc (+0/-2)
Percona-Server/storage/innobase/dict/dict0boot.cc (+6/-0)
Percona-Server/storage/innobase/dict/dict0dict.cc (+5/-3)
Percona-Server/storage/innobase/dict/dict0load.cc (+1/-0)
Percona-Server/storage/innobase/ha/ha0ha.cc (+2/-2)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+21/-19)
Percona-Server/storage/innobase/handler/xtradb_i_s.cc (+35/-33)
Percona-Server/storage/innobase/ibuf/ibuf0ibuf.cc (+2/-0)
Percona-Server/storage/innobase/include/btr0sea.h (+35/-9)
Percona-Server/storage/innobase/include/btr0sea.ic (+66/-11)
Percona-Server/storage/innobase/include/btr0types.h (+7/-6)
Percona-Server/storage/innobase/include/buf0buf.h (+0/-2)
Percona-Server/storage/innobase/include/dict0mem.h (+4/-0)
Percona-Server/storage/innobase/include/trx0trx.h (+7/-5)
Percona-Server/storage/innobase/include/trx0trx.ic (+5/-12)
Percona-Server/storage/innobase/row/row0ftsort.cc (+3/-0)
Percona-Server/storage/innobase/row/row0sel.cc (+32/-91)
Percona-Server/storage/innobase/srv/srv0srv.cc (+42/-44)
Percona-Server/storage/innobase/sync/sync0sync.cc (+3/-3)
Percona-Server/storage/innobase/trx/trx0trx.cc (+3/-0)
tags: | added: ahi-partitions |
Does not technically apply to 5.6, but will be soon once AHI partitioning is ported there.