From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v2 2/2] alter: zap space_vtab::commit_alter
Date: Fri, 6 Apr 2018 18:25:57 +0300 [thread overview]
Message-ID: <20180406152557.564tqm54762uqysr@esperanza> (raw)
In-Reply-To: <20180406142847.GA13233@atlas>
On Fri, Apr 06, 2018 at 05:28:47PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [18/04/06 17:25]:
> > On Fri, Apr 06, 2018 at 05:10:01PM +0300, Konstantin Osipov wrote:
> > > * Vladimir Davydov <vdavydov.dev@gmail.com> [18/04/06 16:20]:
> > >
> > > > space_vtab::commit_alter is implemented only by memtx, which uses it
> > > > to set bsize for a new space. However, it isn't necessary to use
> > > > commit_alter for this - instead we can set bsize in prepare_alter and
> > > > reset it in drop_primary_key, along with memtx_space::replace. Let's
> > > > do it and zap space_vtab::commit_alter altogether, because the callback
> > > > is confusing: judging by its name it should be called after WAL write,
> > > > but it is called before.
> > > > void
> > > > DropIndex::alter(struct alter_space *alter)
> > > > {
> > > > - space_drop_primary_key(alter->new_space);
> > > > + if (old_index_def->iid == 0)
> > > > + space_drop_primary_key(alter->new_space);
> > > > }
> > >
> > > I keep wondering why you ditched a nice comment.
> > > If you think it was bad, please write a better one.
> >
> > This comment is only pertinent to memtx so I just moved it to
> > memtx_space_drop_primary_key.
>
> > > > - /*
> > > > - * If it's not the primary key, nothing to do --
> > > > - * the dropped index didn't exist in the new space
> > > > - * definition, so does not exist in the created space.
> > > > - */
>
> What about this hunk?
>
> Anyway, it's not self-explanatory. Why aren't we doing anything
> here for the secondary index and have to take an extra step for
> primary?
Because there's an engine that needs it, no? If someone needs more
details, they can look into engine implementation, memtx in this case.
Regarding the particular comment you mentioned. I removed it, because
now it contradicts the code: now we call drop_primary_key if iid == 0,
not if new_space->index[0] == NULL (I explained why in the comment to
the patch). I could "fix" the comment, but then we'd have
/*
* If it's not the primary key, nothing to do.
*/
if (old_index_def->iid == 0)
return;
space_drop_primary_key(alter->new_space);
Such a comment would be useless IMHO.
prev parent reply other threads:[~2018-04-06 15:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-06 13:15 [PATCH v2 0/2] alter: fix WAL error handling Vladimir Davydov
2018-04-06 13:15 ` [PATCH v2 1/2] memtx: do not use space_vtab::commit_alter for freeing tuples Vladimir Davydov
2018-04-06 14:08 ` Konstantin Osipov
2018-04-06 14:19 ` Vladimir Davydov
2018-04-06 15:29 ` Vladimir Davydov
2018-04-06 13:15 ` [PATCH v2 2/2] alter: zap space_vtab::commit_alter Vladimir Davydov
2018-04-06 14:10 ` Konstantin Osipov
2018-04-06 14:23 ` Vladimir Davydov
2018-04-06 14:28 ` Konstantin Osipov
2018-04-06 15:25 ` Vladimir Davydov [this message]
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=20180406152557.564tqm54762uqysr@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH v2 2/2] alter: zap space_vtab::commit_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