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

[YSQL] Support observability of actively held and contended locks via pg_locks #12168

Closed
pkj415 opened this issue Apr 14, 2022 · 2 comments
Closed
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics priority/medium Medium priority issue

Comments

@pkj415
Copy link
Contributor

pkj415 commented Apr 14, 2022

Jira Link: DB-502

Description

This google doc is the the functional specification for this feature.

The functional specification and design document will be moved to a .md file once the design is finalized.

Postgres

PG Client

Transaction Coordinator

Tablet

@pkj415 pkj415 added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 14, 2022
@pkj415 pkj415 added the pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics label May 24, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels May 24, 2022
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Jul 23, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug labels Aug 18, 2022
@pkj415 pkj415 changed the title [YSQL] Expose row/column locks taken by active transactions to external clients [YSQL] Expose to the user, row/ column intents and intent types acquired (or waited up on) by transactions Nov 4, 2022
@yugabyte-ci yugabyte-ci assigned robertsami and unassigned tvesely Dec 19, 2022
@robertsami
Copy link
Contributor

We've tentatively agreed on the following schema:

Important fields
----------------
locktype           | relation, keyrange
database           | oid
relation           | oid
pid                | will use 0 for remote backends
mode               | map YSQL modes into Pg modes as much as possible. Add new ones when not possible
granted            | true/ false
fastpath           | Reuse field to indicate whether this is a single shard transaction. In Pg, this has a different meaning which doesn't concern us.
waitstart          | when did this backend start waiting for the lock
waitend            | extra field in YB that also indicates when a particular lock was acquired
ybdetails          | {
                        "node": where does the lock reside?,
                        "transactionid": transaction that holds the lock,
                        "subtransactionid": subtransaction in which lock was acquired,
                        "isexplicit": is this an explicit lock such as `FOR UPDATE` or just an implicit one like one taken by `UPDATE`,
                        "tabletid": which tablet?,
                        "ybkeyrangedetails": {
                          "hash cols": [list of hash col values],
                          "range cols": [list of range col values],
                          "is_full_pk": true/ false
                          "column_id": column id if this is a col level lock
                        }
                     }

Unimportannt fields
-------------------

page               | ****Removed****
tuple              | ****Removed****
virtualxid         | ****Removed****. (In Pg this is not the current txn's xid, it is the virtualxid of the txn that is to be locked. We don't allow locking virtual txn ids in YSQL)
Transactionid      | ****Removed****. (In Pg this is not the current txn's id, it is the id of the txn that is to be locked. We don't allow locking txn ids in YSQL)
classid            | NULL in YSQL since we don't support locking db objects
objid              | NULL in YSQL since we don't support locking db objects
objsubid           | NULL in YSQL since we don't support locking db objects
virtualtransaction | ****Removed**** we decided to preserve this in the meeting for single shard transactions, but we can reuse "transactionid" of "ybdetails" field and ignore this field

@robertsami robertsami changed the title [YSQL] Expose to the user, row/ column intents and intent types acquired (or waited up on) by transactions [YSQL] Support observability of actively held and contended locks via pg_locks Mar 30, 2023
@yugabyte-ci yugabyte-ci changed the title [YSQL] Support observability of actively held and contended locks via pg_locks [YSQL] Support obsersvability of actively held and contended locks via pg_locks Aug 9, 2023
@yugabyte-ci yugabyte-ci changed the title [YSQL] Support obsersvability of actively held and contended locks via pg_locks [YSQL] Support observability of actively held and contended locks via pg_locks Aug 29, 2023
@rthallamko3
Copy link
Contributor

Created #18901 to track the remaining GA items, so that we can close this GH issue. cc @robertsami . This helps with tracking on the release side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

6 participants