Skip to content

mvcc: failing index count limit assertion #11929

@Astronomax

Description

@Astronomax

Steps to reproduce

Run the following init.lua script:

fiber = require('fiber')

local params = require('internal.argparse').parse(arg, {
    { 'memtx_use_mvcc_engine', 'boolean' },
    { 'index_count', 'number' },
})

local memtx_use_mvcc_engine = params.memtx_use_mvcc_engine
local index_count = params.index_count

local function space_format(num_fields)
    local space_format = {}
    for i = 1, num_fields do
        table.insert(space_format, {
            name = ('field_%d'):format(i),
            type = 'unsigned',
        })
    end
    return space_format
end

local function index_opts(format, field_id)
    return {parts={{format[field_id].name}}, unique=true}
end

box.cfg{memtx_use_mvcc_engine=memtx_use_mvcc_engine}

box.schema.space.create("test")

local format = space_format(index_count)
box.space.test:format(format)

for i = 1, index_count do
    box.space.test:create_index(
        ('idx_%d'):format(i),
        index_opts(format, i)
    )
end

local tuple = {}
for _ = 1, index_count do table.insert(tuple, 1) end

box.space.test:replace(tuple)

box.space.test:drop()
os.exit()

With the following arguments:

$ tarantool init.lua --index_count 128 #OK

$ tarantool init.lua --index_count 129
...
2025-10-14 19:41:35.450 [31141] main init.lua:34 E> Can't create or modify index 'idx_129' in space 'test': index id too big {"type":"ClientError","code":14,"name":"MODIFY_INDEX","index":"idx_129","space":"test","details":"index id too big","trace":[{"file":"init.lua","line":34}]}
2025-10-14 19:41:35.450 [31141] main say.c:85 F> fatal error, exiting the event loop

$ tarantool init.lua --index_count 128 --memtx_use_mvcc_engine
tarantool: ./src/box/memtx_tx.c:1129: memtx_tx_story_new: Assertion `index_count < BOX_INDEX_MAX' failed.
Aborted (core dumped)
$ tarantool init.lua --index_count 129 --memtx_use_mvcc_engine
...
2025-10-14 19:41:35.450 [31141] main init.lua:34 E> Can't create or modify index 'idx_129' in space 'test': index id too big {"type":"ClientError","code":14,"name":"MODIFY_INDEX","index":"idx_129","space":"test","details":"index id too big","trace":[{"file":"init.lua","line":34}]}
2025-10-14 19:41:35.450 [31141] main say.c:85 F> fatal error, exiting the event loop

Actual behavior

Assert fails.

Expected behavior

Assert doesn't fails.

Metadata

Metadata

Assignees

Labels

3.2Target is 3.2 and all newer release/master branchesbugSomething isn't workingcrashmvcc

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions