Skip to content

Fix S3 positional partition_strategy case-insensitivity - #107297

Merged
jkartseva merged 6 commits into
masterfrom
jkartseva/fix-s3-partition-strategy-case
Jun 17, 2026
Merged

jkartseva merged 6 commits into
masterfrom
jkartseva/fix-s3-partition-strategy-case

Conversation

@jkartseva

@jkartseva jkartseva commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

A partition_strategy passed positionally to the s3 table function was matched
case-sensitively, so a lowercase value like hive was silently misrouted to
compression_method. Make the disambiguation case-insensitive.

Closes: #102285

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix the s3 table function silently ignoring a lowercase positional partition_strategy (e.g. hive).

Co-authored-by: Claude Opus 4.8 [email protected]

🤖 Generated with Claude Code

Version info

  • Merged into: 26.6.1.941

@clickhouse-gh

clickhouse-gh Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [25d5186]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_asan_ubsan, azure, parallel) FAIL
04337_quorum_insert_honors_time_limit FAIL cidb IGNORED

AI Review

Summary
  • The PR fixes positional partition_strategy disambiguation for the s3 table function by making real strategies case-insensitive while preserving ambiguous none/NONE behavior, and adds focused S3 stateless coverage for lowercase strategy names plus the NONE compatibility cases. I did not find any remaining correctness issues in the current diff.
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jun 11, 2026
@tiandiwonder tiandiwonder self-assigned this Jun 12, 2026
{
auto sixth_arg = checkAndGetLiteralArgument<String>(args[6], "compression_method/partition_strategy");
if (magic_enum::enum_contains<PartitionStrategyFactory::StrategyType>(sixth_arg))
if (looksLikeExplicitPartitionStrategy(sixth_arg))

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.

This regresses a previously-valid 8-arg form: s3(..., format, structure, 'NONE', 1) used to parse as partition_strategy=NONE + partition_columns_in_data_file=1, but now 'NONE' is taken as compression_method and the 1 falls into the String partition_strategy slot, so it throws BAD_ARGUMENTS. Only the table-function path (with_structure=true) hits this. For count==8 it's cleaner to check whether args[7] parses as a bool first (then args[6] is the strategy) and only fall back to looksLikeExplicitPartitionStrategy otherwise.


/// Disambiguates an ambiguous positional slot (partition strategy vs compression method). Matches a
/// real strategy case-insensitively (`hive`/`HIVE`), but excludes `NONE` so the valid compression
/// method `none` keeps mapping to compression_method rather than the default strategy.

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.

compression_method should be backticked like the other names in this comment.

Comment on lines +13 to +14
SELECT * FROM s3('http://localhost:11111/test/test', 'key', 'secret', 'token', 'Parquet', 'col1 UInt32', 'none', 'unknown_strategy') LIMIT 0; -- { serverError BAD_ARGUMENTS }
SELECT * FROM s3('http://localhost:11111/test/test', 'key', 'secret', 'token', 'Parquet', 'col1 UInt32', 'NONE', 'unknown_strategy') LIMIT 0; -- { serverError BAD_ARGUMENTS }

@tiandiwonder tiandiwonder Jun 12, 2026 •

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.

Neither line discriminates — both throw BAD_ARGUMENTS with and without the PR. 'none', 'unknown_strategy' takes the compression+strategy layout both times (fails as an unknown strategy); 'NONE', 'unknown_strategy' fails on master converting 'unknown_strategy' to the bool partition_columns_in_data_file, and as an unknown strategy after — different messages, same code. The case that actually catches the count==8 regression is 'NONE', 1 (a bool 8th arg), which isn't covered.

jkartseva and others added 3 commits June 16, 2026 01:24
Match exact enum names case-sensitively before the case-insensitive check,
so positional `NONE`/`HIVE`/`WILDCARD` stay a partition_strategy while
lowercase `none` keeps meaning compression_method.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ot LIMIT 0

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.20% 85.20% +0.00%
Functions 92.30% 92.30% +0.00%
Branches 77.30% 77.30% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 18/19 (94.74%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@jkartseva

Copy link
Copy Markdown
Member Author

@tiandiwonder Could you give it another look? CI failures are unrelated.

@tiandiwonder

Copy link
Copy Markdown
Contributor

@groeneai would you please fix CI failure: 04337_quorum_insert_honors_time_limit?

@groeneai

Copy link
Copy Markdown
Collaborator

@tiandiwonder confirmed: 04337_quorum_insert_honors_time_limit is unrelated to this PR, the CI failure is pre-existing flaky.

Triage (CIDB, 30d):

  • 0 failures on master (478 OK). Flaky across several unrelated PRs (S3, join-reordering, distributed group-by, etc.); every rerun passes.
  • 100% of the failures are the timeout_overflow_mode='break' INSERT into quorum_break_r1 succeeding when { serverError TIMEOUT_EXCEEDED } is expected. The 'throw' INSERT never fails.
  • Only sanitizer/coverage parallel jobs. It is a new flaky test introduced by Honor query cancellation in waiting for quorum in ReplicatedMergeTree #107513 (merged yesterday).

Mechanism (hypothesis): the break INSERT returns success when waitForQuorum finds /quorum/status gone. That node is removed only when quorum is reached (updateQuorum). The test keeps quorum unsatisfiable with SYSTEM STOP FETCHES quorum_break_r2, but that only blocks new fetches and is not a hard guarantee under sanitizer-slow parallel timing, so r2 can occasionally fetch+commit the part, satisfy quorum, and clear the node before the time limit fires.

I could not reproduce the spurious success locally (debug build: 145+/145+ correct timeouts, including under CPU load and Thread Fuzzer), so I am not pushing a speculative change. The clean fix is test-side, on the author of #107513's call: make the second replica provably unable to confirm quorum (e.g. SYSTEM STOP REPLICATED SENDS on r1, or detach r2) instead of relying on STOP FETCHES. I can open that test-hardening PR if you want it.

(groeneai, session cron:clickhouse-worker-slot-7:20260617-033400)

@jkartseva
jkartseva enabled auto-merge June 17, 2026 21:26
@jkartseva
jkartseva added this pull request to the merge queue Jun 17, 2026
Merged via the queue into master with commit 2624b69 Jun 17, 2026
163 of 165 checks passed
@jkartseva
jkartseva deleted the jkartseva/fix-s3-partition-strategy-case branch June 17, 2026 21:51
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

@tiandiwonder this is now fixed upstream by #107760 (nickitat, the author of #107513), approved by azat. No action needed here.

His fix removes the timeout_overflow_mode='break' escalation that #107513 added to waitForQuorum and makes the break case deterministic in the test: insert_quorum_timeout=3000 with max_execution_time=300 so the quorum-wait bound fires first and the INSERT ends with UNKNOWN_STATUS_OF_INSERT. That also pins down the real trigger I could not reproduce locally: with the old small max_execution_time=3, under sanitizer-slow timing the break-mode budget could be consumed during pipeline setup, so the executor stopped gracefully before waitForQuorum ran and the INSERT returned success instead of erroring. So no test-hardening PR from me; tracking #107760 to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default 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.

S3 positional arg disambiguation uses case-sensitive magic_enum::enum_contains, misidentifying lowercase partition_strategy as compression_method

4 participants