提交 e5496129 编写于 作者: X xiong-gang 提交者: GitHub

Remove incorrect assertion on memory limit of resource queue

Current implementation of resource queue can not guaranty the strong
consistency of configuration of resource limit between catalog and
shared memory, so AssertMemoryLimitsMatch() is incorrect and
unreasonable. We may need to guaranty the consistency some day, but for
now just remove the obvious wrong assertion.
上级 36d10512
......@@ -961,14 +961,6 @@ CreateQueue(CreateQueueStmt *stmt)
overcommit,
ignorelimit);
/**
* Ensure that the shared data structures are consistent with
* the catalog table on memory limits.
*/
#ifdef USE_ASSERT_CHECKING
AssertMemoryLimitsMatch();
#endif
LWLockRelease(ResQueueLock);
if (!queueok)
......@@ -1375,14 +1367,6 @@ AlterQueue(AlterQueueStmt *stmt)
overcommit,
ignorelimit);
/**
* Ensure that the shared data structures are consistent with
* the catalog table on memory limits.
*/
#ifdef USE_ASSERT_CHECKING
AssertMemoryLimitsMatch();
#endif
LWLockRelease(ResQueueLock);
if (queueok != ALTERQUEUE_OK)
......@@ -1534,14 +1518,6 @@ DropQueue(DropQueueStmt *stmt)
queueok = ResDestroyQueue(queueid);
/**
* Ensure that the shared data structures are consistent with
* the catalog table on memory limits.
*/
#ifdef USE_ASSERT_CHECKING
AssertMemoryLimitsMatch();
#endif
LWLockRelease(ResQueueLock);
if (!queueok)
......
......@@ -2004,42 +2004,3 @@ pg_resqueue_status_kv(PG_FUNCTION_ARGS)
else
SRF_RETURN_DONE(funcctx);
}
#ifdef USE_ASSERT_CHECKING
/**
* Checks that in-memory data-structures are consistent with the catalog table.
* This operation can only be performed when we have the ResQueueLock.
*/
void
AssertMemoryLimitsMatch(void)
{
Assert(LWLockHeldExclusiveByMe(ResQueueLock));
HASH_SEQ_STATUS status;
/* Initialize for a sequential scan of the resource queue hash. */
hash_seq_init(&status, ResQueueHash);
ResQueue queue = NULL;
while ((queue = (ResQueue) hash_seq_search(&status)) != NULL)
{
Oid queueId = queue->queueid;
Assert(queueId != InvalidOid);
double v1 = ceil(queue->limits[RES_MEMORY_LIMIT].threshold_value);
double v2 = ceil((double) ResourceQueueGetMemoryLimitInCatalog(queueId));
if (gp_log_resqueue_memory)
{
elog(gp_resqueue_memory_log_level, "Memory limit for queue %d is %.0f in catalog and %.0f in shared mem", queueId, v2, v1);
}
AssertImply(gp_resqueue_memory_policy != RESQUEUE_MEMORY_POLICY_NONE,
v1 == v2 && "Resource queue / shared structure do not match on memory limit in policy AUTO.");
}
return;
}
#endif
......@@ -172,11 +172,4 @@ extern void AtAbort_ResScheduler(void);
extern void ResHandleUtilityStmt(Portal portal, Node *stmt);
extern bool ResLockUtilityPortal(Portal portal, float4 ignoreCostLimit);
/**
* Assert that the in-memory state matches the catalog table.
*/
#ifdef USE_ASSERT_CHECKING
extern void AssertMemoryLimitsMatch(void);
#endif
#endif /* RESSCHEDULER_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册