matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: Cannot get query result with `result_scan` for queries

Open DanielZhangQD opened this issue 2 years ago • 48 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Environment

- Version or commit-id (e.g. v0.1.0 or 8b23a93): nightly-90dac68d
- Hardware parameters:
- OS type:
- Others:

Actual Behavior

  • Run TPCH Q1
  • Try to get the query result with result_scan but failed
MySQL [(none)]> select * from result_scan('cf6e625e-8856-11ee-a532-3e8dd997aa03') as t limit 0,1000;
ERROR 20440 (HY000): result file query_result_meta/738c8806_aa7b_412c_8370_59e47141cfaf_cf6e625e-8856-11ee-a532-3e8dd997aa03.blk not found

Expected Behavior

Get result successfully

Steps to Reproduce

See detail in `Actual Behavior`

Additional information

This issue occurs occasionally. Query result is enabled:

MySQL [(none)]> show global variables like 'save_query_result';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| save_query_result | on    |
+-------------------+-------+

DanielZhangQD avatar Nov 21 '23 13:11 DanielZhangQD

现在的现象是, 执行q1 有时候也能看到结果, 之前其他sql 反而看不到, 修复bug 的时候需要终端关注一下

tianyahui-python avatar Nov 22 '23 02:11 tianyahui-python

Log: http://47.96.110.240/explore?panes=%7B%22Ikw%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bapp%3D%5C%22normal-cn%5C%22%7D%20%7C%3D%20%60794115f0-8856-11ee-a532-3e8dd997aa03%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%22now-24h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1

DanielZhangQD avatar Nov 22 '23 10:11 DanielZhangQD

Statement id: cf6e625e-8856-11ee-a532-3e8dd997aa03 Session id: 794115f0-8856-11ee-a532-3e8dd997aa03 Transaction id: 63b25ade-b5c6-4582-a1f5-c619ff4357f0 Request at: 11/21/2023 6:14:52 PM UTC+8 Response at: 11/21/2023 6:14:57 PM UTC+8

DanielZhangQD avatar Nov 22 '23 10:11 DanielZhangQD

{"level":"INFO","time":"2023/11/21 10:14:57.785146 +0000","name":"cn-service.frontend","caller":"frontend/mysql_cmd_executor.go:3341","msg":"time of Exec.Run : 5.40788172s","uuid":"37303538-3661-6561-3235-363337366537","session_info":"connectionId 1335568|172.20.6.3:35916|{account 738c8806_aa7b_412c_8370_59e47141cfaf:admin:accountadmin -- 9000001:2:2}|goRoutineId 4131|794115f0-8856-11ee-a532-3e8dd997aa03","session_id":"794115f0-8856-11ee-a532-3e8dd997aa03","statement_id":"cf6e625e-8856-11ee-a532-3e8dd997aa03"}

从log中看这个statement是执行成功的

{"level":"ERROR","time":"2023/11/21 10:17:43.914261 +0000","caller":"fileservice/aliyun_sdk.go:258","msg":"error: file mo-20231120/data/query_result_meta/738c8806_aa7b_412c_8370_59e47141cfaf_cf6e625e-8856-11ee-a532-3e8dd997aa03.blk is not found"}

然后在aliyun中找不到这个文件

需要看看这个statement的具体内容 还需要看看aliyun中是否有这个文件

YANGGMM avatar Nov 23 '23 09:11 YANGGMM

从aliyun的bucket中查看确实没有这个文件

YANGGMM avatar Nov 23 '23 09:11 YANGGMM

still working

YANGGMM avatar Nov 28 '23 10:11 YANGGMM

Another query in the new dev 7731bbfe-8df3-11ee-bc20-aa3ba8c1ceed

MySQL [system]> select * from result_scan('7731bbfe-8df3-11ee-bc20-aa3ba8c1ceed') as t limit 0,1000;
ERROR 20440 (HY000): result file query_result_meta/sys_7731bbfe-8df3-11ee-bc20-aa3ba8c1ceed.blk not found

DanielZhangQD avatar Nov 28 '23 13:11 DanielZhangQD

初步怀疑是 结果超过limit_query_result_size大小,现在加日志等待后续观察

YANGGMM avatar Nov 29 '23 08:11 YANGGMM

初步怀疑是 结果超过limit_query_result_size大小,现在加日志等待后续观察

TPCH Q1 就返回几条数据

DanielZhangQD avatar Nov 30 '23 02:11 DanielZhangQD

Another case in Prod env, 1.0.0

2023/12/07 08:21:54.448301 +0000 ERROR models/query_result.go:79 trace {"error": "Error 20301 (HY000): invalid input: empty query result", "elapsed": "43.103425ms", "rows": -1, "sql": "/* cloud_nonuser */ select * from result_scan('5ffa992e-94d9-11ee-a97c-1ec0f12d258b') as t limit 0,1000"}
MySQL [(none)]> select statement,status,request_at,response_at from system.statement_info where statement_id = '5ffa992e-94d9-11ee-a97c-1ec0f12d258b' and request_at >= '2023-12-07 08:16:00' and request_at < '2023-12-07 08:50:00';
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
| statement                                                                                                                                                                                                  | status  | request_at                 | response_at                |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
| select * from lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem | Success | 2023-12-07 08:19:43.413653 | 2023-12-07 08:21:54.385458 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
1 row in set (0.34 sec)

DanielZhangQD avatar Dec 20 '23 10:12 DanielZhangQD

Another case in Prod env, 1.0.0

2023/12/07 08:21:54.448301 +0000 ERROR models/query_result.go:79 trace {"error": "Error 20301 (HY000): invalid input: empty query result", "elapsed": "43.103425ms", "rows": -1, "sql": "/* cloud_nonuser */ select * from result_scan('5ffa992e-94d9-11ee-a97c-1ec0f12d258b') as t limit 0,1000"}
MySQL [(none)]> select statement,status,request_at,response_at from system.statement_info where statement_id = '5ffa992e-94d9-11ee-a97c-1ec0f12d258b' and request_at >= '2023-12-07 08:16:00' and request_at < '2023-12-07 08:50:00';
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
| statement                                                                                                                                                                                                  | status  | request_at                 | response_at                |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
| select * from lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem
union
select * from  lineitem | Success | 2023-12-07 08:19:43.413653 | 2023-12-07 08:21:54.385458 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+----------------------------+----------------------------+
1 row in set (0.34 sec)

Log: http://121.43.41.174/explore?panes=%7B%22y-p%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bapp%3D%5C%22default-cn%5C%22%7D%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%221701937146000%22,%22to%22:%221701937390000%22%7D%7D%7D&schemaVersion=1&orgId=1

DanielZhangQD avatar Dec 21 '23 09:12 DanielZhangQD

still working

YANGGMM avatar Jan 15 '24 10:01 YANGGMM

still working

YANGGMM avatar Jan 18 '24 10:01 YANGGMM

still working

YANGGMM avatar Jan 23 '24 11:01 YANGGMM

still working

YANGGMM avatar Jan 26 '24 10:01 YANGGMM

在处理其他问题

YANGGMM avatar Jan 31 '24 10:01 YANGGMM

在处理其他问题

YANGGMM avatar Feb 02 '24 07:02 YANGGMM

still working

YANGGMM avatar Feb 07 '24 12:02 YANGGMM

still working

YANGGMM avatar Feb 21 '24 10:02 YANGGMM

still working

YANGGMM avatar Mar 08 '24 10:03 YANGGMM

still working

YANGGMM avatar Mar 13 '24 10:03 YANGGMM

still working

YANGGMM avatar Mar 18 '24 10:03 YANGGMM

still working

YANGGMM avatar Mar 21 '24 12:03 YANGGMM

still working

YANGGMM avatar Mar 26 '24 10:03 YANGGMM

still working

YANGGMM avatar Mar 29 '24 10:03 YANGGMM

still working

YANGGMM avatar Apr 03 '24 10:04 YANGGMM

still

YANGGMM avatar Apr 08 '24 10:04 YANGGMM

still working

YANGGMM avatar Apr 11 '24 10:04 YANGGMM

still working

YANGGMM avatar Apr 16 '24 11:04 YANGGMM

still working

YANGGMM avatar Apr 19 '24 10:04 YANGGMM