From 4a5589a1e165a2bbfb8cf6718969a3aea3d8c3ca Mon Sep 17 00:00:00 2001 From: kostas Date: Thu, 3 Oct 2024 17:55:51 +0300 Subject: [PATCH 1/2] chore: allow rdb version 12 --- src/redis/rdb.h | 3 ++- src/server/rdb_load.cc | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/redis/rdb.h b/src/redis/rdb.h index 3b4814800f10..df0c4fdc191e 100644 --- a/src/redis/rdb.h +++ b/src/redis/rdb.h @@ -38,7 +38,7 @@ /* The current RDB version. When the format changes in a way that is no longer * backward compatible this number gets incremented. */ -#define RDB_VERSION 11 +#define RDB_VERSION 12 /* We would like to serialize to version 9 such that our rdb files * can be loaded by redis version 6 (RDB_VERSION 9) */ @@ -110,6 +110,7 @@ /* Range 200-240 is used by Dragonfly specific opcodes */ /* Special RDB opcodes (saved/loaded with rdbSaveType/rdbLoadType). */ +#define RDB_OPCODE_SLOT_INFO 244 /* Individual slot info, such as slot id and size (cluster mode only). */ #define RDB_OPCODE_FUNCTION 246 /* engine data */ #define RDB_OPCODE_FUNCTION2 245 /* function library data */ #define RDB_OPCODE_FUNCTION_PRE_GA 246 /* old function library data for 7.0 rc1 and rc2 */ diff --git a/src/server/rdb_load.cc b/src/server/rdb_load.cc index 65c913a70cba..aa34dba01052 100644 --- a/src/server/rdb_load.cc +++ b/src/server/rdb_load.cc @@ -2280,6 +2280,17 @@ error_code RdbLoader::Load(io::Source* src) { continue; } + if (type == RDB_OPCODE_SLOT_INFO) { + uint64_t slot_id; + SET_OR_RETURN(LoadLen(nullptr), slot_id); + uint64_t slot_size; + SET_OR_RETURN(LoadLen(nullptr), slot_size); + uint64_t expires_slot_size; + SET_OR_RETURN(LoadLen(nullptr), expires_slot_size); + LOG(WARNING) << "Loaded and ignored RDB_OPCODE_SLOT_INFO"; + continue; + } + if (!rdbIsObjectTypeDF(type)) { return RdbError(errc::invalid_rdb_type); } From 8df403f480400ab9f3b829172a85a306be3cf1dd Mon Sep 17 00:00:00 2001 From: kostas Date: Thu, 3 Oct 2024 18:20:59 +0300 Subject: [PATCH 2/2] add maybe unused and sign the commit Signed-off-by: kostas --- src/server/rdb_load.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/rdb_load.cc b/src/server/rdb_load.cc index aa34dba01052..0c8bb4c25273 100644 --- a/src/server/rdb_load.cc +++ b/src/server/rdb_load.cc @@ -2281,11 +2281,11 @@ error_code RdbLoader::Load(io::Source* src) { } if (type == RDB_OPCODE_SLOT_INFO) { - uint64_t slot_id; + [[maybe_unused]] uint64_t slot_id; SET_OR_RETURN(LoadLen(nullptr), slot_id); - uint64_t slot_size; + [[maybe_unused]] uint64_t slot_size; SET_OR_RETURN(LoadLen(nullptr), slot_size); - uint64_t expires_slot_size; + [[maybe_unused]] uint64_t expires_slot_size; SET_OR_RETURN(LoadLen(nullptr), expires_slot_size); LOG(WARNING) << "Loaded and ignored RDB_OPCODE_SLOT_INFO"; continue;