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

[ bug ] #1148

Closed
woshiyanghai opened this issue Aug 3, 2021 · 4 comments
Closed

[ bug ] #1148

woshiyanghai opened this issue Aug 3, 2021 · 4 comments

Comments

@woshiyanghai
Copy link
Contributor

在提交 issue 前,请查阅以下资源,请先进行搜索来保证没有类似的 issue。
文档 | FAQ

重现步骤

实例管理、会话管理、事务信息
经过对比,发现事因为这个p的大小写有问题导致找不到time字段

期待结果和实际结果

期待结果:
能够返回正常的会话信息

实际结果:
报错,不知道P.time

截图

image

错误日志

[2021-08-03 11:38:58,028][Thread-472:140142007613184][task_id:default][mysql.py:164][WARNING]- MySQL语句执行报错,语句:select trx.trx_started,
trx.trx_state,
trx.trx_operation_state,
trx.trx_mysql_thread_id,
trx.trx_tables_locked,
trx.trx_rows_locked,
trx.trx_rows_modified,
trx.trx_is_read_only,
trx.trx_isolation_level,
p.user,
p.host,
p.db,
TO_SECONDS(NOW()) - TO_SECONDS(trx.trx_started) trx_idle_time,
p.time thread_time,
IFNULL((SELECT
GROUP_CONCAT(t1.sql_text SEPARATOR ';
')
FROM performance_schema.events_statements_history t1
INNER JOIN performance_schema.threads t2
ON t1.thread_id = t2.thread_id
WHERE t2.PROCESSLIST_ID = p.id), '') info
FROM information_schema.INNODB_TRX trx
INNER JOIN information_schema.PROCESSLIST p
ON trx.trx_mysql_thread_id = p.id
WHERE trx.trx_state = 'RUNNING'
AND p.COMMAND = 'Sleep'
AND P.TIME > 3
ORDER BY trx.trx_started ASC;,错误信息Traceback (most recent call last):
File "/usr/local/src/Archery-1.8.0/sql/engines/mysql.py", line 153, in query
effect_row = cursor.execute(sql)
File "/usr/local/python3/bin/venv4archery/lib/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/usr/local/python3/bin/venv4archery/lib/python3.6/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/usr/local/python3/bin/venv4archery/lib/python3.6/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1054, "Unknown column 'P.TIME' in 'where clause'")

image

版本信息

应用版本/分支:1.8.0

部署方式:手工部署

@woshiyanghai
Copy link
Contributor Author

因为archery的库,一般会被设置成区分大小写,统一用小写。这个代码里的sql,这个位置存在大小写混用,建议统一小写。

@gaoqiang-0327
Copy link

sql/db_diagnostic.py 这个文件修改完重启。

@woshiyanghai
Copy link
Contributor Author

sql/db_diagnostic.py 这个文件修改完重启。

good

@hhyo
Copy link
Owner

hhyo commented Sep 17, 2021

fix #1175

@hhyo hhyo closed this as completed Sep 17, 2021
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

No branches or pull requests

3 participants