Bug #74511 adaptive_hash_searches_btree not updated
Submitted: 22 Oct 2014 17:12 Modified: 23 Feb 2015 13:53
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 OS:Any
Assigned to: CPU Architecture:Any

[22 Oct 2014 17:12] Inaam Rana
Description:
adaptive_hash_searches_btree is a counter in innodb_metrics exposing number of btree lookups that we have to perform. It is currently not being updated.

How to repeat:
Just run any workload and watch adaptive_hash_searches_btree stay at zero.

Suggested fix:
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index f012028..e75f966 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -936,7 +936,8 @@ static monitor_info_t	innodb_counter_info[] =
 
 	{"adaptive_hash_searches_btree", "adaptive_hash_index",
 	 "Number of searches using B-tree on an index search",
-	 MONITOR_NONE,
+	 static_cast<monitor_type_t>(
+	 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
 	 MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE},
 
 	{"adaptive_hash_pages_added", "adaptive_hash_index",
[22 Nov 2014 11:18] MySQL Verification Team
Hello Inaam,

Thank you for the report and contribution.

Thanks,
Umesh
[22 Nov 2014 11:20] MySQL Verification Team
// 5.6.22 binary tarball build

[(none)]> select * from information_schema.innodb_metrics where name like 'adaptive_hash_searches_btree' order by name\G
*************************** 1. row ***************************
           NAME: adaptive_hash_searches_btree
      SUBSYSTEM: adaptive_hash_index
          COUNT: 0
      MAX_COUNT: NULL
      MIN_COUNT: NULL
      AVG_COUNT: 0
    COUNT_RESET: 0
MAX_COUNT_RESET: NULL
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2014-11-24 17:31:29
  TIME_DISABLED: NULL
   TIME_ELAPSED: 1674
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: counter
        COMMENT: Number of searches using B-tree on an index search
1 row in set (0.00 sec)

// After patching ( 5.6.22 - manually patched) 

[(none)]> select * from information_schema.innodb_metrics where name like 'adaptive_hash_searches_btree' order by name\G
*************************** 1. row ***************************
           NAME: adaptive_hash_searches_btree
      SUBSYSTEM: adaptive_hash_index
          COUNT: 30
      MAX_COUNT: 30
      MIN_COUNT: NULL
      AVG_COUNT: 0.46153846153846156
    COUNT_RESET: 30
MAX_COUNT_RESET: 30
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2014-11-24 18:18:15
  TIME_DISABLED: NULL
   TIME_ELAPSED: 65
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of searches using B-tree on an index search
1 row in set (0.00 sec)
[10 Dec 2014 20:20] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.6 release, and here's the changelog entry:

The "INNODB_METRICS" "adaptive_hash_searches_btree" counter failed to
report counter data.
[11 Dec 2014 6:55] Naga Satyanarayana Bodapati
Thank you Inaam! I've pushed the fix with testcase
[15 Dec 2014 19:05] Daniel Price
Posted by developer:
 
Patch reverted. Changelog entry removed. Bug set back to Verified state.
[15 Dec 2014 19:06] Daniel Price
Patch reverted.
[12 Feb 2015 14:34] Laurynas Biveinis
$ git show -s 3576b50
commit 3576b503f0e4a37dac5dbe4f31706ccfe1cd7bd6
Author: Satya Bodapati <satya.bodapati@oracle.com>
Date:   Wed Dec 17 21:29:46 2014 +0530

    BUG#20080942 - ADAPTIVE_HASH_SEARCHES_BTREE NOT UPDATED
    
    Monitor counter for adaptive_hash_searches_btree is disabled.
    There is existing variable "btr_cur_n_non_sea" which counts number of
    searches using the B-tree (without using AHI).
    
    Fix the monitor to use correct type MONITOR_EXISTING|MONITOR_DEFAULT_ON
    
    Reviewed-by:  Marko Makela <marko.makela@oracle.com>
    RB: 7501
[13 Feb 2015 6:52] Laurynas Biveinis
What is the status of this bug? The patch is present in 5.6.23.
[19 Feb 2015 14:22] Naga Satyanarayana Bodapati
Posted by developer:
 
Sorry for the confusion. The initial patch was reverted but pushed again to 5.6.23, 5.7.6

5.6:
----
git log --grep=BUG#20080942
commit fcc46babee28c197ba4e24c705bc016c7a246962
Author: Satya Bodapati <satya.bodapati@oracle.com>
Date:   Wed Dec 17 21:29:46 2014 +0530

    BUG#20080942 - ADAPTIVE_HASH_SEARCHES_BTREE NOT UPDATED
    
    Monitor counter for adaptive_hash_searches_btree is disabled.
    There is existing variable "btr_cur_n_non_sea" which counts number of
    searches using the B-tree (without using AHI).
    
    Fix the monitor to use correct type MONITOR_EXISTING|MONITOR_DEFAULT_ON
    
    Reviewed-by:  Marko Makela <marko.makela@oracle.com>
    RB: 7501

commit 6fe9da40c4f186b35bb56fc8524a635d8bc8adca
Author: Satya Bodapati <satya.bodapati@oracle.com>
Date:   Wed Dec 17 21:29:46 2014 +0530

    BUG#20080942 - ADAPTIVE_HASH_SEARCHES_BTREE NOT UPDATED
    
    Monitor counter for adaptive_hash_searches_btree is disabled.
    There is existing variable "btr_cur_n_non_sea" which counts number of
    searches using the B-tree (without using AHI).
    
    Fix the monitor to use correct type MONITOR_EXISTING|MONITOR_DEFAULT_ON
    
    Reviewed-by:  Marko Makela <marko.makela@oracle.com>
    RB: 7501
===================================================================================
5.7:
---
git log --grep=BUG#20080942
commit fcc46babee28c197ba4e24c705bc016c7a246962
Author: Satya Bodapati <satya.bodapati@oracle.com>
Date:   Wed Dec 17 21:29:46 2014 +0530

    BUG#20080942 - ADAPTIVE_HASH_SEARCHES_BTREE NOT UPDATED
    
    Monitor counter for adaptive_hash_searches_btree is disabled.
    There is existing variable "btr_cur_n_non_sea" which counts number of
    searches using the B-tree (without using AHI).
    
    Fix the monitor to use correct type MONITOR_EXISTING|MONITOR_DEFAULT_ON
    
    Reviewed-by:  Marko Makela <marko.makela@oracle.com>
    RB: 7501

commit 6fe9da40c4f186b35bb56fc8524a635d8bc8adca
Author: Satya Bodapati <satya.bodapati@oracle.com>
Date:   Wed Dec 17 21:29:46 2014 +0530

    BUG#20080942 - ADAPTIVE_HASH_SEARCHES_BTREE NOT UPDATED
    
    Monitor counter for adaptive_hash_searches_btree is disabled.
    There is existing variable "btr_cur_n_non_sea" which counts number of
    searches using the B-tree (without using AHI).
    
    Fix the monitor to use correct type MONITOR_EXISTING|MONITOR_DEFAULT_ON
    
    Reviewed-by:  Marko Makela <marko.makela@oracle.com>
    RB: 7501
[23 Feb 2015 13:53] Daniel Price
Fixed as of the upcoming 5.6.23, 5.7.6 releases, and here's the changelog entry:

The "INNODB_METRICS" "adaptive_hash_searches_btree" counter failed to
report counter data. 

Thank you for the bug report.