From 2023c69a04ca9cb65685f10b3483a2005a553c15 Mon Sep 17 00:00:00 2001 From: fangfang qi <7285248+qiffang@users.noreply.github.com> Date: Fri, 4 Dec 2026 14:20:48 +0800 Subject: [PATCH] ai: align ti filesystem layer commands with v36 --- TOC-ai.md | 5 +- ai/_index.md | 1 + ai/ti/reference/ti-filesystem.md | 15 +- ai/ti/reference/ti-fs-commit-layer.md | 38 +---- ai/ti/reference/ti-fs-copy-file.md | 4 +- .../ti-fs-create-layer-checkpoint.md | 59 ------- ai/ti/reference/ti-fs-create-layer.md | 14 +- ai/ti/reference/ti-fs-delete-layer.md | 19 +-- ai/ti/reference/ti-fs-describe-layer.md | 7 +- ai/ti/reference/ti-fs-diff-layer.md | 55 ------ ai/ti/reference/ti-fs-find-files.md | 2 - ai/ti/reference/ti-fs-fork-layer.md | 21 +-- ai/ti/reference/ti-fs-list-layer-chain.md | 47 ------ ai/ti/reference/ti-fs-list-layers.md | 2 +- ...rollback-layer.md => ti-fs-merge-layer.md} | 21 +-- ai/ti/reference/ti-fs-mount-file-system.md | 15 +- ai/ti/reference/ti-fs-search-file-content.md | 9 - tidb-cloud-filesystem/filesystem-faq.md | 8 +- .../filesystem-troubleshooting.md | 2 +- .../manage-filesystem-layers.md | 159 ++---------------- 20 files changed, 65 insertions(+), 438 deletions(-) delete mode 100644 ai/ti/reference/ti-fs-create-layer-checkpoint.md delete mode 100644 ai/ti/reference/ti-fs-diff-layer.md delete mode 100644 ai/ti/reference/ti-fs-list-layer-chain.md rename ai/ti/reference/{ti-fs-rollback-layer.md => ti-fs-merge-layer.md} (61%) diff --git a/TOC-ai.md b/TOC-ai.md index 4ba8332a38b6d..a6db75c79091d 100644 --- a/TOC-ai.md +++ b/TOC-ai.md @@ -112,12 +112,9 @@ - [create-layer](/ai/ti/reference/ti-fs-create-layer.md) - [list-layers](/ai/ti/reference/ti-fs-list-layers.md) - [fork-layer](/ai/ti/reference/ti-fs-fork-layer.md) - - [list-layer-chain](/ai/ti/reference/ti-fs-list-layer-chain.md) - [describe-layer](/ai/ti/reference/ti-fs-describe-layer.md) - - [diff-layer](/ai/ti/reference/ti-fs-diff-layer.md) - - [create-layer-checkpoint](/ai/ti/reference/ti-fs-create-layer-checkpoint.md) - [delete-layer](/ai/ti/reference/ti-fs-delete-layer.md) - - [rollback-layer](/ai/ti/reference/ti-fs-rollback-layer.md) + - [merge-layer](/ai/ti/reference/ti-fs-merge-layer.md) - [commit-layer](/ai/ti/reference/ti-fs-commit-layer.md) - [pack-file-system](/ai/ti/reference/ti-fs-pack-file-system.md) - [unpack-file-system](/ai/ti/reference/ti-fs-unpack-file-system.md) diff --git a/ai/_index.md b/ai/_index.md index 10d5f67efa4fd..8e4bd84dd3bc3 100644 --- a/ai/_index.md +++ b/ai/_index.md @@ -103,6 +103,7 @@ The TiDB Cloud CLI (`ti`) lets users, scripts, CI jobs, and AI agents manage TiD | Install and configure `ti`, then complete a first workflow | [Get Started with TiDB Cloud CLI](/ai/ti/ti-quick-start.md) | | Automate TiDB Cloud Starter instance, branch, and SQL operations | [Manage TiDB Cloud Starter Instances](/ai/ti/guides/manage-starter-instances.md) | | Persist and share files across machines, CI jobs, and sandboxes | [Use TiDB Cloud Filesystem with TiDB Cloud CLI](/ai/ti/guides/manage-filesystems-via-cli.md) | +| Try isolated file changes and merge a selected layer | [File system layer commands](/ai/ti/reference/ti-filesystem.md#layer-and-portability-commands) | | Use mounted workspaces, Git workspaces, journals, or delegated secrets | [Mount a file system](/tidb-cloud-filesystem/filesystem-mount.md), [Manage Git Workspaces](/tidb-cloud-filesystem/manage-git-workspaces.md), [Use Journals in a File System](/tidb-cloud-filesystem/use-filesystem-journals.md), and [Manage Vault Secrets for a File System](/tidb-cloud-filesystem/manage-filesystem-vault-secrets.md) | | Follow an end-to-end automation or agent example | [Run a Daily TiDB Cloud CLI Workflow](/ai/ti/guides/ti-daily-workflow-example.md) or [Use TiDB Cloud Filesystem in an Agent Sandbox](/ai/ti/guides/ti-agent-sandbox-example.md) | | Look up commands, global options, output behavior, and errors | [TiDB Cloud CLI Command Reference](/ai/ti/reference/ti-cli-reference.md) | diff --git a/ai/ti/reference/ti-filesystem.md b/ai/ti/reference/ti-filesystem.md index fa1f1d491da75..8476565da9532 100644 --- a/ai/ti/reference/ti-filesystem.md +++ b/ai/ti/reference/ti-filesystem.md @@ -61,18 +61,16 @@ These commands configure optional providers for extracting content from media fi ## Layer and portability commands +The layer commands below apply to `ti` v0.2.12 and the LayerFS v36 runtime. + | Command | Description | | --- | --- | | [`create-layer`](/ai/ti/reference/ti-fs-create-layer.md) | Creates an isolated writable layer. | | [`list-layers`](/ai/ti/reference/ti-fs-list-layers.md) | Lists layers in a file system. | -| [`fork-layer`](/ai/ti/reference/ti-fs-fork-layer.md) | Forks a child layer from a parent tip or checkpoint. | -| [`list-layer-chain`](/ai/ti/reference/ti-fs-list-layer-chain.md) | Lists the pinned ancestry of a layer. | -| [`describe-layer`](/ai/ti/reference/ti-fs-describe-layer.md) | Describes a layer by ID. | -| [`diff-layer`](/ai/ti/reference/ti-fs-diff-layer.md) | Lists changes recorded in a layer. | -| [`create-layer-checkpoint`](/ai/ti/reference/ti-fs-create-layer-checkpoint.md) | Creates a durable checkpoint in a layer. | -| [`delete-layer`](/ai/ti/reference/ti-fs-delete-layer.md) | Logically abandons a layer. | -| [`rollback-layer`](/ai/ti/reference/ti-fs-rollback-layer.md) | Rolls a layer back without committing its changes. | -| [`commit-layer`](/ai/ti/reference/ti-fs-commit-layer.md) | Applies a layer's changes to the base file system. | +| [`fork-layer`](/ai/ti/reference/ti-fs-fork-layer.md) | Forks a child layer from a current state of a parent layer. | +| [`describe-layer`](/ai/ti/reference/ti-fs-describe-layer.md) | Describes a layer by ID, unique name, or tag. | +| [`delete-layer`](/ai/ti/reference/ti-fs-delete-layer.md) | Deletes a layer. | +| [`merge-layer`](/ai/ti/reference/ti-fs-merge-layer.md) | Applies a layer's changes to the base file system. | | [`pack-file-system`](/ai/ti/reference/ti-fs-pack-file-system.md) | Archives selected local overlay state to the file system. | | [`unpack-file-system`](/ai/ti/reference/ti-fs-unpack-file-system.md) | Restores local overlay state from an archive. | @@ -104,6 +102,7 @@ The following `ti fs` commands have Unix-style aliases. For example, `ti fs cp` | Alias | Canonical command | | --- | --- | +| `commit-layer` | `merge-layer` | | `cp` | `copy-file` | | `cat` | `read-file` | | `ls` | `list-files` | diff --git a/ai/ti/reference/ti-fs-commit-layer.md b/ai/ti/reference/ti-fs-commit-layer.md index 8fb2fecbde888..d9869f70d93ac 100644 --- a/ai/ti/reference/ti-fs-commit-layer.md +++ b/ai/ti/reference/ti-fs-commit-layer.md @@ -5,44 +5,8 @@ summary: Commit a file system layer. # ti fs commit-layer -Applies one layer to its base file system. +This command is an alias for [`ti fs merge-layer`](/ai/ti/reference/ti-fs-merge-layer.md). Both names accept the same options and return the same result. > **Note:** > > TiDB Cloud CLI (`ti`) is currently in public preview. Its features and command-line interface are subject to change without notice. - -## Syntax - -```text -ti fs commit-layer - --layer-id - [--dry-run] - [--file-system-id ] - [--fs-token ] - [--help] - [--version] -``` - -## Options - -- `--layer-id `: Layer ID. \[required] -- `--dry-run`: Validate the request without applying changes. -- `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. -- `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. -- `--help`: Display help information. -- `--version`: Display version information. - -For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). - -## Examples - -- Commit a layer: - - ```bash - # Apply the selected layer's changes to its base file system view. - ti fs commit-layer --file-system-id --layer-id "" - ``` - -## Related documentation - -- [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/ai/ti/reference/ti-fs-copy-file.md b/ai/ti/reference/ti-fs-copy-file.md index 891bb5e28c855..b25ea9803630d 100644 --- a/ai/ti/reference/ti-fs-copy-file.md +++ b/ai/ti/reference/ti-fs-copy-file.md @@ -60,9 +60,9 @@ ti fs copy-file - `--from-stdin`: Read from stdin and write to `--to-remote`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. -- `--layer-id `: Write one copied file into a file system layer instead of the base file system. Cannot be combined with `--recursive`. +- `--layer-id `: Write the copied files into the selected layer. Combine with `--recursive` to copy a directory tree. - `--overwrite`: Replace an existing destination file. -- `--recursive`: Copy directory structure recursively. Cannot be combined with `--layer-id`; seed a layer directory through a writable FUSE mount instead. +- `--recursive`: Copy directory structure recursively. - `--resume`: Resume an active copy operation. - `--tag `: Create tags `key=value` for `--to-remote` operation; repeatable. - `--to-local `: The local destination path. diff --git a/ai/ti/reference/ti-fs-create-layer-checkpoint.md b/ai/ti/reference/ti-fs-create-layer-checkpoint.md deleted file mode 100644 index a023a410b61ff..0000000000000 --- a/ai/ti/reference/ti-fs-create-layer-checkpoint.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: ti fs create-layer-checkpoint -summary: Create a checkpoint in a file system layer. ---- - -# ti fs create-layer-checkpoint - -Creates a checkpoint in one layer. If `--checkpoint-id` is omitted, the service generates one. - -> **Note:** -> -> TiDB Cloud CLI (`ti`) is currently in public preview. Its features and command-line interface are subject to change without notice. - -## Syntax - -```text -ti fs create-layer-checkpoint - --layer-id - [--checkpoint-id ] - [--dry-run] - [--file-system-id ] - [--fs-token ] - [--help] - [--label ] - [--version] -``` - -## Options - -- `--layer-id `: The layer ID identifying the layer. \[required] -- `--checkpoint-id `: Checkpoint ID. Normally it is generated by the service automatically. -- `--dry-run`: Validate the request without applying changes. -- `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. -- `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. -- `--help`: Display help information. -- `--label `: The checkpoint label. -- `--version`: Display version information. - -For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). - -## Examples - -- Create a named checkpoint: - - ```bash - # Record the current layer state under a stable checkpoint ID. - ti fs create-layer-checkpoint --file-system-id --layer-id "" --checkpoint-id before-review - ``` - -- Create an automatically identified checkpoint: - - ```bash - # Let the service assign the checkpoint ID while retaining a human label. - ti fs create-layer-checkpoint --file-system-id --layer-id "" --label "before review" - ``` - -## Related documentation - -- [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/ai/ti/reference/ti-fs-create-layer.md b/ai/ti/reference/ti-fs-create-layer.md index 08813c5ab2723..9d19b6f824fe5 100644 --- a/ai/ti/reference/ti-fs-create-layer.md +++ b/ai/ti/reference/ti-fs-create-layer.md @@ -5,7 +5,7 @@ summary: Create a layer in a file system. # ti fs create-layer -Creates a layer for recording isolated changes over a file system base path. If `--layer-id` is omitted, the service generates one. +Creates a layer for recording isolated changes over a file system base path. The service returns a generated layer ID. > **Note:** > @@ -18,13 +18,12 @@ ti fs create-layer --base-root-path [--actor-id ] [--dry-run] - [--durability-mode ] [--file-system-id ] [--fs-token ] [--help] - [--layer-id ] [--layer-name ] [--tag ] + [--ttl ] [--version] ``` @@ -33,13 +32,12 @@ ti fs create-layer - `--base-root-path `: Base root path in the file system. \[required] - `--actor-id `: Actor ID identifying the layer owner (for example, the agent name). - `--dry-run`: Validate the request without applying changes. -- `--durability-mode `: Set the layer durability mode. The only explicitly supported value is `restore-safe`, which preserves changes in the remote layer so the layer can be restored after the local environment ends. If omitted, the service uses `restore-safe`. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. -- `--layer-id `: The layer ID. Normally it is generated by the service automatically. - `--layer-name `: The name of the layer. - `--tag `: Tags for the layer, `key=value`; repeatable. +- `--ttl `: Layer lifetime in whole seconds or a duration such as `5m`. - `--version`: Display version information. For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). @@ -53,11 +51,11 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ti fs create-layer --file-system-id --base-root-path /workspace --layer-name agent-task ``` -- Create a restore-safe tagged layer: +- Create a tagged layer with a one-hour lifetime: ```bash - # Request durable layer behavior and attach task metadata. - ti fs create-layer --file-system-id --base-root-path /workspace --durability-mode restore-safe --tag task=review + # Set the lifetime and attach task metadata. + ti fs create-layer --file-system-id --base-root-path /workspace --ttl 1h --tag task=review ``` ## Related documentation diff --git a/ai/ti/reference/ti-fs-delete-layer.md b/ai/ti/reference/ti-fs-delete-layer.md index adc31d9b0662f..2f999cc3baf7b 100644 --- a/ai/ti/reference/ti-fs-delete-layer.md +++ b/ai/ti/reference/ti-fs-delete-layer.md @@ -1,11 +1,11 @@ --- title: ti fs delete-layer -summary: Abandon a file system layer. +summary: Delete a file system layer. --- # ti fs delete-layer -Abandons a layer without erasing its history. If the layer has live descendants, the command fails unless you specify `--cascade`, which abandons the descendants first. +Deletes the selected layer. An exclusive mount prevents deletion unless you specify `--force`. > **Note:** > @@ -16,7 +16,7 @@ Abandons a layer without erasing its history. If the layer has live descendants, ```text ti fs delete-layer --layer-ref - [--cascade] + [--force] [--dry-run] [--file-system-id ] [--fs-token ] @@ -27,7 +27,7 @@ ti fs delete-layer ## Options - `--layer-ref `: Layer ID, unique name, or [tag reference](/ai/ti/reference/ti-filesystem.md#layer-references). \[required] -- `--cascade`: Abandon live descendants before abandoning the selected layer. +- `--force`: Delete the selected layer even if it is exclusively mounted. - `--dry-run`: Validate the request without applying changes. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. @@ -38,21 +38,12 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ## Examples -- Abandon a rejected leaf timeline: +- Delete a layer: ```bash - # Deletion fails when the selected layer still has live descendants. ti fs delete-layer --file-system-id --layer-ref experiment-a ``` -- Abandon a test-owned subtree: - - ```bash - # Cascade is explicit and abandons descendants before the selected layer. - ti fs delete-layer --file-system-id --layer-ref experiment-root --cascade - ``` - ## Related documentation - [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) -- [`ti fs list-layer-chain`](/ai/ti/reference/ti-fs-list-layer-chain.md) diff --git a/ai/ti/reference/ti-fs-describe-layer.md b/ai/ti/reference/ti-fs-describe-layer.md index 7872d6fd6e362..2b6e78c7dff90 100644 --- a/ai/ti/reference/ti-fs-describe-layer.md +++ b/ai/ti/reference/ti-fs-describe-layer.md @@ -15,7 +15,7 @@ Describes one file system layer. ```text ti fs describe-layer - --layer-id + (--layer-id | --layer-ref ) [--file-system-id ] [--fs-token ] [--help] @@ -24,7 +24,8 @@ ti fs describe-layer ## Options -- `--layer-id `: The ID of the specified file system layer. \[required] +- `--layer-id `: Layer ID. +- `--layer-ref `: Layer ID, unique name, or tag reference. Specify exactly one of `--layer-id` and `--layer-ref`. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. @@ -37,7 +38,7 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli - Describe a layer: ```bash - # Inspect one layer's base root, state, durability, and metadata. + # Inspect one layer's base root and metadata. ti fs describe-layer --file-system-id --layer-id "" ``` diff --git a/ai/ti/reference/ti-fs-diff-layer.md b/ai/ti/reference/ti-fs-diff-layer.md deleted file mode 100644 index fc37273655b44..0000000000000 --- a/ai/ti/reference/ti-fs-diff-layer.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: ti fs diff-layer -summary: Show changes in a file system layer. ---- - -# ti fs diff-layer - -Lists changes in one layer, optionally up to a sequence number. - -> **Note:** -> -> TiDB Cloud CLI (`ti`) is currently in public preview. Its features and command-line interface are subject to change without notice. - -## Syntax - -```text -ti fs diff-layer - --layer-id - [--file-system-id ] - [--fs-token ] - [--help] - [--max-seq ] - [--version] -``` - -## Options - -- `--layer-id `: The ID of the layer. \[required] -- `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. -- `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. -- `--help`: Display help information. -- `--max-seq `: The highest layer sequence to include; 0 includes all sequences. -- `--version`: Display version information. - -For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). - -## Examples - -- Show all layer changes: - - ```bash - # Return the complete ordered change set for the selected layer. - ti fs diff-layer --file-system-id --layer-id "" - ``` - -- Show an earlier layer view: - - ```bash - # Limit the diff to changes at or before a sequence number. - ti fs diff-layer --file-system-id --layer-id "" --max-seq 100 - ``` - -## Related documentation - -- [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/ai/ti/reference/ti-fs-find-files.md b/ai/ti/reference/ti-fs-find-files.md index da50eb8f15a1c..5e8cc57b31b64 100644 --- a/ai/ti/reference/ti-fs-find-files.md +++ b/ai/ti/reference/ti-fs-find-files.md @@ -19,7 +19,6 @@ ti fs find-files [--file-system-id ] [--fs-token ] [--help] - [--layer-id ] [--limit ] [--max-size-bytes ] [--min-size-bytes ] @@ -37,7 +36,6 @@ ti fs find-files - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. -- `--layer-id `: Search files and directories within a specific file system layer. - `--limit `: Maximum number of results; 0 uses the service default. - `--max-size-bytes `: Maximum file size in bytes. - `--min-size-bytes `: Minimum file size in bytes. diff --git a/ai/ti/reference/ti-fs-fork-layer.md b/ai/ti/reference/ti-fs-fork-layer.md index 32e060c3c5b82..d6a991af25bd3 100644 --- a/ai/ti/reference/ti-fs-fork-layer.md +++ b/ai/ti/reference/ti-fs-fork-layer.md @@ -5,7 +5,7 @@ summary: Fork a copy-on-write child layer in a file system. # ti fs fork-layer -Creates a writable child layer from the current state of a parent layer or from one of its checkpoints. Changes to the child layer do not modify the parent layer. +Creates a writable child layer from the current state of a parent layer. Changes to the child layer do not modify the parent layer. > **Note:** > @@ -17,13 +17,13 @@ Creates a writable child layer from the current state of a parent layer or from ti fs fork-layer --parent-layer-ref [--actor-id ] - [--checkpoint-id ] [--dry-run] [--file-system-id ] [--fs-token ] [--help] - [--layer-id ] [--layer-name ] + [--tag ] + [--ttl ] [--version] ``` @@ -31,13 +31,13 @@ ti fs fork-layer - `--parent-layer-ref `: Parent layer ID, unique name, or [tag reference](/ai/ti/reference/ti-filesystem.md#layer-references). \[required] - `--actor-id `: Actor ID identifying the child owner. -- `--checkpoint-id `: Pin the child to this checkpoint of the parent. If omitted, pins the serialized parent tip. - `--dry-run`: Validate the request without applying changes. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. -- `--layer-id `: Stable child layer ID. If omitted, the service generates one. - `--layer-name `: Human-readable child layer name. +- `--tag `: Layer tag in `key=value` form. Repeat to supply multiple tags. +- `--ttl `: Layer lifetime in whole seconds or a duration such as `5m`. - `--version`: Display version information. For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). @@ -51,17 +51,6 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ti fs fork-layer --file-system-id --parent-layer-ref research-base --layer-name experiment-a --actor-id agent-a ``` -- Fork from a stable checkpoint: - - ```bash - # Continue from an earlier review boundary without changing the original timeline. - ti fs fork-layer --file-system-id --parent-layer-ref research-base --checkpoint-id seed --layer-name experiment-b --actor-id agent-b - ``` - -> **Note:** -> -> Layer names remain visible after logical deletion and can become ambiguous. Automation should capture and use the returned layer ID. - ## Related documentation - [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/ai/ti/reference/ti-fs-list-layer-chain.md b/ai/ti/reference/ti-fs-list-layer-chain.md deleted file mode 100644 index 1caac2c0d92a7..0000000000000 --- a/ai/ti/reference/ti-fs-list-layer-chain.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: ti fs list-layer-chain -summary: List the ancestry chain for a file system layer. ---- - -# ti fs list-layer-chain - -Lists the parent-child layer chain from the root layer to a selected child layer, including each layer's sequence boundary. - -> **Note:** -> -> TiDB Cloud CLI (`ti`) is currently in public preview. Its features and command-line interface are subject to change without notice. - -## Syntax - -```text -ti fs list-layer-chain - --layer-ref - [--file-system-id ] - [--fs-token ] - [--help] - [--version] -``` - -## Options - -- `--layer-ref `: Layer ID, unique name, or [tag reference](/ai/ti/reference/ti-filesystem.md#layer-references). \[required] -- `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. -- `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. -- `--help`: Display help information. -- `--version`: Display version information. - -For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). - -## Examples - -- Inspect a child timeline: - - ```bash - # Render the root-to-tip ancestry as stable text columns. - ti fs list-layer-chain --file-system-id --layer-ref experiment-a --output text - ``` - -## Related documentation - -- [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) -- [`ti fs fork-layer`](/ai/ti/reference/ti-fs-fork-layer.md) diff --git a/ai/ti/reference/ti-fs-list-layers.md b/ai/ti/reference/ti-fs-list-layers.md index c2b109ff984ca..bbbadedcc7041 100644 --- a/ai/ti/reference/ti-fs-list-layers.md +++ b/ai/ti/reference/ti-fs-list-layers.md @@ -5,7 +5,7 @@ summary: List layers in a file system. # ti fs list-layers -Lists layers for the selected file system. +Lists layers for the selected file system. Text output includes the current fence value in the `FENCE` column. > **Note:** > diff --git a/ai/ti/reference/ti-fs-rollback-layer.md b/ai/ti/reference/ti-fs-merge-layer.md similarity index 61% rename from ai/ti/reference/ti-fs-rollback-layer.md rename to ai/ti/reference/ti-fs-merge-layer.md index 24ad4a5d509d4..f5a864c1c48d6 100644 --- a/ai/ti/reference/ti-fs-rollback-layer.md +++ b/ai/ti/reference/ti-fs-merge-layer.md @@ -1,11 +1,11 @@ --- -title: ti fs rollback-layer -summary: Roll back a file system layer. +title: ti fs merge-layer +summary: Merge a file system layer. --- -# ti fs rollback-layer +# ti fs merge-layer -Rolls back changes in one layer without committing them to the base. +Applies the layer to the base file system. The command returns the layer ID, status, and number of applied paths. A conflict returns an error. > **Note:** > @@ -14,8 +14,8 @@ Rolls back changes in one layer without committing them to the base. ## Syntax ```text -ti fs rollback-layer - --layer-id +ti fs merge-layer + (--layer-id | --layer-ref ) [--dry-run] [--file-system-id ] [--fs-token ] @@ -25,8 +25,9 @@ ti fs rollback-layer ## Options -- `--layer-id `: The ID of the layer. \[required] +- `--layer-id `: Layer ID. - `--dry-run`: Validate the request without applying changes. +- `--layer-ref `: Layer ID, unique name, or tag reference. Specify exactly one of `--layer-id` and `--layer-ref`. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. @@ -36,11 +37,11 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ## Examples -- Roll back a layer: +- Merge a layer: ```bash - # Discard uncommitted changes and restore the layer's base view. - ti fs rollback-layer --file-system-id --layer-id "" + # Apply the selected layer's changes to its base file system view. + ti fs merge-layer --file-system-id --layer-id "" ``` ## Related documentation diff --git a/ai/ti/reference/ti-fs-mount-file-system.md b/ai/ti/reference/ti-fs-mount-file-system.md index a0d13efbb154d..17e20d97b77aa 100644 --- a/ai/ti/reference/ti-fs-mount-file-system.md +++ b/ai/ti/reference/ti-fs-mount-file-system.md @@ -1,6 +1,6 @@ --- title: ti fs mount-file-system -summary: Learn how to configure local mounts of TiDB Cloud file systems, including FUSE, WebDAV, read-only access, layers, and checkpoints. +summary: Learn how to configure local mounts of TiDB Cloud file systems, including FUSE, WebDAV, read-only access, and layers. --- # ti fs mount-file-system @@ -11,7 +11,7 @@ The command starts the mount process in the background, waits for the mount to b > **Important:** > -> Layer and checkpoint mounts require FUSE. On macOS, install macFUSE and specify `--driver fuse` to use these features. Checkpoint mounts are always read-only. +> Layer mounts require FUSE. On macOS, install macFUSE and specify `--driver fuse` to mount a layer. > **Note:** > @@ -23,7 +23,6 @@ The command starts the mount process in the background, waits for the mount to b ti fs mount-file-system --mount-path [--cache-dir ] - [--checkpoint-id ] [--driver ] [--dry-run] [--file-system-id ] @@ -49,7 +48,6 @@ ti fs mount-file-system - `--mount-path `: Local mount path. \[required] - `--cache-dir `: Local FUSE cache directory. If omitted, uses `~/.ti/cache/mounts/`. -- `--checkpoint-id `: Mount this checkpoint of `--layer-ref` read-only. Requires FUSE. - `--driver `: Mount driver: `auto`, `fuse`, or `webdav`. \[default: auto] - `--dry-run`: Validate the request without applying changes. - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. @@ -68,7 +66,7 @@ ti fs mount-file-system - `--remote-path `: The file system root path to mount. \[default: /] - `--unpack-archive-path `: Restore the pack archive before mounting. - `--version`: Display version information. -- `--write-back-cache`: Persist FUSE writes locally before writing them to the file system on flush. This behavior is enabled by default; specify `--write-back-cache=false` to disable it. Unavailable for checkpoint mounts, which are always read-only. \[default: true] +- `--write-back-cache`: Persist FUSE writes locally before writing them to the file system on flush. This behavior is enabled by default; specify `--write-back-cache=false` to disable it. \[default: true] For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli-reference.md#global-options). @@ -109,13 +107,6 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ti fs mount-file-system --file-system-id --mount-path /path/to/experiment --remote-path /workspace --driver fuse --layer-ref experiment ``` -- Compare an immutable historical checkpoint: - - ```bash - # A checkpoint mount is always read-only. - ti fs mount-file-system --file-system-id --mount-path /path/to/checkpoint --remote-path /workspace --driver fuse --layer-ref experiment --checkpoint-id v5 - ``` - ## Related documentation - [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/ai/ti/reference/ti-fs-search-file-content.md b/ai/ti/reference/ti-fs-search-file-content.md index 32970794018b5..c7b8a105e4096 100644 --- a/ai/ti/reference/ti-fs-search-file-content.md +++ b/ai/ti/reference/ti-fs-search-file-content.md @@ -19,7 +19,6 @@ ti fs search-file-content [--file-system-id ] [--fs-token ] [--help] - [--layer-id ] [--limit ] [--path ] [--version] @@ -31,7 +30,6 @@ ti fs search-file-content - `--file-system-id `: Select the file system. You can also set `TI_FS_FILE_SYSTEM_ID`. - `--fs-token `: Set the file system token. If omitted, the command uses the `TI_FS_TOKEN` environment variable. If neither is provided, the command uses the local token stored for the selected file system. - `--help`: Display help information. -- `--layer-id `: Search within a file system layer. - `--limit `: Maximum number of search results; 0 uses the service default. - `--path `: File path prefix to be searched. \[default: /] - `--version`: Display version information. @@ -47,13 +45,6 @@ For options shared by all commands, see [Global options](/ai/ti/reference/ti-cli ti fs search-file-content --file-system-id --path /workspace --pattern "TODO" --limit 50 ``` -- Search content in a layer: - - ```bash - # Inspect uncommitted layer content separately from the base file system. - ti fs search-file-content --file-system-id --path /workspace --pattern "deprecated" --layer-id "" - ``` - ## Related documentation - [TiDB Cloud Filesystem CLI Command Reference](/ai/ti/reference/ti-filesystem.md) diff --git a/tidb-cloud-filesystem/filesystem-faq.md b/tidb-cloud-filesystem/filesystem-faq.md index ddb333dbca7f1..e297baf434632 100644 --- a/tidb-cloud-filesystem/filesystem-faq.md +++ b/tidb-cloud-filesystem/filesystem-faq.md @@ -43,7 +43,7 @@ Native mounting is not supported on Windows. For platform requirements and alter Yes. When mounted, TiDB Cloud Filesystem provides POSIX-compatible access: applications and agents can read and write files through normal local paths, shell commands, and file system APIs. -Mount capabilities differ by platform and driver. For example, layer and checkpoint mounts require FUSE. See [Mount platform support](/tidb-cloud-filesystem/filesystem-regions-and-limitations.md#mount-platform-support). +Mount capabilities differ by platform and driver. For example, layer mounts require FUSE. See [Mount platform support](/tidb-cloud-filesystem/filesystem-regions-and-limitations.md#mount-platform-support). ## Are SDKs available for TiDB Cloud Filesystem? @@ -65,11 +65,7 @@ For setup, see [Configure AI Providers for a File System](/tidb-cloud-filesystem ## Does the public preview support checkpoints and rollback? -Yes. A layer lets you change files without changing the shared base file system until you commit the layer. Use `ti fs create-layer-checkpoint` to save a point in the layer's history. Use `ti fs rollback-layer` to discard its uncommitted changes. - -Rollback does not restore an earlier checkpoint. To continue working from a checkpoint, fork it into a new writable layer. A checkpoint preserves layer history, but does not freeze the entire base file system or replace a backup. Complex layer histories have additional limitations during public preview; see [Boundaries and limitations](/tidb-cloud-filesystem/filesystem-layers-checkpoints.md#boundaries-and-limitations). - -For concepts and limitations, see [Layers and Checkpoints](/tidb-cloud-filesystem/filesystem-layers-checkpoints.md). For commands, see [Manage File System Layers and Checkpoints](/tidb-cloud-filesystem/manage-filesystem-layers.md). +TiDB Cloud CLI v0.2.12 with LayerFS v36 supports forks from the current parent layer. To preserve an experiment, fork before making changes. Merge the chosen layer or delete it to discard the experiment. The v36 CLI has no checkpoint or rollback commands. See [Manage File System Layers](/tidb-cloud-filesystem/manage-filesystem-layers.md). ## Is a service-level agreement (SLA) available during public preview? diff --git a/tidb-cloud-filesystem/filesystem-troubleshooting.md b/tidb-cloud-filesystem/filesystem-troubleshooting.md index 2cf8c3caf2465..fee5a3ad915ff 100644 --- a/tidb-cloud-filesystem/filesystem-troubleshooting.md +++ b/tidb-cloud-filesystem/filesystem-troubleshooting.md @@ -236,7 +236,7 @@ On Linux, if `XDG_CACHE_HOME` is set, check `$XDG_CACHE_HOME/drive9/mount-logs` If any of these appear: 1. Treat the result as an abnormal shutdown and keep the machine and local cache available. -2. Verify required layer files with direct CLI reads using `--layer-id`. For committed changes, read the base file system without selecting a layer. To verify a checkpoint, mount it at a new local path with the same `--layer-ref` and `--checkpoint-id` and read its required files again. You can also remount a writable layer at a new path to verify its contents independently of the previous mount. +2. With CLI v0.2.12 and LayerFS v36, remount the layer and read its files through the mount. For committed changes, read the base file system without selecting a layer. On an older runtime that supports checkpoints, mount the checkpoint at a new local path with the same `--layer-ref` and `--checkpoint-id` and read its required files again. You can also remount a writable layer at a new path to verify its contents independently of the previous mount. 3. Do not commit or discard the layer, or delete local state, until verification completes. Include the CLI version and redacted mount log when reporting the problem. ## Exit codes diff --git a/tidb-cloud-filesystem/manage-filesystem-layers.md b/tidb-cloud-filesystem/manage-filesystem-layers.md index 46893caf8fce5..195724d801e2d 100644 --- a/tidb-cloud-filesystem/manage-filesystem-layers.md +++ b/tidb-cloud-filesystem/manage-filesystem-layers.md @@ -1,12 +1,12 @@ --- -title: Manage File System Layers and Checkpoints -summary: Learn how to create file system layers, checkpoint and fork changes, verify isolation, and commit or discard your work. +title: Manage File System Layers +summary: Create a layer, verify isolated file changes, fork a layer, and merge or discard your work. aliases: ['/ai/manage-filesystem-layers'] --- -# Manage File System Layers and Checkpoints +# Manage File System Layers -In TiDB Cloud Filesystem, a layer isolates file changes from the base file system until you commit them. You can use checkpoints to preserve intermediate states and forks to explore changes independently. For the underlying concepts, see [Layers and Checkpoints](/tidb-cloud-filesystem/filesystem-layers-checkpoints.md). +This workflow uses TiDB Cloud CLI v0.2.12 with the LayerFS v36 runtime. A layer isolates your file changes until you merge them into the base file system. ## Prerequisites @@ -33,13 +33,12 @@ Then create a layer: ti fs create-layer \ --base-root-path "$base_path" \ --layer-name agent-task \ - --durability-mode restore-safe \ --tag task=review ``` `--base-root-path` determines which part of the base file system the layer overlays. -`restore-safe` is the only `--durability-mode` value accepted by the current CLI. For all available options, see the [`create-layer` command reference](/ai/ti/reference/ti-fs-create-layer.md). +For all available options, see the [`create-layer` command reference](/ai/ti/reference/ti-fs-create-layer.md). Save the returned `layer_id` for the remaining commands: @@ -64,7 +63,6 @@ Inspect the layer and its changes: ```shell ti fs describe-layer --layer-id "$layer_id" -ti fs diff-layer --layer-id "$layer_id" ``` List all layers in the selected file system: @@ -75,19 +73,11 @@ ti fs list-layers --output text Changes that have not been committed remain in the layer. File operations that do not select the layer access the base file system and do not show its uncommitted changes. -Only `copy-file`, `find-files`, and `search-file-content` take `--layer-id`. `read-file`, `list-files`, `describe-file`, `delete-file`, `move-file`, and `create-directory` always act on the base file system. To read the contents of a file in a layer, mount the layer as described in [Mount a writable layer](#mount-a-writable-layer) or [verify a checkpoint's file contents](#create-a-checkpoint). - -> **Note:** -> -> `copy-file` with `--layer-id` does not support recursive copy. To copy a directory tree into a layer, [mount the layer](#mount-a-writable-layer) as a writable FUSE mount and copy files through the mount path. -> -> Do not mount the same writable layer at multiple local paths concurrently. Reuse its existing mount, or unmount it before mounting the layer elsewhere. -> -> The mount command identifies the layer with `--layer-ref`, while the file commands above take `--layer-id`. Both accept the same layer identifier value. +Use `copy-file --recursive --layer-id` to copy a directory into the layer. To read or search layer files, mount the layer and use local tools. ### Mount a writable layer -To use local tools, complete the [FUSE prerequisites](/tidb-cloud-filesystem/filesystem-mount.md#choose-a-mount-method) and mount the layer. WebDAV does not support layers or checkpoints. +To use local tools, complete the [FUSE prerequisites](/tidb-cloud-filesystem/filesystem-mount.md#choose-a-mount-method) and mount the layer. WebDAV does not support layers. ```shell layer_mount="$(mktemp -d "$HOME/ti-fs-layer.XXXXXX")" @@ -107,146 +97,27 @@ ti fs read-file --path "$base_path/proposal.md" Expect a not-found error because the layer has not been committed. If the file is visible in the base, stop and inspect the layer selection before proceeding. -## Create a checkpoint - -A checkpoint preserves a point in the layer's durable history. - -If the layer has a writable FUSE mount, stop writes, close open files, and drain the mount before creating the checkpoint: - -```shell -ti fs drain-file-system \ - --mount-path "$layer_mount" -``` - -Then create the checkpoint: - -```shell -ti fs create-layer-checkpoint \ - --layer-id "$layer_id" \ - --checkpoint-id seed \ - --label "before review" -``` - -To verify the checkpoint's file contents, mount it at a separate local path: - -```shell -checkpoint_mount="$(mktemp -d "$HOME/ti-fs-checkpoint.XXXXXX")" -ti fs mount-file-system \ - --mount-path "$checkpoint_mount" \ - --remote-path "$base_path" \ - --layer-ref "$layer_id" \ - --checkpoint-id seed \ - --driver fuse -cat "$checkpoint_mount/proposal.md" -ti fs unmount-file-system --mount-path "$checkpoint_mount" -``` - -Expected output: `Layer review proposal`. Checkpoint mounts are read-only. If a read hangs, follow [mount troubleshooting](/tidb-cloud-filesystem/filesystem-troubleshooting.md#mount-succeeds-but-file-access-hangs). - -> **Warning:** -> -> In `ti` v0.2.6, and in v0.2.7 installations using bundled runtime `60b63d6`, checkpoint unmount can return `unmounted` even when the background process exited abnormally. Check the mount log before continuing; if shutdown was abnormal, keep the cache and re-verify the checkpoint's contents. For log locations and recovery steps, see [Unmount returns success but the mount process exits abnormally](/tidb-cloud-filesystem/filesystem-troubleshooting.md#unmount-returns-success-but-the-mount-process-exits-abnormally). - ## Fork a layer -If you want to continue working independently from the checkpoint, fork a new writable layer. Otherwise, skip to [Commit or discard layer changes](#commit-or-discard-layer-changes). +Close files and unmount the parent before forking so the child starts from the changes you have written. ```shell -ti fs fork-layer \ - --parent-layer-ref "$layer_id" \ - --layer-name experiment \ - --checkpoint-id seed +ti fs unmount-file-system --mount-path "$layer_mount" +ti fs fork-layer --parent-layer-ref "$layer_id" --layer-name experiment --ttl 1h ``` -Save the fork's returned `layer_id` separately: +The command returns the child’s `layer_id`. Use it to mount or inspect the child independently. To discard the child, delete it by its returned ID. -```shell -forked_layer_id="" -``` +## Merge or discard changes -To inspect the fork's pinned ancestry: - -```shell -ti fs list-layer-chain --layer-ref "$forked_layer_id" -``` - -After a fork is created, changes made to the parent and child layers are independent. - -## Commit or discard layer changes - -If the layer has a writable FUSE mount, stop writers, close open files, and unmount it before choosing an outcome: - -```shell -ti fs unmount-file-system \ - --mount-path "$layer_mount" -``` - -A graceful unmount drains pending writes automatically. - -> **Warning:** -> -> In `ti` v0.2.6, and in v0.2.7 installations using bundled runtime `60b63d6`, layer unmount can return `unmounted` even when the background process exited abnormally. Check the mount log before committing or discarding the layer; if shutdown was abnormal, keep the cache and verify required files first. For log locations and recovery steps, see [Unmount returns success but the mount process exits abnormally](/tidb-cloud-filesystem/filesystem-troubleshooting.md#unmount-returns-success-but-the-mount-process-exits-abnormally). - -Choose one outcome: **commit** applies the changes to the base file system; **rollback** discards them. To commit: - -```shell -ti fs commit-layer --layer-id "$layer_id" -``` - -After a successful commit, verify the content through the base file system: +To publish the parent’s changes, merge it and verify the resulting file in the base file system: ```shell +ti fs merge-layer --layer-id "$layer_id" ti fs read-file --path "$base_path/proposal.md" ``` -Expected output: `Layer review proposal`. - -A commit applies the layer's effective changes to the base file system. If the layer was created by forking another layer, committing it does not merge the changes back into its parent layer. - -If the base file system contains conflicting changes, the commit can fail instead of automatically merging them. Keep the layer and inspect its changes and the base file system before deciding how to proceed. - -If you chose to discard the changes, run this command instead of committing: - -```shell -ti fs rollback-layer --layer-id "$layer_id" -``` - -Rollback discards the current layer changes. It does not reset the layer to an earlier checkpoint. To continue from a checkpoint, fork a new layer from that checkpoint. - -## Delete a layer - -If you created a fork, delete it before its parent: - -```shell -ti fs delete-layer --layer-ref "$forked_layer_id" -``` - -Then delete the parent layer: - -```shell -ti fs delete-layer --layer-ref "$layer_id" -``` - -Deleting a layer abandons it without immediately erasing all of its history. If the layer has live descendants, the command fails by default. - -Alternatively, to abandon a layer and all of its live descendants together, use `--cascade`: - -```shell -ti fs delete-layer \ - --layer-ref "$layer_id" \ - --cascade -``` - -Use `--cascade` only when you intend to abandon the descendant layers as well. - -After unmounting the example mounts and deleting the example layers, remove the base directory: - -```shell -ti fs delete-file --path "${base_path:?Set the example directory first}" --recursive -ti fs describe-file --path "$base_path" -``` - -Expect a not-found error from `describe-file`. After successful unmount, remove the local directories you created with `rmdir "$layer_mount"` and `rmdir "$checkpoint_mount"`. Deleting the example files does not erase the abandoned layers' history immediately. +The expected output is `Layer review proposal`. If you want to discard the parent’s changes instead, run `ti fs delete-layer --layer-ref "$layer_id"` before merging. ## What's next