tidb_low_resolution_tso should only take effect on SELECT query
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Currently, if we set `tidb_low_resolution_tso` to `ON` we cannot run write queries. I only discover this after mistakenly setting this value to `ON` at `GLOBAL` scope.
```sql
MySQL [canh]> CREATE TABLE users (
-> id INT PRIMARY KEY AUTO_INCREMENT,
-> username VARCHAR(255) NOT NULL UNIQUE,
-> email VARCHAR(255),
-> created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
-> );
Query OK, 0 rows affected (0.023 sec)
MySQL [canh]> set tidb_low_resolution_tso = ON;
Query OK, 0 rows affected (0.000 sec)
MySQL [canh]> INSERT INTO users (username, email) VALUES
-> ('jane_smith', 'jane.smith@example.com'),
-> ('peter_jones', 'peter.jones@example.com');
ERROR 1105 (HY000): can not execute write statement when 'tidb_low_resolution_tso' is set
```
IMO:
1. `tidb_low_resolution_tso` should only be effective for SELECT query; or
2. It should not be supported at `GLOBAL` scope (having a system variable that prevent all writes is way too dangerous)
Contributor guide
Assessment
This issue has not been assessed yet.