Bug #106220 LatchCounter::m_counters not pfs instrumented
Submitted: 19 Jan 2022 20:27 Modified: 20 Jan 2022 13:25
Reporter: david zhang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[19 Jan 2022 20:27] david zhang
Description:
LatchCounter::m_counters uses std::vector without ut_allocator<>

in sync0types.h

  typedef std::vector<Count *> Counters;

  /** Counters for the latches */
  Counters m_counters;

IIUC, entire sync0types.h should be pfs instrumented, see ut0new.h
Declaring a type with a std:: container, e.g. std::vector:
----------------------------------------------------------
Standard:
  std::vector<t>
InnoDB:
  std::vector<t, ut_allocator<t> >

Declaring objects of some std:: type:
-------------------------------------
Standard:
  std::vector<t> v
InnoDB, default instrumentation:
  std::vector<t, ut_allocator<t> > v
InnoDB, custom instrumentation, preferred:
  std::vector<t, ut_allocator<t> > v(ut_allocator<t>(key))

How to repeat:
./mtr --sanitize innodb.tablespace_encrypt_1

Suggested fix:
  typedef std::vector<Count *, ut_allocator<Count *>> Counters;
[19 Jan 2022 20:28] david zhang
update category
[20 Jan 2022 13:25] MySQL Verification Team
Hi Mr. zhang,

Thank you for your bug report.

We have analysed carefully your report and concluded that you are correct. This code is not entirely up to the standard and may lead to the problems.

Verified as reported for 8.0.