mirror of https://github.com/citusdata/citus.git
Don't grab in additional locks cstore code when truncating
parent
d065bb495d
commit
691fdb2c64
|
@ -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,17 @@ 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);
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
* These are the same values from src/backend/access/heap/vacuumlazy.c
|
* These are the same values from src/backend/access/heap/vacuumlazy.c
|
||||||
*/
|
*/
|
||||||
#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */
|
#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */
|
||||||
#define VACUUM_TRUNCATE_LOCK_TIMEOUT 5000 /* ms */
|
#define VACUUM_TRUNCATE_LOCK_TIMEOUT 4500 /* ms */
|
||||||
|
|
||||||
typedef struct CStoreScanDescData
|
typedef struct CStoreScanDescData
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue