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

[DocDB] Single Shard waiters don't make progress when the blocking subtransaction is rolled back #20113

Closed
1 task done
basavaraj29 opened this issue Nov 30, 2023 · 1 comment

Comments

@basavaraj29
Copy link
Contributor

basavaraj29 commented Nov 30, 2023

Jira Link: DB-9051

Description

begin TRANSACTION ISOLATION LEVEL READ COMMITTED;
savepoint a;
select * from test where k=1 for update;                            
                                                       update test set v=v+1 where k=1; // ends up getting blocked
rollback to a;
                                                       // doesn't make progress, why?
commit;
                                                       // goes through now

The single shard txn on the right can ideally make progress just after the rollback of the sub-transaction on the left, but it doesn't.
If we have a distributed transaction on the right, it goes through just after the rollback and doesn't wait for the left txn to commit.

upon checking, we override the below in case of OperationConflictResolverContext,

bool CheckConflictWithPending(const TransactionConflictData& transaction_data) override {
  return false;
}

which seems to give us a wrong impression that the wait for is still valid.

for the distributed transaction case, we have

bool CheckConflictWithPending(const TransactionConflictData& transaction_data) override {
  return transaction_data.conflict_info->subtransactions.empty();
}

which I think can be re-used for the single shard waiters as well.

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@basavaraj29 basavaraj29 added area/docdb YugabyteDB core features status/awaiting-triage Issue awaiting triage labels Nov 30, 2023
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Nov 30, 2023
@basavaraj29 basavaraj29 changed the title [DocDB] Single Shard waiters don't make progress when locks are released by rolled back subtransactions [DocDB] Single Shard waiters don't make progress when the blocking subtransaction is rolled back Nov 30, 2023
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Dec 5, 2023
basavaraj29 added a commit that referenced this issue Dec 7, 2023
…lls back

Summary:
Single shard waiters don't seem to get unblocked after a blocking subtxn rolls back. But if we have a distributed transaction instead, it progresses as expected, i.e. it makes progress after the blocking subtxn rolls back.

This diff addresses the issue by re-using the same logic for checking conflicts with pending transaction(s) across both distributed transactions and single shard transactions.
Jira: DB-9051

Test Plan:
Jenkins

./yb_build.sh --java-test org.yb.pgsql.TestPgWaitQueuesRegress

Reviewers: rsami, pjain, rthallam

Reviewed By: rsami

Subscribers: ybase, yql

Differential Revision: https://phorge.dev.yugabyte.com/D30690
basavaraj29 added a commit that referenced this issue Dec 12, 2023
…cking subtxn rolls back

Summary:
Original commit: 7f5b092 / D30690
Single shard waiters don't seem to get unblocked after a blocking subtxn rolls back. But if we have a distributed transaction instead, it progresses as expected, i.e. it makes progress after the blocking subtxn rolls back.

This diff addresses the issue by re-using the same logic for checking conflicts with pending transaction(s) across both distributed transactions and single shard transactions.
Jira: DB-9051

Test Plan:
Jenkins

./yb_build.sh --java-test org.yb.pgsql.TestPgWaitQueuesRegress

Reviewers: rsami, pjain, rthallam

Reviewed By: rsami, rthallam

Subscribers: yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D30833
@basavaraj29 basavaraj29 reopened this Dec 14, 2023
@basavaraj29
Copy link
Contributor Author

Ignoring intents from aborted subtransactions was introduced in 4fb1676 (v2.13.3.0). Could look at backporting this enhancement upto 2.14.

basavaraj29 added a commit that referenced this issue Dec 15, 2023
…cking subtxn rolls back

Summary:
Original commit: 7f5b092 / D30690
Single shard waiters don't seem to get unblocked after a blocking subtxn rolls back. But if we have a distributed transaction instead, it progresses as expected, i.e. it makes progress after the blocking subtxn rolls back.

This diff addresses the issue by re-using the same logic for checking conflicts with pending transaction(s) across both distributed transactions and single shard transactions.
Jira: DB-9051

Test Plan:
Jenkins

./yb_build.sh --java-test org.yb.pgsql.TestPgWaitQueuesRegress

Reviewers: rsami, pjain, rthallam

Reviewed By: rthallam

Subscribers: yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D31093
basavaraj29 added a commit that referenced this issue Dec 15, 2023
…cking subtxn rolls back

Summary:
Original commit: 7f5b092 / D30690
Single shard waiters don't seem to get unblocked after a blocking subtxn rolls back. But if we have a distributed transaction instead, it progresses as expected, i.e. it makes progress after the blocking subtxn rolls back.

This diff addresses the issue by re-using the same logic for checking conflicts with pending transaction(s) across both distributed transactions and single shard transactions.
Jira: DB-9051

Test Plan:
Jenkins

./yb_build.sh --java-test org.yb.pgsql.TestPgWaitQueuesRegress

Reviewers: rsami, pjain, rthallam

Reviewed By: rthallam

Subscribers: yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D31094
basavaraj29 added a commit that referenced this issue Dec 15, 2023
…cking subtxn rolls back

Summary:
Original commit: 7f5b092 / D30690
Single shard waiters don't seem to get unblocked after a blocking subtxn rolls back. But if we have a distributed transaction instead, it progresses as expected, i.e. it makes progress after the blocking subtxn rolls back.

This diff addresses the issue by re-using the same logic for checking conflicts with pending transaction(s) across both distributed transactions and single shard transactions.
Jira: DB-9051

Test Plan:
Jenkins

./yb_build.sh --java-test org.yb.pgsql.TestPgWaitQueuesRegress

Reviewers: rsami, pjain, rthallam

Reviewed By: rthallam

Subscribers: yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D31096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants