You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ai/ti: describe ti fs copy-file overwrite behavior and local path rules - #24767
ti fs copy-file gained behavior in tidbcloud/ti-cli#100 that this page does not describe, so the reference is updated:
--overwrite: an upload or a download overwrites the destination directly; a copy within the file system (--from-remote with --to-remote) stages the source at <destination>.ti-tmp-<id> and renames it onto the destination. The page now states the access the rename needs and the ti fs delete-file --path remedy when a failed rename leaves the temporary file behind.
--from-local and --to-local: state that only plain file system paths are accepted and that a URL scheme such as file:///path is rejected.
Adds the directory rule (<destination>/<source-file-name>), the refusal without --overwrite, and a "Replace an existing remote file" example.
Which TiDB version(s) do your changes apply to? (Required)
master (the latest development version)
v8.5 (TiDB 8.5 versions)
v8.4 (TiDB 8.4 versions)
v8.3 (TiDB 8.3 versions)
v8.2 (TiDB 8.2 versions)
v8.1 (TiDB 8.1 versions)
v7.5 (TiDB 7.5 versions)
v7.1 (TiDB 7.1 versions)
v6.5 (TiDB 6.5 versions)
The ai/ti pages exist only on release-8.5, so this change targets that branch only and does not apply to master.
The changes in this PR were primarily made by an AI agent on behalf of the PR author.
Do your changes match any of the following descriptions?
Delete files
Change aliases
Need modification after applied to another branch
Might cause conflicts after applied to another branch
Summary by CodeRabbit
Documentation
Clarified that --from-local and --to-local require plain filesystem paths; URL schemes such as file:///path are rejected.
Expanded overwrite guidance for uploads, downloads, and remote-to-remote copies, including access and cleanup considerations.
Explained that --overwrite has no effect with recursive copies: an existing destination root is reused, but copying stops if a path beneath it already exists.
Described how directory destinations resolve and documented existing-destination handling for --append, --resume, --recursive, and --layer-id.
The ti fs copy-file reference described --overwrite in one line and did not
say what a destination that already exists means for each direction.
- --overwrite now explains that an upload or a download overwrites the
destination directly, while a copy within the file system stages the
source at <destination>.ti-tmp-<id> and renames it onto the destination,
with the access the rename needs and the path to delete if a failed
rename leaves the temporary file behind.
- --from-local and --to-local say that only plain file system paths are
accepted; a URL scheme such as file:///path is rejected.
- The options list adds the directory rule and the without---overwrite
refusal, and an example shows replacing an existing remote file.
Follow-up for ticloud/ti-cli#100.
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign csuzhangxc for approval. For more information see the Code Review Process. Please ensure that each of them provides their approval before proceeding.
The full list of commands accepted by this bot can be found here.
Details
Needs approval from an approver in each of these files:
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The file-copy reference now documents local path requirements, destination resolution, and overwrite behavior for uploads, downloads, and remote-to-remote copies. It adds an example that overwrites a remote file.
Changes: File Copy Options
Layer / File(s)
Summary
Document path and overwrite behavior ai/ti/reference/ti-fs-copy-file.md
The reference specifies that local paths must not use URL schemes, explains destination resolution and existing-destination handling, and describes overwrite behavior for different copy modes. A new example shows replacing a remote file.
The documentation is mostly accurate, but it overstates the staged-replacement guarantee for resumed copies. It also does not say that copying standard input into a directory needs an explicit destination file path. Fixing both wording gaps is a small follow-up and does not block merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the two changes the page now documents: overwrite behavior and local path rules for ti fs copy-file. The raw summary confirms both, along with the directory destination rule. It omits …
Description check
The description covers the required sections: changes made, the affected version (v8.5 only, with rationale), related links, and AI agent involvement. Template sections such as the first-time contribu…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the two changes the page now documents: overwrite behavior and local path rules for ti fs copy-file. The raw summary confirms both, along with the directory destination rule. It omits the directory rule and the new example, which is acceptable for a title.
Full details: Description check
Explanation
The description covers the required sections: changes made, the affected version (v8.5 only, with rationale), related links, and AI agent involvement. Template sections such as the first-time contributor checklist and the affected-release notes are not filled in, but the required content is present. The description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Additional comments: 1
ai/ti/reference/ti-fs-copy-file.md-73-73: 1
73-73: Major · Data Integrity & Integration · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Distinguish remote symlinks from directories.
A remote symlink to a directory is treated as the link itself, not as that directory. An upload with --overwrite can replace the link payload instead of writing inside the directory. Document this distinction alongside the destination rule. (github.com)
Reviewing files that changed from the base of the PR and between ecad3ce and 1855b36.
Files selected for processing: 1
ai/ti/reference/ti-fs-copy-file.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
…y-file
Review follow-up on the overwrite description:
- a failed staged replace leaves a temporary file that the delete-file
remedy only removes with the same --file-system-id and a token that has
delete access;
- --recursive does not stage or rename, and --overwrite has no effect on it;
- a download with --resume skips the destination check and replaces an
existing local file, and --layer-id skips it too.
The four CodeRabbit findings on the first revision are addressed in eb14d9659:
Cleanup command (file-system + token): the temporary file is deleted with ti fs delete-file --path <temporary-path>, now stating that it needs the same --file-system-id and a token that has delete access.
Recursive copies:--recursive does not stage or rename, and --overwrite has no effect on it; if a destination path exists, the command stops before copying anything.
Download --resume: it skips the destination check and replaces an existing local file, so the page now warns to protect that file before resuming.
--layer-id: it also skips the existing-destination check, writing to the layer and replacing any existing file at that path.
The Chinese translation is open as pingcap/docs-cn#22111 (same branch name, label translation/from-docs).
Reviewing files that changed from the base of the PR and between 1855b36 and eb14d96.
Files selected for processing: 1
ai/ti/reference/ti-fs-copy-file.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Second review round on the overwrite description:
- the staged sibling and rename describe a base file system destination;
--layer-id writes directly to the layer and is not staged or renamed;
- a recursive copy reuses an existing destination root and stops only when
a path below that root already exists;
- --append and --resume also skip the existing-destination check, so the
paragraph now lists all four exceptions instead of two.
Recursive root vs descendant: the text now says a recursive copy reuses an existing destination root and stops only when a path below that root already exists.
Layer writes: the staged sibling and rename are scoped to a base file system destination; with --layer-id the copy is not staged or renamed and writes directly to the layer.
--append and --resume: the paragraph no longer says "two exceptions". It now lists all four checks that are skipped: --append (extends an existing remote file), --resume (continues a transfer; on a download it ignores the flag and replaces the local file), --recursive (reuses the root, stops on a conflicting descendant), and --layer-id (writes to the layer and replaces any existing file there).
The reference is a flag list, so each exception belongs in the bullet it
qualifies instead of one long paragraph:
- --append, --resume, --recursive, and --layer-id each say that the
existing-destination check does not apply (and what that means);
- --overwrite keeps the staged copy and the access it needs in three
sentences, with the staging-file remedy in one line;
- the paragraph after the list is back to the directory rule and the
without---overwrite refusal, two sentences.
Reviewing files that changed from the base of the PR and between eb14d96 and cb1222c.
Files selected for processing: 1
ai/ti/reference/ti-fs-copy-file.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
Fair complaint — the first revision read like a design note. 0c95a0569 rewrites the added text as flag bullets:
--append, --resume, --recursive, and --layer-id each carry the one sentence about the existing-destination check they skip; the four-case paragraph is gone.
--overwrite is three sentences now (what it replaces, the staged sibling + rename, the access it needs), with the staging-file remedy in one line.
The paragraph after the options list is back to two sentences: the directory rule and the refusal without --overwrite.
--from-local/--to-local say only "A URL scheme such as file:///path is not accepted."
Net: 9 changed lines, every option bullet one to three sentences, and the facts from the review rounds are kept.
- --resume, --recursive, and --layer-id skip the staging step, so the
one-step replacement does not apply to them;
- --from-stdin needs an explicit destination file path, because a
directory destination has no file name to use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area/tidb-cloudThis PR relates to the area of TiDB Cloud.do-not-merge/holdIndicates that a PR should not merge because someone has issued a /hold command.size/SDenotes a PR that changes 10-29 lines, ignoring generated files.translation/no-needNo need to translate this PR.
2 participants
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.
What is changed, added or deleted? (Required)
ti fs copy-filegained behavior in tidbcloud/ti-cli#100 that this page does not describe, so the reference is updated:--overwrite: an upload or a download overwrites the destination directly; a copy within the file system (--from-remotewith--to-remote) stages the source at<destination>.ti-tmp-<id>and renames it onto the destination. The page now states the access the rename needs and theti fs delete-file --pathremedy when a failed rename leaves the temporary file behind.--from-localand--to-local: state that only plain file system paths are accepted and that a URL scheme such asfile:///pathis rejected.<destination>/<source-file-name>), the refusal without--overwrite, and a "Replace an existing remote file" example.Which TiDB version(s) do your changes apply to? (Required)
The
ai/tipages exist only onrelease-8.5, so this change targets that branch only and does not apply tomaster.What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?
Summary by CodeRabbit
--from-localand--to-localrequire plain filesystem paths; URL schemes such asfile:///pathare rejected.--overwritehas no effect with recursive copies: an existing destination root is reused, but copying stops if a path beneath it already exists.--append,--resume,--recursive, and--layer-id.