mirror of https://github.com/citusdata/citus.git
Keep read lock until we are done with table relation.
parent
c893454bb8
commit
7d04b40b2d
|
@ -1131,7 +1131,7 @@ DropIdentitiesOnTable(Oid relationId)
|
|||
{
|
||||
Relation relation = relation_open(relationId, AccessShareLock);
|
||||
TupleDesc tupleDescriptor = RelationGetDescr(relation);
|
||||
relation_close(relation, NoLock);
|
||||
List *dropCommandList = NIL;
|
||||
|
||||
for (int attributeIndex = 0; attributeIndex < tupleDescriptor->natts;
|
||||
attributeIndex++)
|
||||
|
@ -1151,16 +1151,25 @@ DropIdentitiesOnTable(Oid relationId)
|
|||
qualifiedTableName,
|
||||
columnName);
|
||||
|
||||
dropCommandList = lappend(dropCommandList, dropCommand->data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
relation_close(relation, NoLock);
|
||||
|
||||
char *dropCommand = NULL;
|
||||
foreach_ptr(dropCommand, dropCommandList)
|
||||
{
|
||||
/*
|
||||
* We need to disable/enable ddl propagation for this command, to prevent
|
||||
* sending unnecessary ALTER COLUMN commands for partitions, to MX workers.
|
||||
*/
|
||||
ExecuteAndLogUtilityCommandList(list_make3(DISABLE_DDL_PROPAGATION,
|
||||
dropCommand->data,
|
||||
dropCommand,
|
||||
ENABLE_DDL_PROPAGATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1896,7 +1896,6 @@ IdentitySequenceDependencyCommandList(Oid targetRelationId)
|
|||
|
||||
Relation relation = relation_open(targetRelationId, AccessShareLock);
|
||||
TupleDesc tupleDescriptor = RelationGetDescr(relation);
|
||||
relation_close(relation, NoLock);
|
||||
|
||||
bool tableHasIdentityColumn = false;
|
||||
for (int attributeIndex = 0; attributeIndex < tupleDescriptor->natts;
|
||||
|
@ -1911,6 +1910,8 @@ IdentitySequenceDependencyCommandList(Oid targetRelationId)
|
|||
}
|
||||
}
|
||||
|
||||
relation_close(relation, NoLock);
|
||||
|
||||
if (tableHasIdentityColumn)
|
||||
{
|
||||
StringInfo stringInfo = makeStringInfo();
|
||||
|
|
|
@ -151,7 +151,6 @@ worker_modify_identity_columns(PG_FUNCTION_ARGS)
|
|||
|
||||
Relation tableRelation = relation_open(tableRelationId, AccessShareLock);
|
||||
TupleDesc tableTupleDesc = RelationGetDescr(tableRelation);
|
||||
relation_close(tableRelation, NoLock);
|
||||
|
||||
bool missingSequenceOk = false;
|
||||
|
||||
|
@ -177,6 +176,8 @@ worker_modify_identity_columns(PG_FUNCTION_ARGS)
|
|||
}
|
||||
}
|
||||
|
||||
relation_close(tableRelation, NoLock);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue