Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add PGLocks query to analyze what locks are held in pg#15308

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedOct 31, 2024
edited
Loading

AddsPGLocks query similar to how we havePing(). I cannot do this via SQLc, as SQLc does not know aboutpg_locks table.

The string format is able to be changed to extract more value. I recognize this is not perfect, but I wrote it trying to learn more about these locks. It felt valuable enough to keep. Not all values are handled correctly here, I'll add functionality as required.

Some example output

  1. Open a TX in modeserializable and runGetQuotaConsumedForUser()
794-<nil> [granted] <nil>/virtualxid/ExclusiveLock: waiting to acquire virtual tx id lock793-<nil> [granted] <nil>/virtualxid/ExclusiveLock: waiting to acquire virtual tx id lock794-<nil> [granted] pg_locks/relation/AccessShareLock: 793-<nil> [granted] workspace_builds/relation/AccessShareLock: 793-<nil> [granted] workspace_builds/tuple/SIReadLock: page=0 tuple=1793-<nil> [granted] workspace_builds_job_id_key/relation/AccessShareLock: 793-<nil> [granted] workspace_builds_pkey/relation/AccessShareLock: 793-<nil> [granted] workspace_builds_workspace_id_build_number_key/page/SIReadLock: page=1793-<nil> [granted] workspace_builds_workspace_id_build_number_key/relation/AccessShareLock: 793-<nil> [granted] workspaces/relation/AccessShareLock: 793-<nil> [granted] workspaces/relation/SIReadLock: 793-<nil> [granted] workspaces_owner_id_lower_idx/relation/AccessShareLock: 793-<nil> [granted] workspaces_owner_id_lower_idx/page/SIReadLock: page=1793-<nil> [granted] workspaces_pkey/relation/AccessShareLock:
  1. RunUpdateWorkspaceBuildCostByID in the TX
868-<nil> [granted] <nil>/virtualxid/ExclusiveLock: waiting to acquire virtual tx id lock867- 3689 [granted] <nil>/transactionid/ExclusiveLock: ???867-<nil> [granted] <nil>/virtualxid/ExclusiveLock: waiting to acquire virtual tx id lock868-<nil> [granted] pg_locks/relation/AccessShareLock: 867-<nil> [granted] workspace_builds/relation/AccessShareLock: 867-<nil> [granted] workspace_builds/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_job_id_key/relation/AccessShareLock: 867-<nil> [granted] workspace_builds_job_id_key/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_pkey/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_pkey/relation/AccessShareLock: 867-<nil> [granted] workspace_builds_pkey/page/SIReadLock: page=1867-<nil> [granted] workspace_builds_workspace_id_build_number_key/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_workspace_id_build_number_key/relation/AccessShareLock: 867-<nil> [granted] workspace_builds_workspace_id_build_number_key/page/SIReadLock: page=1867-<nil> [granted] workspaces/relation/AccessShareLock: 867-<nil> [granted] workspaces/relation/SIReadLock: 867-<nil> [granted] workspaces_owner_id_lower_idx/relation/AccessShareLock: 867-<nil> [granted] workspaces_owner_id_lower_idx/page/SIReadLock: page=1867-<nil> [granted] workspaces_pkey/relation/AccessShareLock:

Specifically these are thenew locks aquired:

868-<nil> [granted] <nil>/virtualxid/ExclusiveLock: waiting to acquire virtual tx id lock867- 3689 [granted] <nil>/transactionid/ExclusiveLock: ???868-<nil> [granted] pg_locks/relation/AccessShareLock: 867-<nil> [granted] workspace_builds/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_job_id_key/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_pkey/relation/RowExclusiveLock: 867-<nil> [granted] workspace_builds_pkey/page/SIReadLock: page=1867-<nil> [granted] workspace_builds_workspace_id_build_number_key/relation/RowExclusiveLock:

Used to respond here:#15261 (comment)

@EmyrkEmyrk marked this pull request as ready for reviewOctober 31, 2024 15:04
Comment on lines +50 to +57
case "relation":
details = ""
case "page":
details = fmt.Sprintf("page=%d", *l.Page)
case "tuple":
details = fmt.Sprintf("page=%d tuple=%d", *l.Page, *l.Tuple)
case "virtualxid":
details = "waiting to acquire virtual tx id lock"
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Will implement this as needed. Not going to be exhaustive here right now

@EmyrkEmyrk merged commit3a9270d intostevenmasley/postgres_tx_serialNov 1, 2024
26 checks passed
@EmyrkEmyrk deleted the stevenmasley/postgres_tx_serial_pg_locks branchNovember 1, 2024 13:25
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 1, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@spikecurtisspikecurtisspikecurtis approved these changes

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Emyrk@spikecurtis

[8]ページ先頭

©2009-2025 Movatter.jp