Greetings,

* Devrim Gündüz (dev...@gunduz.org) wrote:
> On Tue, 2019-10-22 at 19:16 +0900, Michael Paquier wrote:
> > You are referring to the connection string generated in
> > primary_conninfo here, right?
> 
> Right.

I'm awful suspicious that there's other similar cases beyond this
particular one...

> > It would be nice to be more compatible here.  This can be simply fixed by
> > having an extra filter in GenerateRecoveryConfig() (different file between
> > HEAD and REL_12_STABLE).  I also think that there is more.  On HEAD,
> > channel_binding gets added to the connection string generated which
> > would equally cause a failure with pg_basebackup from HEAD used for a
> > v12 or older server.
> 
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=beeb8e2e0717065296dc7b32daba2d66f0f931dd
> 
> had a similar approach in backwards compatibility, so I also agree on fixing
> whatever breaks it.

Yeah, we clearly do want newer versions of pg_basebackup to work with
older versions of PG and therefore we should address this.

Here's just a quick rough-up of a patch (it compiles, I haven't tried it
out more than that) that adds in a check to skip gssencmode on older
versions.  If it seems like a reasonable approach then I can test it out
and deal with back-patching it and such.

Thoughts?

Thanks,

Stephen
diff --git a/src/fe_utils/recovery_gen.c b/src/fe_utils/recovery_gen.c
new file mode 100644
index 6641f95..7d545fa
*** a/src/fe_utils/recovery_gen.c
--- b/src/fe_utils/recovery_gen.c
*************** GenerateRecoveryConfig(PGconn *pgconn, c
*** 58,63 ****
--- 58,64 ----
  		if (strcmp(opt->keyword, "replication") == 0 ||
  			strcmp(opt->keyword, "dbname") == 0 ||
  			strcmp(opt->keyword, "fallback_application_name") == 0 ||
+ 			(strcmp(opt->keyword, "gssencmode") == 0 && PQserverVersion(pgconn) < MINIMUM_VERSION_FOR_GSSENCMODE) ||
  			(opt->val == NULL) ||
  			(opt->val != NULL && opt->val[0] == '\0'))
  			continue;
diff --git a/src/include/fe_utils/recovery_gen.h b/src/include/fe_utils/recovery_gen.h
new file mode 100644
index 8b15307..0a47d83
*** a/src/include/fe_utils/recovery_gen.h
--- b/src/include/fe_utils/recovery_gen.h
***************
*** 20,25 ****
--- 20,30 ----
   */
  #define MINIMUM_VERSION_FOR_RECOVERY_GUC 120000
  
+ /*
+  * GSSENCMODE is only in version 12 and up
+  */
+ #define MINIMUM_VERSION_FOR_GSSENCMODE 120000
+ 
  extern PQExpBuffer GenerateRecoveryConfig(PGconn *pgconn,
  										  char *pg_replication_slot);
  extern void WriteRecoveryConfig(PGconn *pgconn, char *target_dir,

Attachment: signature.asc
Description: PGP signature

Reply via email to