From beb349ecc4748f9ccbd8f47e6765e69ecc3ba03c Mon Sep 17 00:00:00 2001 From: tino247 Date: Mon, 26 Aug 2024 14:36:19 +0800 Subject: [PATCH] [VACUUM] Fix tidstore core problem when disable_memory_stats is on --- src/gausskernel/storage/access/common/tidstore.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/storage/access/common/tidstore.cpp b/src/gausskernel/storage/access/common/tidstore.cpp index 3f8f3fd76..cb16c7fa1 100644 --- a/src/gausskernel/storage/access/common/tidstore.cpp +++ b/src/gausskernel/storage/access/common/tidstore.cpp @@ -172,8 +172,13 @@ TidStoreCreateLocal(size_t max_bytes, bool insert_only) * * STACK_CONTEXT can reduce memory bloat problem for * such a multi small memory allocation scene. + * + * Since disable_memory_stats = on is suitable for + * STANDARD_CONTEXT only, STACK_CONTEXT won't be used + * when such a switch is on. */ - MemoryContextType type = insert_only ? STACK_CONTEXT : STANDARD_CONTEXT; + MemoryContextType type = (insert_only && !g_instance.attr.attr_memory.disable_memory_stats) ? + STACK_CONTEXT : STANDARD_CONTEXT; ts->rt_context = AllocSetContextCreate(CurrentMemoryContext, "TID storage", minContextSize,