mirror of https://github.com/citusdata/citus.git
Do not acquire locks if the index does not exist
parent
3c4cec827d
commit
914aa87c4e
|
@ -748,16 +748,6 @@ PreprocessDropIndexStmt(Node *node, const char *dropIndexCommand,
|
||||||
lockmode = ShareUpdateExclusiveLock;
|
lockmode = ShareUpdateExclusiveLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Acquire global lock to prevent concurrent writes or DDL. However,
|
|
||||||
* we do not bother for DROP INDEX CONCURRENTLY, since we'll have
|
|
||||||
* to release the lock.
|
|
||||||
*/
|
|
||||||
if (!dropIndexStatement->concurrent)
|
|
||||||
{
|
|
||||||
AcquireDistributedLockOnRelations(list_make1(rangeVar), lockmode, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The next few statements are based on RemoveRelations() in
|
* The next few statements are based on RemoveRelations() in
|
||||||
* commands/tablecmds.c in Postgres source.
|
* commands/tablecmds.c in Postgres source.
|
||||||
|
@ -781,6 +771,16 @@ PreprocessDropIndexStmt(Node *node, const char *dropIndexCommand,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Acquire global lock to prevent concurrent writes or DDL. However,
|
||||||
|
* we do not bother for DROP INDEX CONCURRENTLY, since we'll have
|
||||||
|
* to release the lock.
|
||||||
|
*/
|
||||||
|
if (!dropIndexStatement->concurrent)
|
||||||
|
{
|
||||||
|
AcquireDistributedLockOnRelations(list_make1(rangeVar), lockmode, 0);
|
||||||
|
}
|
||||||
|
|
||||||
Oid relationId = IndexGetRelation(indexId, false);
|
Oid relationId = IndexGetRelation(indexId, false);
|
||||||
bool isCitusRelation = IsCitusTable(relationId);
|
bool isCitusRelation = IsCitusTable(relationId);
|
||||||
if (isCitusRelation)
|
if (isCitusRelation)
|
||||||
|
|
|
@ -68,8 +68,9 @@ step s2-begin: BEGIN;
|
||||||
step s1-drop: DROP TABLE drop_hash;
|
step s1-drop: DROP TABLE drop_hash;
|
||||||
step s2-ddl-create-index: CREATE INDEX drop_hash_index ON drop_hash(id); <waiting ...>
|
step s2-ddl-create-index: CREATE INDEX drop_hash_index ON drop_hash(id); <waiting ...>
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
|
s2: WARNING: relation "drop_tests.drop_hash" does not exist
|
||||||
step s2-ddl-create-index: <... completed>
|
step s2-ddl-create-index: <... completed>
|
||||||
ERROR: relation "drop_hash" does not exist
|
ERROR: failure on connection marked as essential: localhost:xxxxx
|
||||||
step s2-commit: COMMIT;
|
step s2-commit: COMMIT;
|
||||||
step s1-select-count: SELECT COUNT(*) FROM drop_hash;
|
step s1-select-count: SELECT COUNT(*) FROM drop_hash;
|
||||||
ERROR: relation "drop_hash" does not exist
|
ERROR: relation "drop_hash" does not exist
|
||||||
|
|
|
@ -140,7 +140,7 @@ step s2-begin:
|
||||||
step s2-index:
|
step s2-index:
|
||||||
CREATE INDEX test_index ON test_table(column1);
|
CREATE INDEX test_index ON test_table(column1);
|
||||||
|
|
||||||
ERROR: must be owner of table test_table
|
ERROR: permission denied for table test_table
|
||||||
step s1-insert:
|
step s1-insert:
|
||||||
UPDATE test_table SET column2 = 1;
|
UPDATE test_table SET column2 = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue