[backport 3.5] box: fix _func id overflow#12108
Merged
sergepetrenko merged 2 commits intorelease/3.5from Dec 8, 2025
Merged
Conversation
Each time one used the `box.schema.func.create`, the primary key of the resulted function increased because of the `_func:auto_increment`. Now the new key is chosen by the `generate_func_id` in Lua and `OP_GenFuncid` SQL opcode, both implemented using the new `box_generate_func_id` function that shares logic with `box_generate_space_id`. Hence we are scanning the entire range of possible ids `[0, BOX_FUNCTION_MAX)` before we are returning an error. Fixes #11849 Fixes #11851 NO_DOC=bugfix (cherry picked from commit 95d3550)
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.
(This PR is a backport of #12004 to
release/3.5to a future3.5.2release.)Each time one used the
box.schema.func.create, the primary key ofthe resulted function increased because of the
_func:auto_increment. Now the new key is chosen by thegenerate_func_idin Lua andOP_GenFuncidSQL opcode, both implementedusing the new
box_generate_func_idfunction that shares logic withbox_generate_space_id. Hence we are scanning the entire range ofpossible ids
[0, BOX_FUNCTION_MAX)before we are returning anerror.
Fixes #11849
Fixes #11851
NO_DOC=bugfix