From: Vladimir Davydov <vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org Subject: [PATCH v2 4/5] vinyl: do not use index lsn to identify indexes in vylog Date: Tue, 20 Mar 2018 14:29:04 +0300 [thread overview] Message-ID: <3bb507af569820382ddf2cce1e776e9d13f1ec91.1521545062.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1521545062.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1521545062.git.vdavydov.dev@gmail.com> vy_log_record::index_lsn serves two purposes. First, it is used as a unique object identifier in vylog (it is similar to range_id or slice_id in this regard). Second, it is the LSN of the WAL row that committed the index, and we use it to lookup the appropriate index incarnation during WAL recovery. Mixing these two functions is a bad design choice because as a result we can't create two vinyl indexes in one WAL row, which may happen on ALTER of a primary key. Besides, we can't create an index object before WAL write, which is also needed for ALTER, because at that time there's no LSN assigned to the index yet. That said, we need to split this variable in two: index_id and commit_lsn. To be backward compatible, we rename index_lsn to index_id everywhere in vylog and add a new record field commit_lsn; if commit_lsn is missing for a create_index record, then this must be a record left from an old vylog and so we initialize it with index_id (former index_lsn) - see vy_log_record_decode(). --- src/box/vinyl.c | 24 +++--- src/box/vy_index.c | 30 +++++--- src/box/vy_index.h | 10 ++- src/box/vy_log.c | 195 ++++++++++++++++++++++++++++------------------- src/box/vy_log.h | 72 ++++++++--------- src/box/vy_scheduler.c | 10 +-- test/unit/vy_log_stub.c | 4 +- test/vinyl/layout.result | 64 ++++++++-------- 8 files changed, 229 insertions(+), 180 deletions(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index af3621df..1908d5fc 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -781,6 +781,8 @@ vinyl_index_commit_create(struct index *base, int64_t lsn) struct vy_env *env = vy_env(base->engine); struct vy_index *index = vy_index(base); + assert(index->id >= 0); + if (env->status == VINYL_INITIAL_RECOVERY_LOCAL || env->status == VINYL_FINAL_RECOVERY_LOCAL) { /* @@ -791,7 +793,7 @@ vinyl_index_commit_create(struct index *base, int64_t lsn) * the index isn't in the recovery context and we * need to retry to log it now. */ - if (index->commit_lsn >= 0) { + if (index->is_committed) { vy_scheduler_add_index(&env->scheduler, index); return; } @@ -816,7 +818,8 @@ vinyl_index_commit_create(struct index *base, int64_t lsn) if (index->opts.lsn != 0) lsn = index->opts.lsn; - index->commit_lsn = lsn; + assert(!index->is_committed); + index->is_committed = true; assert(index->range_count == 1); struct vy_range *range = vy_range_tree_first(index->tree); @@ -830,9 +833,9 @@ vinyl_index_commit_create(struct index *base, int64_t lsn) * recovery. */ vy_log_tx_begin(); - vy_log_create_index(index->commit_lsn, index->index_id, - index->space_id, index->key_def); - vy_log_insert_range(index->commit_lsn, range->id, NULL, NULL); + vy_log_create_index(index->id, index->space_id, index->index_id, + index->key_def, lsn); + vy_log_insert_range(index->id, range->id, NULL, NULL); vy_log_tx_try_commit(); /* * After we committed the index in the log, we can schedule @@ -889,7 +892,7 @@ vinyl_index_commit_drop(struct index *base) vy_log_tx_begin(); vy_log_index_prune(index, checkpoint_last(NULL)); - vy_log_drop_index(index->commit_lsn); + vy_log_drop_index(index->id); vy_log_tx_try_commit(); } @@ -938,7 +941,8 @@ vinyl_space_prepare_truncate(struct space *old_space, struct space *new_space) struct vy_index *old_index = vy_index(old_space->index[i]); struct vy_index *new_index = vy_index(new_space->index[i]); - new_index->commit_lsn = old_index->commit_lsn; + new_index->id = old_index->id; + new_index->is_committed = old_index->is_committed; if (truncate_done) { /* @@ -1015,10 +1019,8 @@ vinyl_space_commit_truncate(struct space *old_space, struct space *new_space) assert(new_index->range_count == 1); vy_log_index_prune(old_index, gc_lsn); - vy_log_insert_range(new_index->commit_lsn, - range->id, NULL, NULL); - vy_log_truncate_index(new_index->commit_lsn, - new_index->truncate_count); + vy_log_insert_range(new_index->id, range->id, NULL, NULL); + vy_log_truncate_index(new_index->id, new_index->truncate_count); } vy_log_tx_try_commit(); diff --git a/src/box/vy_index.c b/src/box/vy_index.c index e4f567e2..de8c5f1e 100644 --- a/src/box/vy_index.c +++ b/src/box/vy_index.c @@ -220,8 +220,8 @@ vy_index_new(struct vy_index_env *index_env, struct vy_cache_env *cache_env, if (index->mem == NULL) goto fail_mem; + index->id = -1; index->refs = 1; - index->commit_lsn = -1; index->dump_lsn = -1; vy_cache_create(&index->cache, cache_env, cmp_def); rlist_create(&index->sealed); @@ -381,6 +381,10 @@ vy_index_create(struct vy_index *index) return -1; } + /* Assign unique id. */ + assert(index->id < 0); + index->id = vy_log_next_id(); + /* Allocate initial range. */ return vy_index_init_range_tree(index); } @@ -536,6 +540,8 @@ vy_index_recover(struct vy_index *index, struct vy_recovery *recovery, struct vy_run_env *run_env, int64_t lsn, bool is_checkpoint_recovery, bool force_recovery) { + assert(index->id < 0); + assert(!index->is_committed); assert(index->range_count == 0); /* @@ -552,7 +558,7 @@ vy_index_recover(struct vy_index *index, struct vy_recovery *recovery, * Look up the last incarnation of the index in vylog. */ struct vy_index_recovery_info *index_info; - index_info = vy_recovery_lookup_index(recovery, + index_info = vy_recovery_index_by_id(recovery, index->space_id, index->index_id); if (is_checkpoint_recovery) { if (index_info == NULL) { @@ -568,29 +574,31 @@ vy_index_recover(struct vy_index *index, struct vy_recovery *recovery, (unsigned)index->index_id)); return -1; } - if (lsn > index_info->index_lsn) { + if (lsn > index_info->commit_lsn) { /* * The last incarnation of the index was created * before the last checkpoint, load it now. */ - lsn = index_info->index_lsn; + lsn = index_info->commit_lsn; } } - if (index_info == NULL || lsn > index_info->index_lsn) { + if (index_info == NULL || lsn > index_info->commit_lsn) { /* * If we failed to log index creation before restart, * we won't find it in the log on recovery. This is * OK as the index doesn't have any runs in this case. * We will retry to log index in vy_index_commit_create(). - * For now, just create the initial range. + * For now, just create the initial range and assign id. */ + index->id = vy_log_next_id(); return vy_index_init_range_tree(index); } - index->commit_lsn = lsn; + index->id = index_info->id; + index->is_committed = true; - if (lsn < index_info->index_lsn || index_info->is_dropped) { + if (lsn < index_info->commit_lsn || index_info->is_dropped) { /* * Loading a past incarnation of the index, i.e. * the index is going to dropped during final @@ -672,7 +680,7 @@ vy_index_recover(struct vy_index *index, struct vy_recovery *recovery, if (prev == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Index %lld has empty range tree", - (long long)index->commit_lsn)); + (long long)index->id)); return -1; } if (prev->end != NULL) { @@ -1049,7 +1057,7 @@ vy_index_split_range(struct vy_index *index, struct vy_range *range) vy_log_delete_range(range->id); for (int i = 0; i < n_parts; i++) { part = parts[i]; - vy_log_insert_range(index->commit_lsn, part->id, + vy_log_insert_range(index->id, part->id, tuple_data_or_null(part->begin), tuple_data_or_null(part->end)); rlist_foreach_entry(slice, &part->slices, in_range) @@ -1115,7 +1123,7 @@ vy_index_coalesce_range(struct vy_index *index, struct vy_range *range) * Log change in metadata. */ vy_log_tx_begin(); - vy_log_insert_range(index->commit_lsn, result->id, + vy_log_insert_range(index->id, result->id, tuple_data_or_null(result->begin), tuple_data_or_null(result->end)); for (it = first; it != end; it = vy_range_tree_next(index->tree, it)) { diff --git a/src/box/vy_index.h b/src/box/vy_index.h index 7a5a8aa8..417f2d36 100644 --- a/src/box/vy_index.h +++ b/src/box/vy_index.h @@ -148,6 +148,8 @@ struct vy_index { * until all pending operations have completed. */ int refs; + /** Unique ID of this index. */ + int64_t id; /** Ordinal index number in the index array. */ uint32_t index_id; /** ID of the space this index belongs to. */ @@ -253,11 +255,11 @@ struct vy_index { * been dumped yet. */ int64_t dump_lsn; - /** - * LSN of the row that committed the index or -1 if - * the index was not committed to the metadata log. + /* + * This flag is set if the index creation was + * committed to the metadata log. */ - int64_t commit_lsn; + bool is_committed; /** * This flag is set if the index was dropped. * It is also set on local recovery if the index diff --git a/src/box/vy_log.c b/src/box/vy_log.c index a6f03a55..9c8dd631 100644 --- a/src/box/vy_log.c +++ b/src/box/vy_log.c @@ -68,7 +68,7 @@ * Used for packing a record in MsgPack. */ enum vy_log_key { - VY_LOG_KEY_INDEX_LSN = 0, + VY_LOG_KEY_INDEX_ID = 0, VY_LOG_KEY_RANGE_ID = 1, VY_LOG_KEY_RUN_ID = 2, VY_LOG_KEY_BEGIN = 3, @@ -80,11 +80,12 @@ enum vy_log_key { VY_LOG_KEY_DUMP_LSN = 9, VY_LOG_KEY_GC_LSN = 10, VY_LOG_KEY_TRUNCATE_COUNT = 11, + VY_LOG_KEY_COMMIT_LSN = 12, }; /** vy_log_key -> human readable name. */ static const char *vy_log_key_name[] = { - [VY_LOG_KEY_INDEX_LSN] = "index_lsn", + [VY_LOG_KEY_INDEX_ID] = "index_id", [VY_LOG_KEY_RANGE_ID] = "range_id", [VY_LOG_KEY_RUN_ID] = "run_id", [VY_LOG_KEY_BEGIN] = "begin", @@ -96,6 +97,7 @@ static const char *vy_log_key_name[] = { [VY_LOG_KEY_DUMP_LSN] = "dump_lsn", [VY_LOG_KEY_GC_LSN] = "gc_lsn", [VY_LOG_KEY_TRUNCATE_COUNT] = "truncate_count", + [VY_LOG_KEY_COMMIT_LSN] = "commit_lsn", }; /** vy_log_type -> human readable name. */ @@ -207,10 +209,10 @@ vy_log_record_snprint(char *buf, int size, const struct vy_log_record *record) assert(record->type < vy_log_record_type_MAX); SNPRINT(total, snprintf, buf, size, "%s{", vy_log_type_name[record->type]); - if (record->index_lsn > 0) + if (record->index_id > 0) SNPRINT(total, snprintf, buf, size, "%s=%"PRIi64", ", - vy_log_key_name[VY_LOG_KEY_INDEX_LSN], - record->index_lsn); + vy_log_key_name[VY_LOG_KEY_INDEX_ID], + record->index_id); if (record->range_id > 0) SNPRINT(total, snprintf, buf, size, "%s=%"PRIi64", ", vy_log_key_name[VY_LOG_KEY_RANGE_ID], @@ -250,6 +252,10 @@ vy_log_record_snprint(char *buf, int size, const struct vy_log_record *record) SNPRINT(total, snprintf, buf, size, "%s=%"PRIi64", ", vy_log_key_name[VY_LOG_KEY_SLICE_ID], record->slice_id); + if (record->commit_lsn > 0) + SNPRINT(total, snprintf, buf, size, "%s=%"PRIi64", ", + vy_log_key_name[VY_LOG_KEY_COMMIT_LSN], + record->commit_lsn); if (record->dump_lsn > 0) SNPRINT(total, snprintf, buf, size, "%s=%"PRIi64", ", vy_log_key_name[VY_LOG_KEY_DUMP_LSN], @@ -305,9 +311,9 @@ vy_log_record_encode(const struct vy_log_record *record, size += mp_sizeof_array(2); size += mp_sizeof_uint(record->type); size_t n_keys = 0; - if (record->index_lsn > 0) { - size += mp_sizeof_uint(VY_LOG_KEY_INDEX_LSN); - size += mp_sizeof_uint(record->index_lsn); + if (record->index_id > 0) { + size += mp_sizeof_uint(VY_LOG_KEY_INDEX_ID); + size += mp_sizeof_uint(record->index_id); n_keys++; } if (record->range_id > 0) { @@ -358,6 +364,11 @@ vy_log_record_encode(const struct vy_log_record *record, size += mp_sizeof_uint(record->slice_id); n_keys++; } + if (record->commit_lsn > 0) { + size += mp_sizeof_uint(VY_LOG_KEY_COMMIT_LSN); + size += mp_sizeof_uint(record->commit_lsn); + n_keys++; + } if (record->dump_lsn > 0) { size += mp_sizeof_uint(VY_LOG_KEY_DUMP_LSN); size += mp_sizeof_uint(record->dump_lsn); @@ -387,9 +398,9 @@ vy_log_record_encode(const struct vy_log_record *record, pos = mp_encode_array(pos, 2); pos = mp_encode_uint(pos, record->type); pos = mp_encode_map(pos, n_keys); - if (record->index_lsn > 0) { - pos = mp_encode_uint(pos, VY_LOG_KEY_INDEX_LSN); - pos = mp_encode_uint(pos, record->index_lsn); + if (record->index_id > 0) { + pos = mp_encode_uint(pos, VY_LOG_KEY_INDEX_ID); + pos = mp_encode_uint(pos, record->index_id); } if (record->range_id > 0) { pos = mp_encode_uint(pos, VY_LOG_KEY_RANGE_ID); @@ -431,6 +442,10 @@ vy_log_record_encode(const struct vy_log_record *record, pos = mp_encode_uint(pos, VY_LOG_KEY_SLICE_ID); pos = mp_encode_uint(pos, record->slice_id); } + if (record->commit_lsn > 0) { + pos = mp_encode_uint(pos, VY_LOG_KEY_COMMIT_LSN); + pos = mp_encode_uint(pos, record->commit_lsn); + } if (record->dump_lsn > 0) { pos = mp_encode_uint(pos, VY_LOG_KEY_DUMP_LSN); pos = mp_encode_uint(pos, record->dump_lsn); @@ -502,8 +517,8 @@ vy_log_record_decode(struct vy_log_record *record, for (uint32_t i = 0; i < n_keys; i++) { uint32_t key = mp_decode_uint(&pos); switch (key) { - case VY_LOG_KEY_INDEX_LSN: - record->index_lsn = mp_decode_uint(&pos); + case VY_LOG_KEY_INDEX_ID: + record->index_id = mp_decode_uint(&pos); break; case VY_LOG_KEY_RANGE_ID: record->range_id = mp_decode_uint(&pos); @@ -552,6 +567,9 @@ vy_log_record_decode(struct vy_log_record *record, case VY_LOG_KEY_SLICE_ID: record->slice_id = mp_decode_uint(&pos); break; + case VY_LOG_KEY_COMMIT_LSN: + record->commit_lsn = mp_decode_uint(&pos); + break; case VY_LOG_KEY_DUMP_LSN: record->dump_lsn = mp_decode_uint(&pos); break; @@ -568,6 +586,17 @@ vy_log_record_decode(struct vy_log_record *record, goto fail; } } + if (record->type == VY_LOG_CREATE_INDEX && record->commit_lsn == 0) { + /* + * We used to use LSN as unique index identifier + * and didn't store LSN separately so if there's + * no 'commit_lsn' field in the record, we are + * recovering from an old vylog and 'id' is in + * fact the LSN of the WAL record that committed + * the index. + */ + record->commit_lsn = record->index_id; + } return 0; fail: buf = tt_static_buf(); @@ -1095,8 +1124,8 @@ vy_recovery_index_id_hash(uint32_t space_id, uint32_t index_id) /** Lookup a vinyl index in vy_recovery::index_id_hash map. */ struct vy_index_recovery_info * -vy_recovery_lookup_index(struct vy_recovery *recovery, - uint32_t space_id, uint32_t index_id) +vy_recovery_index_by_id(struct vy_recovery *recovery, + uint32_t space_id, uint32_t index_id) { int64_t key = vy_recovery_index_id_hash(space_id, index_id); struct mh_i64ptr_t *h = recovery->index_id_hash; @@ -1106,12 +1135,12 @@ vy_recovery_lookup_index(struct vy_recovery *recovery, return mh_i64ptr_node(h, k)->val; } -/** Lookup a vinyl index in vy_recovery::index_lsn_hash map. */ +/** Lookup a vinyl index in vy_recovery::index_hash map. */ static struct vy_index_recovery_info * -vy_recovery_lookup_index_by_lsn(struct vy_recovery *recovery, int64_t index_lsn) +vy_recovery_lookup_index(struct vy_recovery *recovery, int64_t id) { - struct mh_i64ptr_t *h = recovery->index_lsn_hash; - mh_int_t k = mh_i64ptr_find(h, index_lsn, NULL); + struct mh_i64ptr_t *h = recovery->index_hash; + mh_int_t k = mh_i64ptr_find(h, id, NULL); if (k == mh_end(h)) return NULL; return mh_i64ptr_node(h, k)->val; @@ -1152,15 +1181,15 @@ vy_recovery_lookup_slice(struct vy_recovery *recovery, int64_t slice_id) /** * Handle a VY_LOG_CREATE_INDEX log record. - * This function allocates a new vinyl index with ID @index_lsn + * This function allocates a new vinyl index with ID @id * and inserts it to the hash. * Return 0 on success, -1 on failure (ID collision or OOM). */ static int -vy_recovery_create_index(struct vy_recovery *recovery, int64_t index_lsn, - uint32_t index_id, uint32_t space_id, +vy_recovery_create_index(struct vy_recovery *recovery, int64_t id, + uint32_t space_id, uint32_t index_id, const struct key_part_def *key_parts, - uint32_t key_part_count) + uint32_t key_part_count, int64_t commit_lsn) { struct vy_index_recovery_info *index; struct key_part_def *key_parts_copy; @@ -1175,7 +1204,7 @@ vy_recovery_create_index(struct vy_recovery *recovery, int64_t index_lsn, if (key_parts == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Missing key definition for index %lld", - (long long)index_lsn)); + (long long)id)); return -1; } key_parts_copy = malloc(sizeof(*key_parts) * key_part_count); @@ -1242,23 +1271,24 @@ vy_recovery_create_index(struct vy_recovery *recovery, int64_t index_lsn, free(index->key_parts); } - index->index_lsn = index_lsn; + index->id = id; index->key_parts = key_parts_copy; index->key_part_count = key_part_count; index->is_dropped = false; + index->commit_lsn = commit_lsn; index->dump_lsn = -1; index->truncate_count = 0; /* - * Add the index to the LSN hash. + * Add the index to the hash. */ - h = recovery->index_lsn_hash; - node.key = index_lsn; + h = recovery->index_hash; + node.key = id; node.val = index; - if (mh_i64ptr_find(h, index_lsn, NULL) != mh_end(h)) { + if (mh_i64ptr_find(h, id, NULL) != mh_end(h)) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Duplicate index id %lld", - (long long)index_lsn)); + (long long)id)); return -1; } if (mh_i64ptr_put(h, &node, NULL, NULL) == mh_end(h)) { @@ -1266,36 +1296,40 @@ vy_recovery_create_index(struct vy_recovery *recovery, int64_t index_lsn, "mh_i64ptr_node_t"); return -1; } + + if (recovery->max_id < id) + recovery->max_id = id; + return 0; } /** * Handle a VY_LOG_DROP_INDEX log record. - * This function marks the vinyl index with ID @index_lsn as dropped. + * This function marks the vinyl index with ID @id as dropped. * All ranges and runs of the index must have been deleted by now. * Returns 0 on success, -1 if ID not found or index is already marked. */ static int -vy_recovery_drop_index(struct vy_recovery *recovery, int64_t index_lsn) +vy_recovery_drop_index(struct vy_recovery *recovery, int64_t id) { struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Index %lld deleted but not registered", - (long long)index_lsn)); + (long long)id)); return -1; } if (index->is_dropped) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Index %lld deleted twice", - (long long)index_lsn)); + (long long)id)); return -1; } if (!rlist_empty(&index->ranges)) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Dropped index %lld has ranges", - (long long)index_lsn)); + (long long)id)); return -1; } struct vy_run_recovery_info *run; @@ -1303,7 +1337,7 @@ vy_recovery_drop_index(struct vy_recovery *recovery, int64_t index_lsn) if (!run->is_dropped && !run->is_incomplete) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Dropped index %lld has active " - "runs", (long long)index_lsn)); + "runs", (long long)id)); return -1; } } @@ -1314,25 +1348,25 @@ vy_recovery_drop_index(struct vy_recovery *recovery, int64_t index_lsn) /** * Handle a VY_LOG_DUMP_INDEX log record. * This function updates LSN of the last dump of the vinyl index - * with ID @index_lsn. + * with ID @id. * Returns 0 on success, -1 if ID not found or index is dropped. */ static int vy_recovery_dump_index(struct vy_recovery *recovery, - int64_t index_lsn, int64_t dump_lsn) + int64_t id, int64_t dump_lsn) { struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Dump of unregistered index %lld", - (long long)index_lsn)); + (long long)id)); return -1; } if (index->is_dropped) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Dump of deleted index %lld", - (long long)index_lsn)); + (long long)id)); return -1; } index->dump_lsn = dump_lsn; @@ -1341,25 +1375,25 @@ vy_recovery_dump_index(struct vy_recovery *recovery, /** * Handle a VY_LOG_TRUNCATE_INDEX log record. - * This function updates truncate_count of the index with ID @index_lsn. + * This function updates truncate_count of the index with ID @id. * Returns 0 on success, -1 if ID not found or index is dropped. */ static int vy_recovery_truncate_index(struct vy_recovery *recovery, - int64_t index_lsn, int64_t truncate_count) + int64_t id, int64_t truncate_count) { struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Truncation of unregistered index %lld", - (long long)index_lsn)); + (long long)id)); return -1; } if (index->is_dropped) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Truncation of deleted index %lld", - (long long)index_lsn)); + (long long)id)); return -1; } index->truncate_count = truncate_count; @@ -1403,21 +1437,21 @@ vy_recovery_do_create_run(struct vy_recovery *recovery, int64_t run_id) /** * Handle a VY_LOG_PREPARE_RUN log record. * This function creates a new incomplete vinyl run with ID @run_id - * and adds it to the list of runs of the index with ID @index_lsn. + * and adds it to the list of runs of the index with ID @index_id. * Return 0 on success, -1 if run already exists, index not found, * or OOM. */ static int -vy_recovery_prepare_run(struct vy_recovery *recovery, int64_t index_lsn, +vy_recovery_prepare_run(struct vy_recovery *recovery, int64_t index_id, int64_t run_id) { struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, index_id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Run %lld created for unregistered " "index %lld", (long long)run_id, - (long long)index_lsn)); + (long long)index_id)); return -1; } if (vy_recovery_lookup_run(recovery, run_id) != NULL) { @@ -1438,29 +1472,29 @@ vy_recovery_prepare_run(struct vy_recovery *recovery, int64_t index_lsn, /** * Handle a VY_LOG_CREATE_RUN log record. * This function adds the vinyl run with ID @run_id to the list - * of runs of the index with ID @index_lsn and marks it committed. + * of runs of the index with ID @index_id and marks it committed. * If the run does not exist, it will be created. * Return 0 on success, -1 if index not found, run or index * is dropped, or OOM. */ static int -vy_recovery_create_run(struct vy_recovery *recovery, int64_t index_lsn, +vy_recovery_create_run(struct vy_recovery *recovery, int64_t index_id, int64_t run_id, int64_t dump_lsn) { struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, index_id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Run %lld created for unregistered " "index %lld", (long long)run_id, - (long long)index_lsn)); + (long long)index_id)); return -1; } if (index->is_dropped) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Run %lld created for deleted " "index %lld", (long long)run_id, - (long long)index_lsn)); + (long long)index_id)); return -1; } struct vy_run_recovery_info *run; @@ -1539,11 +1573,11 @@ vy_recovery_forget_run(struct vy_recovery *recovery, int64_t run_id) * Handle a VY_LOG_INSERT_RANGE log record. * This function allocates a new vinyl range with ID @range_id, * inserts it to the hash, and adds it to the list of ranges of the - * index with ID @index_lsn. + * index with ID @index_id. * Return 0 on success, -1 on failure (ID collision or OOM). */ static int -vy_recovery_insert_range(struct vy_recovery *recovery, int64_t index_lsn, +vy_recovery_insert_range(struct vy_recovery *recovery, int64_t index_id, int64_t range_id, const char *begin, const char *end) { if (vy_recovery_lookup_range(recovery, range_id) != NULL) { @@ -1553,12 +1587,12 @@ vy_recovery_insert_range(struct vy_recovery *recovery, int64_t index_lsn, return -1; } struct vy_index_recovery_info *index; - index = vy_recovery_lookup_index_by_lsn(recovery, index_lsn); + index = vy_recovery_lookup_index(recovery, index_id); if (index == NULL) { diag_set(ClientError, ER_INVALID_VYLOG_FILE, tt_sprintf("Range %lld created for unregistered " "index %lld", (long long)range_id, - (long long)index_lsn)); + (long long)index_id)); return -1; } @@ -1765,26 +1799,27 @@ vy_recovery_process_record(struct vy_recovery *recovery, int rc; switch (record->type) { case VY_LOG_CREATE_INDEX: - rc = vy_recovery_create_index(recovery, record->index_lsn, - record->index_def_id, record->space_def_id, - record->key_parts, record->key_part_count); + rc = vy_recovery_create_index(recovery, record->index_id, + record->space_def_id, record->index_def_id, + record->key_parts, record->key_part_count, + record->commit_lsn); break; case VY_LOG_DROP_INDEX: - rc = vy_recovery_drop_index(recovery, record->index_lsn); + rc = vy_recovery_drop_index(recovery, record->index_id); break; case VY_LOG_INSERT_RANGE: - rc = vy_recovery_insert_range(recovery, record->index_lsn, + rc = vy_recovery_insert_range(recovery, record->index_id, record->range_id, record->begin, record->end); break; case VY_LOG_DELETE_RANGE: rc = vy_recovery_delete_range(recovery, record->range_id); break; case VY_LOG_PREPARE_RUN: - rc = vy_recovery_prepare_run(recovery, record->index_lsn, + rc = vy_recovery_prepare_run(recovery, record->index_id, record->run_id); break; case VY_LOG_CREATE_RUN: - rc = vy_recovery_create_run(recovery, record->index_lsn, + rc = vy_recovery_create_run(recovery, record->index_id, record->run_id, record->dump_lsn); break; case VY_LOG_DROP_RUN: @@ -1803,11 +1838,11 @@ vy_recovery_process_record(struct vy_recovery *recovery, rc = vy_recovery_delete_slice(recovery, record->slice_id); break; case VY_LOG_DUMP_INDEX: - rc = vy_recovery_dump_index(recovery, record->index_lsn, + rc = vy_recovery_dump_index(recovery, record->index_id, record->dump_lsn); break; case VY_LOG_TRUNCATE_INDEX: - rc = vy_recovery_truncate_index(recovery, record->index_lsn, + rc = vy_recovery_truncate_index(recovery, record->index_id, record->truncate_count); break; default: @@ -1837,19 +1872,19 @@ vy_recovery_new_f(va_list ap) rlist_create(&recovery->indexes); recovery->index_id_hash = NULL; - recovery->index_lsn_hash = NULL; + recovery->index_hash = NULL; recovery->range_hash = NULL; recovery->run_hash = NULL; recovery->slice_hash = NULL; recovery->max_id = -1; recovery->index_id_hash = mh_i64ptr_new(); - recovery->index_lsn_hash = mh_i64ptr_new(); + recovery->index_hash = mh_i64ptr_new(); recovery->range_hash = mh_i64ptr_new(); recovery->run_hash = mh_i64ptr_new(); recovery->slice_hash = mh_i64ptr_new(); if (recovery->index_id_hash == NULL || - recovery->index_lsn_hash == NULL || + recovery->index_hash == NULL || recovery->range_hash == NULL || recovery->run_hash == NULL || recovery->slice_hash == NULL) { @@ -1974,9 +2009,9 @@ vy_recovery_delete(struct vy_recovery *recovery) } mh_i64ptr_delete(recovery->index_id_hash); } - if (recovery->index_lsn_hash != NULL) { + if (recovery->index_hash != NULL) { /* Hash entries were deleted along with index_id_hash. */ - mh_i64ptr_delete(recovery->index_lsn_hash); + mh_i64ptr_delete(recovery->index_hash); } if (recovery->range_hash != NULL) vy_recovery_delete_hash(recovery->range_hash); @@ -2013,7 +2048,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) vy_log_record_init(&record); record.type = VY_LOG_CREATE_INDEX; - record.index_lsn = index->index_lsn; + record.index_id = index->id; record.index_def_id = index->index_id; record.space_def_id = index->space_id; record.key_parts = index->key_parts; @@ -2024,7 +2059,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) if (index->truncate_count > 0) { vy_log_record_init(&record); record.type = VY_LOG_TRUNCATE_INDEX; - record.index_lsn = index->index_lsn; + record.index_id = index->id; record.truncate_count = index->truncate_count; if (vy_log_append_record(xlog, &record) != 0) return -1; @@ -2033,7 +2068,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) if (index->dump_lsn >= 0) { vy_log_record_init(&record); record.type = VY_LOG_DUMP_INDEX; - record.index_lsn = index->index_lsn; + record.index_id = index->id; record.dump_lsn = index->dump_lsn; if (vy_log_append_record(xlog, &record) != 0) return -1; @@ -2047,7 +2082,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) record.type = VY_LOG_CREATE_RUN; record.dump_lsn = run->dump_lsn; } - record.index_lsn = index->index_lsn; + record.index_id = index->id; record.run_id = run->id; if (vy_log_append_record(xlog, &record) != 0) return -1; @@ -2066,7 +2101,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) rlist_foreach_entry(range, &index->ranges, in_index) { vy_log_record_init(&record); record.type = VY_LOG_INSERT_RANGE; - record.index_lsn = index->index_lsn; + record.index_id = index->id; record.range_id = range->id; record.begin = range->begin; record.end = range->end; @@ -2093,7 +2128,7 @@ vy_log_append_index(struct xlog *xlog, struct vy_index_recovery_info *index) if (index->is_dropped) { vy_log_record_init(&record); record.type = VY_LOG_DROP_INDEX; - record.index_lsn = index->index_lsn; + record.index_id = index->id; if (vy_log_append_record(xlog, &record) != 0) return -1; } diff --git a/src/box/vy_log.h b/src/box/vy_log.h index ac9b987e..19987c61 100644 --- a/src/box/vy_log.h +++ b/src/box/vy_log.h @@ -65,18 +65,18 @@ struct mh_i64ptr_t; enum vy_log_record_type { /** * Create a new vinyl index. - * Requires vy_log_record::index_lsn, index_def_id, space_def_id, - * key_def (with primary key parts). + * Requires vy_log_record::index_id, index_def_id, space_def_id, + * key_def (with primary key parts), commit_lsn. */ VY_LOG_CREATE_INDEX = 0, /** * Drop an index. - * Requires vy_log_record::index_lsn. + * Requires vy_log_record::index_id. */ VY_LOG_DROP_INDEX = 1, /** * Insert a new range into a vinyl index. - * Requires vy_log_record::index_lsn, range_id, begin, end. + * Requires vy_log_record::index_id, range_id, begin, end. */ VY_LOG_INSERT_RANGE = 2, /** @@ -86,7 +86,7 @@ enum vy_log_record_type { VY_LOG_DELETE_RANGE = 3, /** * Prepare a vinyl run file. - * Requires vy_log_record::index_lsn, run_id. + * Requires vy_log_record::index_id, run_id. * * Record of this type is written before creating a run file. * It is needed to keep track of unfinished due to errors run @@ -95,7 +95,7 @@ enum vy_log_record_type { VY_LOG_PREPARE_RUN = 4, /** * Commit a vinyl run file creation. - * Requires vy_log_record::index_lsn, run_id, dump_lsn. + * Requires vy_log_record::index_id, run_id, dump_lsn. * * Written after a run file was successfully created. */ @@ -136,7 +136,7 @@ enum vy_log_record_type { VY_LOG_DELETE_SLICE = 9, /** * Update LSN of the last index dump. - * Requires vy_log_record::index_lsn, dump_lsn. + * Requires vy_log_record::index_id, dump_lsn. */ VY_LOG_DUMP_INDEX = 10, /** @@ -152,7 +152,7 @@ enum vy_log_record_type { VY_LOG_SNAPSHOT = 11, /** * Update truncate count of a vinyl index. - * Requires vy_log_record::index_lsn, truncate_count. + * Requires vy_log_record::index_id, truncate_count. */ VY_LOG_TRUNCATE_INDEX = 12, @@ -163,11 +163,8 @@ enum vy_log_record_type { struct vy_log_record { /** Type of the record. */ enum vy_log_record_type type; - /** - * LSN from the time of index creation. - * Used to identify indexes in vylog. - */ - int64_t index_lsn; + /** Unique ID of the vinyl index. */ + int64_t index_id; /** Unique ID of the vinyl range. */ int64_t range_id; /** Unique ID of the vinyl run. */ @@ -194,6 +191,8 @@ struct vy_log_record { struct key_part_def *key_parts; /** Number of key parts. */ uint32_t key_part_count; + /** LSN of the WAL row corresponding to this record. */ + int64_t commit_lsn; /** Max LSN stored on disk. */ int64_t dump_lsn; /** @@ -216,8 +215,8 @@ struct vy_recovery { struct rlist indexes; /** space_id, index_id -> vy_index_recovery_info. */ struct mh_i64ptr_t *index_id_hash; - /** index_lsn -> vy_index_recovery_info. */ - struct mh_i64ptr_t *index_lsn_hash; + /** ID -> vy_index_recovery_info. */ + struct mh_i64ptr_t *index_hash; /** ID -> vy_range_recovery_info. */ struct mh_i64ptr_t *range_hash; /** ID -> vy_run_recovery_info. */ @@ -235,8 +234,8 @@ struct vy_recovery { struct vy_index_recovery_info { /** Link in vy_recovery::indexes. */ struct rlist in_recovery; - /** LSN of the index creation. */ - int64_t index_lsn; + /** ID of the index. */ + int64_t id; /** Ordinal index number in the space. */ uint32_t index_id; /** Space ID. */ @@ -247,6 +246,8 @@ struct vy_index_recovery_info { uint32_t key_part_count; /** True if the index was dropped. */ bool is_dropped; + /** LSN of the WAL row that committed the index. */ + int64_t commit_lsn; /** LSN of the last index dump. */ int64_t dump_lsn; /** Truncate count. */ @@ -480,8 +481,8 @@ vy_recovery_delete(struct vy_recovery *recovery); * Returns NULL if the index was not found. */ struct vy_index_recovery_info * -vy_recovery_lookup_index(struct vy_recovery *recovery, - uint32_t space_id, uint32_t index_id); +vy_recovery_index_by_id(struct vy_recovery *recovery, + uint32_t space_id, uint32_t index_id); /** * Initialize a log record with default values. @@ -496,39 +497,40 @@ vy_log_record_init(struct vy_log_record *record) /** Helper to log a vinyl index creation. */ static inline void -vy_log_create_index(int64_t index_lsn, uint32_t index_id, uint32_t space_id, - const struct key_def *key_def) +vy_log_create_index(int64_t id, uint32_t space_id, uint32_t index_id, + const struct key_def *key_def, int64_t commit_lsn) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_CREATE_INDEX; - record.index_lsn = index_lsn; - record.index_def_id = index_id; + record.index_id = id; record.space_def_id = space_id; + record.index_def_id = index_id; record.key_def = key_def; + record.commit_lsn = commit_lsn; vy_log_write(&record); } /** Helper to log a vinyl index drop. */ static inline void -vy_log_drop_index(int64_t index_lsn) +vy_log_drop_index(int64_t id) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_DROP_INDEX; - record.index_lsn = index_lsn; + record.index_id = id; vy_log_write(&record); } /** Helper to log a vinyl range insertion. */ static inline void -vy_log_insert_range(int64_t index_lsn, int64_t range_id, +vy_log_insert_range(int64_t index_id, int64_t range_id, const char *begin, const char *end) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_INSERT_RANGE; - record.index_lsn = index_lsn; + record.index_id = index_id; record.range_id = range_id; record.begin = begin; record.end = end; @@ -548,24 +550,24 @@ vy_log_delete_range(int64_t range_id) /** Helper to log a vinyl run file creation. */ static inline void -vy_log_prepare_run(int64_t index_lsn, int64_t run_id) +vy_log_prepare_run(int64_t index_id, int64_t run_id) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_PREPARE_RUN; - record.index_lsn = index_lsn; + record.index_id = index_id; record.run_id = run_id; vy_log_write(&record); } /** Helper to log a vinyl run creation. */ static inline void -vy_log_create_run(int64_t index_lsn, int64_t run_id, int64_t dump_lsn) +vy_log_create_run(int64_t index_id, int64_t run_id, int64_t dump_lsn) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_CREATE_RUN; - record.index_lsn = index_lsn; + record.index_id = index_id; record.run_id = run_id; record.dump_lsn = dump_lsn; vy_log_write(&record); @@ -623,24 +625,24 @@ vy_log_delete_slice(int64_t slice_id) /** Helper to log index dump. */ static inline void -vy_log_dump_index(int64_t index_lsn, int64_t dump_lsn) +vy_log_dump_index(int64_t id, int64_t dump_lsn) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_DUMP_INDEX; - record.index_lsn = index_lsn; + record.index_id = id; record.dump_lsn = dump_lsn; vy_log_write(&record); } /** Helper to log index truncation. */ static inline void -vy_log_truncate_index(int64_t index_lsn, int64_t truncate_count) +vy_log_truncate_index(int64_t id, int64_t truncate_count) { struct vy_log_record record; vy_log_record_init(&record); record.type = VY_LOG_TRUNCATE_INDEX; - record.index_lsn = index_lsn; + record.index_id = id; record.truncate_count = truncate_count; vy_log_write(&record); } diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index 05234532..7c75390c 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -583,7 +583,7 @@ vy_run_prepare(struct vy_run_env *run_env, struct vy_index *index) if (run == NULL) return NULL; vy_log_tx_begin(); - vy_log_prepare_run(index->commit_lsn, run->id); + vy_log_prepare_run(index->id, run->id); if (vy_log_tx_commit() < 0) { vy_run_unref(run); return NULL; @@ -706,7 +706,7 @@ vy_task_dump_complete(struct vy_scheduler *scheduler, struct vy_task *task) * to log index dump anyway. */ vy_log_tx_begin(); - vy_log_dump_index(index->commit_lsn, dump_lsn); + vy_log_dump_index(index->id, dump_lsn); if (vy_log_tx_commit() < 0) goto fail; vy_run_discard(new_run); @@ -766,7 +766,7 @@ vy_task_dump_complete(struct vy_scheduler *scheduler, struct vy_task *task) * Log change in metadata. */ vy_log_tx_begin(); - vy_log_create_run(index->commit_lsn, new_run->id, dump_lsn); + vy_log_create_run(index->id, new_run->id, dump_lsn); for (range = begin_range, i = 0; range != end_range; range = vy_range_tree_next(index->tree, range), i++) { assert(i < index->range_count); @@ -778,7 +778,7 @@ vy_task_dump_complete(struct vy_scheduler *scheduler, struct vy_task *task) if (++loops % VY_YIELD_LOOPS == 0) fiber_sleep(0); /* see comment above */ } - vy_log_dump_index(index->commit_lsn, dump_lsn); + vy_log_dump_index(index->id, dump_lsn); if (vy_log_tx_commit() < 0) goto fail_free_slices; @@ -1103,7 +1103,7 @@ vy_task_compact_complete(struct vy_scheduler *scheduler, struct vy_task *task) rlist_foreach_entry(run, &unused_runs, in_unused) vy_log_drop_run(run->id, gc_lsn); if (new_slice != NULL) { - vy_log_create_run(index->commit_lsn, new_run->id, + vy_log_create_run(index->id, new_run->id, new_run->dump_lsn); vy_log_insert_slice(range->id, new_run->id, new_slice->id, tuple_data_or_null(new_slice->begin), diff --git a/test/unit/vy_log_stub.c b/test/unit/vy_log_stub.c index 1fda0a6b..7cfaff84 100644 --- a/test/unit/vy_log_stub.c +++ b/test/unit/vy_log_stub.c @@ -52,8 +52,8 @@ void vy_log_write(const struct vy_log_record *record) {} struct vy_index_recovery_info * -vy_recovery_lookup_index(struct vy_recovery *recovery, - uint32_t space_id, uint32_t index_id) +vy_recovery_index_by_id(struct vy_recovery *recovery, + uint32_t space_id, uint32_t index_id) { unreachable(); } diff --git a/test/vinyl/layout.result b/test/vinyl/layout.result index 603d2865..f1f52b9f 100644 --- a/test/vinyl/layout.result +++ b/test/vinyl/layout.result @@ -128,59 +128,59 @@ result - - HEADER: type: INSERT BODY: - tuple: [0, {0: 3, 7: [{'field': 0, 'collation': 1, 'type': 'string'}], 6: 512}] + tuple: [0, {7: [{'field': 0, 'collation': 1, 'type': 'string'}], 6: 512}] - HEADER: type: INSERT BODY: - tuple: [10, {0: 3, 9: 9}] + tuple: [10, {9: 9}] - HEADER: type: INSERT BODY: - tuple: [5, {0: 3, 2: 6, 9: 9}] + tuple: [5, {2: 8, 9: 9}] - HEADER: type: INSERT BODY: - tuple: [4, {0: 3, 2: 3}] + tuple: [4, {2: 5}] - HEADER: type: INSERT BODY: - tuple: [6, {2: 3}] + tuple: [6, {2: 5}] - HEADER: type: INSERT BODY: - tuple: [2, {0: 3}] + tuple: [2, {1: 1}] - HEADER: type: INSERT BODY: - tuple: [8, {2: 6, 8: 7}] + tuple: [8, {1: 1, 2: 8, 8: 9}] - HEADER: type: INSERT BODY: - tuple: [0, {0: 4, 5: 1, 6: 512, 7: [{'field': 1, 'is_nullable': true, 'type': 'unsigned'}]}] + tuple: [0, {0: 2, 5: 1, 6: 512, 7: [{'field': 1, 'is_nullable': true, 'type': 'unsigned'}]}] - HEADER: type: INSERT BODY: - tuple: [10, {0: 4, 9: 9}] + tuple: [10, {0: 2, 9: 9}] - HEADER: type: INSERT BODY: - tuple: [5, {0: 4, 2: 4, 9: 9}] + tuple: [5, {0: 2, 2: 6, 9: 9}] - HEADER: type: INSERT BODY: - tuple: [4, {0: 4, 2: 2}] + tuple: [4, {0: 2, 2: 4}] - HEADER: type: INSERT BODY: - tuple: [6, {2: 2}] + tuple: [6, {2: 4}] - HEADER: type: INSERT BODY: - tuple: [2, {0: 4, 1: 1}] + tuple: [2, {0: 2, 1: 3}] - HEADER: type: INSERT BODY: - tuple: [8, {1: 1, 2: 4, 8: 5}] + tuple: [8, {1: 3, 2: 6, 8: 7}] - HEADER: type: INSERT BODY: @@ -189,53 +189,53 @@ result timestamp: <timestamp> type: INSERT BODY: - tuple: [7, {2: 2}] + tuple: [7, {2: 4}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [7, {2: 3}] + tuple: [7, {2: 5}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [4, {0: 4, 2: 8}] + tuple: [4, {0: 2, 2: 10}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [5, {0: 4, 2: 8, 9: 12}] + tuple: [5, {0: 2, 2: 10, 9: 12}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [8, {1: 1, 2: 8, 8: 9}] + tuple: [8, {1: 3, 2: 10, 8: 11}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [10, {0: 4, 9: 12}] + tuple: [10, {0: 2, 9: 12}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [4, {0: 3, 2: 10}] + tuple: [4, {2: 12}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [5, {0: 3, 2: 10, 9: 12}] + tuple: [5, {2: 12, 9: 12}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [8, {2: 10, 8: 11}] + tuple: [8, {1: 1, 2: 12, 8: 13}] - HEADER: timestamp: <timestamp> type: INSERT BODY: - tuple: [10, {0: 3, 9: 12}] - - - 00000000000000000006.index + tuple: [10, {9: 12}] + - - 00000000000000000008.index - - HEADER: type: RUNINFO BODY: @@ -254,7 +254,7 @@ result unpacked_size: 67 row_count: 3 min_key: ['ёёё'] - - - 00000000000000000006.run + - - 00000000000000000008.run - - HEADER: lsn: 9 type: INSERT @@ -274,7 +274,7 @@ result type: ROWINDEX BODY: row_index: "\0\0\0\0\0\0\0\x10\0\0\0 " - - - 00000000000000000010.index + - - 00000000000000000012.index - - HEADER: type: RUNINFO BODY: @@ -293,7 +293,7 @@ result unpacked_size: 71 row_count: 3 min_key: ['ёёё'] - - - 00000000000000000010.run + - - 00000000000000000012.run - - HEADER: lsn: 10 type: REPLACE @@ -313,7 +313,7 @@ result type: ROWINDEX BODY: row_index: "\0\0\0\0\0\0\0\x10\0\0\0\"" - - - 00000000000000000004.index + - - 00000000000000000006.index - - HEADER: type: RUNINFO BODY: @@ -332,7 +332,7 @@ result unpacked_size: 67 row_count: 3 min_key: [null, 'ёёё'] - - - 00000000000000000004.run + - - 00000000000000000006.run - - HEADER: lsn: 9 type: INSERT @@ -352,7 +352,7 @@ result type: ROWINDEX BODY: row_index: "\0\0\0\0\0\0\0\x10\0\0\0 " - - - 00000000000000000008.index + - - 00000000000000000010.index - - HEADER: type: RUNINFO BODY: @@ -371,7 +371,7 @@ result unpacked_size: 91 row_count: 4 min_key: [null, 'ёёё'] - - - 00000000000000000008.run + - - 00000000000000000010.run - - HEADER: lsn: 10 type: DELETE -- 2.11.0
next prev parent reply other threads:[~2018-03-20 11:29 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-20 11:29 [PATCH v2 0/5] Prepare vylog for space alter Vladimir Davydov 2018-03-20 11:29 ` [PATCH v2 1/5] vinyl: refactor vylog recovery Vladimir Davydov 2018-03-20 11:29 ` [PATCH v2 2/5] vinyl: rename vy_index::id to index_id Vladimir Davydov 2018-03-20 11:29 ` [PATCH v2 3/5] vinyl: rename vy_log_record::index_id/space_id to index_def_id/space_def_id Vladimir Davydov 2018-03-20 11:29 ` Vladimir Davydov [this message] 2018-03-22 15:08 ` [PATCH v2 4/5] vinyl: do not use index lsn to identify indexes in vylog Vladimir Davydov 2018-03-20 11:29 ` [PATCH v2 5/5] alter: rewrite space truncation using alter infrastructure 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=3bb507af569820382ddf2cce1e776e9d13f1ec91.1521545062.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH v2 4/5] vinyl: do not use index lsn to identify indexes in vylog' \ /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