Skip to content

input_format_protobuf_oneof_presence does not require exact match of tags to allow schema changes - #109174

Merged
Avogar merged 13 commits into
ClickHouse:masterfrom
ilejn:protobuf_enum_relax
Jul 29, 2026
Merged

Avogar merged 13 commits into
ClickHouse:masterfrom
ilejn:protobuf_enum_relax

Conversation

@ilejn

@ilejn ilejn commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Improvement

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

Processing protobuf messages with input_format_protobuf_oneof_presence we do not require exact match of tags to allow schema changes.

We are moving from validating the oneof presence Enum against all oneof tags declared in the .proto schema, which is too strict, to validating it against the oneof tags that actually have matching columns in the target table.

Version info

  • Merged into: 26.8.1.352 (included in 26.8 and later)

@ilejn
ilejn marked this pull request as ready for review July 2, 2026 17:55
@ilejn

ilejn commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Hello @Avogar, could you enable testing for this, please.

@ilejn

ilejn commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Hello @Avogar, could you look into this please?

@Avogar Avogar self-assigned this Jul 21, 2026
@Avogar Avogar added the can be tested Allows running workflows for external contributors label Jul 21, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ec18511]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_tsan, parallel) FAIL
04546_constant_join_shrink_stored_blocks FAIL cidb IGNORED
Stress test (arm_msan) FAIL
Cannot start clickhouse-server FAIL cidb IGNORED
Logical error: Cannot create part with type A and storage type B because table does not support polymorphic parts (STID: 3286-403e) FAIL cidb IGNORED
Check failed FAIL cidb IGNORED

AI Review

Summary

This PR relaxes input_format_protobuf_oneof_presence validation so the presence Enum only needs tags for oneof cases that actually map to table columns, and it extends the fallback path for unmaterialized message branches to record either the branch tag or 0 when only the omitted marker is available. The current code and the expanded stateless coverage address the earlier empty-branch and documentation issues, and I did not find any remaining correctness or contract gaps in the touched paths.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jul 21, 2026
Comment thread src/Formats/ProtobufSerializer.cpp Resolved

@Avogar Avogar 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.

Review bot comments seem valid, let's fix them and it can be merged

Comment thread src/Formats/ProtobufSerializer.cpp Resolved
@ilejn

ilejn commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor Author

I found a design flaw in how we deal with empty messages.
'Empty message' is what is empty in .proto, but if a message does have fields, but nothing can be materialized to target table, it is ignored.

Working on it, will be finished by EOD 24 Jun

@clickhouse-gh

clickhouse-gh Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.20% 86.20% +0.00%
Functions 92.00% 92.00% +0.00%
Branches 78.40% 78.40% +0.00%

Changed lines: Changed C/C++ lines covered: 78/85 (91.76%) · Uncovered code

Full report · Diff report

@ilejn

ilejn commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Hello @Avogar , is it possible to wake up review bot and go further ?
Test failures are not related.

@Avogar
Avogar added this pull request to the merge queue Jul 29, 2026
Merged via the queue into ClickHouse:master with commit 7644a0d Jul 29, 2026
175 of 178 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 29, 2026
rorylshanks pushed a commit to rorylshanks/ClickHouse that referenced this pull request Aug 25, 2026
04411_memory_profiler_sample_probability_sql_settings runs a query with
memory_profiler_sample_probability = 1, then SYSTEM FLUSH LOGS trace_log,
then asserts a MemorySample row is visible.

SystemLogQueue::waitFlush uses a hardcoded timeout_seconds = 180
(src/Common/SystemLogBase.cpp:191) and waits for getLastLogIndex(), a
server-global queue position, so the flush drains the trace rows of every
concurrently running parallel test rather than only this test's. Under LLVM
source-based coverage instrumentation the server is slow enough that this
crosses 180 s, waitFlush throws at :213 with

  Code: 159. Timeout exceeded (180 s) while flushing system log
  'DB::SystemLogQueue<DB::TraceLogElement>'. (TIMEOUT_EXCEEDED)

and the following SELECT count() > 0 then reads 0, so the coverage lane
reports a false negative rather than only contaminating stderr.

Over 30 days of coverage-lane runs that PASSED, this test has p50 9.6 s and
p95 183.6 s (max 202.3 s) against p50 5.1 s / p95 11.1 s in every other lane,
and 2307 of 37648 coverage runs already exceed 180 s. Two crossed it on the
flush: Stateless tests (amd_llvm_coverage, 3/3) on 2026-08-20 (PR ClickHouse#115623)
and (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) on 2026-07-23
(PR ClickHouse#109174).

Report for the 2026-08-20 failure:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115623&sha=9b52646c82721f24b7dfb1ddc58d949beef5a7d0&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%203%2F3%29

no-llvm-coverage is the established remedy for this mechanism: 36 stateless
tests carry it, and commit 36decd6 ("Mark tests that timed out under LLVM
coverage as no-llvm-coverage") applied it to five tests including this test's
direct sibling 02818_memory_profiler_sample_min_max_allocation_size, whose
shape is identical. 04411 was created two months after that commit, which is
why it was missed.

Coverage is relocated, not lost: the inverse filter at
tests/clickhouse-test:2967-2971 makes Stateless tests
(amd_binary_excluded_from_llvm) run exactly the tagged complement, and the
two flags are mutually exclusive by construction
(ci/jobs/functional_tests.py:608-612). Over 14 days in that job the tagged
siblings 02818 and 01473_event_time_microseconds are OK 4367 and 4365 times
while 04411 is SKIPPED 4367 times. The same intervention on 01473 (ClickHouse#103219,
merged 2026-08-04) took its coverage-lane failures from 5 to 0.

Raising or parameterizing the 180 s constant was rejected: it is a
server-wide change for one test, the constant is already a deliberate
concession to parallel-test load, and because the drain is global a larger
value only moves the threshold.

Validated with the real runner. With the tag, --llvm-coverage skips and
--excluded-from-llvm runs; with the tag removed both verdicts invert, which
is the liveness proof that the arms measure the tag. Without any coverage
flag the test still runs, 10/10.

Related: ClickHouse#114204
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-improvement Pull request with some product improvements 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