From c0e4b1b7b8e981b0aadc43e96de40a952ed64c19 Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Tue, 8 Mar 2022 14:25:38 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=8D=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=BA=BF=E7=A8=8B=E6=B1=A0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=98=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Offering: openGaussDev More detail: 修复单用户模式下,使用未初始化线程池控制变量问题 Match-id-fd3c7865f75ad8a8a3ceef95feb1f721c50eca2e --- .../storage/access/ustore/undo/knl_uundoapi.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gausskernel/storage/access/ustore/undo/knl_uundoapi.cpp b/src/gausskernel/storage/access/ustore/undo/knl_uundoapi.cpp index f71e4b023..4dfa6deb3 100644 --- a/src/gausskernel/storage/access/ustore/undo/knl_uundoapi.cpp +++ b/src/gausskernel/storage/access/ustore/undo/knl_uundoapi.cpp @@ -33,8 +33,6 @@ #include "utils/builtins.h" namespace undo { -static uint64 g_maxUndoSizePerTrans = 0; - void AllocateTransSlot(UndoSlotPtr slotPtr, UndoZone *zone, TransactionId xid, UndoPersistence upersistence) { TransactionSlot *slot = zone->AllocTransactionSlot(slotPtr, xid, u_sess->proc_cxt.MyDatabaseId); @@ -67,9 +65,10 @@ bool CheckNeedSwitch(UndoPersistence upersistence, uint64 size, UndoRecPtr undoP void RollbackIfUndoExceeds(TransactionId xid, uint64 size) { t_thrd.undo_cxt.transUndoSize += size; - if ((!t_thrd.xlog_cxt.InRecovery) && (t_thrd.undo_cxt.transUndoSize > g_maxUndoSizePerTrans)) { + uint64 transUndoThresholdSize = (uint64)u_sess->attr.attr_storage.undo_limit_size_transaction * BLCKSZ; + if ((!t_thrd.xlog_cxt.InRecovery) && (t_thrd.undo_cxt.transUndoSize > transUndoThresholdSize)) { ereport(ERROR, (errmsg(UNDOFORMAT("xid %lu, the undo size %lu of the transaction exceeds the threshold %lu."), - xid, t_thrd.undo_cxt.transUndoSize, g_maxUndoSizePerTrans))); + xid, t_thrd.undo_cxt.transUndoSize, transUndoThresholdSize))); } return; } @@ -365,7 +364,7 @@ void InitUndoCountThreshold() uint32 maxThreadNum = 0; - if (g_instance.attr.attr_common.enable_thread_pool) { + if (ENABLE_THREAD_POOL) { maxThreadNum = g_threadPoolControler->GetThreadNum(); } @@ -571,8 +570,6 @@ void RecoveryUndoSystemMeta(void) } g_instance.undo_cxt.undoTotalSize = 0; g_instance.undo_cxt.undoMetaSize = 0; - g_maxUndoSizePerTrans = - (uint64)u_sess->attr.attr_storage.undo_limit_size_transaction * BLCKSZ; /* Recover undospace meta. */ undo::UndoZone::RecoveryUndoZone(fd); /* Recover undospace meta. */