From 566172483aac2b1ba25dfbc0080733b87ccb6497 Mon Sep 17 00:00:00 2001 From: Nicole Chen <51746100+nicolevv@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:38:26 +0800 Subject: [PATCH] Update info_schema_auto_increment.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文件系统大小写敏感,数据库参数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> --- collector/info_schema_auto_increment.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/info_schema_auto_increment.go b/collector/info_schema_auto_increment.go index d52ebd27d..d3724347a 100644 --- a/collector/info_schema_auto_increment.go +++ b/collector/info_schema_auto_increment.go @@ -24,7 +24,7 @@ import ( ) const infoSchemaAutoIncrementQuery = ` - SELECT table_schema, table_name, column_name, auto_increment, + SELECT c.table_schema, c.table_name, column_name, auto_increment, pow(2, case data_type when 'tinyint' then 7 when 'smallint' then 15 @@ -33,7 +33,7 @@ const infoSchemaAutoIncrementQuery = ` when 'bigint' then 63 end+(column_type like '% unsigned'))-1 as max_int FROM information_schema.columns c - STRAIGHT_JOIN information_schema.tables t USING (table_schema,table_name) + STRAIGHT_JOIN information_schema.tables t ON (BINARY c.table_schema=t.table_schema AND BINARY c.table_name=t.table_name) WHERE c.extra = 'auto_increment' AND t.auto_increment IS NOT NULL `