-
Notifications
You must be signed in to change notification settings - Fork 4.1k
kv: intent resolution for high priority pushes should not wait for batching #50390
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-kv-transactionsRelating to MVCC and the transactional model.Relating to MVCC and the transactional model.A-read-committedRelated to the introduction of Read CommittedRelated to the introduction of Read CommittedC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-kvKV TeamKV Team
Description
Describe the problem
When select for update a row, other query running into it will significantly increase cost, example below:
To Reproduce
- start fresh
./cockroach start-single-node --insecure
CREATE TABLE test_table (
id uuid NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO test_table (id) values ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO test_table (id) values ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb');- open two cockroach shells:
# shell 1
begin;
root@:26257/test_database OPEN> select * from test_table where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' for update;
id
----------------------------------------
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
(1 row)
Time: 766.309µs# shell 2
begin priority high;
root@:26257/default OPEN> select * from test_table where id = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' for update;
id
----------------------------------------
bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
(1 row)
Time: 1.265911ms
root@:26257/default OPEN> select * from test_table where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' for update;
id
----------------------------------------
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
(1 row)
Time: 14.729765msNotice that, the select time are significantly higher.
I don't know how to get around this ? Maybe we could have a select priority read and skip all of the checking
Because this make our select for update kinda work - but does not truly.
Environment:
- CockroachDB version: v20.1.1
P/s: another example
# shell 1
begin priority low;
root@:26257/default OPEN> select * from test_table where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' for update;
id
----------------------------------------
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
(1 row)
Time: 1.081118ms# shell 2
# no need transaction here
root@:26257/default> select * from test_table where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
id
----------------------------------------
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
(1 row)
Time: 19.77373msJira issue: CRDB-4129
Epic CRDB-25218
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-kv-transactionsRelating to MVCC and the transactional model.Relating to MVCC and the transactional model.A-read-committedRelated to the introduction of Read CommittedRelated to the introduction of Read CommittedC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-kvKV TeamKV Team