Skip to content

ddl: the use of sys var tidb_scatter_region seems incorrect #61321

@fzzf678

Description

@fzzf678

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int);

-- global scope
mysql> set @@global.tidb_scatter_region='table';
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye
(base) ➜  ~ mysql -h 127.0.0.1 -P 4001 --local-infile=1  -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 44040196
Server version: 8.0.11-TiDB-v8.4.0-this-is-a-placeholder TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> truncate table t;
Query OK, 0 rows affected (32.54 sec)

-- session scope
mysql> set @@session.tidb_scatter_region='table';
Query OK, 0 rows affected (0.00 sec)

mysql> truncate table t;
Query OK, 0 rows affected (2 min 50.06 sec)

After set the sys var tidb_scatter_region and truncate a table, in function preSplitAndScatter we can't get the val, it's both empty in global and session scope:

  • global:
Image
  • sesssion:
Image

Maybe introduce by #56157

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

Get tidb_scatter_region value

3. What did you see instead (Required)

Can't get tidb_scatter_region value

4. What is your TiDB version? (Required)

v8.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions