mirror of https://github.com/citusdata/citus.git
Cache whether an object is in pg_dist_object. Avoids redundant lookups for non-distributed objects
parent
2a47cff7b7
commit
dd490b6376
|
@ -54,7 +54,7 @@ CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *dest)
|
||||||
Oid functionId = funcExpr->funcid;
|
Oid functionId = funcExpr->funcid;
|
||||||
|
|
||||||
procedure = LookupDistObjectCacheEntry(ProcedureRelationId, functionId, 0);
|
procedure = LookupDistObjectCacheEntry(ProcedureRelationId, functionId, 0);
|
||||||
if (procedure == NULL)
|
if (procedure == NULL || !procedure->isDistributed)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ TryToDelegateFunctionCall(Query *query, bool *hasExternParam)
|
||||||
|
|
||||||
funcExpr = (FuncExpr *) targetEntry->expr;
|
funcExpr = (FuncExpr *) targetEntry->expr;
|
||||||
procedure = LookupDistObjectCacheEntry(ProcedureRelationId, funcExpr->funcid, 0);
|
procedure = LookupDistObjectCacheEntry(ProcedureRelationId, funcExpr->funcid, 0);
|
||||||
if (procedure == NULL)
|
if (procedure == NULL || !procedure->isDistributed)
|
||||||
{
|
{
|
||||||
/* not a distributed function call */
|
/* not a distributed function call */
|
||||||
ereport(DEBUG4, (errmsg("function is not distributed")));
|
ereport(DEBUG4, (errmsg("function is not distributed")));
|
||||||
|
|
|
@ -991,6 +991,7 @@ LookupDistObjectCacheEntry(Oid classid, Oid objid, int32 objsubid)
|
||||||
isNullArray);
|
isNullArray);
|
||||||
|
|
||||||
cacheEntry->isValid = true;
|
cacheEntry->isValid = true;
|
||||||
|
cacheEntry->isDistributed = true;
|
||||||
|
|
||||||
cacheEntry->distributionArgIndex =
|
cacheEntry->distributionArgIndex =
|
||||||
DatumGetInt32(datumArray[Anum_pg_dist_object_distribution_argument_index -
|
DatumGetInt32(datumArray[Anum_pg_dist_object_distribution_argument_index -
|
||||||
|
@ -1000,8 +1001,8 @@ LookupDistObjectCacheEntry(Oid classid, Oid objid, int32 objsubid)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* return NULL, cacheEntry left invalid in hash table */
|
cacheEntry->isValid = true;
|
||||||
cacheEntry = NULL;
|
cacheEntry->isDistributed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
systable_endscan(pgDistObjectScan);
|
systable_endscan(pgDistObjectScan);
|
||||||
|
|
|
@ -110,6 +110,7 @@ typedef struct DistObjectCacheEntry
|
||||||
DistObjectCacheEntryKey key;
|
DistObjectCacheEntryKey key;
|
||||||
|
|
||||||
bool isValid;
|
bool isValid;
|
||||||
|
bool isDistributed;
|
||||||
|
|
||||||
int distributionArgIndex;
|
int distributionArgIndex;
|
||||||
int colocationId;
|
int colocationId;
|
||||||
|
|
Loading…
Reference in New Issue