Here is a patch that adds a Rendezvous GUC variable to set the Rendezvous name. Chris, would you please test this and let me know how it works.
I know we are past cutoff, but I want to get Rendezvous completely functional. I didn't bother with conditionally including it in postgresql.conf because we don't do that with other options that aren't enabled by default, like SSL and Kerberos. --------------------------------------------------------------------------- Chris Campbell wrote: > On Wednesday, Jun 11, 2003, at 10:43 US/Eastern, Bruce Momjian wrote: > > > Bruce Momjian wrote: > >> Tom Lane wrote: > >>> Bruce Momjian <[EMAIL PROTECTED]> writes: > >>>> I also _didn't_ add the Rendezvous GUC variable, so we default to > >>>> the > >>>> host name. If there is need, we can add it later. > >>> > >>> How do you figure there is not need for it? What about running more > >>> than one postmaster at a time? > >> > >> No one brought up that idea, and Chris agreed we could try it without > >> it. Chris, is that an issue? I see the port number in the Rendezvous > >> function call: > > Rendezvous advertises the port number of the service, yes, but the > service name itself (which is usually related to the host name) MUST be > unique. So if there are two postmasters running on the same machine, > the first one will be advertised, and when the second one tries to > register to be advertised, it will silently fail to register. It will > still work just fine as a postmaster process, but it won't be > advertised. > > This is identical to the situation where there are two machines on the > same network with identical Rendezvous names -- the second one to > attempt to register a service with that name will silently fail. > > Just to reassure you: nothing will break if the second postmaster fails > to register its service name -- it just won't be advertised. That's the > only consequence. There are no additional runtime costs, no strange log > messages, nothing like that. > > I'd love to have that GUC variable so that the service name could be > configured...but I think that 99% of the people that will want to use > the Rendezvous support in PostgreSQL will only be running a single > instance of postmaster on a machine. Like you said, if people need the > ability to configure the service name, the GUC variable can be added > later. The way we're doing it now, Rendezvous will be enabled and the > postmaster will be advertised by default on systems that support it. I > like that. :) If we add the variable, then it won't be configured and > advertised by default (I'm assuming). > > > Two more issues --- first, I changed 'pgsql' to 'postgresql' as the > > service name, to match our registered TCP service name. Second, if we > > do add a GUC variable, it has to conditionally be included in > > postgresql.conf.sample if Rendezvous is enabled. > > For the first issue, "_postgresql._tcp" sounds great. For the second > one...is conditional inclusion in postgresql.conf.sample hard? Would it > suffice to put a "This option can only be configured on systems with > support for Rendezvous (ex: Darwin, Mac OS X)" comment above the > (commented out) line that configures the variable? > > Thanks! > > - Chris > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] > -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /cvsroot/pgsql-server/doc/src/sgml/runtime.sgml,v retrieving revision 1.193 diff -c -c -r1.193 runtime.sgml *** doc/src/sgml/runtime.sgml 14 Jul 2003 20:00:22 -0000 1.193 --- doc/src/sgml/runtime.sgml 18 Jul 2003 20:43:38 -0000 *************** *** 732,737 **** --- 732,747 ---- </listitem> </varlistentry> + <varlistentry> + <term><varname>RENDEZVOUS_NAME</varname> (<type>string</type>)</term> + <listitem> + <para> + Specifies the Rendezvous broadcast name. By default, the + local hostname is used. + </para> + </listitem> + </varlistentry> + </variablelist> </sect3> <sect3 id="runtime-config-connection-security"> Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.333 diff -c -c -r1.333 postmaster.c *** src/backend/postmaster/postmaster.c 12 Jun 2003 07:36:51 -0000 1.333 --- src/backend/postmaster/postmaster.c 18 Jul 2003 20:43:42 -0000 *************** *** 210,215 **** --- 210,217 ---- bool Log_connections = false; bool Db_user_namespace = false; + char *rendezvous_name = NULL; + /* For FNCTL_NONBLOCK */ #if defined(WIN32) || defined(__BEOS__) long ioctlsocket_ret; *************** *** 756,772 **** "socket."); } } ! #ifdef USE_RENDEZVOUS ! if (service_name != NULL) ! { ! DNSServiceRegistrationCreate(NULL, /* default to hostname */ ! "_postgresql._tcp.", ! "", ! htonl(PostPortNumber), ! "", ! (DNSServiceRegistrationReply)reg_reply, ! NULL); ! } #endif } --- 758,775 ---- "socket."); } } ! #ifdef USE_RENDEZVOUS ! if (service_name != NULL) ! { ! DNSServiceRegistrationCreate((rendezvous_name && strlen(rendezvous_name) > 0)) ? ! rendezvous_name : NULL, /* default to hostname */ ! "_postgresql._tcp.", ! "", ! htonl(PostPortNumber), ! "", ! (DNSServiceRegistrationReply)reg_reply, ! NULL); ! } #endif } Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/utils/misc/guc.c,v retrieving revision 1.137 diff -c -c -r1.137 guc.c *** src/backend/utils/misc/guc.c 15 Jul 2003 19:19:56 -0000 1.137 --- src/backend/utils/misc/guc.c 18 Jul 2003 20:43:47 -0000 *************** *** 1299,1304 **** --- 1299,1313 ---- PG_KRB_SRVTAB, NULL, NULL }, + { + {"rendezvous_name", PGC_POSTMASTER, CONN_AUTH_SETTINGS, + gettext_noop("The Rendezvous broadcast service name"), + NULL + }, + &rendezvous_name, + NULL /* defaults to local hostname */, NULL, NULL + }, + /* See main.c about why defaults for LC_foo are not all alike */ { Index: src/backend/utils/misc/postgresql.conf.sample =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/utils/misc/postgresql.conf.sample,v retrieving revision 1.85 diff -c -c -r1.85 postgresql.conf.sample *** src/backend/utils/misc/postgresql.conf.sample 18 Jul 2003 19:16:03 -0000 1.85 --- src/backend/utils/misc/postgresql.conf.sample 18 Jul 2003 20:43:47 -0000 *************** *** 38,43 **** --- 38,44 ---- #unix_socket_group = '' #unix_socket_permissions = 0777 # octal #virtual_host = '' + #rendezvous_name = '' # defaults to local hostname # - Security & Authentication - Index: src/include/tcop/tcopprot.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/tcop/tcopprot.h,v retrieving revision 1.57 diff -c -c -r1.57 tcopprot.h *** src/include/tcop/tcopprot.h 5 May 2003 00:44:56 -0000 1.57 --- src/include/tcop/tcopprot.h 18 Jul 2003 20:43:48 -0000 *************** *** 32,37 **** --- 32,38 ---- extern bool log_hostname; extern bool LogSourcePort; extern DLLIMPORT const char *debug_query_string; + extern char *rendezvous_name; #ifndef BOOTSTRAP_INCLUDE
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend