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 D76826EC5D; Fri, 2 Apr 2021 12:24:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D76826EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617355487; bh=6JHfYm5O/o2pCTjmBhimnGoKvlpnr46IyOjQIYix+jc=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=KujsopHBUgz3q5qwfKSanYhLzQpcgoP8qDaSIv8RdpcHCq3EoEquONjzGJlBfBx6R 3kFWPQS8zWztJ+VQnX+zNnCve5pk6fq+G0tLJR+ypLAWLGWGJz7yuCBxIWYyZ5mE0I yxZzJreO7rq4Chrbfqfp5KPVn06qJqioHI5yTtIg= Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (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 5F04B6EC5D for ; Fri, 2 Apr 2021 12:24:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5F04B6EC5D Received: by smtp53.i.mail.ru with esmtpa (envelope-from ) id 1lSG2k-0001Cr-Qz; Fri, 02 Apr 2021 12:24:43 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, korablev@tarantool.org References: <39bfed3293d262592e646eb4ca6c60f5022eac26.1617315744.git.v.shpilevoy@tarantool.org> Message-ID: <54dcea70-8e4f-a91f-d3c5-2ade5e922ff1@tarantool.org> Date: Fri, 2 Apr 2021 12:24:42 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <39bfed3293d262592e646eb4ca6c60f5022eac26.1617315744.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4F844F00D7AFD5C3C182A05F538085040A58AC07AF885CDCFA82C06F27513446BE178A621D60B80EF16BDCFC16B6BDF67 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B7733D0215A2F71AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F10F1F3256FD32E28638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C7B5A45DDF210A4CF93A1225FD491FAF749BA47A136C3DABFA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7A6779F98BF527B7A9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C38D8BB953E4894305117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF13DA1F31D6884882BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B638BCB7A7EE7F5AC876E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CDDB9BF3B882869D543847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A57C25BF7E927666C537760119D3655DB982C848AACDE38417D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3467D08F30473A58427863AD87D72CD7C503F0313AA22F6D852032C29DF1A75DD609F7909A5C7C15FA1D7E09C32AA3244C7BBEF5FAB863373A7EE410F90FFBA4C98580396430872480927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojiysexgWf337bJAjz4UXqRQ== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8C425B25CB1940830840F1153FDDE2F41CA0C14F2B61A014F424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/3] vinyl: handle multi-statement recovery txns 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 02.04.2021 01:23, Vladislav Shpilevoy пишет: > During recovery and xlog replay vinyl skips the statements already > stored in runs. Indeed, their re-insertion into the mems would > lead to their second dump otherwise. > > But that results into an issue that the recovery transactions in > vinyl don't have a write set - their tx->log is empty. On the > other hand they still are added to the write set (xm->writers). > Probably so as not to have too many checks "skip if in recovery" > all over the code. > > It works fine with single-statement transactions, but would break > on multi-statement transactions. Because the decision whether > need to add to the write set was done based on the tx's log > emptiness. It is always empty, and so the transaction could be > added to the write set twice and corrupt its list-link member. > > The patch makes the decision about being added to the write set > based on emptiness of the list-link member instead of the log so > it works fine both during recovery and normal operation. > > Needed for #5874 Hi! Thanks for the patch! Looks fine at first glance. > --- > src/box/vy_tx.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c > index ff63cd7a1..cd210beb0 100644 > --- a/src/box/vy_tx.c > +++ b/src/box/vy_tx.c > @@ -899,8 +899,15 @@ vy_tx_begin_statement(struct vy_tx *tx, struct space *space, void **savepoint) > } > assert(tx->state == VINYL_TX_READY); > tx->last_stmt_space = space; > - if (stailq_empty(&tx->log)) > + /* > + * When want to add to the writer list, can't rely on the log emptiness. > + * During recovery it is empty always for the data stored both in runs > + * and xlogs. Must check the list member explicitly. > + */ > + if (rlist_empty(&tx->in_writers)) { > + assert(stailq_empty(&tx->log)); > rlist_add_entry(&tx->xm->writers, tx, in_writers); > + } > *savepoint = stailq_last(&tx->log); > return 0; > } -- Serge Petrenko