On Mon, 7 Apr 2025 at 18:09, Álvaro Herrera <alvhe...@alvh.no-ip.org> wrote: > > Here's the additional changes I made here before giving up on this. > I think it needs some additional rethinking, not going to happen for 18. >
Hi Alvaro, Thanks for reviewing the patch. The changes shared by you in [1], look good to me and I have added it to the latest patch. I have also included the changes shared by you in [2]. I have also addressed the issue reported by Sergey in [3]. Additionally, I made some changes to the comments, commit message and documentation to reflect the changes in the function name and to reduce the usage of 'foreign partition' term. I saw some comments by you in the patches: 1. + /* + * Keep lock till end of transaction: must prevent this table from + * being attached a foreign table until we're done. XXX does this + * prevent addition of a partition in a partitioned child? + */ This is same as the issue reported by Sergey in [3]. I have addressed the issue in the latest patch. So, I have modified this comment. 2. + * We also take a ShareLock on pg_partitioned_table to restrict addition + * of new partitioned table which may contain a foreign partition while + * publication is being created. XXX this is quite weird actually. This change was added to resolve the concurrency issue shared by Vignesh in [4]. I tried with different locks and found that lock with severity >= ShareLock was needed to avoid the concurrency issue. Initially I added ShareLock to pg_class, but to reduce the scope I added it to pg_partitioned_table instead. I cannot think of an alternate approach. Do you have any suggestions for this? [1]: https://www.postgresql.org/message-id/202504062027.tqmabk2h353o%40alvherre.pgsql [2]: https://www.postgresql.org/message-id/202504071239.kuj6m5a5wqxg%40alvherre.pgsql [3]: https://www.postgresql.org/message-id/c64352fa-9a30-4e0a-853a-a6b5b6d07f4e%40postgrespro.ru [4]: https://www.postgresql.org/message-id/CALDaNm2%2BeL22Sbvj74uS37xvt%3DhaQWcOwP15QnDuVeYsjHiffw%40mail.gmail.com Thanks and Regards, Shlok Kyal
v13-0001-Restrict-publishing-of-partitioned-table-with-fo.patch
Description: Binary data