pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.11k stars 5.83k forks source link

The `Succ` field in slow-log for interrupted(killed) queries is not correct #33541

Open qw4990 opened 2 years ago

qw4990 commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (a int);
insert into t values (1, 2, ..., 30);

select a, sleep(1) from t; -- in session-1
kill tidb {session-1-ID}; -- in session-2
# Time: 2022-03-29T12:09:54.267994+08:00
# Txn_start_ts: 432151457788854272
# User@Host: root[root] @ 127.0.0.1 [127.0.0.1]
# Conn_ID: 407
# Query_time: 9.904559531
# Parse_time: 0.000059072
# Compile_time: 0.000189809
# Rewrite_time: 0.000075135
# Optimize_time: 0.000048354
# Wait_TS: 0.000010953
# Cop_time: 0.000185059 Request_count: 1
# DB: test
# Is_internal: false
# Digest: 4d3a16fb84db716612c8eed76184d3bdadd49919464e97934ba7c28e3adcc8b7
# Stats: t:pseudo
# Num_cop_tasks: 1
# Cop_proc_avg: 0 Cop_proc_addr: store1
# Cop_wait_avg: 0 Cop_wait_addr: store1
# Mem_max: 1160
# Prepared: false
# Plan_from_cache: false
# Plan_from_binding: false
# Has_more_results: false
# KV_total: 0
# PD_total: 0.000001379
# Backoff_total: 0
# Write_sql_response_total: 0.000018256
# Result_rows: 96
# Succ: true
# IsExplicitTxn: false
# Plan: tidb_decode_plan('8wKYMAkzXzMJMAk5NglzbGVlcCgxKS0+Q29sdW1uIzMsIHRlc3QudC5hASDYdGltZTo5LjlzLCBsb29wczoyLCBDb25jdXJyZW5jeTpPRkYJMS4xMyBLQglOL0EKMQkzMV81CQVcTGRhdGE6VGFibGVGdWxsU2Nhbl80FVQYMjI2LjHCtS5YAHBjb3BfdGFzazoge251bTogMSwgbWF4OiAxNDkuOAUrRHByb2Nfa2V5czogMCwgcnBjXxEpAQwFrAggMTMJLOBjb3ByX2NhY2hlX2hpdF9yYXRpbzogMC4wMH0JMzU4IEJ5dGVzCU4vQQoyCTQzXzQJMV8wCTk2CXQBsYg6dCwga2VlcCBvcmRlcjpmYWxzZSwgc3RhdHM6cHNldWRvCQErCGlrdgmyAHsFfBAxMjIuNgWpKSwoMH0JTi9BCU4vQQo=')
# Plan_digest: 71e94616fedfe6fd248fb4ec1ab028eaa92e7261ac506e46103877b8763b70ef
use test;
select sleep(1), a from t;

2. What did you expect to see? (Required)

The Succ field should be false.

3. What did you see instead (Required)

# Succ: true

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                         |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.1.0-alpha-78-g8f8dfafc10-dirty
Edition: Community
Git Commit Hash: 8f8dfafc105d4177986dfb2ec706b1e9c08bc6fd
Git Branch: cost-refactor
UTC Build Time: 2022-03-29 05:10:21
GoVersion: go1.16.3
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
qw4990 commented 2 years ago

PTAL @XuHuaiyu