Skip to content

feat: copy mode data recovery - 3.3.6#35238

Open
localvar wants to merge 22 commits into3.3.6from
feat/copy-mode-revovery
Open

feat: copy mode data recovery - 3.3.6#35238
localvar wants to merge 22 commits into3.3.6from
feat/copy-mode-revovery

Conversation

@localvar
Copy link
Copy Markdown
Contributor

Description

implement copy mode data recovery.

Issue(s)

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

localvar and others added 13 commits April 23, 2026 15:10
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@localvar localvar changed the base branch from main to 3.3.6 April 27, 2026 08:13
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new vnode data repair tool (dmRepairCopy) for data recovery via SSH or local copy, alongside a meta-reader utility for manual metadata inspection and repair. It implements enhanced table-level privilege filtering for system table queries, addresses client-side double-free vulnerabilities, and fixes DST-related inaccuracies in time truncation. Other significant changes include the addition of a flexible deployment mode, optimized log rotation, and expanded test coverage for subquery pruning and CASE WHEN conditions. Review feedback highlights several critical issues in the new repair tool, including the incorrect use of dot notation for nested JSON lookups, potential buffer overflows when handling shell-quoted paths, and fragile parsing of remote directory listings.

Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
localvar and others added 3 commits April 28, 2026 18:37
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@localvar localvar force-pushed the feat/copy-mode-revovery branch from 10f8581 to 4508164 Compare May 6, 2026 01:26
@localvar localvar force-pushed the feat/copy-mode-revovery branch from 4508164 to 15c9782 Compare May 6, 2026 02:13
@localvar localvar marked this pull request as ready for review May 6, 2026 07:01
@localvar localvar requested a review from guanshengliang as a code owner May 6, 2026 07:01
Copilot AI review requested due to automatic review settings May 6, 2026 07:01
@localvar localvar requested review from a team and dapan1121 as code owners May 6, 2026 07:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new taosd repair “copy” mode to recover vnode data by copying TSDB/non-TSDB files from a source node (local or via SSH), regenerating current.json, updating sync indexes, and cleaning sync state. It also adds CI tests to validate multiple copy/repair scenarios, including multi-tier and multi-disk remapping.

Changes:

  • Add -r --mode copy CLI workflow in taosd and route execution to dmRepairCopyMode().
  • Implement copy-mode repair logic (source cfg parsing, vnode backup/rollback, file copy/link, current.json regeneration, sync index updates, cleanup).
  • Add a comprehensive pytest suite and register it in CI tasks.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/ci/cases.task Adds the new repair-copy pytest case to CI execution.
test/cases/50-Others/02-Repair/test_copy_repair.py New end-to-end tests for local/remote copy-mode repair and disk/tier remapping.
source/dnode/mgmt/exe/dmMain.c Adds CLI parsing for copy-mode repair and invokes dmRepairCopyMode() when enabled.
source/common/src/dmRepairCopy.c New implementation of copy-mode repair (copy/link/remap/regenerate/cleanup with rollback).
source/common/CMakeLists.txt Adds include paths needed to build the new common repair-copy implementation.
include/common/dmRepairCopy.h New public header defining options and entry points for repair-copy mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/common/src/dmRepairCopy.c
Comment thread source/common/src/dmRepairCopy.c
Comment thread source/common/src/dmRepairCopy.c
Comment thread source/dnode/mgmt/exe/dmMain.c
Comment thread test/cases/50-Others/02-Repair/test_copy_repair.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 07:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c
Comment thread source/common/src/dmRepairCopy.c
@localvar localvar changed the title feat: copy mode data revovery feat: copy mode data recovery May 7, 2026
@localvar localvar changed the title feat: copy mode data recovery feat: copy mode data recovery - 3.3.6 May 7, 2026
Copilot AI review requested due to automatic review settings May 8, 2026 09:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment on lines +676 to +685
char filePath[PATH_MAX];
dmBuildTsdbFilePath(diskPath, vnodeId, lf, filePath, sizeof(filePath));

int64_t actualSize = 0;
if (taosStatFile(filePath, &actualSize, NULL, NULL) != 0 || actualSize <= 0) {
allExist = false;
break;
}
}
if (allExist && nLocalFiles > 0) retained = true;
}
uInfo("repair: vnode%d renamed %s to .bak", vnodeId, srcPath);
} else {
if (taosMkDir(dstPath) != 0) {

SDiskSize diskSize = {0};
if (taosGetDiskSize((char *)diskPath, &diskSize) != 0) continue;
if (diskSize.avail < fileSize + TFS_MIN_DISK_FREE_SIZE) continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants