[PATCH 2/4] alter: pass lsn of index drop record to engine

Vladimir Davydov vdavydov.dev at gmail.com
Wed May 23 19:10:05 MSK 2018


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




More information about the Tarantool-patches mailing list