Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: "v.shpilevoy@tarantool.org" <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Konstantin Osipov <kostja@tarantool.org>
Subject: Re: [tarantool-patches] [PATCH 05/12] vinyl: do not reallocate tuple formats on alter
Date: Sun, 1 Apr 2018 14:24:18 +0300	[thread overview]
Message-ID: <20180401112418.gcfo7soj2flmv4mg@esperanza> (raw)
In-Reply-To: <998CF4CA-7826-4848-B895-C82D8C8DDB22@tarantool.org>

On Sun, Apr 01, 2018 at 02:12:26PM +0300, v.shpilevoy@tarantool.org wrote:
> > diff --git a/src/box/vinyl.c b/src/box/vinyl.c
> > index fc37283a..f3cef52f 100644
> > --- a/src/box/vinyl.c
> > +++ b/src/box/vinyl.c
> > +static void
> > +vinyl_space_swap_index(struct space *old_space, struct space *new_space,
> > +		       uint32_t old_index_id, uint32_t new_index_id)
> > +{
> > +	struct vy_lsm *old_lsm = vy_lsm(old_space->index_map[old_index_id]);
> > +	struct vy_lsm *new_lsm = vy_lsm(new_space->index_map[new_index_id]);
> > +
> > +	/*
> > +	 * Swap the two indexes between the two spaces,
> > +	 * but leave tuple formats.
> > +	 */
> > +	generic_space_swap_index(old_space, new_space,
> > +				 old_index_id, new_index_id);
> > +
> > +	SWAP(old_lsm->mem_format, new_lsm->mem_format);
> 
> How do you swap the formats, if they are variable length structures?
> 1) Their fields[] arrays are not swapped here, 2) even if you will try
> to swap - they can have different length.

I swap pointers, not objects:

struct vy_lsm {
  	...
	struct tuple_format *disk_format;
	struct tuple_format *mem_format;
	struct tuple_format *mem_format_with_colmask;
};

> 
> > +	SWAP(old_lsm->mem_format_with_colmask,
> > +	     new_lsm->mem_format_with_colmask);
> > +	SWAP(old_lsm->disk_format, new_lsm->disk_format);
> > +	SWAP(old_lsm->opts, new_lsm->opts);
> > }

  reply	other threads:[~2018-04-01 11:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  9:05 [PATCH 00/12] vinyl: allow to extend key def of non-empty index Vladimir Davydov
2018-04-01  9:05 ` [PATCH 01/12] index: add commit_modify virtual method Vladimir Davydov
2018-04-01  9:05 ` [PATCH 02/12] alter: require rebuild of all secondary vinyl indexes if pk changes Vladimir Davydov
2018-04-01  9:05 ` [PATCH 03/12] alter: do not rebuild secondary indexes on compatible " Vladimir Davydov
2018-04-05 12:30   ` Konstantin Osipov
2018-04-01  9:05 ` [PATCH 04/12] space: make space_swap_index method virtual Vladimir Davydov
2018-04-01  9:05 ` [PATCH 05/12] vinyl: do not reallocate tuple formats on alter Vladimir Davydov
2018-04-01 11:12   ` [tarantool-patches] " v.shpilevoy
2018-04-01 11:24     ` Vladimir Davydov [this message]
2018-04-01  9:05 ` [PATCH 06/12] vinyl: zap vy_lsm_validate_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 07/12] vinyl: zap vy_mem_update_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 08/12] vinyl: remove pointless is_nullable initialization for disk_format Vladimir Davydov
2018-04-01  9:05 ` [PATCH 09/12] vinyl: use source tuple format when copying field map Vladimir Davydov
2018-04-01  9:05 ` [PATCH 10/12] vinyl: rename vy_log_record::commit_lsn to create_lsn Vladimir Davydov
2018-04-01  9:05 ` [PATCH 11/12] vinyl: do not write VY_LOG_DUMP_LSM record to snapshot Vladimir Davydov
2018-04-01  9:05 ` [PATCH 12/12] vinyl: allow to modify key definition if it does not require rebuild Vladimir Davydov
2018-04-02  8:46   ` Vladimir Davydov
2018-04-05 14:32     ` Konstantin Osipov
2018-04-05 14:45     ` Konstantin Osipov
2018-04-05 14:48       ` Konstantin Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180401112418.gcfo7soj2flmv4mg@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH 05/12] vinyl: do not reallocate tuple formats on alter' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox