Bug #117659 OpenTelemetry symbols pollute MySQL Community Edition binaries.
Submitted: 10 Mar 19:24 Modified: 11 Mar 11:23
Reporter: Jean-François Gagné Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.4.4, 9.2.0 OS:Any
Assigned to: CPU Architecture:Any

[10 Mar 19:24] Jean-François Gagné
Description:
Hi,

from what I understand, OpenTelemetry is a MySQL Enterprise feature [1] and [2].

[1]: https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-telemetry.html

[2]: https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-telemetry.html

When looking at InnoDB code, I see static arrays related to OpenTelemetry not protected by "#ifdef HAVE_PSI_METRICS_INTERFACE".  I found [3], [4], [5] and [6], there might be others (the one I found are inno_meter, inno_metrics, buffer_metrics and data_metrics).

[3]: https://github.com/jfg956/mysql-server/blob/mysql-9.2.0/storage/innobase/handler/ha_innodb...

[4]: https://github.com/jfg956/mysql-server/blob/mysql-9.2.0/storage/innobase/handler/ha_innodb...

[5]: https://github.com/jfg956/mysql-server/blob/mysql-9.2.0/storage/innobase/handler/ha_innodb...

[6]: https://github.com/jfg956/mysql-server/blob/mysql-9.2.0/storage/innobase/handler/ha_innodb...

The 4 arrays above end-up as symbols in mysqld binaries in 8.4.4 and 9.2.0, see how to repeat for details.

Because these are about an Enterprise-only feature, I would expect them not to pollute MySQL Community Edition binaries.

There are probably others, see a quick grep finding more in how to repeat.

Many thanks for looking into this,

Jean-François Gagné

How to repeat:
$ nm ~/opt/mysql/mysql_8.4.4/bin/mysqld | grep -e inno_meter -e inno_metrics -e buffer_metrics -e data_metrics
0000000003e721e0 d _ZL10inno_meter
0000000003e72280 d _ZL12data_metrics
0000000003e727a0 d _ZL12inno_metrics
0000000003e72440 d _ZL14buffer_metrics

$ nm ~/opt/mysql/mysql_9.2.0/bin/mysqld | grep -e inno_meter -e inno_metrics -e buffer_metrics -e data_metrics
0000000003f1a640 d _ZL10inno_meter
0000000003f1a6e0 d _ZL12data_metrics
0000000003f1ac00 d _ZL12inno_metrics
0000000003f1a8a0 d _ZL14buffer_metrics

$ grep -r -e PSI_metric_info_v1 -e PSI_meter_info_v1  . | grep -e "\[\]"
./plugin/x/src/variables/status_variables.cc:static PSI_metric_info_v1 xpl_metrics[] = {
./plugin/x/src/variables/status_variables.cc:static PSI_metric_info_v1 stmt_metrics[] = {
./plugin/x/src/variables/status_variables.cc:PSI_meter_info_v1 Plugin_status_variables::m_xpl_meter[] = {
./plugin/x/src/variables/status_variables.h:  static PSI_meter_info_v1 m_xpl_meter[];
./storage/perfschema/telemetry_pfs_metrics.cc:static PSI_metric_info_v1 ps_metrics[] = {
./storage/perfschema/telemetry_pfs_metrics.cc:static PSI_meter_info_v1 ps_meters[] = {
./storage/innobase/handler/ha_innodb.cc:static PSI_metric_info_v1 inno_metrics[] = {
./storage/innobase/handler/ha_innodb.cc:static PSI_metric_info_v1 buffer_metrics[] = {
./storage/innobase/handler/ha_innodb.cc:static PSI_metric_info_v1 data_metrics[] = {
./storage/innobase/handler/ha_innodb.cc:static PSI_meter_info_v1 inno_meter[] = {
./storage/temptable/src/plugin.cc:static PSI_metric_info_v1 metrics[] = {
./storage/temptable/src/plugin.cc:static PSI_meter_info_v1 meter[] = {
[...]
./sql/mysqld.cc:static PSI_metric_info_v1 com_metrics[] = {
./sql/mysqld.cc:static PSI_metric_info_v1 core_metrics[] = {
./sql/mysqld.cc:static PSI_metric_info_v1 connection_metrics[] = {
./sql/mysqld.cc:static PSI_metric_info_v1 handler_metrics[] = {
./sql/mysqld.cc:static PSI_metric_info_v1 myisam_metrics[] = {
./sql/mysqld.cc:static PSI_metric_info_v1 ssl_metrics[] = {
./sql/mysqld.cc:static PSI_meter_info_v1 core_meters[] = {
[11 Mar 5:18] MySQL Verification Team
Hello Jean-François,

Thank you for the report and feedback.

regards,
Umesh
[11 Mar 8:26] Daniël van Eeden
I assume [1] and [2] shouldn't be identical and one of them should point to the 9.2 version?
[11 Mar 11:23] Jean-François Gagné
Indeed Daniël, [2] should be as below.

[2]: https://dev.mysql.com/doc/refman/9.2/en/mysql-enterprise-telemetry.html