release-25.4: pkg/cli: support full zip path matching in --include-files/--exclude-files#164149
release-25.4: pkg/cli: support full zip path matching in --include-files/--exclude-files#164149Abhinav1299 wants to merge 1 commit intocockroachdb:release-25.4from
Conversation
|
Thanks for opening a backport. Before merging, please confirm that it falls into one of the following categories (select one):
Add a brief release justification to the PR description explaining your selection. Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy. All backports must be reviewed by the TL and EM for the owning area. |
|
✅ PR #164149 is compliant with backport policy Confidence: high Additionally, the PR description indicates that the changes are backward compatible and only additive, preserving backward compatibility as required by the policy. The expression of critical diagnostic data preservation and enhancement of the existing debug capabilities suggests alignment with the policy's criteria for critical bugs, ensuring the PR's relevance and necessity. ✅ ENGREQ Check Passed: No ENGREQ required (non-production code or serious issues). 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
…files Previously, the --include-files and --exclude-files flags in `debug zip` only matched against the base file name (e.g. "details.json"). This made it impossible to filter by location within the zip archive, for example including only a specific node's files, or excluding per-node ranges.json while keeping the cluster-wide copy. This commit extends the file filter flags to support full zip path matching. Patterns without '/' continue to match the base file name, preserving the backward compatibility. Patterns with '/' are matched against the full path within the zip archive using filepath.Match semantics (e.g. "debug/nodes/1/*.json" or "debug/nodes/*/ranges.json"). The core change adds a zipPath parameter to shouldIncludeFile and isIncluded, with a matchPattern helper that routes each pattern to the appropriate match target. Server-side retrieval patterns only forward base-name patterns since the server does not know the zip directory layout. Fixes: cockroachdb#158450 Part of: CRDB-57302 Epic: none Release note (cli change): The `cockroach debug zip` command's `--include-files` and `--exclude-files` flags now support full zip path patterns. Patterns containing '/' are matched against the full path within the zip archive (e.g. `--include-files='debug/nodes/1/*.json'`). Patterns without '/' continue to match the base file name as before.
97f5a79 to
dc6a330
Compare
Backport 1/1 commits from #163266.
/cc @cockroachdb/release
Previously, the --include-files and --exclude-files flags in
debug ziponly matched against the base file name (e.g. "details.json"). This made
it impossible to filter by location within the zip archive, for example
including only a specific node's files, or excluding per-node ranges.json
while keeping the cluster-wide copy.
This commit extends the file filter flags to support full zip path
matching. Patterns without '/' continue to match the base file name,
preserving the backward compatibility. Patterns with '/' are matched
against the full path within the zip archive using filepath.Match
semantics (e.g. "debug/nodes/1/.json" or "debug/nodes//ranges.json").
The core change adds a zipPath parameter to shouldIncludeFile and
isIncluded, with a matchPattern helper that routes each pattern to the
appropriate match target. Server-side retrieval patterns only forward
base-name patterns since the server does not know the zip directory
layout.
Fixes: #158450
Part of: CRDB-57302
Epic: none
Release note (cli change): The
cockroach debug zipcommand's--include-filesand--exclude-filesflags now support full zip pathpatterns. Patterns containing '/' are matched against the full path
within the zip archive (e.g.
--include-files='debug/nodes/1/*.json').Patterns without '/' continue to match the base file name as before.
Release justification: This change is needed to unblock an active customer investigation
runbook. The current workaround for collecting faster "lite" debug zips uses
--exclude-files='*.pprof',but this over-excludes: it drops per-node cpu.pprof and heap.pprof (<1% of zip size) which are
critical for diagnosing cluster behavior at collection time. The actual bloat comes from historical
profiles in heapprof/ folders (49% of zip size). Without path-based filtering there is no way to
exclude heapprof/* while retaining the current profiles -- the only option is the blunt
*.pprofwhich sacrifices essential diagnostic data. This change enables surgical patterns like --exclude-files='debug/nodes//heapprof/' to target the bulk data. The change is backward compatible and
additive only.