Skip to content

Avoid sending cop request for show columns for view #37369

@aytrack

Description

@aytrack

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. deploy a cluster with tikv
  2. execute the flow sql
create table if not exists added (`id` int(11), `name` text, `some_date` timestamp);
CREATE TABLE if not exists incremental (`id` int(11), `name`text, `some_date` timestamp);
create or replace view temp_view as (select * from `added` where id > (select max(id) from `incremental`));
set tidb_slow_log_threshold = 0;
show columns from temp_view;
  1. check the slow log for "show columns from temp_view"
tail -f tidb_slow_query.log |grep "show columns from temp_view" -A 20 |grep "Num_cop_tasks"

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

num_cop_tasks should always 0

3. What did you see instead (Required)

╭─tidb@localhost /tidb/deploy/audit/tidb-14100/log
╰─$ tail -f tidb_slow_query.log |grep "show columns from temp_view" -A 20 |grep "Num_cop_tasks"                                                                                                       
# Num_cop_tasks: 1
# Num_cop_tasks: 0
# Num_cop_tasks: 0
# Num_cop_tasks: 1
# Num_cop_tasks: 0
# Num_cop_tasks: 1
# Num_cop_tasks: 1
# Num_cop_tasks: 0
# Num_cop_tasks: 0
# Num_cop_tasks: 0
# Num_cop_tasks: 0
# Num_cop_tasks: 1
# Num_cop_tasks: 2

4. What is your TiDB version? (Required)

MySQL root@172.16.4.131:test> select * from information_schema.cluster_info;
+------+--------------------+--------------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| TYPE | INSTANCE           | STATUS_ADDRESS     | VERSION | GIT_HASH                                 | START_TIME                | UPTIME           | SERVER_ID |
+------+--------------------+--------------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| tidb | 172.16.4.131:14100 | 172.16.4.131:21080 | 6.1.1   | a5fd7d13dd234ca7dec2b8fd65831b8d7a2f5c39 | 2022-08-25T09:46:57+08:00 | 46m43.246893495s | 1939425   |
| pd   | 172.16.4.131:12379 | 172.16.4.131:12379 | 6.1.1   | 4ab9c0ef123441a0ef279bf9d2e36d1abe4a14c1 | 2022-08-25T09:46:51+08:00 | 46m49.246904453s | 0         |
| tikv | 172.16.4.131:21163 | 172.16.4.131:21183 | 6.1.0   | a116fcae5fc7b80d17906dedf2bb4d3929fb4dcc | 2022-08-25T09:46:53+08:00 | 46m47.246908401s | 0         |
+------+--------------------+--------------------+---------+------------------------------------------+---------------------------+------------------+-----------+

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions