diff options
| author | martinko | 2014-02-19 12:44:58 +0000 |
|---|---|---|
| committer | martinko | 2014-02-19 12:44:58 +0000 |
| commit | f847875a1072e17eb98962260040926c2322228f (patch) | |
| tree | 7e576d871dd917a1dbeb37c0dd922eb83c7c9f65 | |
| parent | bba8a4d4370a9085d0fd74ebe61e6fb98622ef62 (diff) | |
londiste.create_partition: fixed to avoid deadlocks from concurrent workers
| -rw-r--r-- | sql/londiste/functions/londiste.create_partition.sql | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/londiste/functions/londiste.create_partition.sql b/sql/londiste/functions/londiste.create_partition.sql index 1a59e2ee..168aedfd 100644 --- a/sql/londiste/functions/londiste.create_partition.sql +++ b/sql/londiste/functions/londiste.create_partition.sql @@ -8,10 +8,10 @@ create or replace function londiste.create_partition( i_part_period text ) returns int as $$ ------------------------------------------------------------------------ --- Function: public.create_partition +-- Function: londiste.create_partition -- -- Creates inherited child table if it does not exist by copying parent table's structure. --- Locks parent table to avoid parallel creation. +-- Locks londiste.table_info table to avoid parallel creation of any partitions. -- -- Elements that are copied over by "LIKE x INCLUDING ALL": -- * Defaults @@ -91,7 +91,8 @@ begin fq_part := quote_ident(part_schema) || '.' || quote_ident(part_name); -- allow only single creation at a time, without affecting DML operations - execute 'lock table ' || fq_table || ' in share update exclusive mode'; + -- (changed from locking parent table to avoid deadlocks from concurrent workers) + execute 'lock table londiste.table_info in share update exclusive mode'; parent_oid := fq_table::regclass::oid; -- check if part table exists |
