Skip to content

Commit

Permalink
Fix error when jemalloc is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo authored and lzydmxy committed Sep 19, 2024
1 parent d652312 commit 4d453b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions programs/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ int Server::run()

int Server::main(const std::vector<std::string> & /*args*/)
{
#if USE_JEMALLOC
setJemallocBackgroundThreads(true);
#endif

static ServerErrorHandler error_handler;
Poco::ErrorHandler::set(&error_handler);
Poco::Logger * log = &logger();

#if USE_JEMALLOC
setJemallocBackgroundThreads(true);
#endif

#if !defined(NDEBUG) || !defined(__OPTIMIZE__)
LOG_WARNING(log, "Server was built in debug mode. It will work slowly.");
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/Service/FourLetterCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ void FourLetterCommandFactory::registerCommands(KeeperDispatcher & keeper_dispat
FourLetterCommandPtr uptime_command = std::make_shared<UpTimeCommand>(keeper_dispatcher);
factory.registerCommand(uptime_command);

#if USE_JEMALLOC
FourLetterCommandPtr jemalloc_dump_stats = std::make_shared<JemallocDumpStats>(keeper_dispatcher);
factory.registerCommand(jemalloc_dump_stats);

Expand All @@ -163,6 +164,7 @@ void FourLetterCommandFactory::registerCommands(KeeperDispatcher & keeper_dispat

FourLetterCommandPtr jemalloc_purge_arenas = std::make_shared<JemallocPurgeUnusedArenas>(keeper_dispatcher);
factory.registerCommand(jemalloc_purge_arenas);
#endif

factory.initializeWhiteList(keeper_dispatcher);
factory.setInitialize(true);
Expand Down Expand Up @@ -488,7 +490,7 @@ String LogInfoCommand::run()
KeeperLogInfo log_info = keeper_dispatcher.getKeeperLogInfo();
StringBuffer ret;

auto append = [&ret] (String key, uint64_t value) -> void
auto append = [&ret] (const String & key, uint64_t value) -> void
{
writeText(key, ret);
writeText("\t", ret);
Expand Down

0 comments on commit 4d453b4

Please sign in to comment.