Repository navigation
Fix definitions import 18517 - #18518
Open
mkuratczyk wants to merge 2 commits into
Open
mkuratczyk wants to merge 2 commits into
mkuratczyk wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The changed filesystem and HTTPS loader failure paths lack regression coverage confirming that failed resource imports preserve stored hashes and still fail on identical retries when skip_if_unchanged is enabled.
2 open issues
What changed in this PR
This PR corrects RabbitMQ’s definitions-import error handling, addressing #18517 and preventing failed imports from being skipped on retry.
Changes:
- Returns HTTP
400when vhost-scoped definitions are submitted to the cluster-wide endpoint - Stores content hashes only after successful imports and propagates boot-time import errors from filesystem and HTTPS sources
- Adds regression tests for HTTP rejection and hash preservation after failed cluster-wide and vhost-specific imports
| File | Description |
|---|---|
deps/rabbitmq_management/test/rabbit_mgmt_http_SUITE.erl |
Checks the HTTP status and reason for rejected vhost-scoped definitions |
deps/rabbit/test/definition_import_SUITE.erl |
Checks that rejected and failed imports preserve stored hashes |
deps/rabbit/src/rabbit_definitions.erl |
Returns validation errors normally and stores hashes through success callbacks |
deps/rabbit/src/rabbit_definitions_import_local_filesystem.erl |
Propagates file and directory import failures instead of returning a hash |
deps/rabbit/src/rabbit_definitions_import_https.erl |
Propagates HTTPS import failures instead of returning a hash |
Review effort: Balanced
| _ = load_from_local_path(IsDir, Path), | ||
| Other | ||
| maybe | ||
| ok ?= load_from_local_path(IsDir, Path), |
With `skip_if_unchanged` enabled, the content hash was stored even when the import failed, so a retry of the same definitions was skipped and reported success. This applies to imports via the CLI and to imports at boot from a local file, a directory or an HTTPS source. Note that at boot, an import error with `skip_if_unchanged` enabled now stops the node, the same as it already does without `skip_if_unchanged`. Previously the error was ignored and the hash was stored. References #18517
The check for queues, exchanges and bindings without a virtual host threw outside of the `try` in `rabbit_definitions:apply_defs/3`, so the HTTP API handler crashed instead of returning a 400. Return the error instead. Fixes #18517
mkuratczyk
force-pushed
the
fix-definitions-import-18517
branch
from
November 27, 2026 14:19
95d91f6 to
29dba53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Importing definitions exported for a single virtual host via
POST /api/definitionscrashed the HTTP API handler instead of returning a 400. The check for queues, exchanges
and bindings without a virtual host threw outside of the
tryinrabbit_definitions:apply_defs/3. It now returns{error, <<"invalid_definitions_file">>}.While at it, this fixes how
skip_if_unchangedhandles a failed import. The content hashwas stored even when the import failed, so a retry with the same definitions was skipped
and reported success. Now the hash is stored only after a successful import. This covers
imports via the CLI, cluster-wide and for a single virtual host, and imports at boot from
a local file, a directory or an HTTPS source.
Note that at boot, an import error with
skip_if_unchangedenabled now stops the node,the same as it already does without
skip_if_unchanged. Previously the error was ignoredand the hash was stored.
Fixes #18517