From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 4693B6EC5B; Wed, 12 May 2021 23:36:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4693B6EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620851781; bh=pRWRPkV5t2uKyyCpCSJueFoLUNhboyaHsuKgS1ew4Eg=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=P2pl4I0TlLVPL0lR6JYZgCCI2EDrIx0mgcNgEej8pJUknK13lyLgV7k44mHfMusAT 5c5O6g6iN3kQFu7FwJLGZxZswkLatjInndpYWJl1PL1DLq/fEj6VpMDIUbEk3XIUCw qK/4WRLBE83Ks93HBUsDNGRF6FOVja/YK00FDurY= Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [94.100.177.107]) (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 AFB566EC5B for ; Wed, 12 May 2021 23:36:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AFB566EC5B Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1lgvac-0001iB-32; Wed, 12 May 2021 23:36:18 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <20210512112928.12509-1-sergepetrenko@tarantool.org> Message-ID: Date: Wed, 12 May 2021 22:36:17 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210512112928.12509-1-sergepetrenko@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0890FB394E039F71AA2C815CBBA0C08E7182A05F5380850409CDEAF8AABEF3D87E310DB6EE6B51E85BB2B733379A010B16F94E292E00D1531 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A25B432396ED6D32EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BB2557E27C12D3EF8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B12C7F7BB466B14EA842FF613E099AD0117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC55D5BE2F85BDEC5FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209647ADFADE5905B1CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE1E561CDFBCA1751FB2D370F7B14D4BC4D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE317119E5299B287EE2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637AD0424077D726551EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD7C74C850041D70F4B2472938CB67E1B6 X-C1DE0DAB: 0D63561A33F958A53CD5E185A846C71C6D6C4626FED76765D80F16079651AE17D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A150564C13026C1833E7D3655854A266DCB5239E9FCB128F77465F15E60E4B770EB1DF988C8384C01D7E09C32AA3244CA9C2D394620715BA21EBCF778648E41897FE24653F78E668FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojo6y/qPNd2uyJ29lGtj5l5A== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110289681A904DD4CDDB6127D9063FE177EA98AFB19BEADDED907784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2] recovery: make it yield when positioning in a WAL X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! See 4 comments below. On 12.05.2021 13:29, Serge Petrenko wrote: > We had various places in box.cc and relay.cc which counted processed > rows and yielded every now and then. These yields didn't cover cases, > when recovery has to position inside a long WAL file: > > For example, when tarantool exits without leaving an empty WAL file > which'll be used to recover instance vclock on restart. In this case > the instance freezes while processing the last availabe WAL in order 1. availabe -> available. > diff --git a/changelogs/unreleased/gh-5979-recovery-ligs.md b/changelogs/unreleased/gh-5979-recovery-ligs.md > new file mode 100644 > index 000000000..86abfd66a > --- /dev/null > +++ b/changelogs/unreleased/gh-5979-recovery-ligs.md > @@ -0,0 +1,11 @@ > +# bugfix/core > + > +* Now tarantool yields when scanning `.xlog` files for the latest applied vclock > + and when finding the right place in `.xlog`s to start recovering. This means > + that the instance is responsive right after `box.cfg` call even when an empty > + `.xlog` was not created on previous exit. > + Also this prevents relay from timing out when a freshly subscribed replica > + needs rows from the end of a relatively long (hundreds of MBs) `.xlog` > + (gh-5979). 2. Maybe an empty line here? Could simplify reading a bit. > +* The counter in `x.yM rows processed` log messages does not reset on each new > + recovered `xlog` anymore. > diff --git a/src/box/box.cc b/src/box/box.cc > index 59925962d..8a7b8593d 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -610,15 +597,28 @@ end_error: > diag_raise(); > } > > +static struct wal_stream wal_stream; > + > +/** > + * Plan a yield in recovery stream. Wal stream will execute it as soon as it's > + * ready. > + */ > +static void > +wal_stream_schedule_yield(void) 3. Since now you have an object owning the callback, you could pass it as a first argument, like 'this' in C++, and like apply_row() does. Then you wouldn't need the global wal_stream. > +{ > + wal_stream.has_yield = true; > + wal_stream_try_yield(&wal_stream); > +} > diff --git a/src/box/xstream.h b/src/box/xstream.h > index d29ff4213..d27de09a3 100644 > --- a/src/box/xstream.h > +++ b/src/box/xstream.h > @@ -41,16 +41,40 @@ extern "C" { > struct xrow_header; > struct xstream; > > +/** > + * A type for a callback invoked by recovery after some batch of rows is > + * processed. Is used mostly to unblock the event loop every now and then. > + */ > +typedef void (*schedule_yield_f)(void); 4. How about moving closer to the consistency and calling it xstream_yield_f/xstream_schedule_yield_f? So it has xstream_ prefix like xstream_write_f does.