Skip to content

feat: copy mode data revovery#35238

Draft
localvar wants to merge 16 commits into3.3.6from
feat/copy-mode-revovery
Draft

feat: copy mode data revovery#35238
localvar wants to merge 16 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
Comment thread source/common/src/dmRepairCopy.c Outdated
Comment thread source/common/src/dmRepairCopy.c Outdated
// Fetch a remote file to a local path via SSH.
// Returns 0 on success, -1 on error.
static int32_t dmSshFetchFile(const char *host, const char *remotePath, const char *localPath) {
char qHost[320], qRemote[PATH_MAX + 4], qLocal[PATH_MAX + 4];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The buffers qRemote and qLocal are too small to hold the output of dmShellQuote. Since dmShellQuote can expand each character (e.g., a single quote becomes 4 characters), a path of length PATH_MAX could require up to 4 * PATH_MAX + 3 bytes. Using PATH_MAX + 4 will lead to truncation and subsequent command failure for long paths containing special characters. This issue also exists in other functions in this file (e.g., dmValidateSourceDisksRemote, dmCopyNonTsdbFiles, dmGetRemoteFileSize, dmCopySourceFileSets).

  char qHost[1024], qRemote[PATH_MAX * 4 + 4], qLocal[PATH_MAX * 4 + 4];

Comment thread source/common/src/dmRepairCopy.c Outdated
uError("repair: shell quote failed in dmSshFetchFile");
return -1;
}
char cmd[2048];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The cmd buffer size (2048) is insufficient to hold the full SSH command when qRemote or qLocal are near PATH_MAX. This will result in truncated commands that fail to execute correctly. This issue also exists in other functions in this file.

  char cmd[PATH_MAX * 10];

Comment thread source/common/src/dmRepairCopy.c
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>
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.

1 participant