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

[YCQL] Index scan and parallel scan need to use a consistent read time when doing a multi page scan #13502

Open
lnguyen-yugabyte opened this issue Aug 1, 2022 · 0 comments
Assignees
Labels
area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@lnguyen-yugabyte
Copy link
Contributor

lnguyen-yugabyte commented Aug 1, 2022

Jira Link: DB-3098

Description

Currently for index scan and parallel scan, a consistent read point is not enforced. That results in an index scan having different read time on each page, which might cause one to read a partial update of a transaction (similar to the issue in #10328).

Example

CREATE TABLE t (k int primary key, v1 int, v2 int) WITH transactions = "
      "{ 'enabled' : true };

INSERT INTO t (k, v1, v2) VALUES (0, 0, 20000);
INSERT INTO t (k, v1, v2) VALUES (1, 0, 0);

CREATE INDEX idx ON t(v1);

Now on two ycqlsh shells, execute the following concurrently:

ycqlsh1>   BEGIN TRANSACTION
                   ... update t set v2 = v2 - 10 where k = 0;
                   ... update t set v2 = v2 - 10 where k = 1;
                   ... insert into t (k, v1, v2) values (2, 0, 10) if not exists else error;
                   ... insert into t (k, v1, v2) values (3, 0, 10) if not exists else error;
                   ... END TRANSACTION;
ycqlsh2> paging 1;

ycqlsh2>
explain select (k, v1, v2) from t where v1 = 0;

 QUERY PLAN
-----------------------------------------------------------
 Index Scan using ybdemo_keyspace.idx on ybdemo_keyspace.t
   Key Conditions: (v1 = 0)

ycqlsh2> select k, v1, v2 from t where v1 = 0;

The result would be

 k | v1 | v2
---+----+-------
 0 |  0 | 20000

---MORE---
 k | v1 | v2
---+----+-----
 1 |  0 | -10

---MORE---
 k | v1 | v2
---+----+----
 2 |  0 | 10

---MORE---
 k | v1 | v2
---+----+----
 3 |  0 | 10

which is wrong.

@lnguyen-yugabyte lnguyen-yugabyte added area/ycql Yugabyte CQL (YCQL) status/awaiting-triage Issue awaiting triage labels Aug 1, 2022
@lnguyen-yugabyte lnguyen-yugabyte self-assigned this Aug 1, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Aug 1, 2022
@lnguyen-yugabyte lnguyen-yugabyte removed the priority/medium Medium priority issue label Aug 1, 2022
@yugabyte-ci yugabyte-ci added priority/medium Medium priority issue and removed status/awaiting-triage Issue awaiting triage labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants