[PATCH 2/9] vinyl: ignore unknown .run, .index and .vylog keys
Vladimir Davydov
vdavydov.dev at gmail.com
Thu Jan 24 19:56:04 MSK 2019
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.
More information about the Tarantool-patches
mailing list