mirror of https://github.com/citusdata/citus.git
lock while initializing relfilenode
parent
b18c9c8060
commit
a2f7eadeb9
|
@ -948,12 +948,21 @@ InitializeRelFileNode(Relation relation)
|
||||||
|
|
||||||
if (!OidIsValid(classform->relfilenode))
|
if (!OidIsValid(classform->relfilenode))
|
||||||
{
|
{
|
||||||
|
Relation tmprel;
|
||||||
Oid tablespace;
|
Oid tablespace;
|
||||||
Oid filenode = relation->rd_id;
|
Oid filenode = relation->rd_id;
|
||||||
char persistence = relation->rd_rel->relpersistence;
|
char persistence = relation->rd_rel->relpersistence;
|
||||||
RelFileNode newrnode;
|
RelFileNode newrnode;
|
||||||
SMgrRelation srel;
|
SMgrRelation srel;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Upgrade to AccessExclusiveLock, and hold until the end of the
|
||||||
|
* transaction. This shouldn't happen during a read, but it's hard to
|
||||||
|
* prove that because it happens lazily.
|
||||||
|
*/
|
||||||
|
tmprel = heap_open(relation->rd_id, AccessExclusiveLock);
|
||||||
|
heap_close(tmprel, NoLock);
|
||||||
|
|
||||||
if (OidIsValid(relation->rd_rel->reltablespace))
|
if (OidIsValid(relation->rd_rel->reltablespace))
|
||||||
tablespace = relation->rd_rel->reltablespace;
|
tablespace = relation->rd_rel->reltablespace;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue