File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -950,8 +950,19 @@ repack_drop(PG_FUNCTION_ARGS)
950
950
repack_init ();
951
951
952
952
/*
953
- * To prevent concurrent lockers of the repack target table from
954
- * causing deadlocks, take an exclusive lock on it.
953
+ * To prevent concurrent lockers of the repack target table from causing
954
+ * deadlocks, take an exclusive lock on it. Consider that the following
955
+ * commands take exclusive lock on tables log_xxx and the target table
956
+ * itself when deleting the z_repack_trigger on it, while concurrent
957
+ * updaters require row exclusive lock on the target table and in
958
+ * addition, on the log_xxx table, because of the trigger.
959
+ *
960
+ * Consider how a deadlock could occur - if the DROP TABLE repack.log_%u
961
+ * gets a lock on log_%u table before a concurrent updater could get it
962
+ * but after the updater has obtained a lock on the target table, the
963
+ * subsequent DROP TRIGGER ... ON target-table would report a deadlock as
964
+ * it finds itself waiting for a lock on target-table held by the updater,
965
+ * which in turn, is waiting for lock on log_%u table.
955
966
*
956
967
* Fixes deadlock mentioned in the Github issue #55.
957
968
*/
You can’t perform that action at this time.
0 commit comments