RE: Conflict detection for update_deleted in logical replication

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Conflict detection for update_deleted in logical replication
Date: 2024-12-23 06:14:49
Message-ID: OSCPR01MB1496673B9D9F972AFB646BA75F5022@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hou,

Thanks for updating the patch. Few comments:

01. worker.c

```
+/*
+ * The minimum (100ms) and maximum (3 minutes) intervals for advancing
+ * non-removable transaction IDs.
+ */
+#define MIN_XID_ADVANCEMENT_INTERVAL 100
+#define MAX_XID_ADVANCEMENT_INTERVAL 180000L
```

Since the max_interval is an integer variable, it can be s/180000L/180000/.

02. ErrorOnReservedSlotName()

Currently the function is callsed from three points - create_physical_replication_slot(),
create_logical_replication_slot() and CreateReplicationSlot().
Can we move them to the ReplicationSlotCreate(), or combine into ReplicationSlotValidateName()?

03. advance_conflict_slot_xmin()

```
Assert(TransactionIdIsValid(MyReplicationSlot->data.xmin));
```

Assuming the case that the launcher crashed just after ReplicationSlotCreate(CONFLICT_DETECTION_SLOT).
After the restart, the slot can be acquired since SearchNamedReplicationSlot(CONFLICT_DETECTION_SLOT)
is true, but the process would fail the assert because data.xmin is still invalid.

I think we should re-create the slot when the xmin is invalid. Thought?

04. documentation

Should we update "Configuration Settings" section in logical-replication.sgml
because an additional slot is required?

05. check_remote_recovery()

Can we add a test case related with this?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 2024-12-23 06:26:44 Re: Re: Re: transaction lost when delete clog file after normal shutdown
Previous Message Tom Lane 2024-12-23 05:53:11 Re: wrong comments in ClassifyUtilityCommandAsReadOnly