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] GetLockStatus returns the wrong value for table_id when querying a colocated table #18205

Closed
1 task done
tvesely opened this issue Jul 13, 2023 · 0 comments
Closed
1 task done
Assignees
Labels
area/docdb YugabyteDB core features kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@tvesely
Copy link
Contributor

tvesely commented Jul 13, 2023

Jira Link: DB-7226

Description

GetLockStatus returns the wrong table_id when operating on a colocated table.

testdb=# select * from yb_lock_status(null,null);
ERROR:  Not a YSQL ID string: 00004000000030008000000000004004.colocation.parent.uuid

The PgGetLockStatusResponse:

node_locks {
  permanent_uuid: "a18b02419a354998b5bfbc499ccffe7b"
  tablet_lock_infos {
    table_id: "00004000000030008000000000004004.colocation.parent.uuid"
    tablet_id: "19a5fef75f664cc98cc5e68cbd472083"
  }
  tablet_lock_infos {
    table_id: "00004000000030008000000000004004.colocation.parent.uuid"
    tablet_id: "dc6d40f15f1e48b4b7d273c57d791f52"
    transaction_locks {
      key: "ad545d25-d35b-418c-8969-cb3c46672b1a"
      value {
<snip>
        locks {
          range_cols: "1"
          attnum: 7
          column_id: 16
          multiple_rows_locked: false
          wait_end_ht: 6918625730931699712
          subtransaction_id: 1
          is_explicit: false
          modes: STRONG_READ
          modes: STRONG_WRITE
        }
      }
    }
  }

When decoding intents we should obtain the ColocationId from the DocKey, and use that to look up the correct table_id from the tablet schema.

SubDocKey(DocKey(ColocationId=706431629, [], []), []) [kWeakRead, kWeakWrite] HT{ days: 19550 time: 16:58:54.320346 w: 3 } => TransactionId(7916e577-8f9f-4805-8cbb-8d6d47d83b2c) SubTransactionId(2) none

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

  • I confirm this issue does not contain any sensitive information.
@tvesely tvesely added area/docdb YugabyteDB core features status/awaiting-triage Issue awaiting triage labels Jul 13, 2023
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jul 13, 2023
@robertsami robertsami added this to Needs Triage in Wait-Queue Based Locking via automation Jul 13, 2023
@robertsami robertsami moved this from Needs Triage to Tech-Preview (Due 7/21/23) in Wait-Queue Based Locking Jul 13, 2023
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Jul 13, 2023
@robertsami robertsami assigned basavaraj29 and unassigned robertsami Jul 19, 2023
@robertsami robertsami moved this from Tech-Preview (Due 7/21/23) to In progress in Wait-Queue Based Locking Jul 19, 2023
basavaraj29 added a commit that referenced this issue Jul 21, 2023
Summary:
Previously, we used to return the non-primary table id in the GetLockStatus resp for colocated tables.

This diff addresses the issue by populating the table_id at `LockInfoPB` level (per lock) and setting the table id when the lock belongs to a colocated table. In other cases, the table id is set at `TabletLockInfoPB` level. Additionally, the diff also fixes an issue with the schema being used when populating the response. It now uses the right schema (both in colocated and non-colocated case).
Jira: DB-7226

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

Reviewers: rsami, tvesely

Reviewed By: rsami

Subscribers: yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D27110
Wait-Queue Based Locking automation moved this from In progress to Done Jul 22, 2023
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/bug This issue is a bug priority/medium Medium priority issue
Projects
Status: Done
Development

No branches or pull requests

4 participants