Bug #106735 Constant but non-static fields in the clone C++ classes
Submitted: 15 Mar 2022 11:30 Modified: 15 Mar 2022 11:45
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S3 (Non-critical)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: Clone

[15 Mar 2022 11:30] Laurynas Biveinis
Description:
In the clone implementation (handler & plugin) there are several C++ class fields that are marked const, initialized with a compile-time value, but not static. Thus they are allocated for each class instance separately, wasting memory.

- File sql/handler.h, class Ha_clone_cbk, fields HA_CLONE_ACK, HA_CLONE_FILE_CACHE, HA_CLONE_ZERO_COPY, HA_CLONE_SECURE, & HA_CLONE_STATE_CHANGE
- File plugin/clone/include/clone_client.h, struct Thread_Tune_Auto, fields m_history_interval & m_step.
- clone_client.h, class Client_Stat, fields m_interval & m_minimum_speed.

How to repeat:
Read code

Suggested fix:
Mark the fields static constexpr
[15 Mar 2022 11:45] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feedback!

regards,
Umesh