Remove FastShardPruning method

With the other simplifications, it doesn't make sense to keep around.
pull/1353/head
Jason Petersen 2017-04-27 13:15:48 -06:00
parent 42ee7c05f5
commit 93e3afc25c
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
3 changed files with 5 additions and 26 deletions

View File

@ -1974,8 +1974,9 @@ FindShardForInsert(Query *query, DeferredErrorMessage **planningError)
if (partitionMethod == DISTRIBUTE_BY_HASH || partitionMethod == DISTRIBUTE_BY_RANGE)
{
Datum partitionValue = partitionValueConst->constvalue;
ShardInterval *shardInterval = FastShardPruning(distributedTableId,
partitionValue);
DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(distributedTableId);
ShardInterval *shardInterval = FindShardInterval(partitionValue, cacheEntry);
if (shardInterval != NULL)
{
prunedShardList = list_make1(shardInterval);
@ -2047,28 +2048,6 @@ FindShardForInsert(Query *query, DeferredErrorMessage **planningError)
}
/*
* FastShardPruning is a higher level API for FindShardInterval function. Given the
* relationId of the distributed table and partitionValue, FastShardPruning function finds
* the corresponding shard interval that the partitionValue should be in. FastShardPruning
* returns NULL if no ShardIntervals exist for the given partitionValue.
*/
ShardInterval *
FastShardPruning(Oid distributedTableId, Datum partitionValue)
{
DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(distributedTableId);
ShardInterval *shardInterval = NULL;
/*
* Call FindShardInterval to find the corresponding shard interval for the
* given partition value.
*/
shardInterval = FindShardInterval(partitionValue, cacheEntry);
return shardInterval;
}
/*
* FindShardForUpdateOrDelete finds the shard interval in which an UPDATE or
* DELETE command should be applied, or sets planningError when the query

View File

@ -332,6 +332,7 @@ get_shard_id_for_distribution_column(PG_FUNCTION_ARGS)
char *distributionValueString = NULL;
Datum inputDatum = 0;
Datum distributionValueDatum = 0;
DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(relationId);
/* if given table is not reference table, distributionValue cannot be NULL */
if (PG_ARGISNULL(1))
@ -351,7 +352,7 @@ get_shard_id_for_distribution_column(PG_FUNCTION_ARGS)
distributionValueDatum = StringToDatum(distributionValueString,
distributionDataType);
shardInterval = FastShardPruning(relationId, distributionValueDatum);
shardInterval = FindShardInterval(distributionValueDatum, cacheEntry);
}
else
{

View File

@ -44,7 +44,6 @@ extern void AddShardIntervalRestrictionToSelect(Query *subqery,
ShardInterval *shardInterval);
extern ShardInterval * FindShardForInsert(Query *query,
DeferredErrorMessage **planningError);
extern ShardInterval * FastShardPruning(Oid distributedTableId, Datum partitionValue);
#endif /* MULTI_ROUTER_PLANNER_H */