From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 2/9] vinyl: ignore unknown .run, .index and .vylog keys Date: Mon, 21 Jan 2019 00:17:01 +0300 Message-Id: <828fd6243abcca2c09e532f50da88e254775cdef.1548017258.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org List-ID: Currently, if we encounter an unknown key while parsing a .run, .index, or .vylog file we raise an error. As a result, if we add a new key to either of those entities, we will break forward compatibility although there's actually no reason for that. To avoid that, let's silently ignore unknown keys, as we do in case of xrow header keys. --- src/box/vy_log.c | 9 ++------- src/box/vy_run.c | 12 ++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/box/vy_log.c b/src/box/vy_log.c index c9e0713c..d3fa0c7a 100644 --- a/src/box/vy_log.c +++ b/src/box/vy_log.c @@ -620,14 +620,9 @@ vy_log_record_decode(struct vy_log_record *record, case VY_LOG_KEY_GC_LSN: record->gc_lsn = mp_decode_uint(&pos); break; - case VY_LOG_KEY_TRUNCATE_COUNT: - /* Not used anymore, ignore. */ - break; default: - diag_set(ClientError, ER_INVALID_VYLOG_FILE, - tt_sprintf("Bad record: unknown key %u", - (unsigned)key)); - goto fail; + mp_next(&pos); /* unknown key, ignore */ + break; } } if (record->type == VY_LOG_CREATE_LSM) { diff --git a/src/box/vy_run.c b/src/box/vy_run.c index d82f1e37..cee90458 100644 --- a/src/box/vy_run.c +++ b/src/box/vy_run.c @@ -524,10 +524,8 @@ vy_page_info_decode(struct vy_page_info *page, const struct xrow_header *xrow, page->row_index_offset = mp_decode_uint(&pos); break; default: - diag_set(ClientError, ER_INVALID_INDEX_FILE, filename, - tt_sprintf("Can't decode page info: " - "unknown key %u", (unsigned)key)); - return -1; + mp_next(&pos); /* unknown key, ignore */ + break; } } if (key_map) { @@ -634,10 +632,8 @@ vy_run_info_decode(struct vy_run_info *run_info, vy_stmt_stat_decode(&run_info->stmt_stat, &pos); break; default: - diag_set(ClientError, ER_INVALID_INDEX_FILE, filename, - "Can't decode run info: unknown key %u", - (unsigned)key); - return -1; + mp_next(&pos); /* unknown key, ignore */ + break; } } if (key_map) { -- 2.11.0