Bug #70241 innodb_metrics::INDEX_MERGE defined but not set
Submitted: 4 Sep 2013 15:24 Modified: 18 Sep 2013 14:20
Reporter: Inaam Rana (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6.12, 5.6.14 OS:Any
Assigned to: CPU Architecture:Any

[4 Sep 2013 15:24] Inaam Rana
Description:
information_schema.innodb_metrics has index_merge counter defined but it is not incremented in btr0btr.cc:

[irana@tw-mbp-irana:~/workspace/mysql-5.6/storage/innobase]grep -rIn INDEX_MERGE .
./include/srv0mon.h:311:	MONITOR_INDEX_MERGE,
./srv/srv0mon.cc:893:	 MONITOR_DEFAULT_START, MONITOR_INDEX_MERGE},
[irana@tw-mbp-irana:~/workspace/mysql-5.6/storage/innobase]

Also I think index_merge and index_split are not good names. Kind of implies as if we are counting some index level operations. index_page_merge and index_page_split are more appropriate IMO.

How to repeat:
see code

Suggested fix:
Update counter in btr0btr.cc

In fact, I have a patch against 5.6.12 which fixes this issue and also add some other relevant counters like index_page_discards, index_page_reorg etc. I'll be happy to submit the patch if someone can tell me the process.
[4 Sep 2013 16:38] Sveta Smirnova
Inaam,

thank you for the report. To contribute the fix you need to sign Oracle contributor agreement. All steps described in the "Contribution" tab of the bug report. Let us know if you have any issues with this description.
[10 Sep 2013 17:24] Inaam Rana
I have signed and sent the OCA. I'll upload the patch file next.
[10 Sep 2013 17:25] Inaam Rana
Patch for extra innodb_metrics for index ops

Attachment: index_metrics-5.6.patch (application/octet-stream, text), 7.40 KiB.

[18 Sep 2013 14:20] Bugs System
Added changelog entry to 5.6.15:

"The "information_schema.innodb_metrics" "index_merge" counter was not
incremented in "btr0btr.cc". This patch also introduces new counters
("index_page_reorg_attempts", "index_page_reorg_successful" and
"index_page_discards") and renames the "index_merges" counter to
""index_page_merge_attempts"" to distinguish it from the
"index_page_merge_successful" counter."

Thank you for the bug report.
[4 Dec 2013 11:28] Laurynas Biveinis
5.6$ bzr log -r 5448
------------------------------------------------------------
revno: 5448
committer: bin.x.su@oracle.com
branch nick: mysql-5.6
timestamp: Fri 2013-09-13 10:08:28 +0800
message:
  BUG 17409657 - INNODB_METRICS::INDEX_MERGE DEFINED BUT NOT SET
  
  1. Information_schema.innodb_metrics has index_merge counter defined but
     it is not incremented in btr0btr.cc.
  
  2. Users need some other relevant counters like index_page_discards,
     index_page_reorg etc.
  
  So index_page_merge_attempts which replace index_merges is introduced to
  distinguish from index_page_merge_successful, also, index_page_reorg_attempts, 
  index_page_reorg_successful and index_page_discards are introduced too.
  
  Original patch is provided by Inaam.
  
  Approved by Jimmy, rb#3297