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 3/5] vinyl: use disk_format in vy_run_rebuild_index
Date: Tue,  3 Apr 2018 20:37:41 +0300	[thread overview]
Message-ID: <5ef3059f4bce472bae242021e4f0e30c679d7d06.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>

We read tuples from disk hence we should use disk_format, not
mem_format. Fix it. While we are at it, let's also update the
outdated comment to vy_run_rebuild_index.
---
 src/box/vy_lsm.c |  2 +-
 src/box/vy_run.c |  4 ++--
 src/box/vy_run.h | 14 ++++++++------
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c
index a8ed39ad..73196b10 100644
--- a/src/box/vy_lsm.c
+++ b/src/box/vy_lsm.c
@@ -353,7 +353,7 @@ vy_lsm_recover_run(struct vy_lsm *lsm, struct vy_run_recovery_info *run_info,
 	     vy_run_rebuild_index(run, lsm->env->path,
 				  lsm->space_id, lsm->index_id,
 				  lsm->cmp_def, lsm->key_def,
-				  lsm->mem_format, &lsm->opts) != 0)) {
+				  lsm->disk_format, &lsm->opts) != 0)) {
 		vy_run_unref(run);
 		return NULL;
 	}
diff --git a/src/box/vy_run.c b/src/box/vy_run.c
index 637f63fa..c12fb9c5 100644
--- a/src/box/vy_run.c
+++ b/src/box/vy_run.c
@@ -2201,7 +2201,7 @@ vy_run_rebuild_index(struct vy_run *run, const char *dir,
 		     uint32_t space_id, uint32_t iid,
 		     const struct key_def *cmp_def,
 		     const struct key_def *key_def,
-		     struct tuple_format *mem_format,
+		     struct tuple_format *format,
 		     const struct index_opts *opts)
 {
 	assert(run->info.bloom == NULL);
@@ -2255,7 +2255,7 @@ vy_run_rebuild_index(struct vy_run *run, const char *dir,
 			}
 			++page_row_count;
 			struct tuple *tuple = vy_stmt_decode(&xrow, cmp_def,
-							mem_format, iid == 0);
+							     format, iid == 0);
 			if (tuple == NULL)
 				goto close_err;
 			if (bloom_builder != NULL) {
diff --git a/src/box/vy_run.h b/src/box/vy_run.h
index 1e8bf740..d31dd645 100644
--- a/src/box/vy_run.h
+++ b/src/box/vy_run.h
@@ -350,21 +350,23 @@ vy_run_recover(struct vy_run *run, const char *dir,
 	       uint32_t space_id, uint32_t iid);
 
 /**
- * Rebuild vy_run index
- * @param run - run to laod
+ * Rebuild run index
+ * @param run - run to rebuild index for
  * @param dir - path to the vinyl directory
  * @param space_id - space id
  * @param iid - index id
- * @param key_def index key definition
- * @param bloom_fpr bloom filter param
+ * @param cmp_def - key definition with primary key parts
+ * @param key_def - user defined key definition
+ * @param format - format for allocating tuples read from disk
+ * @param opts - index options
  * @return - 0 on sucess, -1 on fail
  */
 int
 vy_run_rebuild_index(struct vy_run *run, const char *dir,
 		     uint32_t space_id, uint32_t iid,
+		     const struct key_def *cmp_def,
 		     const struct key_def *key_def,
-		     const struct key_def *user_key_def,
-		     struct tuple_format *mem_format,
+		     struct tuple_format *format,
 		     const struct index_opts *opts);
 
 enum vy_file_type {
-- 
2.11.0

  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 ` [PATCH 2/5] memtx: don't call begin_buid and end_build for new pk after recovery Vladimir Davydov
2018-04-03 17:37 ` Vladimir Davydov [this message]
2018-04-05 20:25   ` [PATCH 3/5] vinyl: use disk_format in vy_run_rebuild_index 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=5ef3059f4bce472bae242021e4f0e30c679d7d06.1522775293.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 3/5] vinyl: use disk_format in vy_run_rebuild_index' \
    /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