tarantool / tarantool/tarantool
`box.snapshot()` fails with `ER_NO_SUCH_SPACE`
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
Bug description
If a space with enabled deferred DELETEs is dropped while compaction is in progress, box.snapshot() can fail with ER_NO_SUCH_SPACE error.
Tarantool version:
Tarantool 3.4.0-entrypoint-127-g7089b0c7d7bc
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 with a debug build (it uses error injections):
local fiber = require('fiber')
os.execute('rm -rf [0-9]*')
box.cfg{log_level = 'warn'}
local s = box.schema.space.create('test', {
engine = 'vinyl',
defer_deletes = true,
})
s:create_index('primary')
s:create_index('secondary', {
unique = false,
parts = {2, 'unsigned'},
})
box.error.injection.set('ERRINJ_VY_COMPACTION_DELAY', true)
s:replace{1, 10}
box.snapshot()
s:replace{1, 20}
box.snapshot()
s:replace{1, 30}
s.index.primary:compact()
box.error.injection.set('ERRINJ_WAL_DELAY', true)
fiber.create(s.drop, s)
box.error.injection.set('ERRINJ_VY_COMPACTION_DELAY', false)
box.error.injection.set('ERRINJ_VY_DUMP_DELAY', true)
fiber.new(function()
fiber.sleep(0.1)
box.error.injection.set('ERRINJ_VY_DUMP_DELAY', false)
box.error.injection.set('ERRINJ_WAL_DELAY', false)
end)
box.snapshot()
os.exit(0)
Actual behavior
The script fails with the following log:
2025-02-17 18:55:53.179 [1375006] main/109/vinyl.scheduler space_cache.h:157 E> ER_NO_SUCH_SPACE: Space '512' does not exist
2025-02-17 18:55:53.179 [1375006] main/109/vinyl.scheduler vy_scheduler.c:1689 E> 512/0: failed to compact range (-inf..inf)
2025-02-17 18:55:53.179 [1375006] main/109/vinyl.scheduler vy_scheduler.c:2175 W> throttling scheduler for 1 second(s)
2025-02-17 18:55:53.183 [1375006] main/104/test.lua vy_scheduler.c:783 E> vinyl checkpoint failed: Space '512' does not exist
2025-02-17 18:55:53.184 [1375006] main test.lua:36 E> ER_NO_SUCH_SPACE: Space '512' does not exist
2025-02-17 18:55:53.184 [1375006] main say.c:85 F> fatal error, exiting the event loop
Expected behavior
The script completes successfully.
Notes
The bug is responsible for vinyl/deferred_delete test failures:
[047] vinyl/deferred_delete.test.lua [ fail ]
[047]
[047] Test failed! Result content mismatch:
[047] --- vinyl/deferred_delete.result Tue Dec 24 12:15:13 2024
[047] +++ /tmp/t/rejects/vinyl/deferred_delete.reject Tue Dec 24 12:16:35 2024
[047] @@ -793,15 +793,15 @@
[047] ...
[047] box.snapshot()
[047] ---
[047] -- ok
[047] +- error: Space '512' does not exist
[047] ...
[047] pk:stat().rows -- 1: INSERT{2,2,3}
[047] ---
[047] -- 1
[047] +- 4
[047] ...
[047] sk:stat().rows -- 1: INSERT{2,2}
[047] ---
[047] -- 1
[047] +- 3
[047] ...
[047] pk:select()
[047] ---
The issue doesn't permanently block creation of checkpoints so it isn't critical.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the vinyl/deferred_delete.test.lua failures and reproduce the supplied Lua script using a debug build with error injections. Follow the interaction between box.snapshot(), s.drop, and vinyl compaction; done means the script and deferred_delete test complete without ER_NO_SUCH_SPACE or changed result output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100