mirror of https://github.com/citusdata/citus.git
Populate DATABASEOID cache before CREATE INDEX CONCURRENTLY
(cherry picked from commit affe38eac6
)
pull/5009/head
parent
ad9469b351
commit
61a89c69cd
|
@ -910,6 +910,19 @@ ExecuteDistributedDDLJob(DDLJob *ddlJob)
|
||||||
*/
|
*/
|
||||||
if (ddlJob->startNewTransaction)
|
if (ddlJob->startNewTransaction)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If cache is not populated, system catalog lookups will cause
|
||||||
|
* the xmin of current backend to change. Then the last phase
|
||||||
|
* of CREATE INDEX CONCURRENTLY, which is in a separate backend,
|
||||||
|
* will hang waiting for our backend and result in a deadlock.
|
||||||
|
*
|
||||||
|
* We populate the cache before starting the next transaction to
|
||||||
|
* avoid this. Most of the metadata has already been resolved in
|
||||||
|
* planning phase, we only need to lookup metadata needed for
|
||||||
|
* connection establishment.
|
||||||
|
*/
|
||||||
|
(void) CurrentDatabaseName();
|
||||||
|
|
||||||
CommitTransactionCommand();
|
CommitTransactionCommand();
|
||||||
StartTransactionCommand();
|
StartTransactionCommand();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue