Skip to content

Add test: Fallback path in checkDataPart and MergeTreeDataPartWide::doCheckConsistency (parts without columns_substreams.txt) is untested for wide parts with Dynamic columns - #103907

Closed
clickgapai wants to merge 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr103858

Conversation

@clickgapai

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #103858.
That PR PR #103858 fixes false-positive NO_FILE_IN_DATA_PART errors during data-part check (CHECK TABLE) and consistency check (called on part load / ATTACH / BACKUP) for MergeTree tables with JSON columns in wide parts. (1) The PR rewrites checkDataPart (Wide branch) and `MergeTreeDataPartWide::doC

1. Fallback path in checkDataPart and MergeTreeDataPartWide::doCheckConsistency (parts without columns_substreams.txt) is untested for wide parts with Dynamic columns
src/Storages/MergeTree/checkDataPart.cpp:290, src/Storages/MergeTree/MergeTreeDataPartWide.cpp:393
Risk: Call chain: ATTACH TABLE → loadDataParts → IMergeTreeDataPart::loadColumnsChecksumsAndIndexes → loadColumnsSubstreams (file missing → columns_substreams stays empty) → checkConsistency → **What's unique vs PR tests:** PR's04109_check_table_json_wide.sqlonly exercises the PRIMARY branch (cols_substreams not empty) with a JSON column — newly-written parts always havecolumns_substreams.txt`, so the FALLBACK bran

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@Avogar Avogar self-assigned this May 2, 2026
@Avogar Avogar closed this May 2, 2026
@Avogar Avogar reopened this May 2, 2026
@Avogar Avogar added the can be tested Allows running workflows for external contributors label May 2, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0ab8f82]

Summary: ❌

job_name test_name status info comment
Finish Workflow FAIL
python3 ./ci/jobs/scripts/workflow_hooks/check_report_messages.py FAIL

AI Review

Summary

This PR adds a new stateless shell test for the columns_substreams.txt-missing fallback path in checkDataPart / MergeTreeDataPartWide::doCheckConsistency for Dynamic columns in wide parts. The coverage target is valid, but the test currently has a gap that can let it pass without actually validating the intended fallback path.

Findings

⚠️ Majors

  • [tests/queries/0_stateless/04202_check_table_dynamic_old_part_no_substreams.sh:36] rm -f "$path/columns_substreams.txt" can silently succeed when the file was never present, so the test may become a no-op and still pass. This weakens regression protection for the exact path the PR claims to cover.
    Suggested fix: assert columns_substreams.txt exists before removal, then delete without -f (or explicitly fail if deletion does not happen).
Tests
  • ⚠️ Strengthen 04202_check_table_dynamic_old_part_no_substreams.sh by failing when columns_substreams.txt is absent before deletion; otherwise the test does not reliably prove fallback execution.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict

Status: ⚠️ Request changes

Minimum required action: make the new test fail if columns_substreams.txt is not actually deleted (assert existence first and avoid silent rm -f behavior).

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 2, 2026
# Detach so the part is unloaded from memory; then physically remove columns_substreams.txt
# (the file is not listed in checksums.txt — it's a metadata-only file).
$CLICKHOUSE_CLIENT -q "DETACH TABLE test_check_dynamic_old;"
rm -f "$path/columns_substreams.txt"

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.

rm -f makes this test able to pass even when columns_substreams.txt was never present (wrong part selected, path mismatch, or format behavior change), so the fallback branch might not actually be exercised.

Please assert the file exists before deleting it, and then delete without -f (or fail explicitly if deletion does not happen). That keeps the test validating the intended regression scenario instead of silently becoming a no-op.

@clickgapai

Copy link
Copy Markdown
Contributor Author

CI check Finish Workflow failed, but the failure does not reference this PR's test (04202_check_table_dynamic_old_part_no_substreams).

This PR is test-only; the bot will not retrigger CI or modify the test to chase a failure that appears unrelated. If you believe the failure is related to this test, please comment with details and the bot will re-evaluate.

@clickgapai

Copy link
Copy Markdown
Contributor Author

This PR has accumulated 5 CI failures that don't reference its test, so the bot has not attempted any fix. Closing — please re-run CI or comment if you'd like the bot to look again.

@Avogar Avogar closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants