From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 2/5] memtx: don't call begin_buid and end_build for new pk after recovery
Date: Tue, 3 Apr 2018 20:37:40 +0300 [thread overview]
Message-ID: <1298fbd1d051b9d36e55e641f2b9786f1f7dcf81.1522775293.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1522775293.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1522775293.git.vdavydov.dev@gmail.com>
Basically, index_begin_build() followed by index_end_build() is a no-op.
There's absolutely no point in calling it for primary indexes after
initial recovery has completed.
---
src/box/memtx_space.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c
index e0fa3e2c..ec6f6db6 100644
--- a/src/box/memtx_space.c
+++ b/src/box/memtx_space.c
@@ -680,12 +680,12 @@ memtx_space_create_index(struct space *space, struct index_def *index_def)
* then the primary key is not built, otherwise it's created
* right away.
*/
-static void
-memtx_space_do_add_primary_key(struct space *space,
- enum memtx_recovery_state state)
+static int
+memtx_space_add_primary_key(struct space *space)
{
struct memtx_space *memtx_space = (struct memtx_space *)space;
- switch (state) {
+ struct memtx_engine *memtx = (struct memtx_engine *)space->engine;
+ switch (memtx->state) {
case MEMTX_INITIALIZED:
panic("can't create a new space before snapshot recovery");
break;
@@ -694,23 +694,12 @@ memtx_space_do_add_primary_key(struct space *space,
memtx_space->replace = memtx_space_replace_build_next;
break;
case MEMTX_FINAL_RECOVERY:
- index_begin_build(space->index[0]);
- index_end_build(space->index[0]);
memtx_space->replace = memtx_space_replace_primary_key;
break;
case MEMTX_OK:
- index_begin_build(space->index[0]);
- index_end_build(space->index[0]);
memtx_space->replace = memtx_space_replace_all_keys;
break;
}
-}
-
-static int
-memtx_space_add_primary_key(struct space *space)
-{
- struct memtx_engine *memtx = (struct memtx_engine *)space->engine;
- memtx_space_do_add_primary_key(space, memtx->state);
return 0;
}
@@ -752,7 +741,8 @@ memtx_space_drop_primary_key(struct space *space)
static void
memtx_init_system_space(struct space *space)
{
- memtx_space_do_add_primary_key(space, MEMTX_OK);
+ struct memtx_space *memtx_space = (struct memtx_space *)space;
+ memtx_space->replace = memtx_space_replace_all_keys;
}
static int
--
2.11.0
next prev parent reply other threads:[~2018-04-03 17:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 17:37 [PATCH 0/5] alter: fix WAL error handling Vladimir Davydov
2018-04-03 17:37 ` [PATCH 1/5] memtx: rtree: remove pointless index_vtab::begin_build implementation Vladimir Davydov
2018-04-05 20:25 ` Konstantin Osipov
2018-04-03 17:37 ` Vladimir Davydov [this message]
2018-04-03 17:37 ` [PATCH 3/5] vinyl: use disk_format in vy_run_rebuild_index Vladimir Davydov
2018-04-05 20:25 ` Konstantin Osipov
2018-04-03 17:37 ` [PATCH 4/5] vinyl: do not use space_vtab::commit_alter for preparing new indexes Vladimir Davydov
2018-04-03 17:37 ` [PATCH 5/5] alter: call space_vtab::commit_alter after WAL write Vladimir Davydov
2018-04-05 20:37 ` Konstantin Osipov
2018-04-06 10:59 ` Vladimir Davydov
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=1298fbd1d051b9d36e55e641f2b9786f1f7dcf81.1522775293.git.vdavydov.dev@gmail.com \
--to=vdavydov.dev@gmail.com \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH 2/5] memtx: don'\''t call begin_buid and end_build for new pk after recovery' \
/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