feat: initial support for table branching and tagging #19035
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
This PR introduces Git-like branching and tagging for Databend's Fuse tables, inspired by Apache Iceberg. Users can create independent branches for development/testing and read-only tags for marking important snapshots.
1. Core Concepts
Branch
Tag
2. SQL Syntax
2.1 Creating Branches or Tags
Parameters:
BRANCH | TAG: Specify whether to create a branch or tagAT: Specify the point in time to base the creation on (optional, defaults to current snapshot)SNAPSHOT: Based on a specific snapshot IDTIMESTAMP: Based on a specific timestampSTREAM: Based on the current position of a StreamOFFSET: Based on a relative time offsetBRANCH: Based on the current state of another branchTAG: Based on a tagRETAIN: Set the retention period for the branch|tag (optional, defaults to none)Examples:
2.2 Dropping Branches or Tags
Note: Drop operations are irreversible. Use with caution.
Examples:
2.3 Querying Branch Data
3. Data Structure Design
4. Storage Layout
_ss/directory_refs/<ref_id>/directories5. Vacuum and GC Integration
NOTE: If a branch or tag has expired, it will be cleaned up during vacuum and purge.
5.1 Tag Processing
Tags are read-only with a single snapshot
5.2 Branch Processing
Branches need snapshot cleanup
ByTimePeriodfirst.ByNumOfSnapshotsToKeepis only used when no snapshots are expired by time.Tests
Type of change
This change is