RE: Single transaction in the tablesync worker?

From: "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, "Peter Eisentraut" <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: RE: Single transaction in the tablesync worker?
Date: 2021-01-07 01:45:15
Message-ID: 314f9e626fc94dc387e100825b534b07@G08CNEXMBPEKD05.g08.fujitsu.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> PSA the v11 patch for the Tablesync Solution1.
>
> Difference from v10:
> - Addresses several recent review comments.
> - pg_indent has been run
>
Hi

I took a look into the patch and have some comments.

1.
* So the state progression is always: INIT -> DATASYNC -> SYNCWAIT ->
- * CATCHUP -> SYNCDONE -> READY.
+ * CATCHUP -> (sync worker TCOPYDONE) -> SYNCDONE -> READY.

I noticed the new state TCOPYDONE is commented between CATCHUP and SYNCDONE,
But It seems the SUBREL_STATE_TCOPYDONE is actually set before SUBREL_STATE_SYNCWAIT[1].
Did i miss something here ?

[1]-----------------
+ UpdateSubscriptionRelState(MyLogicalRepWorker->subid,
+ MyLogicalRepWorker->relid,
+ SUBREL_STATE_TCOPYDONE,
+ MyLogicalRepWorker->relstate_lsn);
...
/*
* We are done with the initial data synchronization, update the state.
*/
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
MyLogicalRepWorker->relstate = SUBREL_STATE_SYNCWAIT;
------------------

2.
<literal>i</literal> = initialize,
<literal>d</literal> = data is being copied,
+ <literal>C</literal> = table data has been copied,
<literal>s</literal> = synchronized,
<literal>r</literal> = ready (normal replication)

+#define SUBREL_STATE_TCOPYDONE 't' /* tablesync copy phase is completed
+ * (sublsn NULL) */
The character representing 'data has been copied' in the catalog seems different from the macro define.

Best regards,
houzj

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2021-01-07 01:50:17 RE: When (and whether) should we improve the chapter on parallel query to accommodate parallel data updates?
Previous Message Masahiko Sawada 2021-01-07 01:44:50 Re: Transactions involving multiple postgres foreign servers, take 2