[MDEV-25804] Queries that contain Executables comments, and do not correspond to the version, are recorded in the query log, losing the "!" in the comment Created: 2021-05-27  Updated: 2021-05-27

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.5.10
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Eduardo Ubide Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Tested on 10.5.10, 10.5.0, 10.4.19, 10.2.17



 Description   

Setting up the slow queries on `my.cnf` for MariaDB 10.5.10

log_output=file
slow_query_log=ON
long_query_time=0
log_slow_verbosity=query_plan,innodb
log_slow_admin_statements=ON
log_slow_slave_statements=ON
innodb_monitor_enable=all
userstat=1

This query, matching version 100500 and works fine.

mysql [localhost:10510] {msandbox} ((none)) > /*!100500 select 1 as T3st */;
+------+
| T3st |
+------+
|    1 |
+------+
1 row in set (0.000 sec)

In the slow query log is written with the exclamation mark:

# Time: 210527 16:44:26
# User@Host: msandbox[msandbox] @ localhost []
# Thread_id: 3  Schema:   QC_hit: No
# Query_time: 0.000071  Lock_time: 0.000000  Rows_sent: 1  Rows_examined: 0
# Rows_affected: 0  Bytes_sent: 60
SET timestamp=1622133866;
/*!100500 select 1 as T3st */;

By contrast, this query filtered for an upper version 106000, doesn't put the "!" on the slow log.

mysql [localhost:10510] {msandbox} ((none)) > /*!100600 select 1 as T3st */;
Query OK, 0 rows affected (0.000 sec)

# Time: 210527 16:47:28
# User@Host: msandbox[msandbox] @ localhost []
# Thread_id: 3  Schema:   QC_hit: No
# Query_time: 0.000022  Lock_time: 0.000000  Rows_sent: 0  Rows_examined: 0
# Rows_affected: 0  Bytes_sent: 11
SET timestamp=1622134048;
/* 100600 select 1 as T3st */;

This even happens with the MariaDB-style executable comment syntax:

mysql [localhost:10510] {msandbox} ((none)) > /*M!100600 select 1 as T3st */;
Query OK, 0 rows affected (0.000 sec)
 
mysql [localhost:10510] {msandbox} ((none)) > /*M!100500 select 1 as T3st */;
+------+
| T3st |
+------+
|    1 |
+------+
1 row in set (0.001 sec)

The slow query log misses the "!" in case the comment is ignored.

# Time: 210527 16:49:29
# User@Host: msandbox[msandbox] @ localhost []
# Thread_id: 3  Schema:   QC_hit: No
# Query_time: 0.000028  Lock_time: 0.000000  Rows_sent: 0  Rows_examined: 0
# Rows_affected: 0  Bytes_sent: 11
SET timestamp=1622134169;
/*M 100600 select 1 as T3st */;
# Time: 210527 16:49:37
# User@Host: msandbox[msandbox] @ localhost []
# Thread_id: 3  Schema:   QC_hit: No
# Query_time: 0.000116  Lock_time: 0.000000  Rows_sent: 1  Rows_examined: 0
# Rows_affected: 0  Bytes_sent: 60
SET timestamp=1622134177;
/*M!100500 select 1 as T3st */;


Generated at Thu Feb 08 09:40:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.