From c628fae6d1e05163de321b06fcc7bde34989a129 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Mon, 13 Jul 2020 20:25:37 -0700 Subject: [PATCH] Report corruption on unrecognized value type (#7121) Summary: During memtable lookup, an unrecognized value type should be reported as Status::Corruption. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7121 Test Plan: make check Reviewed By: cheng-chang Differential Revision: D22512124 Pulled By: riversand963 fbshipit-source-id: 9b97be7d9b230c5aae9205f96054420e5ea09066 --- db/memtable.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/db/memtable.cc b/db/memtable.cc index fe627eaec..b391fe561 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -767,7 +767,13 @@ static bool SaveValue(void* arg, const char* entry) { } return true; } - default: + default: { + std::string msg("Unrecognized value type: " + + std::to_string(static_cast(type)) + ". "); + msg.append("User key: " + user_key_slice.ToString(/*hex=*/true) + ". "); + msg.append("seq: " + std::to_string(seq) + "."); + *(s->status) = Status::Corruption(msg.c_str()); + } assert(false); return true; }