Skip to content

sql: TRUNCATE unable to preserve split point when run from a tenant #82944

@knz

Description

@knz

Describe the problem

Internally TRUNCATE works by dropping all indexes from the table then creating new indexes with new IDs.
If the user had run SPLIT before on the table, TRUNCATE contains code to extract the split points pre-DROP, then apply them again post-CREATE.

All this code is currently disabled under multitenancy.

This is a problem as we want to continue to preserve split point in CC Dedicated with multi-tenancy enabled.

Expected behavior

The TRUNCATE code unconditionally runs a KV request through the KV connector to "extract the split points" from an existing table (key range) pre-DROP, then sends another request to "apply the split points" post-CREATE.

This code runs regardless of the privilege level of the tenant. In non-privileged tenants, the "extract" operation would return the empty set so there is nothing to apply.

Jira issue: CRDB-16747

Epic CRDB-16746

Metadata

Metadata

Assignees

Labels

A-multitenancyRelated to multi-tenancyC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions