修复单用户模式下,使用未初始化线程池控制变量问题

Offering: openGaussDev

More detail: 修复单用户模式下,使用未初始化线程池控制变量问题

Match-id-fd3c7865f75ad8a8a3ceef95feb1f721c50eca2e
This commit is contained in:
openGaussDev 2022-03-08 14:25:38 +08:00 committed by yanghao
parent 4f86334f04
commit c0e4b1b7b8
1 changed files with 4 additions and 7 deletions

View File

@ -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. */