Re: Logical Replication of sequences - Mailing list pgsql-hackers

From shveta malik
Subject Re: Logical Replication of sequences
Date
Msg-id CAJpy0uAQ43WjvuBi9F_hOJwsa1veGCJJs0ogH1o_o9AAv0jTfg@mail.gmail.com
Whole thread Raw
In response to RE: Logical Replication of sequences  ("Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>)
Responses Re: Logical Replication of sequences
List pgsql-hackers
Please find a few comments for 002:

1)
sequencesync.c compiles without these inclusions:

+#include "replication/logicallauncher.h"
+#include "replication/worker_internal.h"
+#include "utils/rls.h"

2)
SEQ_LOG_CNT_INVALID: it is not used anywhere.

3)
+## ALTER SUBSCRIPTION ... REFRESH SEQUENCES should cause sync of new sequences

Comment seems incorrect, later one is correct:
+# Check - newly published sequence is not synced

4)
+# ALTER SUBSCRIPTION ... REFRESH PUBLICATION should throw an error
+# for sequence definition not matching between the publisher and the
subscriber.

Since we check for both non-matching and missing seq in the concerned
test, we shall mention missing-seq in comment as well.

5)
For the race condition where the worker is going to access the seq
locally and meanwhile it is altered; now the worker correctly reports
this. But it reports this as a success scenario. And once the scenario
is reported as 'seq-worker finished', we do not expect it to start
running again without the user doing REFRESH. But in this case, it
runs, see logs. Also it starts immediately for once due to the same
reason that start_time is reset in the success scenario.
-------
17:35:05.618 IST [132551] LOG:  logical replication apply worker for
subscription "sub1" has started
17:35:05.637 IST [132553] LOG:  logical replication sequence
synchronization worker for subscription "sub1" has started
17:35:05.663 IST [132553] LOG:  logical replication sequence
synchronization for subscription "sub1" - total unsynchronized: 1
17:36:11.987 IST [132553] LOG:  skip synchronization of sequence
"public.myseq249" because it has been altered concurrently
17:36:19.614 IST [132553] LOG:  logical replication sequence
synchronization for subscription "sub1" - batch #1 = 1 attempted, 0
succeeded, 1 skipped, 0 mismatched, 0 insufficient permission, 0
missing from publisher
17:36:20.335 IST [132553] LOG:  logical replication sequence
synchronization worker for subscription "sub1" has finished
17:36:20.435 IST [132586] LOG:  logical replication sequence
synchronization worker for subscription "sub1" has started
17:36:20.545 IST [132586] LOG:  logical replication sequence
synchronization for subscription "sub1" - total unsynchronized: 1
-------

The behaviour looks slightly odd. Is there anything we can do about
this? Shall the skipped case be reported as ERROR due to the fact that
we leave it in state 'i' in pg_subscription_rel?

thanks
Shveta



pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: Avoid resource leak (src/test/regress/pg_regress.c)
Next
From: Michael Paquier
Date:
Subject: Re: contrib/sepgsql regression tests have been broken for months