fix: handle nil bucket_id in storage get/update/delete operations#495
Open
fix: handle nil bucket_id in storage get/update/delete operations#495
Conversation
Starting from crud 1.7.0, storage asserts if `opts.bucket_id` is nil during `get`, `update`, or `delete` operations. Since older routers (< 1.7.0) do not pass `bucket_id`, this causes protocol incompatibility. This commit adds a nil check to skip bucket ref when `bucket_id` is missing, restoring backward compatibility with old routers.
vakhov
reviewed
May 6, 2026
Contributor
vakhov
left a comment
There was a problem hiding this comment.
Thanks for the PR. I have suggestions here:
- the workaround itself looks reasonable as a temporary solution for rolling cluster upgrades, but it should be made observable. Right now, when bucket_id == nil, storage silently skips bucket_ref, so during a partial upgrade some traffic goes through a path with weaker guarantees, and operations won’t see it.
- maybe it’s worth adding a rate-limited warning through a shared helper, for example warn_nil_bucket_id_compat_once(operation, space_name, space.engine), to avoid duplicating the same logic across get/update/delete. The message could be something like: crud.%s_on_storage called without bucket_id; old router compatibility mode is used, bucket_ref is skipped, rebalance safety is reduced until routers are upgraded; space=%s engine=%s.
- it may also be worth adding a storage-side counter: tnt_crud_storage_nil_bucket_id_compat_total with labels like operation, engine, and possibly safe_mode.
- also, it may be worth documenting the upgrade workaround explicitly for clusters upgrading from < 1.7.0 to >= 1.7.0. The docs should say that during a rolling upgrade storages should be upgraded first, and routers afterwards. While old routers are still running, storages may enter the compatibility path where bucket_id is missing and bucket_ref is skipped, so should expect the warning/counter above until all routers are upgraded.
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.
Starting from crud 1.7.0, storage asserts if
opts.bucket_idis nil duringget,update, ordeleteoperations. Since older routers (< 1.7.0) do not passbucket_id, this causes protocol incompatibility.This PR adds a nil check to skip bucket ref when
bucket_idis missing, restoring backward compatibility with old routers.Closes TNTP-7622