From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 11/12] vinyl: do not write VY_LOG_DUMP_LSM record to snapshot Date: Sun, 1 Apr 2018 12:05:38 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: There's no point in writing this record to snapshot, because we can store LSN of the last index dump right in VY_LOG_CREATE_LSM record. --- src/box/vy_log.c | 17 +++++------------ test/vinyl/layout.result | 12 ++---------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/box/vy_log.c b/src/box/vy_log.c index 7fa395d5..5552065d 100644 --- a/src/box/vy_log.c +++ b/src/box/vy_log.c @@ -1171,7 +1171,8 @@ static int vy_recovery_create_lsm(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, int64_t create_lsn) + uint32_t key_part_count, int64_t create_lsn, + int64_t dump_lsn) { struct vy_lsm_recovery_info *lsm; struct key_part_def *key_parts_copy; @@ -1258,7 +1259,7 @@ vy_recovery_create_lsm(struct vy_recovery *recovery, int64_t id, lsm->key_part_count = key_part_count; lsm->is_dropped = false; lsm->create_lsn = create_lsn; - lsm->dump_lsn = -1; + lsm->dump_lsn = dump_lsn; /* * Add the LSM tree to the hash. @@ -1756,7 +1757,7 @@ vy_recovery_process_record(struct vy_recovery *recovery, rc = vy_recovery_create_lsm(recovery, record->lsm_id, record->space_id, record->index_id, record->key_parts, record->key_part_count, - record->create_lsn); + record->create_lsn, record->dump_lsn); break; case VY_LOG_DROP_LSM: rc = vy_recovery_drop_lsm(recovery, record->lsm_id); @@ -2006,18 +2007,10 @@ vy_log_append_lsm(struct xlog *xlog, struct vy_lsm_recovery_info *lsm) record.key_parts = lsm->key_parts; record.key_part_count = lsm->key_part_count; record.create_lsn = lsm->create_lsn; + record.dump_lsn = lsm->dump_lsn; if (vy_log_append_record(xlog, &record) != 0) return -1; - if (lsm->dump_lsn >= 0) { - vy_log_record_init(&record); - record.type = VY_LOG_DUMP_LSM; - record.lsm_id = lsm->id; - record.dump_lsn = lsm->dump_lsn; - if (vy_log_append_record(xlog, &record) != 0) - return -1; - } - rlist_foreach_entry(run, &lsm->runs, in_lsm) { vy_log_record_init(&record); if (run->is_incomplete) { diff --git a/test/vinyl/layout.result b/test/vinyl/layout.result index c7b14645..4af2c024 100644 --- a/test/vinyl/layout.result +++ b/test/vinyl/layout.result @@ -127,15 +127,11 @@ result - - HEADER: type: INSERT BODY: - tuple: [0, {7: [{'field': 0, 'collation': 1, 'type': 'string'}], 12: 3, + tuple: [0, {7: [{'field': 0, 'collation': 1, 'type': 'string'}], 9: 9, 12: 3, 6: 512}] - HEADER: type: INSERT BODY: - tuple: [10, {9: 9}] - - HEADER: - type: INSERT - BODY: tuple: [5, {2: 8, 9: 9}] - HEADER: type: INSERT @@ -157,11 +153,7 @@ result type: INSERT BODY: tuple: [0, {0: 2, 5: 1, 6: 512, 7: [{'field': 1, 'is_nullable': true, 'type': 'unsigned'}], - 12: 4}] - - HEADER: - type: INSERT - BODY: - tuple: [10, {0: 2, 9: 9}] + 9: 9, 12: 4}] - HEADER: type: INSERT BODY: -- 2.11.0