-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
the default value of tidb_partition_prune_mode
is set to dynamic
#27156
Comments
another test scenario that does not meet expectations: /* s1 */ create table t2(c1 int primary key, c2 int, c3 int, c4 int, unique key uk2(c2), key k3(c3));
/* s1 */ insert into t2 values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4);
/* s1 */ set autocommit = 0;
/* s1 */ set innodb_lock_wait_timeout = 0;
/* s1 */ set tidb_txn_mode = pessimistic;
/* s3 */ set autocommit = 0;
/* s3 */ set tidb_txn_mode = optimistic;
/* s1 */ select * from t2 where c4 > 2 for update;
/* s3 */ update t2 set c4 = c4 * 10 where c4 = 4;
/* s1 */ commit;
/* s3 */ commit; ---return error:Write conflict do the same operations, but commit success; /* s1 */ drop table if exists t2;
/* s1 */ create table t2(c1 int primary key, c2 int, c3 int, c4 int, unique key uk2(c2), key k3(c3));
/* s1 */ insert into t2 values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4);
/* s1 */ set autocommit = 0;
/* s1 */ set innodb_lock_wait_timeout = 0;
/* s1 */ set tidb_txn_mode = pessimistic;
/* s3 */ set autocommit = 0;
/* s3 */ set tidb_txn_mode = optimistic;
/* s1 */ select * from t2 where c4 > 2 for update;
/* s3 */ update t2 set c4 = c4 * 10 where c4 = 4;
/* s1 */ commit;
/* s3 */ commit; ---actual success,expect return error:Write conflict |
I meet the problem with the partition table only, is the partition statement missing in the second code section? |
ordinary table excute the same operation twice, and it will be submitted successfully |
@vivid392845427 thanks, this case is confirmed. |
In the second round, session1 executes |
A simple reproduce. /* init */ drop table if exists t2;
/* init */ create table t2(c1 int primary key, c2 int, c3 int, c4 int, key k2(c2), key k3(c3)) partition by hash(c1) partitions 10;
/* init */ insert into t2 values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4);
/* s3 */ set tidb_general_log = 1;
/* s3 */ set autocommit = 0;
/* s3 */ set tidb_txn_mode = optimistic;
/* s3 */ update t2 set c4 = c4 * 10 where c4 = 4;
/* s3 */ commit;
/* s3 */ select * from t2; -- 0 rows returned
/* s3 */ select * from t2; -- 4 rows returned, the effect of update is lost |
After #26972, the default value of |
So there are two problems in this issue.
|
The reason why TiDB highly depends on flags when bootstrapping environment variables. Line 91 in 50572f1
Here Lines 1661 to 1667 in 50572f1
As BR moved into TiDB and BR use the packages from PD, the flags set by PD will be inherited by TiDB. Then the unexpected behavior appears. |
@you06 could you cross reference to the PD issue number? |
OK I can see the corresponding PR is tikv/pd#3999 |
@tisonkun not yet, this issue actually reports a bug of the new feature, as I mentioned here, the second problem still needs to be fixed.
|
tikv/pd#3999 temporarily solves the issue of the default value, I filed up an issue for tracing a complete solution in #27351. If you're interested in this problem, check it out. |
@you06 |
Open a new one is a good idea, there are already many discussions about the flag problem in this issue. |
tidb_partition_prune_mode
is set to dynamic
The further solution to the first problem can be discussed in #27351. Move the second problem to #27532, will investigate in that issue. Close this issue. |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)The 2. Symptom (optional)Check the MySQL [test]> select @@tidb_partition_prune_mode;
+-----------------------------+
| @@tidb_partition_prune_mode |
+-----------------------------+
| static |
+-----------------------------+
1 row in set (0.001 sec) 3. All Trigger Conditions (optional)All the users will use the unstable feature by default. 4. Workaround (optional)5. Affected versionsunreleased 6. Fixed versionsmaster |
( AffectedVersions ) fields are empty. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
2. What did you expect to see? (Required)
commit return err:
3. What did you see instead (Required)
commit success
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: