Re: Minimal logical decoding on standbys
Amit Khandekar <amitdkhan.pg@gmail.com>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Reduce the log level in 035_standby_logical_decoding.pl.
- 3034dc56ef4b 16.0 landed
-
035_standby_logical_decoding: Add missing waits for replication
- 57411c82ce86 16.0 landed
-
For cascading replication, wake physical and logical walsenders separately
- e101dfac3a53 16.0 landed
-
Handle logical slot conflicts on standby
- 26669757b6a7 16.0 landed
-
Support invalidating replication slots due to horizon and wal_level
- be87200efd93 16.0 landed
-
Prevent use of invalidated logical slot in CreateDecodingContext()
- 4397abd0a2af 16.0 landed
-
Replace replication slot's invalidated_at LSN with an enum
- 15f8203a5975 16.0 landed
-
Pass down table relation into more index relation functions
- 61b313e47eb9 16.0 landed
-
Assert only valid flag bits are passed to visibilitymap_set()
- a88a18b1250b 16.0 landed
-
Remove unused _bt_delitems_delete() argument.
- dc43492e46c7 14.0 cited
-
Add xl_btree_delete optimization.
- d2e5e20e5711 13.0 cited
Attachments
- logical-decoding-on-standby_v3.patch (application/octet-stream) patch v3
On Wed, 3 Apr 2019 at 19:57, Amit Khandekar <amitdkhan.pg@gmail.com> wrote: > Oops, it was my own change that caused the hang. Sorry for the noise. > After using wal_debug, found out that after replaying the LOCK records > for the catalog pg_auth, it was not releasing it because it had > actually got stuck in ReplicationSlotDropPtr() itself. In > ResolveRecoveryConflictWithSlots(), a shared > ReplicationSlotControlLock was already held before iterating through > the slots, and now ReplicationSlotDropPtr() again tries to take the > same lock in exclusive mode for setting slot->in_use, leading to a > deadlock. I fixed that by releasing the shared lock before calling > ReplicationSlotDropPtr(), and then re-starting the slots' scan over > again since we released it. We do similar thing for > ReplicationSlotCleanup(). > > Attached is a rebased version of your patch > logical-decoding-on-standby.patch. This v2 version also has the above > changes. It also includes the tap test file which is still in WIP > state, mainly because I have yet to add the conflict recovery handling > scenarios. Attached v3 patch includes a new scenario to test conflict recovery handling by verifying that the conflicting slot gets dropped. WIth this, I am done with the test changes, except the below question that I had posted earlier which I would like to have inputs : Regarding the test result failures, I could see that when we drop a logical replication slot at standby server, then the catalog_xmin of physical replication slot becomes NULL, whereas the test expects it to be equal to xmin; and that's the reason a couple of test scenarios are failing : ok 33 - slot on standby dropped manually Waiting for replication conn replica's replay_lsn to pass '0/31273E0' on master done not ok 34 - physical catalog_xmin still non-null not ok 35 - xmin and catalog_xmin equal after slot drop # Failed test 'xmin and catalog_xmin equal after slot drop' # at t/016_logical_decoding_on_replica.pl line 272. # got: # expected: 2584 I am not sure what is expected. What actually happens is : the physical xlot catalog_xmin remains NULL initially, but becomes non-NULL after the logical replication slot is created on standby. -- Thanks, -Amit Khandekar EnterpriseDB Corporation The Postgres Database Company