From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 24 Jan 2019 19:56:04 +0300 From: Vladimir Davydov Subject: Re: [PATCH 2/9] vinyl: ignore unknown .run, .index and .vylog keys Message-ID: <20190124165604.skr4ipxpwq3qdbr2@esperanza> References: <828fd6243abcca2c09e532f50da88e254775cdef.1548017258.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <828fd6243abcca2c09e532f50da88e254775cdef.1548017258.git.vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org List-ID: On Mon, Jan 21, 2019 at 12:17:01AM +0300, Vladimir Davydov wrote: > 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) { This one is trivial and should raise no questions. I pushed it to 2.1 and 1.10.