mirror of https://github.com/citusdata/citus.git
Don't grab in additional locks cstore code when truncating
parent
5420dd6832
commit
f6279751e4
|
@ -718,7 +718,7 @@ FindCStoreTables(List *tableList)
|
||||||
foreach(relationCell, tableList)
|
foreach(relationCell, tableList)
|
||||||
{
|
{
|
||||||
RangeVar *rangeVar = (RangeVar *) lfirst(relationCell);
|
RangeVar *rangeVar = (RangeVar *) lfirst(relationCell);
|
||||||
Oid relationId = RangeVarGetRelid(rangeVar, AccessShareLock, true);
|
Oid relationId = RangeVarGetRelid(rangeVar, NoLock, true);
|
||||||
if (IsCStoreFdwTable(relationId) && !DistributedTable(relationId))
|
if (IsCStoreFdwTable(relationId) && !DistributedTable(relationId))
|
||||||
{
|
{
|
||||||
cstoreTableList = lappend(cstoreTableList, rangeVar);
|
cstoreTableList = lappend(cstoreTableList, rangeVar);
|
||||||
|
@ -758,6 +758,16 @@ OpenRelationsForTruncate(List *cstoreTableList)
|
||||||
{
|
{
|
||||||
heap_close(relation, AccessExclusiveLock);
|
heap_close(relation, AccessExclusiveLock);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Type of cstore tables can change since we checked last time,
|
||||||
|
* since we didn't hold a lock when checking.
|
||||||
|
*/
|
||||||
|
else if (!IsCStoreFdwTable(relationId))
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errmsg("relation \"%s\" not columnar anymore",
|
||||||
|
RelationGetRelationName(relation)),
|
||||||
|
errhint("try repeating the truncate command")));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
relationIdList = lappend_oid(relationIdList, relationId);
|
relationIdList = lappend_oid(relationIdList, relationId);
|
||||||
|
|
Loading…
Reference in New Issue