apache / apache/incubator-seata

MYSQL慢日志一直打印问题

Open
#3,971 3 comments 0 reactions 0 assignees View on GitHub
status: waiting-for-feedback
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

你好,我这边是用了seata做分布式事务,然后数据库是用MYSQL,以下是seata_server的数据库:

![image](https://user-images.githubusercontent.com/89343975/130355721-7cce6502-65a1-4575-93fe-0ba92d4314ab.png)

然后我在微服务的mysql开启慢日志,然后监控慢日志时,发现每秒钟都会打印以下日志信息,我慢日志的时间long_query_time已经是调了2秒了,但是还是会不断打印以下信息:
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000446 Lock_time: 0.000207 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635285;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:05.684876Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000503 Lock_time: 0.000237 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635285;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (0,1,2,3,4,5,6,7,8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:06.659649Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000536 Lock_time: 0.000289 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635286;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (5,4,6,7) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:06.665833Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000246 Lock_time: 0.000088 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635286;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:06.665849Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000459 Lock_time: 0.000231 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635286;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (3) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:06.687370Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000521 Lock_time: 0.000284 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635286;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (0,1,2,3,4,5,6,7,8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:07.659773Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000573 Lock_time: 0.000289 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635287;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (5,4,6,7) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:07.665637Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000418 Lock_time: 0.000215 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635287;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (3) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:07.666084Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000427 Lock_time: 0.000266 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635287;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:07.685012Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000567 Lock_time: 0.000278 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635287;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (0,1,2,3,4,5,6,7,8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:08.659693Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000478 Lock_time: 0.000247 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635288;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (5,4,6,7) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:08.666109Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000462 Lock_time: 0.000218 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635288;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (8) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:08.666109Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 70722
Query_time: 0.000462 Lock_time: 0.000218 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635288;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (3) order by gmt_modified limit 100;
Time: 2021-08-22T12:28:08.684733Z
User@Host: 项目名[项目名] @ 项目名_seata.项目名 [xxx.xxx.xxx.xxx] Id: 43088
Query_time: 0.000420 Lock_time: 0.000232 Rows_sent: 0 Rows_examined: 0
SET timestamp=1629635288;
select xid, transaction_id, status, application_id, transaction_service_group, transaction_name, timeout, begin_time, application_data, gmt_create, gmt_modified from global_table where status in (0,1,2,3,4,5,6,7,8) order by gmt_modified limit 100;

请问这个情况是要怎么处理呢?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Seata server's MySQL slow-log output using the reported global_table queries and the displayed query times. Check how the MySQL slow-query settings interact with these queries and trace the Seata server entry point that polls global_table. Done means the cause of the repeated logging and the appropriate handling are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.