Skip to content

Add sed command to clickhouse-disks - #107131

Merged
asya-ch merged 21 commits into
masterfrom
asya/sed
Jun 23, 2026
Merged

asya-ch merged 21 commits into
masterfrom
asya/sed

Conversation

@asya-ch

@asya-ch asya-ch commented Jun 11, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add sed command to clickhouse-disks. It applies a sed expression to a given path, in-place.

Version info

  • Merged into: 26.6.1.1146

@clickhouse-gh

clickhouse-gh Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5b2bfaa]

Summary: ✅


AI Review

Summary

This PR adds a single-expression sed command to clickhouse-disks, with docs and stateless coverage for local and object-storage disks. The current implementation addresses the earlier fail-close and process-cleanup issues, but the tests still do not prove two non-obvious safety contracts that were added during review.

Tests
  • ⚠️ [tests/queries/0_stateless/04327_clickhouse_disks_sed.sh:40] The test still does not cover that option-looking expressions remain scripts (sed -- --help ... must fail and leave the file unchanged), or that an early-exit script such as 1q succeeds on input larger than a pipe buffer. Removing exec sed -- "$0" or the EPIPE handling in CommandSed would still pass this test. Please add focused regressions for both cases.
Final Verdict

Status: ⚠️ Request changes

Minimum required action: add the two focused regression cases above.

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Jun 11, 2026
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
@arsenmuk arsenmuk self-assigned this Jun 11, 2026
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved

@arsenmuk arsenmuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All good, let's fix the indentation, the test and it's good to go.

One tiny-super-nit comment, please ignore it if you don't share my feelings. I often find AI-generated multi-line comments to be too heavy, slop-ish and not really adding value. As a last touch before merging, I either manually revise and rephrase them to concise brief one-liners, or ask claude to do that for me. I'd do that here as well before pushing tbh.

Comment thread programs/disks/CommandSed.cpp Resolved
Comment thread programs/disks/CommandSed.cpp Resolved
@asya-ch

asya-ch commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

I totally agree with you on the comments -- I edited them to be shorter.


# A bad expression must fail and leave the original file untouched (fail-close).
echo "--- bad expression error ---"
run "sed 's/[/x/' $file" 2>&1 | grep -o "unterminated \`s' command" | head -n 1

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.

sed now has two non-obvious safety contracts that this test would not catch if they regressed: option-looking scripts must stay scripts (sed -- --help ... should fail and leave the file unchanged), and scripts that exit before consuming stdin (1q) must not fail on files larger than a pipe buffer. Removing -- "$0" or the EPIPE handling would still pass this test today. Please add focused regressions for those cases so we do not reintroduce replacing the file with sed --help output or failing valid early-exit scripts based on file size.

@asya-ch
asya-ch enabled auto-merge June 18, 2026 20:25
@clickhouse-gh

clickhouse-gh Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 38 queries analysed

This PR only adds a new sed command to the clickhouse-disks command-line utility (plus docs and tests); it touches nothing in the server's query-execution path. The single flagged item, a -7.95% improvement on tpch_adapted_1_official Q4, cannot plausibly come from this change, so it is downgraded to not-sure as run-to-run variance. No real performance impact expected from this PR.

clickbench

🟢 No significant changes

tpch_adapted_1_official

⚠️ 1 inconclusive

Flagged queries (1 of 22)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 4 not_sure 2529 2328 -8.0% 0.0120 PR only adds a sed command to the clickhouse-disks CLI; nothing in the server query path. -7.95% is run-to-run variance.

q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

Debug info
  • StressHouse run: 450722d8-0619-425f-8ea2-1ef5f9e2d8eb
  • MIRAI run: 70e26e58-0463-4ba7-bac1-a61cc813de37
  • PR check IDs:
    • clickbench_99468_1781860080
    • clickbench_99483_1781860080
    • clickbench_99489_1781860080
    • tpch_adapted_1_official_99495_1781860080
    • tpch_adapted_1_official_99506_1781860080
    • tpch_adapted_1_official_99516_1781860080

@clickhouse-gh

clickhouse-gh Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.30% 85.40% +0.10%
Functions 92.50% 92.50% +0.00%
Branches 77.50% 77.60% +0.10%

Changed lines: Changed C/C++ lines covered by tests: 59/72 (81.94%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@asya-ch
asya-ch added this pull request to the merge queue Jun 23, 2026
Merged via the queue into master with commit 35fc8d8 Jun 23, 2026
329 of 330 checks passed
@asya-ch
asya-ch deleted the asya/sed branch June 23, 2026 10:30
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 23, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants