diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc index 0a9051d8412afabffb6a31f3a15b715f31dc25b1..192595c68f7ddfd1b9e8171991f24c4be7ad3ebf 100644 --- a/src/box/memtx_engine.cc +++ b/src/box/memtx_engine.cc @@ -1132,6 +1132,8 @@ static void memtx_engine_abort_checkpoint(struct engine *engine) { struct memtx_engine *memtx = (struct memtx_engine *)engine; + if (memtx->checkpoint == NULL) + return; /** * An error in the other engine's first phase. diff --git a/test/box-luatest/gh_10265_memtx_checkpoint_fail_assertion_test.lua b/test/box-luatest/gh_10265_memtx_checkpoint_fail_assertion_test.lua new file mode 100644 index 0000000000000000000000000000000000000000..60cc7f9a903ec465e3aee88cd47926a2ad68510d --- /dev/null +++ b/test/box-luatest/gh_10265_memtx_checkpoint_fail_assertion_test.lua @@ -0,0 +1,28 @@ +local t = require('luatest') +local server = require('luatest.server') + +local g = t.group() + +g.before_all(function(cg) + t.tarantool.skip_if_not_debug() + cg.server = server:new() + cg.server:start() +end) + +g.after_all(function(cg) + cg.server:drop() +end) + +g.test_memtx_checkpoint_fail_assertion = function(cg) + cg.server:exec(function() + local s = box.schema.space.create('test') + s:create_index('pk') + s:replace{0, 0} + -- Set error injection to iterator creation to fail + -- memtx checkpoint right from the start. + box.error.injection.set('ERRINJ_INDEX_ITERATOR_NEW', true) + local ok = pcall(box.snapshot) + box.error.injection.set('ERRINJ_INDEX_ITERATOR_NEW', false) + t.assert_equals(ok, false, "Snapshot must fail") + end) +end