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] Expose RPC endpoint to fetch long-running transactions from transaction coordinator #16912

Closed
1 task done
robertsami opened this issue Apr 18, 2023 · 0 comments
Closed
1 task done
Assignees
Labels
area/docdb YugabyteDB core features kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@robertsami
Copy link
Contributor

robertsami commented Apr 18, 2023

Jira Link: DB-6241

Description

Expose new RPC endpoint to fetch transactions and their involved tablets based on:

  • min_txn_age – only return txns older than this
  • max_txns – only return at most this many txns, starting with the oldest first

We may need to start persisting txn start time when we send the first heartbeat after taking the txn if we do not already. It may also be good enough to just store this in memory at the coordinator.

This will be the endpoint hit in the first step of pg_client_service's GetLockStatus

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

  • I confirm this issue does not contain any sensitive information.
@robertsami robertsami added area/docdb YugabyteDB core features status/awaiting-triage Issue awaiting triage labels Apr 18, 2023
@robertsami robertsami added this to Needs Triage in Wait-Queue Based Locking via automation Apr 18, 2023
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Apr 18, 2023
@robertsami robertsami moved this from Needs Triage to On-By-Default Blocking in Wait-Queue Based Locking Apr 18, 2023
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug status/awaiting-triage Issue awaiting triage labels Apr 18, 2023
@robertsami robertsami moved this from On-By-Default Blocking to GA Blocking in Wait-Queue Based Locking May 4, 2023
@robertsami robertsami moved this from GA Blocking to In progress in Wait-Queue Based Locking May 4, 2023
@robertsami robertsami self-assigned this May 8, 2023
robertsami added a commit that referenced this issue Jun 21, 2023
…ransaction metadata

Summary:
This revision adds a GetOldTransactions endpoint at the tserver. This endpoint allows fetching the oldest transactions at a given status tablet, along with associated metadata such as involved tablets and aborted subtransactions which will be required when fetching lock statuses for these transactions in pg_locks. The RPC returns only those transactions which are older than a specified minimum age, and optionally at most a specified max number of transactions (prioritizing the oldest first).

A few changes needed to be made to support this endpoint:
1. The client needs to report involved tablets to the coordinator during heartbeat even if the transaction is pending. Previously we would only report these tablets on commit. This behavior can be turned off using the new flag `--disable_heartbeat_send_involved_tablets`, which is included in this revision as a precautionary measure
2. We index managed transactions in the coordinator by a new first_touch field, which stores the start time of the transaction reported by the client

Test Plan: `ybd --cxx-test pgwrapper_pg_old_txn-test`

Reviewers: bkolagani, pjain, esheng, sergei

Reviewed By: bkolagani, esheng

Subscribers: bogdan

Differential Revision: https://phorge.dev.yugabyte.com/D25351
@robertsami robertsami moved this from In progress to Needs Backport in Wait-Queue Based Locking Jun 21, 2023
robertsami added a commit that referenced this issue Jun 21, 2023
… long-running transaction metadata

Summary:
Original commit: 320cffb / D25351
This revision adds a GetOldTransactions endpoint at the tserver. This endpoint allows fetching the oldest transactions at a given status tablet, along with associated metadata such as involved tablets and aborted subtransactions which will be required when fetching lock statuses for these transactions in pg_locks. The RPC returns only those transactions which are older than a specified minimum age, and optionally at most a specified max number of transactions (prioritizing the oldest first).

A few changes needed to be made to support this endpoint:
1. The client needs to report involved tablets to the coordinator during heartbeat even if the transaction is pending. Previously we would only report these tablets on commit. This behavior can be turned off using the new flag `--disable_heartbeat_send_involved_tablets`, which is included in this revision as a precautionary measure
2. We index managed transactions in the coordinator by a new first_touch field, which stores the start time of the transaction reported by the client
Jira: DB-6241

Test Plan: `ybd --cxx-test pgwrapper_pg_old_txn-test`

Reviewers: bkolagani, pjain, esheng, sergei

Reviewed By: bkolagani

Subscribers: bogdan

Differential Revision: https://phorge.dev.yugabyte.com/D26319
Wait-Queue Based Locking automation moved this from Needs Backport to Done Jun 22, 2023
dr0pdb pushed a commit to dr0pdb/yugabyte-db that referenced this issue Jul 6, 2023
…unning transaction metadata

Summary:
This revision adds a GetOldTransactions endpoint at the tserver. This endpoint allows fetching the oldest transactions at a given status tablet, along with associated metadata such as involved tablets and aborted subtransactions which will be required when fetching lock statuses for these transactions in pg_locks. The RPC returns only those transactions which are older than a specified minimum age, and optionally at most a specified max number of transactions (prioritizing the oldest first).

A few changes needed to be made to support this endpoint:
1. The client needs to report involved tablets to the coordinator during heartbeat even if the transaction is pending. Previously we would only report these tablets on commit. This behavior can be turned off using the new flag `--disable_heartbeat_send_involved_tablets`, which is included in this revision as a precautionary measure
2. We index managed transactions in the coordinator by a new first_touch field, which stores the start time of the transaction reported by the client

Test Plan: `ybd --cxx-test pgwrapper_pg_old_txn-test`

Reviewers: bkolagani, pjain, esheng, sergei

Reviewed By: bkolagani, esheng

Subscribers: bogdan

Differential Revision: https://phorge.dev.yugabyte.com/D25351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
Status: Done
Development

No branches or pull requests

2 participants