提交 57d590f9 编写于 作者: H Heikki Linnakangas

Remove caql_indexOK option.

There was only one caller left, and it was quite superfluous. I don't see
a need to explicitly not use an index here. Also, there were no quals on
the query, so you couldn't possibly use an an index for it.
上级 43dc290d
......@@ -233,10 +233,6 @@ caql_basic_fn_all(caql_hash_cookie *pchn, cqContext *pCtx,
int i, numScanKeys;
List *predicates;
ListCell *l;
bool can_use_idxOK;
/* the caller states no index scan? */
can_use_idxOK = !(pCtx->cq_setidxOK && !pCtx->cq_useidxOK);
pCtx->cq_relationId = pchn->relation->relid;
......@@ -286,7 +282,7 @@ caql_basic_fn_all(caql_hash_cookie *pchn, cqContext *pCtx,
/*
* Use index scan if available and unless the caller states otherwise.
*/
if (index && can_use_idxOK)
if (index)
{
scanIndexId = index->indexoid;
pCtx->cq_useidxOK = true;
......
......@@ -127,21 +127,6 @@ cqContext *caql_addrel(cqContext *pCtx, Relation rel)
return (pCtx);
}
/* ----------------------------------------------------------------
* caql_indexOK()
*
* if false, force a heapscan
* ----------------------------------------------------------------
*/
cqContext *caql_indexOK(cqContext *pCtx, bool bindexOK)
{
pCtx->cq_setidxOK = true;
pCtx->cq_useidxOK = bindexOK;
return (pCtx);
}
/* ----------------------------------------------------------------
* caql_snapshot()
*
......@@ -617,8 +602,7 @@ HeapTuple caql_getattname(cqContext *pCtx, Oid relid, const char *attname)
pCtx->cq_heap_rel = InvalidRelation;
}
if (!pCtx->cq_setidxOK)
pCtx->cq_useidxOK = true;
pCtx->cq_useidxOK = true;
pCtx->cq_lasttup = tup;
}
......@@ -677,8 +661,7 @@ caql_getattname_scan(cqContext *pCtx0, Oid relid, const char *attname)
pCtx->cq_heap_rel = InvalidRelation;
}
if (!pCtx->cq_setidxOK)
pCtx->cq_useidxOK = true;
pCtx->cq_useidxOK = true;
pCtx->cq_freeScan = true;
pCtx->cq_EOF = true;
......
......@@ -256,10 +256,9 @@ test__caql_switch4(void **state)
hash_cookie = cq_lookup(query, strlen(query), pcql);
/*
* Add explicit relation, and set indexOK = true
* Add explicit relation
*/
pCtx = caql_addrel(cqclr(&context), &dummyrel);
pCtx = caql_indexOK(pCtx, true);
/* setup ScanKeyInit */
expect__ScanKeyInit(NULL, false,
......@@ -310,10 +309,9 @@ test__caql_switch5(void **state)
hash_cookie = cq_lookup(query, strlen(query), pcql);
/*
* Add explicit relation, and set indexOK = true
* Add explicit relation
*/
pCtx = caql_addrel(cqclr(&context), &dummyrel);
pCtx = caql_indexOK(pCtx, true);
/* setup ScanKeyInit */
expect__ScanKeyInit(NULL, false,
......
......@@ -174,12 +174,10 @@ InitResPortalIncrementHash(void)
void
InitResQueues(void)
{
HeapTuple tuple;
int numQueues = 0;
bool queuesok = true;
cqContext *pcqCtx;
cqContext cqc;
SysScanDesc sscan;
Assert(ResScheduler);
......@@ -199,6 +197,7 @@ InitResQueues(void)
* So, we must have obtained ResQueueRelationId and ResQueueCapabilityRelationId lock
* first.
*/
/* XXX XXX: should this be rowexclusive ? */
Relation relResqueue = heap_open(ResQueueRelationId, AccessShareLock);
LockRelationOid(ResQueueCapabilityRelationId, RowExclusiveLock);
LWLockAcquire(ResQueueLock, LW_EXCLUSIVE);
......@@ -214,14 +213,8 @@ InitResQueues(void)
return;
}
/* XXX XXX: should this be rowexclusive ? */
pcqCtx = caql_beginscan(
caql_indexOK(
caql_addrel(cqclr(&cqc), relResqueue),
false),
cql("SELECT * FROM pg_resqueue ", NULL));
while (HeapTupleIsValid(tuple = caql_getnext(pcqCtx)))
sscan = systable_beginscan(relResqueue, InvalidOid, false, SnapshotNow, 0, NULL);
while (HeapTupleIsValid(tuple = systable_getnext(sscan)))
{
Form_pg_resqueue queueform;
Oid queueid;
......@@ -251,7 +244,7 @@ InitResQueues(void)
}
}
caql_endscan(pcqCtx);
systable_endscan(sscan);
LWLockRelease(ResQueueLock);
UnlockRelationOid(ResQueueCapabilityRelationId, RowExclusiveLock);
heap_close(relResqueue, AccessShareLock);
......
......@@ -71,7 +71,6 @@ typedef struct cqContextData
LOCKMODE cq_lockmode; /* locking mode */
bool cq_EOF; /* true if hit end of fetch */
bool cq_setidxOK; /* set the indexOK mode */
bool cq_useidxOK; /* use supplied indexOK mode) */
bool cq_pklock_excl; /* lock exclusive if true */
......@@ -183,7 +182,6 @@ cq_list *cql1(const char* caqlStr, const char* filename, int lineno, ...);
* future releases
*/
cqContext *caql_addrel(cqContext *pCtx, Relation rel); /* */
cqContext *caql_indexOK(cqContext *pCtx, bool bindexOK); /* */
cqContext *caql_snapshot(cqContext *pCtx, Snapshot ss); /* */
cqContext *cqclr(cqContext *pCtx); /* */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册