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 11/12] vinyl: do not write VY_LOG_DUMP_LSM record to snapshot
Date: Sun,  1 Apr 2018 12:05:38 +0300	[thread overview]
Message-ID: <f275f8134294efec6e1e3cf1df98e5ddc305316e.1522572161.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1522572160.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1522572160.git.vdavydov.dev@gmail.com>

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

  parent reply	other threads:[~2018-04-01  9:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  9:05 [PATCH 00/12] vinyl: allow to extend key def of non-empty index Vladimir Davydov
2018-04-01  9:05 ` [PATCH 01/12] index: add commit_modify virtual method Vladimir Davydov
2018-04-01  9:05 ` [PATCH 02/12] alter: require rebuild of all secondary vinyl indexes if pk changes Vladimir Davydov
2018-04-01  9:05 ` [PATCH 03/12] alter: do not rebuild secondary indexes on compatible " Vladimir Davydov
2018-04-05 12:30   ` Konstantin Osipov
2018-04-01  9:05 ` [PATCH 04/12] space: make space_swap_index method virtual Vladimir Davydov
2018-04-01  9:05 ` [PATCH 05/12] vinyl: do not reallocate tuple formats on alter Vladimir Davydov
2018-04-01 11:12   ` [tarantool-patches] " v.shpilevoy
2018-04-01 11:24     ` Vladimir Davydov
2018-04-01  9:05 ` [PATCH 06/12] vinyl: zap vy_lsm_validate_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 07/12] vinyl: zap vy_mem_update_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 08/12] vinyl: remove pointless is_nullable initialization for disk_format Vladimir Davydov
2018-04-01  9:05 ` [PATCH 09/12] vinyl: use source tuple format when copying field map Vladimir Davydov
2018-04-01  9:05 ` [PATCH 10/12] vinyl: rename vy_log_record::commit_lsn to create_lsn Vladimir Davydov
2018-04-01  9:05 ` Vladimir Davydov [this message]
2018-04-01  9:05 ` [PATCH 12/12] vinyl: allow to modify key definition if it does not require rebuild Vladimir Davydov
2018-04-02  8:46   ` Vladimir Davydov
2018-04-05 14:32     ` Konstantin Osipov
2018-04-05 14:45     ` Konstantin Osipov
2018-04-05 14:48       ` Konstantin Osipov

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=f275f8134294efec6e1e3cf1df98e5ddc305316e.1522572161.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 11/12] vinyl: do not write VY_LOG_DUMP_LSM record to snapshot' \
    /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