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] Fix pg_locks "relation" column after table rewrite #22081

Closed
1 task done
fizaaluthra opened this issue Apr 19, 2024 · 0 comments
Closed
1 task done

[YSQL] Fix pg_locks "relation" column after table rewrite #22081

fizaaluthra opened this issue Apr 19, 2024 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue status/awaiting-triage Issue awaiting triage

Comments

@fizaaluthra
Copy link
Contributor

fizaaluthra commented Apr 19, 2024

Jira Link: DB-11001

Description

Currently, after a table rewrite, this column will be populated with the relfilenode ID instead of the PG table OID.

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.
@fizaaluthra fizaaluthra added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 19, 2024
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Apr 19, 2024
@fizaaluthra fizaaluthra self-assigned this Apr 19, 2024
fizaaluthra added a commit that referenced this issue Apr 23, 2024
…er a table rewrite

Summary:
Currently, after a table rewrite, the "relation" column in `pg_locks` will be populated with the
table's relfilenode oid instead of the table oid. This is because `TabletLockInfoPB` (and `LockInfoPB`
for a colocated table) is populated with the DocDB table's UUID. However, after a table rewrite
the DocDB table UUID no longer matches the table oid (instead, it matches the relfilenode of the table).

This diff fixes the above issue and introduces the following changes:
- Rename `table_id` proto fields in `LockInfoPB` and `TabletLockInfoPB` to `pg_table_id`.
- Populate the `pg_table_id` field with either `pg_table_id` (if non-empty) or `table_id` present in `TableInfo`.
- Additionally, some `TableInfo` constructors don't set `pg_table_id` -- fix this.
- `pg_table_id` was previously not set in tablet metadata for colocated tables, fix this by setting it in `AsyncAddTableToTablet`.

Upgrade/Rollback safety:
This change is upgrade/rollback safe as we are simply renaming existing proto fields (and not adding any new ones).
Jira: DB-11001

Test Plan: ./yb_build.sh --cxx-test pgwrapper_pg_get_lock_status-test --gtest_filter PgGetLockStatusTest.TestPgLocksOutputAfterTableRewrite

Reviewers: pjain, patnaik.balivada, bkolagani

Reviewed By: patnaik.balivada, bkolagani

Subscribers: yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D34339
fizaaluthra added a commit that referenced this issue Apr 23, 2024
…n of pg_locks after a table rewrite

Summary:
Currently, after a table rewrite, the "relation" column in `pg_locks` will be populated with the
table's relfilenode oid instead of the table oid. This is because `TabletLockInfoPB` (and `LockInfoPB`
for a colocated table) is populated with the DocDB table's UUID. However, after a table rewrite
the DocDB table UUID no longer matches the table oid (instead, it matches the relfilenode of the table).

This diff fixes the above issue and introduces the following changes:
- Rename `table_id` proto fields in `LockInfoPB` and `TabletLockInfoPB` to `pg_table_id`.
- Populate the `pg_table_id` field with either `pg_table_id` (if non-empty) or `table_id` present in `TableInfo`.
- Additionally, some `TableInfo` constructors don't set `pg_table_id` -- fix this.
- `pg_table_id` was previously not set in tablet metadata for colocated tables, fix this by setting it in `AsyncAddTableToTablet`.

Upgrade/Rollback safety:
This change is upgrade/rollback safe as we are simply renaming existing proto fields (and not adding any new ones).
Jira: DB-11001

Original commit: ad67123 / D34339

Test Plan: ./yb_build.sh --cxx-test pgwrapper_pg_get_lock_status-test --gtest_filter PgGetLockStatusTest.TestPgLocksOutputAfterTableRewrite

Reviewers: pjain, patnaik.balivada, bkolagani

Reviewed By: patnaik.balivada

Subscribers: ybase, yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34422
svarnau pushed a commit that referenced this issue May 25, 2024
…er a table rewrite

Summary:
Currently, after a table rewrite, the "relation" column in `pg_locks` will be populated with the
table's relfilenode oid instead of the table oid. This is because `TabletLockInfoPB` (and `LockInfoPB`
for a colocated table) is populated with the DocDB table's UUID. However, after a table rewrite
the DocDB table UUID no longer matches the table oid (instead, it matches the relfilenode of the table).

This diff fixes the above issue and introduces the following changes:
- Rename `table_id` proto fields in `LockInfoPB` and `TabletLockInfoPB` to `pg_table_id`.
- Populate the `pg_table_id` field with either `pg_table_id` (if non-empty) or `table_id` present in `TableInfo`.
- Additionally, some `TableInfo` constructors don't set `pg_table_id` -- fix this.
- `pg_table_id` was previously not set in tablet metadata for colocated tables, fix this by setting it in `AsyncAddTableToTablet`.

Upgrade/Rollback safety:
This change is upgrade/rollback safe as we are simply renaming existing proto fields (and not adding any new ones).
Jira: DB-11001

Test Plan: ./yb_build.sh --cxx-test pgwrapper_pg_get_lock_status-test --gtest_filter PgGetLockStatusTest.TestPgLocksOutputAfterTableRewrite

Reviewers: pjain, patnaik.balivada, bkolagani

Reviewed By: patnaik.balivada, bkolagani

Subscribers: yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D34339
ZhenYongFan pushed a commit to ZhenYongFan/yugabyte-db that referenced this issue Jun 15, 2024
…on column of pg_locks after a table rewrite

Summary:
Currently, after a table rewrite, the "relation" column in `pg_locks` will be populated with the
table's relfilenode oid instead of the table oid. This is because `TabletLockInfoPB` (and `LockInfoPB`
for a colocated table) is populated with the DocDB table's UUID. However, after a table rewrite
the DocDB table UUID no longer matches the table oid (instead, it matches the relfilenode of the table).

This diff fixes the above issue and introduces the following changes:
- Rename `table_id` proto fields in `LockInfoPB` and `TabletLockInfoPB` to `pg_table_id`.
- Populate the `pg_table_id` field with either `pg_table_id` (if non-empty) or `table_id` present in `TableInfo`.
- Additionally, some `TableInfo` constructors don't set `pg_table_id` -- fix this.
- `pg_table_id` was previously not set in tablet metadata for colocated tables, fix this by setting it in `AsyncAddTableToTablet`.

Upgrade/Rollback safety:
This change is upgrade/rollback safe as we are simply renaming existing proto fields (and not adding any new ones).
Jira: DB-11001

Original commit: ad67123 / D34339

Test Plan: ./yb_build.sh --cxx-test pgwrapper_pg_get_lock_status-test --gtest_filter PgGetLockStatusTest.TestPgLocksOutputAfterTableRewrite

Reviewers: pjain, patnaik.balivada, bkolagani

Reviewed By: patnaik.balivada

Subscribers: ybase, yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34422
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/bug This issue is a bug priority/medium Medium priority issue status/awaiting-triage Issue awaiting triage
Projects
None yet
Development

No branches or pull requests

2 participants