diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 5a5a40d1c..94abffb35 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -4,7 +4,7 @@ cxx_link(dragonfly base dragonfly_lib) add_library(dragonfly_lib command_registry.cc common.cc config_flags.cc conn_context.cc db_slice.cc debugcmd.cc dragonfly_listener.cc dragonfly_connection.cc engine_shard_set.cc generic_family.cc - list_family.cc main_service.cc memcache_parser.cc rdb_save.cc snapshot.cc + list_family.cc main_service.cc memcache_parser.cc rdb_load.cc rdb_save.cc snapshot.cc redis_parser.cc reply_builder.cc server_family.cc string_family.cc transaction.cc) cxx_link(dragonfly_lib dfly_core redis_lib uring_fiber_lib diff --git a/server/common_types.h b/server/common_types.h index aef4e12c3..39e8d01a6 100644 --- a/server/common_types.h +++ b/server/common_types.h @@ -31,6 +31,7 @@ using CmdArgVec = std::vector; constexpr DbIndex kInvalidDbId = DbIndex(-1); constexpr ShardId kInvalidSid = ShardId(-1); +constexpr DbIndex kMaxDbId = 1024; // Reasonable starting point. class CommandId; class Transaction; diff --git a/server/debugcmd.cc b/server/debugcmd.cc index 06bdeb8e5..8f6f5a899 100644 --- a/server/debugcmd.cc +++ b/server/debugcmd.cc @@ -1,4 +1,4 @@ -// Copyright 2021, Roman Gershman. All rights reserved. +// Copyright 2022, Roman Gershman. All rights reserved. // See LICENSE for licensing terms. // #include "server/debugcmd.h" @@ -6,12 +6,18 @@ #include #include +#include #include "base/logging.h" #include "server/engine_shard_set.h" #include "server/error.h" +#include "server/rdb_load.h" #include "server/string_family.h" #include "util/uring/uring_fiber_algo.h" +#include "util/uring/uring_file.h" + +DECLARE_string(dir); +DECLARE_string(dbfilename); namespace dfly { @@ -19,6 +25,7 @@ using namespace std; using namespace util; namespace this_fiber = ::boost::this_fiber; using boost::fibers::fiber; +namespace fs = std::filesystem; struct PopulateBatch { DbIndex dbid; @@ -52,6 +59,12 @@ void DebugCmd::Run(CmdArgList args) { if (subcmd == "HELP") { std::string_view help_arr[] = { "DEBUG [ [value] [opt] ...]. Subcommands are:", + "RELOAD [option ...]", + " Save the RDB on disk (TBD) and reload it back to memory. Valid