Repository navigation
Cherry pick #120025 to 26.3: Fix unparseable metadata for a NATS table defined only by a named collection - #120235
Conversation
…lection registerStorageNATS called NATSSettings::loadFromQuery unconditionally. With ENGINE = NATS(collection) and no SETTINGS clause, args.storage_def->settings is null, and loadFromQuery's else branch attaches an empty ASTSetQuery to the ASTStorage. ASTStorage::formatImpl emits the keyword for any non-null settings member, so the definition serialized into the table's metadata file ends in a bare "SETTINGS ". Re-parsing that file fails with SYNTAX_ERROR, which makes the table unloadable and aborts the whole database load, so unrelated healthy tables in the same database become inaccessible too. Guard the call, exactly as the sibling registrars already do: StorageRabbitMQ.cpp has the same preceding "else if (!args.storage_def->settings) throw" together with the guard, and its RabbitMQSettings::loadFromQuery carries the identical empty-ASTSetQuery branch; StorageKafkaUtils.cpp and StorageDistributed.cpp guard the same way. Nothing after the call needs settings to be non-null: the later uses are already inside "if (args.storage_def->settings)". The empty-ASTSetQuery branch of NATSSettings::loadFromQuery becomes unreachable and is left in place so that NATS and RabbitMQ stay the same shape. The shape became reachable when named collections were added in b3ca976; the unguarded call dates from the original engine in 944a729. 05029_nats_tls_certificate_path_restriction already coded around this defect: its full-definition ATTACH carried SETTINGS nats_num_consumers = 1 purely so that the stored definition would parse on the DETACH/ATTACH replay that follows. Removing that crutch turns the existing block into the regression oracle. The value equalled the setting's own default and is read nowhere in the certificate provenance logic, so the block's assertions keep their meaning. Without this fix the short ATTACH fails with SYNTAX_ERROR (62) where the test expects BAD_ARGUMENTS (36). Closes #119120
04891_nats_credential_file_path_restriction carried the same SETTINGS nats_num_consumers = 1 crutch on the full-definition ATTACH whose metadata the block replays, and a comment stating that a collection-only definition is stored with an empty SETTINGS clause. The guard added in this branch makes that comment false, so remove the crutch there too: the block then covers the fixed shape on the credential-file path as well. The value equalled the setting's own default and is read nowhere in the credential provenance logic, so every assertion keeps its meaning. Without the guard the short ATTACH of that block fails with SYNTAX_ERROR (62) where the test expects BAD_ARGUMENTS (36). Both replay blocks now state what the stored definition must carry instead of describing what it happens to carry, so the property the block exists to check does not read as an incidental remark.
…adata Fix unparseable metadata for a NATS table defined only by a named collection
Conflict resolution for the 26.3 cherry-pickWhat conflicted. Resolution, by content. Keep the auto-merged source guard, drop the two absent files. Nothing is Scope. Against Verification. I built the merge with the compiler this branch pins (clang-21, read from
Local style checks flag nothing in this path. To take it. The merge's first parent is this PR's head, so this is a fast-forward and nothing needs Once this PR reports mergeable, |
… cherrypick/26.3/120025 # Conflicts: # tests/queries/0_stateless/04891_nats_credential_file_path_restriction.sql # tests/queries/0_stateless/05029_nats_tls_certificate_path_restriction.sql
Original pull-request #120025
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job