Skip to content

keyset-provision: the label check reads the tenant's keys under the tenant lock without an index on (tenant, label, active) #598

Backlog

Description

@GottZ

keyset-provision (since v5.95.0) refuses a set without replace_label while an active key of the tenant already carries one of its labels. The check runs under the tenant lock and reads the tenant's keys; there is no index on (tenant, label, active).

Measured on the PR (#595) with 20 000 keys in the tenant: 2.7 to 3.9 ms for a set of 64 labels, 19 to 24 ms for the whole set. The cost grows with the keys of the tenant and is paid while the tenant lock is held.

Not measured: several hundred thousand keys per tenant. This issue is to measure there and, if the check dominates the held lock, add a partial index in a migration of its own (the next free migration is 199).

Related limit, by design for now: the one-active-key-per-label rule holds for keyset-provision only; api-key-create and a reactivation through api-key-update do not check labels (documented in docs/api.md).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions