Skip to content

Commit 65a91a3

Browse files
ti-chi-botCalvinNeoJaySon-Huang
authored
Re-enable jemalloc's background thread by default (#9813) (#9814)
ref #9722, close #9812 Re-enable jemalloc's background thread by default Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Signed-off-by: JaySon-Huang <tshent@qq.com> Co-authored-by: Calvin Neo <CalvinNeo@users.noreply.github.com> Co-authored-by: JaySon-Huang <tshent@qq.com> Co-authored-by: JaySon <tshent@qq.com>
1 parent 3034774 commit 65a91a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dbms/src/Server/Server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ void UpdateMallocConfig([[maybe_unused]] const LoggerPtr & log)
379379
RUN_FAIL_RETURN(je_mallctl("opt.background_thread", (void *)&old_b, &sz_b, nullptr, 0));
380380
RUN_FAIL_RETURN(je_mallctl("opt.max_background_threads", (void *)&old_max_thd, &sz_st, nullptr, 0));
381381

382-
LOG_INFO(log, "Got jemalloc config: opt.background_thread {}, opt.max_background_threads {}", old_b, old_max_thd);
383-
384-
if (!malloc_conf && !old_b)
382+
bool not_config_bg = !malloc_conf || strstr(malloc_conf, "background_thread") == nullptr;
383+
if (not_config_bg && !old_b)
385384
{
385+
// If the user doesn't explicitly set the background_thread opt, and it is actually false, then set it to true.
386386
LOG_INFO(log, "Try to use background_thread of jemalloc to handle purging asynchronously");
387387

388388
RUN_FAIL_RETURN(je_mallctl("max_background_threads", nullptr, nullptr, (void *)&new_max_thd, sz_st));

0 commit comments

Comments
 (0)