docs: add physical storage UUID RFC#69924
Conversation
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
CodexM5 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
c2b35a4 to
95b35fd
Compare
95b35fd to
129ca13
Compare
|
[FORMAT CHECKER NOTIFICATION] Notice: To remove the For example:
📖 For more info, you can check the "Contribute Code" section in the development guide. |
| Generation timing: | ||
|
|
||
| * `CREATE TABLE`: generate one physical storage UUID for a non-partitioned table. | ||
| * `CREATE TABLE` with partitions: generate one physical storage UUID per physical partition. |
There was a problem hiding this comment.
Maybe we also need a storage UUID for the global index 🤔 .
| ``` | ||
|
|
||
| The new layout may keep the `t` table-key family for locality and compatibility with table-key scanning, but the byte after `t` or an equivalent field must identify the key format before decoding the physical identity. | ||
| This is required because existing tablecodec logic assumes `t + 8-byte int64` in many places, including fixed offsets for record/index separators and table range boundaries. |
There was a problem hiding this comment.
I don't understand how the format_marker can make it better.
A decoder still cannot tell whether it's an old key or a new key, because the prefix of int64_physical_table_id can also be a format_marker.
| * `ADD PARTITION`: generate one physical storage UUID for each new partition. | ||
| * `REORGANIZE PARTITION`: generate UUIDs for newly created physical partitions. | ||
| * `TRUNCATE TABLE`: generate a new physical storage UUID for the new physical data space. | ||
| * `TRUNCATE PARTITION`: generate a new physical storage UUID for the truncated partition. |
There was a problem hiding this comment.
Do we need to rewrite the whole table for MODIFY COLUMN if it's still using the old format?
|
|
||
| // PhysicalStorageUUID identifies this physical partition data space | ||
| // when the partition uses the UUID-based physical key format. | ||
| PhysicalStorageUUID []byte |
There was a problem hiding this comment.
Should we store PhysicalStorageKeyFormat for each partition?
|
see #69923 (comment), before we proceed with writing an RFC, maybe we should eval the gain/cost first |
|
|
||
| Even though random collision is practically negligible, metadata mutation must still enforce uniqueness within a keyspace. | ||
| If a newly generated UUID conflicts, DDL can retry generation. | ||
| If restore or migration sees an existing target object with the same preserved UUID, it must report a conflict unless the requested mode explicitly drops or replaces that object. |
There was a problem hiding this comment.
Do not reuse UUIDs until asynchronous delete-range cleanup completes; it may delete newly restored data.
| * For new-format tables, BR preserves source physical storage UUIDs and can ingest KV data without rewriting the physical table key prefix. | ||
| * If the target cluster already has the same physical storage UUID, restore reports a conflict unless the user requested a mode that drops/replaces the target object. | ||
| * Restore must advance or reconcile metadata ID allocators as needed, but this does not require rewriting UUID-based data key prefixes. | ||
| * Log restore should use physical storage UUID as the stable physical object identity for UUID-format tables. |
There was a problem hiding this comment.
Existing UUIDs owned by the same BR checkpoint should be resumable, not conflicting.
| 2. **Experimental key format** | ||
| * Add UUID-based tablecodec helpers. | ||
| * Enable the new format only behind an experimental switch for newly created tables. | ||
| * Keep old-format table behavior unchanged. |
There was a problem hiding this comment.
Require cluster-wide UUID-key support during upgrades, otherwise older TiDB nodes may read or write incompatible keys.
| 1. **Metadata preparation** | ||
| * Add physical storage UUID metadata fields. | ||
| * Generate UUIDs for new tables and partitions but keep old key format as default. | ||
| * Add uniqueness checks and diagnostic display. |
There was a problem hiding this comment.
Line 289 generates UUIDs for legacy-format tables, contradicting the empty-UUID invariant at lines 125–126.
What problem does this PR solve?
Issue Number: ref #69923
Problem Summary:
This PR adds an RFC for introducing a globally restorable physical storage identity for TiDB tables and partitions. The goal is to enable supported BR restore and TiDB-X tenant migration flows to preserve physical data key prefixes instead of rewriting source physical table IDs to target-local physical table IDs.
What changed and how does it work?
This PR adds a new design document under
docs/design/:docs/design/2026-07-19-physical-storage-uuid.mdThe RFC describes:
PhysicalStorageUUIDmetadata for tables and partitions;Check List
Tests
Side effects
Documentation
Release note