| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | RE: [PATCH] Support automatic sequence replication |
| Date: | 2026-03-13 11:35:41 |
| Message-ID: | OS9PR01MB121497F8BFA0114DDF6523DC7F545A@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dear Hou,
Thanks for updating the patch. Comments for v12-0002.
01.
```
+ /* Free the existing invalid cache entries */
+ foreach_ptr(LogicalRepSequenceInfo, seqinfo, sequence_infos)
+ {
+ pfree(seqinfo->nspname);
+ pfree(seqinfo->seqname);
+ pfree(seqinfo);
+ }
```
According to the comment atop foreach_delete_current, we should not directly pfree()
the iterator.
02.
```
+ /* Cache the information in a permanent memory context */
+ oldctx = MemoryContextSwitchTo(CacheMemoryContext);
```
Do you have a reason to use CacheMemoryContext instead of ApplyContext?
According to the readme, the context can be used for the limited purpose, like catcache
and relcache. Not sure we can easily use it.
03.
I think seqinfo->found_on_pub must be set to false before doing copy_sequences() again.
Otherwise, sequences dropped on the publisher cannot be detected as the missing ones.
Or we may have to have another array to indicate it.
I found a below scenario.
There are 10 sequences on both instances, and sequencesync worker synchronizes once.
Now two of them are dropped on the publisher. In the next iteration by the worker,
it can find that only 8 sequeces are found on the publisher. Then it scans the
cache to check each found_on_pub in sequence_infos, but they were cached as true.
Thus sequencesync worker cannot report anything for missing ones.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aya Iwata (Fujitsu) | 2026-03-13 11:38:51 | RE: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE |
| Previous Message | Fujii Masao | 2026-03-13 11:33:50 | Re: gistGetFakeLSN() can return incorrect LSNs |