Skip to content

sql/catalog/lease: optimize descriptor leasing protocol for cold start #85741

@ajwerner

Description

@ajwerner

Is your feature request related to a problem? Please describe.
In order to use tables for DML queries, sql servers need to acquire leases for the underlying descriptors. The process of acquiring a lease on a descriptor required a number of KV operations:

  • Read the namespace table to find the descriptor
  • Read the descriptor
  • Read and validate the cross-references for the descriptor
  • Write the lease entry

Today, each of these operations will potentially leave the current region. We'd like it to be the case that we can acquire leases without leaving the current region.

Describe the solution you'd like
We ought to leverage a combination of LOCALITY GLOBAL and LOCALITY REGIONAL BY ROW configurations for the relevant system tables.

Describe alternatives you've considered
We could attempt to avoid the LOCALITY GLOBAL configuration on the system.descriptors table if we used some other causality propagation mechanism. It's probably not worth the trouble.

Additional context

The above leasing protocol is also used to cache password hashes, role membership, and virtual privileges. Those system will benefit transparently from the above work.

This work depends on being able to configure system tables with MR primitives (currently tracked in #63365).

Epic: CRDB-18596

Jira issue: CRDB-18414

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions