Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auto_increment metric collection errors caused by using collation in INFORMATION_SCHEMA searches #833

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolevv
Copy link

@nicolevv nicolevv commented Apr 18, 2024

Hello, we have encountered the following issues in our actual production:

There are two tables in the database, test.x and test.X, which caused data collection failure.

Original error message:

An error has occurred while serving metrics:

4 error(s) occurred:
* collected metric "mysql_info_schema_auto_increment_column" { label:<name:"column" value:"id" > label:<name:"schema" value:"test" > label:<name:"table" value:"x" > gauge:<value:1 > } was collected before with the same name and label values
* collected metric "mysql_info_schema_auto_increment_column_max" { label:<name:"column" value:"id" > label:<name:"schema" value:"test" > label:<name:"table" value:"x" > gauge:<value:4.294967295e+09 > } was collected before with the same name and label values
* collected metric "mysql_info_schema_auto_increment_column" { label:<name:"column" value:"id" > label:<name:"schema" value:"test" > label:<name:"table" value:"X" > gauge:<value:1 > } was collected before with the same name and label values
* collected metric "mysql_info_schema_auto_increment_column_max" { label:<name:"column" value:"id" > label:<name:"schema" value:"test" > label:<name:"table" value:"X" > gauge:<value:4.294967295e+09 > } was collected before with the same name and label values

The result set obtained from the original SQL query on the database is as follows:

img_v3_02a1_b82584ff-f320-41b2-b02a-d97cb6b06c9g

MySQL instance parameters:

lower_case_file_system=off
lower_case_file_system=0

The data of the two tables with different cases, x and X, will appear twice separately. This caused the data collection to fail, and the relevant metrics for that node could not be collected. The table_schema and table_name need to be treated as case-sensitive unique keys for association.

References:

https://bugs.mysql.com/bug.php?id=34921

https://dev.mysql.com/doc/refman/5.7/en/charset-collation-information-schema.html

文件系统大小写敏感,数据库参数lower_case_file_system=off,lower_case_file_system=0的情况下,两张大小写不同的x和X表的数据会分别重复出现两次。(这里是因为联表查询大小写不敏感,是因为会用Open_full_table会用到默认的校对规则。)
导致抓取数据的时候失败,采集不到该节点的相关指标。

Signed-off-by: Nicole Chen <51746100+nicolevv@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant