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

Nikita Pettik korablev at tarantool.org
Tue May 12 04:16:22 MSK 2020


On 10 May 21:59, Vladislav Shpilevoy wrote:
> Hi! Thanks for the fixes!
> 
> See 1 comment below.
> 
> > +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.
>

Indeed. Here's diff:

diff --git a/test/vinyl/gh-4805-open-run-err-recovery.test.lua b/test/vinyl/gh-4805-open-run-err-recovery.test.lua
index 8b5895d41..0b97f09da 100644
--- a/test/vinyl/gh-4805-open-run-err-recovery.test.lua
+++ b/test/vinyl/gh-4805-open-run-err-recovery.test.lua
@@ -27,12 +27,8 @@ test_run:cmd('switch default')
 test_run:cmd('stop server err_recovery')
 test_run:cmd('start server err_recovery with crash_expected=True')
 
-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
-line = fh:read(256)
-fh:close()
-string.match(line, 'failed to open') ~= nil
+opts = {}
+opts.filename = 'errinj_recovery.log'
+test_run:grep_log('err_recovery', 'failed to open', 1000, opts) ~= nil
 
 test_run:cmd('delete server err_recovery')
 


More information about the Tarantool-patches mailing list