From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B483C27381 for ; Wed, 22 Aug 2018 04:06:20 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WF9W_qqPXlFo for ; Wed, 22 Aug 2018 04:06:20 -0400 (EDT) Received: from smtp62.i.mail.ru (smtp62.i.mail.ru [217.69.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 013712668F for ; Wed, 22 Aug 2018 04:06:19 -0400 (EDT) Date: Wed, 22 Aug 2018 11:03:40 +0300 From: Kirill Yukhin Subject: [tarantool-patches] Re: [PATCH 1/2] xlog: simplify xdir_add_vclock protocol Message-ID: <20180822080340.hq5rqu4cutpzi6cd@tarantool.org> References: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: kostja@tarantool.org Hello, On 19 авг 23:44, Vladimir Davydov wrote: > We add the vclock of a new snapshot/xlog/vylog file to the corresponding > xdir, because we need it for garbage collection and backup. We use the > xdir_add_vclock() function for that. Currently, the function protocol is > rather abstruse: it expects that the caller allocates a vclock with > malloc() and passes the ownership on to the xdir by calling this > function. This is done that way, because we add a vclock to an xdir > after committing a new xlog file, where we can't fail anymore. Since > malloc() can theoretically fail, we allocate a vclock before writing an > xlog and add it to an xdir only after the xlog is committed. This makes > the code look rather complicated. > > Actually, as explained in #3534, malloc() doesn't normally fail so this > complexity is in fact needless and only makes it more difficult to patch > the code. Let's simplify the code by making xdir_add_vclock() allocate > vclock by itself and, since it can't fail, panic on allocation error. > --- > https://github.com/tarantool/tarantool/issues/3624 > https://github.com/tarantool/tarantool/commits/dv/gh-3624-vy-fix-vylog-backup I've checked the patchset into 1.10 branch. -- Regards, Kirill Yukhin