Skip to content

Vinyl loses secondary key after updating duplicate multikey index field #10870

@locker

Description

@locker

Bug description

Updating a multikey index field with duplicates that was inserted in the same transaction results in losing it from the secondary index.

Tarantool version:

Tarantool 3.3.0-entrypoint-269-g6a214e42e707
Target: Linux-x86_64-Debug
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/home/vlad/src/tarantool/tarantool/build/debug/install -DENABLE_BACKTRACE=TRUE
Compiler: GNU-13.2.0
C_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/vlad/src/tarantool/tarantool=. -std=c11 -Wall -Wextra -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type -Werror -g -ggdb -O0
CXX_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/vlad/src/tarantool/tarantool=. -std=c++11 -Wall -Wextra -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror -g -ggdb -O0

Steps to reproduce

Run the following script:

os.execute('rm -rf [0-9]*')

local json = require('json')

box.cfg{
    log_level = 'warn',
    vinyl_defer_deletes = false,
}

local s = box.schema.space.create('test', {engine = 'vinyl'})
s:create_index('primary')
s:create_index('secondary', {
    unique = false,
    parts = {{'[2][*]', 'unsigned'}},
})

box.begin()
s:replace({1, {1, 1}})
s:update({1}, {{'=', 2, {1}}})
box.commit()

print('primary:',
      json.encode(s.index.primary:select({}, {fullscan = true})))
print('secondary:',
      json.encode(s.index.secondary:select({}, {fullscan = true})))

os.exit(0)

Actual behavior

primary:        [[1,[1]]]
secondary:      []

Expected behavior

primary:        [[1,[1]]]
secondary:      [[1,[1]]]

Notes

The bug can be reproduced both with and without enabled defer_deletes space option.

Related issue: #10869

Metadata

Metadata

Assignees

Labels

2.11Target is 2.11 and all newer release/master branches3.2Target is 3.2 and all newer release/master branchesbugSomething isn't workingvinyl

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions