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

Avoid sending cop request for show columns for view #37369

Open
aytrack opened this issue Aug 25, 2022 · 2 comments
Open

Avoid sending cop request for show columns for view #37369

aytrack opened this issue Aug 25, 2022 · 2 comments
Assignees
Labels
sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.

Comments

@aytrack
Copy link
Contributor

aytrack commented Aug 25, 2022

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         |
+------+--------------------+--------------------+---------+------------------------------------------+---------------------------+------------------+-----------+
@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/execution SIG execution labels Aug 25, 2022
@aytrack
Copy link
Contributor Author

aytrack commented Aug 25, 2022

similar to #36496 but the fix pr #36629 is already merged.

@windtalker windtalker added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Aug 25, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 labels Aug 25, 2022
@bb7133
Copy link
Member

bb7133 commented Aug 26, 2022

I don't think this is a bug. There's no such spec/design saying that 'we can't send copr request for SHOW COLUMNS'. I will change this to 'enhancement'.

@bb7133 bb7133 changed the title show columns for view send cop request Avoid sending cop request for show columns for view Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

5 participants