[PATCH 3/5] vinyl: use disk_format in vy_run_rebuild_index
Vladimir Davydov
vdavydov.dev at gmail.com
Tue Apr 3 20:37:41 MSK 2018
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
More information about the Tarantool-patches
mailing list