[Tarantool-patches] [PATCH 2/2] vinyl: drop wasted runs in case range recovery fails

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun May 10 22:59:01 MSK 2020


Hi! Thanks for the fixes!

See 1 comment below.

> diff --git a/test/vinyl/gh-4805-open-run-err-recovery.result b/test/vinyl/gh-4805-open-run-err-recovery.result
> new file mode 100644
> index 000000000..31e0e7857
> --- /dev/null
> +++ b/test/vinyl/gh-4805-open-run-err-recovery.result
> @@ -0,0 +1,101 @@
> +-- test-run result file version 2
> +fiber = require('fiber')
> + | ---
> + | ...
> +test_run = require('test_run').new()
> + | ---
> + | ...
> +
> +test_run:cmd('create server err_recovery with script = "vinyl/errinj_recovery.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server err_recovery')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('switch err_recovery')
> + | ---
> + | - true
> + | ...
> +
> +s = box.schema.space.create('test', {engine = 'vinyl'})
> + | ---
> + | ...
> +_ = s:create_index('pk', {run_count_per_level = 100, page_size = 128, range_size = 1024})
> + | ---
> + | ...
> +
> +digest = require('digest')
> + | ---
> + | ...
> +test_run:cmd("setopt delimiter ';'")
> + | ---
> + | - true
> + | ...
> +function dump(big)
> +    local step = big and 1 or 5
> +    for i = 1, 20, step do
> +        s:replace{i, digest.urandom(1000)}
> +    end
> +    box.snapshot()
> +end;
> + | ---
> + | ...
> +test_run:cmd("setopt delimiter ''");
> + | ---
> + | - true
> + | ...
> +
> +dump(true)
> + | ---
> + | ...
> +dump()
> + | ---
> + | ...
> +dump()
> + | ---
> + | ...
> +
> +test_run:cmd('switch default')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('stop server err_recovery')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server err_recovery with crash_expected=True')
> + | ---
> + | - false
> + | ...
> +
> +fio = require('fio')
> + | ---
> + | ...
> +fh = fio.open(fio.pathjoin(fio.cwd(), 'errinj_recovery.log'), {'O_RDONLY'})
> + | ---
> + | ...
> +size = fh:seek(0, 'SEEK_END')
> + | ---
> + | ...
> +fh:seek(-256, 'SEEK_END') ~= nil
> + | ---
> + | - true
> + | ...
> +line = fh:read(256)
> + | ---
> + | ...
> +fh:close()
> + | ---
> + | - true
> + | ...
> +string.match(line, 'failed to open') ~= nil

Why can't you use test_run:grep_log()? It supports
searching in logs of an already crashed instance too.
See its parameters in test_run.lua. Looks like it can
solve your task.



More information about the Tarantool-patches mailing list