Dear Cagri,

Thanks for the patch. I have comments for v7.

```
+       /*
+        * The relation set is now known to be fed by this subscription alone, 
and
+        * this subscription has no running workers, so nothing that replicates
+        * into these relations is still holding them.  Take the level the
+        * truncate needs.
+        */
+       foreach_oid(relid, relids)
+               LockRelationOid(relid, AccessExclusiveLock);
```

Here we does not acquire a lock for the root table if the publication publishes
only leaves. So subscriptions can be created after
CheckRefreshTableNotInOtherSubscriptions(). I considered a race condition due to
this with LLM: See attached patch.

Also, I found the test could fail like:

```
[14:44:37.892](0.014s) not ok 35 - only the named inheritance parent is reset
[14:44:37.893](0.000s) #   Failed test 'only the named inheritance parent is 
reset'
#   at /home/hayato/postgres/src/test/subscription/t/039_refresh_table.pl line 
407.
[14:44:37.893](0.000s) #          got: 'tab_inh_c=s,tab_inh_p=i'
#     expected: 'tab_inh_c=r,tab_inh_p=i'
```

It tried to ensure the tab_inh_c was synchronized, right? Should accept 's'

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment: 0001-Reproducer-race-condition-with-CREATE-SUBSCRIPTION.patch
Description: 0001-Reproducer-race-condition-with-CREATE-SUBSCRIPTION.patch

Reply via email to