Skip to content

NACK broken messages when using rabbitmq storage#102157

Merged
grantholly-clickhouse merged 3 commits intoClickHouse:masterfrom
seva-potapov:rabbitmq-nack-parse-error
Apr 9, 2026
Merged

NACK broken messages when using rabbitmq storage#102157
grantholly-clickhouse merged 3 commits intoClickHouse:masterfrom
seva-potapov:rabbitmq-nack-parse-error

Conversation

@seva-potapov
Copy link
Copy Markdown
Contributor

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):

NACK broken messages when using rabbitmq storage

Details:

Bugfix for #73541: when rabbitmq_handle_error_mode = 'default' (the default) and a RabbitMQ message fails to parse, the exception escapes generateImpl before the message's delivery tag is recorded in commit_info. The message, already dequeued from the internal buffer by consume, is then never ack'd or nack'd — it stays permanently "in flight" in RabbitMQ. The fix wraps executor.execute(*buf) in a try-catch that captures the delivery tag before re-throwing. An integration test verifies that bad messages are properly nack'd to a dead-letter exchange.

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Apr 9, 2026

Workflow [PR], commit [1f62fea]

Summary:


AI Review

Summary

This PR fixes a real correctness issue in RabbitMQ default error mode: when parsing failed, the message delivery tag was not persisted before the exception escaped, so the message could remain permanently unacked. The change records the current message tag in the exception path and rethrows, enabling downstream nackMessages to reject it. The new integration test covers the regression path and validates dead-lettering behavior. High-level verdict: the fix is correct, scoped, and safe.

Missing context
  • ⚠️ CI logs/results were not provided in this review context, so this review is based on code and tests in the PR diff.
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: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 9, 2026
@seva-potapov seva-potapov changed the title fixes #73541 NACK broken messages when using rabbitmq storage Apr 9, 2026
@alexey-milovidov alexey-milovidov self-assigned this Apr 9, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Apr 9, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 90.90% 90.90% +0.00%
Branches 76.50% 76.40% -0.10%

Changed lines: 66.67% (10/15) | lost baseline coverage: 2 line(s) · Uncovered code

Full report · Diff report

@alexey-milovidov
Copy link
Copy Markdown
Member

The Fast test (arm_darwin) failure is unrelated to this PR — the fix is in #102184.

@grantholly-clickhouse grantholly-clickhouse added this pull request to the merge queue Apr 9, 2026
Merged via the queue into ClickHouse:master with commit bcbd2b5 Apr 9, 2026
321 of 324 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 9, 2026
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.

4 participants