Skip to content

Invalid memory row count for multikey index with deferred deletes #10751

@locker

Description

@locker

Bug description

Under certain conditions, index:stat().memory reports 0 bytes but non-0 row count for a multikey secondary index with enabled deferred deletes.

Tarantool 3.3.0-entrypoint-172-g3831f9d1a75d
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:

#!/usr/bin/env tarantool

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

local yaml = require('yaml')

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

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

s:replace({1, {1, 1}})
s:delete(1)
s:replace({1, {1, 1}})
box.snapshot()

print(yaml.encode(s.index.sk:stat().memory))

os.exit(0)

Actual behavior

Output:

---
bytes: 0
index_size: 0
rows: 1
iterator:
  lookup: 0
  get:
    rows: 0
    bytes: 0
...

Note: 0 bytes but 1 row. This shouldn't be possible.

Expected behavior

0 bytes and 0 rows.

Notes

This bug is responsible for flakiness of vinyl-luatest/select_consistency_test.lua because index:len() returns the sum of memory and disk row counts.

not ok 2	vinyl.select_consistency.defer_deletes:true.test_select_consistency
#   ...tarantool/test/vinyl-luatest/select_consistency_test.lua:237: expected: 132077, actual: 132088
#   stack traceback:
#   	...tarantool/test/vinyl-luatest/select_consistency_test.lua:217: in function 'vinyl.select_consistency.defer_deletes:true.test_select_consistency'

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