From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 46808469710 for ; Tue, 12 May 2020 04:16:23 +0300 (MSK) Date: Tue, 12 May 2020 01:16:22 +0000 From: Nikita Pettik Message-ID: <20200512011622.GA617@tarantool.org> References: <5012bd8eb07b5379eb70aa777402c7cd566a3b34.1588273848.git.korablev@tarantool.org> <959a3f72-6b95-30b1-c838-3b9e2bebc04c@tarantool.org> <20200507130256.GB11724@tarantool.org> <5a697151-e6fc-c567-ccf6-8d02a1df340e@tarantool.org> <20200507223625.GB13970@tarantool.org> <10f1d262-b1ae-ba9a-fdae-efc9229ccd52@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <10f1d262-b1ae-ba9a-fdae-efc9229ccd52@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 2/2] vinyl: drop wasted runs in case range recovery fails List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org 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')