On Fri, Jul 1, 2022 at 17:44 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > Thanks for your comments.
> On Fri, Jul 1, 2022 at 12:13 PM Peter Smith <smithpb2...@gmail.com> wrote: > > > > ====== > > > > 1.2 doc/src/sgml/protocol.sgml - Protocol constants > > > > Previously I wrote that since there are protocol changes here, > > shouldn’t there also be some corresponding LOGICALREP_PROTO_XXX > > constants and special checking added in the worker.c? > > > > But you said [1 comment #6] you think it is OK because... > > > > IMO, I still disagree with the reply. The fact is that the protocol > > *has* been changed, so IIUC that is precisely the reason for having > > those protocol constants. > > > > e.g I am guessing you might assign the new one somewhere here: > > -- > > server_version = walrcv_server_version(LogRepWorkerWalRcvConn); > > options.proto.logical.proto_version = > > server_version >= 150000 ? > LOGICALREP_PROTO_TWOPHASE_VERSION_NUM : > > server_version >= 140000 ? > LOGICALREP_PROTO_STREAM_VERSION_NUM : > > LOGICALREP_PROTO_VERSION_NUM; > > -- > > > > And then later you would refer to this new protocol version (instead > > of the server version) when calling to the apply_handle_stream_abort > > function. > > > > ====== > > > > One point related to this that occurred to me is how it will behave if > the publisher is of version >=16 whereas the subscriber is of versions > <=15? Won't in that case publisher sends the new fields but > subscribers won't be reading those which may cause some problems. Makes sense. Fixed this point. As Peter-san suggested, I added a new protocol macro LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM. This new macro marks the version that supports apply background worker (it means we will read abort_lsn and abort_time). And the publisher sends abort_lsn and abort_time fields only if subscriber will read them. (see function logicalrep_write_stream_abort) The new patches were attached in [1]. [1] - https://www.postgresql.org/message-id/OS3PR01MB62755C6C9A75EB09F7218B589E839%40OS3PR01MB6275.jpnprd01.prod.outlook.com Regards, Wang wei