Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 2/4] alter: pass lsn of index drop record to engine
Date: Wed, 23 May 2018 19:10:05 +0300	[thread overview]
Message-ID: <22e380ef5508c29eff472f641ebba08e6bb80b9d.1527090319.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1527090319.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1527090319.git.vdavydov.dev@gmail.com>

We pass lsn of index alter/create records, let's pass lsn of drop record
for consistency. This is also needed by vinyl to store it in vylog (see
the next patch).
---
 src/box/alter.cc |  8 ++++----
 src/box/index.cc |  2 +-
 src/box/index.h  | 11 +++++++----
 src/box/vinyl.c  |  3 ++-
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/box/alter.cc b/src/box/alter.cc
index f0315ff7..6f6fcb09 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -1037,12 +1037,12 @@ DropIndex::prepare(struct alter_space *alter)
 }
 
 void
-DropIndex::commit(struct alter_space *alter, int64_t /* signature */)
+DropIndex::commit(struct alter_space *alter, int64_t signature)
 {
 	struct index *index = space_index(alter->old_space,
 					  old_index_def->iid);
 	assert(index != NULL);
-	index_commit_drop(index);
+	index_commit_drop(index, signature);
 }
 
 /**
@@ -1298,7 +1298,7 @@ RebuildIndex::commit(struct alter_space *alter, int64_t signature)
 	struct index *old_index = space_index(alter->old_space,
 					      old_index_def->iid);
 	assert(old_index != NULL);
-	index_commit_drop(old_index);
+	index_commit_drop(old_index, signature);
 	assert(new_index != NULL);
 	index_commit_create(new_index, signature);
 	new_index = NULL;
@@ -1355,7 +1355,7 @@ TruncateIndex::commit(struct alter_space *alter, int64_t signature)
 	struct index *old_index = space_index(alter->old_space, iid);
 	struct index *new_index = space_index(alter->new_space, iid);
 
-	index_commit_drop(old_index);
+	index_commit_drop(old_index, signature);
 	index_commit_create(new_index, signature);
 }
 
diff --git a/src/box/index.cc b/src/box/index.cc
index 978935b3..f2274d23 100644
--- a/src/box/index.cc
+++ b/src/box/index.cc
@@ -562,7 +562,7 @@ generic_index_commit_modify(struct index *, int64_t)
 }
 
 void
-generic_index_commit_drop(struct index *)
+generic_index_commit_drop(struct index *, int64_t)
 {
 }
 
diff --git a/src/box/index.h b/src/box/index.h
index c7384b61..3bc41239 100644
--- a/src/box/index.h
+++ b/src/box/index.h
@@ -377,8 +377,11 @@ struct index_vtab {
 	/**
 	 * Called after WAL write to commit index drop.
 	 * Must not fail.
+	 *
+	 * @signature is the LSN that was assigned to the row
+	 * that dropped the index.
 	 */
-	void (*commit_drop)(struct index *);
+	void (*commit_drop)(struct index *index, int64_t signature);
 	/**
 	 * Called after index definition update that did not
 	 * require index rebuild.
@@ -522,9 +525,9 @@ index_commit_modify(struct index *index, int64_t signature)
 }
 
 static inline void
-index_commit_drop(struct index *index)
+index_commit_drop(struct index *index, int64_t signature)
 {
-	index->vtab->commit_drop(index);
+	index->vtab->commit_drop(index, signature);
 }
 
 static inline void
@@ -661,7 +664,7 @@ index_end_build(struct index *index)
 void generic_index_commit_create(struct index *, int64_t);
 void generic_index_abort_create(struct index *);
 void generic_index_commit_modify(struct index *, int64_t);
-void generic_index_commit_drop(struct index *);
+void generic_index_commit_drop(struct index *, int64_t);
 void generic_index_update_def(struct index *);
 bool generic_index_depends_on_pk(struct index *);
 ssize_t generic_index_size(struct index *);
diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index 2e2c145a..a423e95b 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -929,8 +929,9 @@ vy_log_lsm_prune(struct vy_lsm *lsm, int64_t gc_lsn)
 }
 
 static void
-vinyl_index_commit_drop(struct index *index)
+vinyl_index_commit_drop(struct index *index, int64_t lsn)
 {
+	(void)lsn;
 	struct vy_env *env = vy_env(index->engine);
 	struct vy_lsm *lsm = vy_lsm(index);
 
-- 
2.11.0

  parent reply	other threads:[~2018-05-23 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 16:10 [PATCH 0/4] vinyl: fix index drop vs compaction race Vladimir Davydov
2018-05-23 16:10 ` [PATCH 1/4] vinyl: do not reuse lsm objects during recovery from vylog Vladimir Davydov
2018-05-23 16:10 ` Vladimir Davydov [this message]
2018-05-23 16:10 ` [PATCH 3/4] vinyl: store lsn of index drop record in vylog Vladimir Davydov
2018-05-23 16:10 ` [PATCH 4/4] vinyl: purge dropped indexes from vylog on garbage collection 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=22e380ef5508c29eff472f641ebba08e6bb80b9d.1527090319.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 2/4] alter: pass lsn of index drop record to engine' \
    /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