RE: Re: Spilling hashed SetOps and aggregates to disk
От | serge@rielau.com |
---|---|
Тема | RE: Re: Spilling hashed SetOps and aggregates to disk |
Дата | |
Msg-id | 20180605083902.9cf3801d03770ada01bb39dc8f52321d.8e74dafc00.mailapi@email18.godaddy.com обсуждение исходный текст |
Ответ на | Re: Spilling hashed SetOps and aggregates to disk (Tomas Vondra <tomas.vondra@2ndquadrant.com>) |
Ответы |
Re: Re: Spilling hashed SetOps and aggregates to disk
|
Список | pgsql-hackers |
/*
* NOTE: Shared contexts stats are global and shared by
* all engines, so, never add the size directly, instead
* use stats API which uses Atomic.*() calls to ensure
* mutual exclusion.
*/
static void MaintainAllocStats(MemoryContext context, Size size)
{
if (context->stats)
{
if (!context->isShared)
{
sMonAdd(memory_context_stats, TotalBackendAllocated_Size, size);
sMonHWM(memory_context_stats, TotalBackendAllocated_HWM,
sMonGet(memory_context_stats, TotalBackendAllocated_Size));
context->allocatedSize += size;
context->stats[0] += size;
context->stats[1] = (context->stats[1] >= context->stats[0] ?
context->stats[1] : context->stats[0]);
}
else
{
if (!context->isNested)
size += SHM_BLOCK_OVERHEAD;
sAtomicAdd(&context->allocatedSize, size);
if (!context->isNested ||
!context->clusterrep ||
context->clusterrep->stats != context->stats)
sAtomicAdd(context->stats, size);
}
}
}
Serge
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: