!2874 autovacuum launcher线程开始时重置queryMemInChunks相关变量
Merge pull request !2874 from CCA/fixbug
This commit is contained in:
@ -580,16 +580,6 @@ static bool memTracker_ReserveMemChunks(int32 numChunksToReserve, bool needProte
|
||||
|
||||
Assert(0 < numChunksToReserve);
|
||||
|
||||
/* query level memory verification */
|
||||
if (t_thrd.shemem_ptr_cxt.mySessionMemoryEntry && type != MEM_SHRD) {
|
||||
/* 1. increase memory in chunk at query level */
|
||||
total = gs_atomic_add_32(&(t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->queryMemInChunks), numChunksToReserve);
|
||||
|
||||
/* 2. update the peak memory of the query */
|
||||
if (t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->peakChunksQuery < total)
|
||||
gs_lock_test_and_set(&(t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->peakChunksQuery), total);
|
||||
}
|
||||
|
||||
/* increase chunk quota at global gaussdb process level */
|
||||
if (t_thrd.utils_cxt.backend_reserved) {
|
||||
currSize = &backendUsedMemInChunk;
|
||||
@ -611,6 +601,16 @@ static bool memTracker_ReserveMemChunks(int32 numChunksToReserve, bool needProte
|
||||
t_thrd.utils_cxt.beyondChunk = 0;
|
||||
}
|
||||
|
||||
/* query level memory verification */
|
||||
if (t_thrd.shemem_ptr_cxt.mySessionMemoryEntry && type != MEM_SHRD) {
|
||||
/* 1. increase memory in chunk at query level */
|
||||
total = gs_atomic_add_32(&(t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->queryMemInChunks), numChunksToReserve);
|
||||
|
||||
/* 2. update the peak memory of the query */
|
||||
if (t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->peakChunksQuery < total)
|
||||
gs_lock_test_and_set(&(t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->peakChunksQuery), total);
|
||||
}
|
||||
|
||||
if (peakChunksPerProcess < processMemInChunks + backendUsedMemInChunk) {
|
||||
peakChunksPerProcess = processMemInChunks + backendUsedMemInChunk;
|
||||
|
||||
|
@ -395,6 +395,14 @@ NON_EXEC_STATIC void AutoVacLauncherMain()
|
||||
|
||||
t_thrd.autovacuum_cxt.AutoVacuumShmem->av_launcherpid = t_thrd.proc_cxt.MyProcPid;
|
||||
|
||||
if (likely(t_thrd.shemem_ptr_cxt.mySessionMemoryEntry != NULL)) {
|
||||
t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->initMemInChunks = t_thrd.utils_cxt.trackedMemChunks;
|
||||
t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->queryMemInChunks = t_thrd.utils_cxt.trackedMemChunks;
|
||||
t_thrd.shemem_ptr_cxt.mySessionMemoryEntry->peakChunksQuery = t_thrd.utils_cxt.trackedMemChunks;
|
||||
}
|
||||
t_thrd.utils_cxt.peakedBytesInQueryLifeCycle = 0;
|
||||
t_thrd.utils_cxt.basedBytesInQueryLifeCycle = 0;
|
||||
|
||||
/*
|
||||
* Create the initial database list. The invariant we want this list to
|
||||
* keep is that it's ordered by decreasing next_time. As soon as an entry
|
||||
|
Reference in New Issue
Block a user