[tarantool-patches] Re: [PATCH 1/2] xlog: simplify xdir_add_vclock protocol

Kirill Yukhin kyukhin at tarantool.org
Wed Aug 22 11:03:40 MSK 2018


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




More information about the Tarantool-patches mailing list