Re: [PATCHES] Avahi support for Postgresql

Lists: pgsql-hackerspgsql-patches
From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Avahi support for Postgresql
Date: 2007-11-27 10:19:27
Message-ID: 1196158767.7596.18.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Postmaster already has code to announce its services via DNS-SD
(ZeroConf) by using Apple's Bonjour API. This series of patches
implements that capability on top of the Avahi library[1] which
is free software, available for a wider variety of platforms.

I've separated the change set into smaller pieces for easy review. Also
I don't know, if the 4th patch adding subtypes describing Postgresql's
capabilities is wanted by the Postgresql community. Being a desktop guy,
using Postgresql as embedded database, I'd really like to see all of the
patches merged, but I could imagine some opposition against the verbose
nature of the subtypes patch.

Each of the patches as a short description of its purpose.

I couldn't find any ChangeLog files in the repository, and also I didn't
invest much time in investigating how the HISTORY file of distribution
tarballs is assembled. So if the repository contains file I should have
modified for documenting my changes, I apologize for not updating them.

[1] http://www.avahi.org/
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
www.openismus.com

Attachment Content-Type Size
0001-Update-the-build-system-to-provide-Avahi-support.patch application/mbox 0 bytes

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2007-11-28 22:44:49
Message-ID: 200711282244.lASMinL18318@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


This has been saved for the 8.4 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Mathias Hasselmann wrote:
> Postmaster already has code to announce its services via DNS-SD
> (ZeroConf) by using Apple's Bonjour API. This series of patches
> implements that capability on top of the Avahi library[1] which
> is free software, available for a wider variety of platforms.
>
> I've separated the change set into smaller pieces for easy review. Also
> I don't know, if the 4th patch adding subtypes describing Postgresql's
> capabilities is wanted by the Postgresql community. Being a desktop guy,
> using Postgresql as embedded database, I'd really like to see all of the
> patches merged, but I could imagine some opposition against the verbose
> nature of the subtypes patch.
>
> Each of the patches as a short description of its purpose.
>
> I couldn't find any ChangeLog files in the repository, and also I didn't
> invest much time in investigating how the HISTORY file of distribution
> tarballs is assembled. So if the repository contains file I should have
> modified for documenting my changes, I apologize for not updating them.
>
> [1] http://www.avahi.org/
> --
> Mathias Hasselmann <mathias(at)openismus(dot)com>
> www.openismus.com

[ application/mbox is not supported, skipping... ]

[ application/mbox is not supported, skipping... ]

[ application/mbox is not supported, skipping... ]

[ application/mbox is not supported, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Cc: Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-23 12:13:38
Message-ID: 1203768818.6668.23.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hello,

Congratulations to the 8.3 release. No, that pre-release stress is over
I'd really like to put attention on my Avahi patches again.

Avahi/Bonjour/DNS-SD support[1] is very important, for integrating
Postgresql with modern desktop environments like OSX, GNOME, KDE: It's
very convenient to choose active DBMS servers in your local network from
a list, instead of memorizing "cryptic" connection parameters.

In Glom[2] we use Postgresql as DBMS of choice. This application would
greatly benefit from the possibility to choose central Postgresql
servers from an automatically updated list.

For OSX builds Postgresql already has DNS-SD support via Apple's Bonjour
library. For Linux Avahi[3] is the library of choice. Modern distribu-
tions ship it as main package, since both GNOME and KDE make use of it.
Since DNS-SD is a published IETF standard [4] client applications
choose whatever DNS-SD implementation they like.

Applying this patche series would bring Postgresql's Linux port on par
with the OSX port in terms of desktop integration.

People not wanting DNS-SD support for their server can easily control
that feature via the "--with-avahi" configure scripts.

Thank your for attention,
Mathias

[1] http://www.dns-sd.org/
[2] http://www.glom.org/
[3] http://www.avahi.org/
[4] http://www.ietf.org/rfc/rfc2782.txt

Am Dienstag, den 27.11.2007, 11:19 +0100 schrieb Mathias Hasselmann:
> Postmaster already has code to announce its services via DNS-SD
> (ZeroConf) by using Apple's Bonjour API. This series of patches
> implements that capability on top of the Avahi library[1] which
> is free software, available for a wider variety of platforms.
>
> I've separated the change set into smaller pieces for easy review. Also
> I don't know, if the 4th patch adding subtypes describing Postgresql's
> capabilities is wanted by the Postgresql community. Being a desktop guy,
> using Postgresql as embedded database, I'd really like to see all of the
> patches merged, but I could imagine some opposition against the verbose
> nature of the subtypes patch.
>
> Each of the patches as a short description of its purpose.
>
> I couldn't find any ChangeLog files in the repository, and also I didn't
> invest much time in investigating how the HISTORY file of distribution
> tarballs is assembled. So if the repository contains file I should have
> modified for documenting my changes, I apologize for not updating them.
>
> [1] http://www.avahi.org/
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-23 20:08:27
Message-ID: 200802232108.28590.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Mathias Hasselmann wrote:
> Congratulations to the 8.3 release. No, that pre-release stress is over
> I'd really like to put attention on my Avahi patches again.

I've added your item to the patch list
(http://developer.postgresql.org/index.php/Todo:PatchStatus). It would help
if you could include or point to your actual patch.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-23 21:19:17
Message-ID: 1203801557.6668.52.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Samstag, den 23.02.2008, 21:08 +0100 schrieb Peter Eisentraut:
> Mathias Hasselmann wrote:
> > Congratulations to the 8.3 release. Now, that pre-release stress is over
> > I'd really like to put attention on my Avahi patches again.
>
> I've added your item to the patch list
> (http://developer.postgresql.org/index.php/Todo:PatchStatus). It would help
> if you could include or point to your actual patch.

Thanks a lot.

The patches were in my initial mail, but now I've also uploaded them to
my personal site for convenience:

http://taschenorakel.de/files/pgsql-avahi-support/

I just failed to update the Wiki page:

This page has been locked to prevent editing.
You can view and copy the source of this page:

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 14:05:01
Message-ID: 200802251505.02636.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> Postmaster already has code to announce its services via DNS-SD
> (ZeroConf) by using Apple's Bonjour API. This series of patches
> implements that capability on top of the Avahi library[1] which
> is free software, available for a wider variety of platforms.

Is there a reason we couldn't use the Bonjour compatibility layer offered by
Avahi to keep the code differences to a minimum?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 14:23:35
Message-ID: 200802251523.35712.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> Postmaster already has code to announce its services via DNS-SD
> (ZeroConf) by using Apple's Bonjour API. This series of patches
> implements that capability on top of the Avahi library[1] which
> is free software, available for a wider variety of platforms.

Note to hackers: This set of patches renames the GUC parameter bonjour_name
to zeroconf_name to make the more general meaning clear. We have generally
not hesitated to rename GUC parameters between major releases, but if this
bothers you, please speak up.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 14:27:33
Message-ID: 200802251527.34491.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> I don't know, if the 4th patch adding subtypes describing Postgresql's
> capabilities is wanted by the Postgresql community. Being a desktop guy,
> using Postgresql as embedded database, I'd really like to see all of the
> patches merged, but I could imagine some opposition against the verbose
> nature of the subtypes patch.

I am not convinced about the usefulness of the subtypes patch. The examples
you cite -- FTP, bittorrent, distcc -- are cases where a client could pick
the most appropriate server from a set of equivalent instances. I don't see
how this can be useful in a PostgreSQL setting, at least not based on the
parameters server version and protocol version that you implemented.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-02-25 14:33:17
Message-ID: 20080225143317.GB15597@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Mathias Hasselmann wrote:

> The patches were in my initial mail, but now I've also uploaded them to
> my personal site for convenience:
>
> http://taschenorakel.de/files/pgsql-avahi-support/

Hmm, a quick look at the third patch reveals that it is using the
"threaded" Avahi client. That's a showstopper. Please consider using
some other approach -- writing our own handlers for AvahiPoll would seem
apropos.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 14:45:42
Message-ID: 200802251545.43591.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> Postmaster already has code to announce its services via DNS-SD
> (ZeroConf) by using Apple's Bonjour API. This series of patches
> implements that capability on top of the Avahi library[1] which
> is free software, available for a wider variety of platforms.

One thing I found curious: The Bonjour code uses service
type "_postgresql._tcp." whereas your code uses "_postgresql._tcp" (note the
dot). Is that an expected difference?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 16:04:26
Message-ID: 200802251704.27748.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Montag, 25. Februar 2008 schrieb Alvaro Herrera:
> Hmm, a quick look at the third patch reveals that it is using the
> "threaded" Avahi client.  That's a showstopper.

Could you elaborate why that is?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 17:32:55
Message-ID: 20080225173255.GH15597@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Am Montag, 25. Februar 2008 schrieb Alvaro Herrera:
> > Hmm, a quick look at the third patch reveals that it is using the
> > "threaded" Avahi client.  That's a showstopper.
>
> Could you elaborate why that is?

Because it creates a new thread under the Postmaster to handle Avahi
events, if I'm reading the Avahi docs right. This is verboten.

We have an event loop in the postmaster -- see ServerLoop. Is there a
reason the Avahi events could not be hooked in there?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 18:12:58
Message-ID: 200802251912.58801.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Am Samstag, 23. Februar 2008 schrieb Mathias Hasselmann:
> The patches were in my initial mail, but now I've also uploaded them to
> my personal site for convenience:
>
> http://taschenorakel.de/files/pgsql-avahi-support/

I have reworked the first three of your patches (mostly formatting and some
refactoring) and published them here:

http://git.postgresql.org/?p=~petere/postgresql.git;a=shortlog;h=avahi-support

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 19:10:33
Message-ID: 1203966633.7227.28.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Montag, den 25.02.2008, 15:45 +0100 schrieb Peter Eisentraut:
> Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> > Postmaster already has code to announce its services via DNS-SD
> > (ZeroConf) by using Apple's Bonjour API. This series of patches
> > implements that capability on top of the Avahi library[1] which
> > is free software, available for a wider variety of platforms.
>
> One thing I found curious: The Bonjour code uses service
> type "_postgresql._tcp." whereas your code uses "_postgresql._tcp" (note the
> dot). Is that an expected difference?

Oh, that difference is really interesting. I didn't even see it.

DNS-SD uses the convention "_<protoname>._<type>" to describe services,
and that's the convention Avahi follows. I don't know why the Bonjour
API uses that trailing dot, but it seems wrong:

"a trailing dot indicates the root domain. so bonjour is clearly
wrong, since there's no ._tcp top-level domain."

-- James Andrewartha on #avahi today

Avahi's maintainer Sjoerd Simons agreed, that the trailing dot seems to
be wrong.

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 19:17:00
Message-ID: 1203967020.7227.34.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Montag, den 25.02.2008, 15:05 +0100 schrieb Peter Eisentraut:
> Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> > Postmaster already has code to announce its services via DNS-SD
> > (ZeroConf) by using Apple's Bonjour API. This series of patches
> > implements that capability on top of the Avahi library[1] which
> > is free software, available for a wider variety of platforms.
>
> Is there a reason we couldn't use the Bonjour compatibility layer offered by
> Avahi to keep the code differences to a minimum?

1) The Avahi's compatibility layer doesn't implement the now deprecated
function DNSServiceRegistrationCreate().

2) Unless DNSServiceRegistrationCreate() installs a lot of black magic,
the Bonjour code in postmaster.c has very poor error handling: There
seem to be no attempts made to handle name collisions (unless Bonjour
does this automatically, of course).

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 19:24:08
Message-ID: 1203967448.7227.41.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Montag, den 25.02.2008, 15:27 +0100 schrieb Peter Eisentraut:
> Am Dienstag, 27. November 2007 schrieb Mathias Hasselmann:
> > I don't know, if the 4th patch adding subtypes describing Postgresql's
> > capabilities is wanted by the Postgresql community. Being a desktop guy,
> > using Postgresql as embedded database, I'd really like to see all of the
> > patches merged, but I could imagine some opposition against the verbose
> > nature of the subtypes patch.
>
> I am not convinced about the usefulness of the subtypes patch. The examples
> you cite -- FTP, bittorrent, distcc -- are cases where a client could pick
> the most appropriate server from a set of equivalent instances. I don't see
> how this can be useful in a PostgreSQL setting, at least not based on the
> parameters server version and protocol version that you implemented.

Well, I could imagine certain cases, where applications only want to
list Postgresql servers newer than release x.y - since they depend on
certain new features of that release.

But you could be right, that the approach I've implemented only allows
filtering for "revision == x.y", but not the intended "revision >= x.y".

So maybe the release number, or a feature list (similar the capability
list of SMTP) should be put into the announcement's TXT record.

Well, but I do not consider that sub-type feature that important.

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 19:25:21
Message-ID: 1371.1203967521@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Mathias Hasselmann <mathias(at)openismus(dot)com> writes:
> Oh, that difference is really interesting. I didn't even see it.

> DNS-SD uses the convention "_<protoname>._<type>" to describe services,
> and that's the convention Avahi follows. I don't know why the Bonjour
> API uses that trailing dot, but it seems wrong:

Is removing that dot going to create compatibility problems for us?
If it means that an 8.3 client wouldn't find an 8.4 server, for
instance, I don't think that's going to be acceptable. Do we need
to "listen" on both names (whatever the heck that means in zeroconf)?

regards, tom lane


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: Avahi support for Postgresql
Date: 2008-02-25 19:26:22
Message-ID: 1203967582.7227.45.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Montag, den 25.02.2008, 19:12 +0100 schrieb Peter Eisentraut:
> Am Samstag, 23. Februar 2008 schrieb Mathias Hasselmann:
> > The patches were in my initial mail, but now I've also uploaded them to
> > my personal site for convenience:
> >
> > http://taschenorakel.de/files/pgsql-avahi-support/
>
> I have reworked the first three of your patches (mostly formatting and some
> refactoring) and published them here:
>
> http://git.postgresql.org/?p=~petere/postgresql.git;a=shortlog;h=avahi-support

Thanks alot.

Didn't know about that git repository, btw.

Is git://git.postgresql.org/git/postgresql.git assumed to reliably
mirror the CVS repository?

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 19:35:02
Message-ID: 1547.1203968102@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Mathias Hasselmann <mathias(at)openismus(dot)com> writes:
> Am Montag, den 25.02.2008, 15:05 +0100 schrieb Peter Eisentraut:
>> Is there a reason we couldn't use the Bonjour compatibility layer offered by
>> Avahi to keep the code differences to a minimum?

> 1) The Avahi's compatibility layer doesn't implement the now deprecated
> function DNSServiceRegistrationCreate().

Note that Apple themselves have been deprecating
DNSServiceRegistrationCreate for some time:

postmaster.c: In function 'PostmasterMain':
postmaster.c:856: warning: 'DNSServiceRegistrationCreate' is deprecated (declared at /usr/include/DNSServiceDiscovery/DNSServiceDiscovery.h:139)

It's a fairly good bet that the function will disappear entirely from OS
X at some point, so we're going to have to change this code soon anyway.

What I'd like to know is whether the Avahi API that this patch is using
is compatible with whatever Apple is pushing as the not-deprecated API.
It would be annoying to tell Mac users that they have to install Avahi
to get at functionality that their platform provides natively.

regards, tom lane


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 19:40:50
Message-ID: 1203968450.7227.60.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Montag, den 25.02.2008, 14:32 -0300 schrieb Alvaro Herrera:
> Peter Eisentraut wrote:
> > Am Montag, 25. Februar 2008 schrieb Alvaro Herrera:
> > > Hmm, a quick look at the third patch reveals that it is using the
> > > "threaded" Avahi client. That's a showstopper.
> >
> > Could you elaborate why that is?
>
> Because it creates a new thread under the Postmaster to handle Avahi
> events, if I'm reading the Avahi docs right. This is verboten.

Just to be sure we talk about the same topic: I assume the prohibition
you talk about is something like "no use of threads in Postmaster"?

If that's the case: Are there some docs, mails, ... explaining the
rationale behind this restriction? I could imagine your do not want
random locking in the postmaster code?

See, interaction points with the main thread are very small:

1) Lock-free creation of the threaded Avahi client in PostmasterMain()
2) Locked shutdown of the Avahi client in ExitAvahiClient(), which only
is called from ExitPostmaster().

So IMHO usage of the threaded poll API has much smaller impact on the
behavior of the postmaster process, than any attempt to integrate Avahi
with postmaster's main loop.

> We have an event loop in the postmaster -- see ServerLoop. Is there a
> reason the Avahi events could not be hooked in there?

Currently there are four ___well tested___ implementations of Avahi's
poll API: AvahiSimplePoll, which really just works for simple command
line tools and demonstration purposes. The single threaded APIs that
integrate with the main loops of glib and Qt, and the threaded poll API.

Avahi's requirements for a poll API aren't exactly trivial: You don't
only have to care about file descriptors, you also have to implement
some kind of timeout scheduling. So in favor of reinventing the wheel
and delivering an untested custom poll API, I've chosen the threaded
poll API: It's the only well-tested poll API that fits into Postgresql,
and its interaction points with the Postmaster process are minimal.

>From looking at ServerLoop() I do not see any facilities for
registering timeout callbacks. Select timeouts are static. So for
implementing Avahi's poll API in ServerLoop() some radical code changes
would be needed. I don't believe such changes would be justified,
unless other portions of postmaster also need timeout callbacks.

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-02-25 20:08:29
Message-ID: 2073.1203970109@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Mathias Hasselmann <mathias(at)openismus(dot)com> writes:
> Just to be sure we talk about the same topic: I assume the prohibition
> you talk about is something like "no use of threads in Postmaster"?

Correct.

> If that's the case: Are there some docs, mails, ... explaining the
> rationale behind this restriction? I could imagine your do not want
> random locking in the postmaster code?

Portability, irreproducible misbehavior, etc. Some trawling in the
pgsql-hackers archives should turn up previous discussions. For a
recent demonstration that wanting to avoid threads is not just idle
paranoia on our part, see
http://archives.postgresql.org/pgsql-patches/2007-09/msg00194.php

regards, tom lane


From: tomas(at)tuxteam(dot)de
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-03-29 12:25:21
Message-ID: 20080329122521.GA20142@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Feb 23, 2008 at 01:13:38PM +0100, Mathias Hasselmann wrote:

[...]

> Avahi/Bonjour/DNS-SD support[1] is very important, for integrating
> Postgresql with modern desktop environments like OSX, GNOME, KDE: It's
> very convenient to choose active DBMS servers in your local network from
> a list, instead of memorizing "cryptic" connection parameters.

[...]

> People not wanting DNS-SD support for their server can easily control
> that feature via the "--with-avahi" configure scripts.

Sorry for a dumb question, but I couldn't figure that out from your
references [1]..[4]: does that mean that the PostgreSQL server would
"advertise itself" on the local net? Or what is the purpose of liking-in
libavahi into the postmaster?

Surely one wouldn't want this in a data center? Is there a possiblity to
disable that at run time?

Thanks for any insights

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFH7jUxBcgs9XrR2kYRAsfOAJ0Ulfydo3G1kzQo3HTOdjtswA1A2gCfYYyL
VHprJ63unId85/Iht4ha2RE=
=get0
-----END PGP SIGNATURE-----


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: tomas(at)tuxteam(dot)de
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-04-01 07:35:56
Message-ID: 1207035356.8343.8.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Samstag, den 29.03.2008, 12:25 +0000 schrieb tomas(at)tuxteam(dot)de:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sat, Feb 23, 2008 at 01:13:38PM +0100, Mathias Hasselmann wrote:
>
> [...]
>
> > Avahi/Bonjour/DNS-SD support[1] is very important, for integrating
> > Postgresql with modern desktop environments like OSX, GNOME, KDE: It's
> > very convenient to choose active DBMS servers in your local network from
> > a list, instead of memorizing "cryptic" connection parameters.
>
> [...]
>
> > People not wanting DNS-SD support for their server can easily control
> > that feature via the "--with-avahi" configure scripts.
>
> Sorry for a dumb question, but I couldn't figure that out from your
> references [1]..[4]: does that mean that the PostgreSQL server would
> "advertise itself" on the local net? Or what is the purpose of liking-in
> libavahi into the postmaster?

Yes, that's the purpose.

> Surely one wouldn't want this in a data center?

Yes, this feature definitely targets small-office use, personal use, DB
developers. Don't know enough about data centers to judge the impact
there, but since Avahi - as used in the patch - announces to the local
network only, the impact sould be small.

Still you can tell Avahi to explicitly announce at a certain, non-local
domain, but this feature is not implemented by the patch. Maybe database
developers in large network environments could make use of such
announcements. It would be trivial to add.

> Is there a possiblity to disable that at run time?

The feature is disabled by default. As long as you do not specify a
zeroconf_name in your configuration file, nothing happens. This is the
same behavior as established by the Bonjour code.

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: tomas(at)tuxteam(dot)de
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-04-01 12:02:14
Message-ID: 20080401120213.GA18336@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Apr 01, 2008 at 09:35:56AM +0200, Mathias Hasselmann wrote:
> Am Samstag, den 29.03.2008, 12:25 +0000 schrieb tomas(at)tuxteam(dot)de:
> [...]
> > Sorry for a dumb question, but I couldn't figure that out from your
> > references [1]..[4]: does that mean that the PostgreSQL server would
> > "advertise itself" on the local net? Or what is the purpose of liking-in
> > libavahi into the postmaster?
>
> Yes, that's the purpose.
>
> > Surely one wouldn't want this in a data center?
>
> Yes, this feature definitely targets small-office use, personal use, DB
> developers [...]
> Still you can tell Avahi to explicitly announce at a certain, non-local
> domain, but this feature is not implemented by the patch. Maybe database
> developers in large network environments could make use of such
> announcements. It would be trivial to add.

Personally, I'be rather scared than delighted ;-)

> > Is there a possiblity to disable that at run time?
>
> The feature is disabled by default. As long as you do not specify a
> zeroconf_name in your configuration file, nothing happens. This is the
> same behavior as established by the Bonjour code.

Thanks, good to know.

Isn't there a less-intrusive option to linking a lib into each and every
possible server, like a config file in which to put what is to be announced?

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFH8iRFBcgs9XrR2kYRAmJ0AJkB7MkxfYI0nVa4RqHVEV1HYjz41gCdEgWz
YQ2T4Y/xfoLRF4D6hMLbpEk=
=Goho
-----END PGP SIGNATURE-----


From: Mathias Hasselmann <mathias(at)openismus(dot)com>
To: tomas(at)tuxteam(dot)de
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-04-01 15:07:31
Message-ID: 1207062451.8343.25.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Am Dienstag, den 01.04.2008, 12:02 +0000 schrieb tomas(at)tuxteam(dot)de:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tue, Apr 01, 2008 at 09:35:56AM +0200, Mathias Hasselmann wrote:
> > Am Samstag, den 29.03.2008, 12:25 +0000 schrieb tomas(at)tuxteam(dot)de:
> > [...]
> > > Sorry for a dumb question, but I couldn't figure that out from your
> > > references [1]..[4]: does that mean that the PostgreSQL server would
> > > "advertise itself" on the local net? Or what is the purpose of liking-in
> > > libavahi into the postmaster?
> >
> > Yes, that's the purpose.
> >
> > > Surely one wouldn't want this in a data center?
> >
> > Yes, this feature definitely targets small-office use, personal use, DB
> > developers [...]
> > Still you can tell Avahi to explicitly announce at a certain, non-local
> > domain, but this feature is not implemented by the patch. Maybe database
> > developers in large network environments could make use of such
> > announcements. It would be trivial to add.
>
> Personally, I'be rather scared than delighted ;-)

So in data centers you don't even trust the machines in your broadcast
domain?

> > > Is there a possiblity to disable that at run time?
> >
> > The feature is disabled by default. As long as you do not specify a
> > zeroconf_name in your configuration file, nothing happens. This is the
> > same behavior as established by the Bonjour code.
>
> Thanks, good to know.
>
> Isn't there a less-intrusive option to linking a lib into each and every
> possible server, like a config file in which to put what is to be announced?

You could directly talk to the D-Bus interface of Avahi. libavahi-client
just is a convenience wrapper. Well, but this route will be much more
cumbersome.

One other route is calling avahi-publish-service on startup and killing
it on shutdown, but: avahi-publish-service really only exists for
demonstration purposes and doesn't handle service name collisions for
instance. I don't believe that a high-profile application like
Postgresql should rely on low-quality hacks, like invoking educational
demo programs.

Ciao,
Mathias
--
Mathias Hasselmann <mathias(at)openismus(dot)com>
http://www.openismus.com/ - We can get it done.


From: tomas(at)tuxteam(dot)de
To: Mathias Hasselmann <mathias(at)openismus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-04-01 15:34:33
Message-ID: 20080401153433.GA18822@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Apr 01, 2008 at 05:07:31PM +0200, Mathias Hasselmann wrote:
[...]
> > Personally, I'be rather scared than delighted ;-)
>
> So in data centers you don't even trust the machines in your broadcast
> domain?

Kind of. Put it another way: never have services running you don't use.

[...]

> > Isn't there a less-intrusive option to linking a lib into each and every
> > possible server, like a config file in which to put what is to be announced?
>
> You could directly talk to the D-Bus interface of Avahi. libavahi-client
> just is a convenience wrapper. Well, but this route will be much more
> cumbersome.

So this goes through the D-Bus. Makes kind of sense. Thanks for the
enlightenment.

> One other route is calling avahi-publish-service on startup and killing
> it on shutdown, but: avahi-publish-service really only exists for
> demonstration purposes and doesn't handle service name collisions for
> instance. I don't believe that a high-profile application like
> Postgresql should rely on low-quality hacks, like invoking educational
> demo programs.

Unelegant as it might seem -- this solution still affords a lot more
when it comes to "separation of concerns". I'm still a bit wary at the
prospect that each and every daemon evolves into a huge fuzzball
linked to all conceivable service-lets with a multitude of funny
side-effects (remember tcpwrappers?).

Of course, "you can always disable this at compile time", but let's face
it: with the predominance of binary distribs, the path of least
resistance will be to put up with whatever strange side-effects.

I would really prefer a more loosely coupled system.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFH8lYJBcgs9XrR2kYRAmDJAJ4jWKYkhUfKEAIaZVnIbAAEqJF2AwCfS/6D
4rH9OoY7wjia7h1cuk5CjZI=
=AF1W
-----END PGP SIGNATURE-----


From: Murray Cumming <murrayc(at)openismus(dot)com>
To: tomas(at)tuxteam(dot)de
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Avahi support for Postgresql
Date: 2008-04-01 21:31:23
Message-ID: 1207085483.22196.17.camel@murrayc-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2008-04-01 at 15:34 +0000, tomas(at)tuxteam(dot)de wrote:
> I would really prefer a more loosely coupled system.

The functionality will be much the same. The implementation would be
more difficult and obscure and there would be more points of failure and
more things to configure, but it wouldn't remove much risk, I think.

Anyway, this feature is already in Postgres when it's built for MacOS X.
So this decision seems to have been made already, at least for that
platform.

--
murrayc(at)murrayc(dot)com
www.murrayc.com
www.openismus.com


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-04-15 14:51:41
Message-ID: 200804151451.m3FEpf221368@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera wrote:
> Mathias Hasselmann wrote:
>
> > The patches were in my initial mail, but now I've also uploaded them to
> > my personal site for convenience:
> >
> > http://taschenorakel.de/files/pgsql-avahi-support/
>
> Hmm, a quick look at the third patch reveals that it is using the
> "threaded" Avahi client. That's a showstopper. Please consider using
> some other approach -- writing our own handlers for AvahiPoll would seem
> apropos.

Based on the threading usage in this patch, I assume it is rejected, and
that we don't want a TODO item for this.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-04-15 15:06:23
Message-ID: 20080415150622.GD4429@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Mathias Hasselmann wrote:
> >
> > > The patches were in my initial mail, but now I've also uploaded them to
> > > my personal site for convenience:
> > >
> > > http://taschenorakel.de/files/pgsql-avahi-support/
> >
> > Hmm, a quick look at the third patch reveals that it is using the
> > "threaded" Avahi client. That's a showstopper. Please consider using
> > some other approach -- writing our own handlers for AvahiPoll would seem
> > apropos.
>
> Based on the threading usage in this patch, I assume it is rejected, and
> that we don't want a TODO item for this.

This particular patch should be rejected, but we certainly do need a
TODO item IMHO.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Mathias Hasselmann <mathias(at)openismus(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Murray Cumming <murrayc(at)openismus(dot)com>
Subject: Re: [PATCHES] Avahi support for Postgresql
Date: 2008-04-16 17:26:05
Message-ID: 200804161726.m3GHQ5w01887@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Added to TODO:

* Implement the non-threaded Avahi service discovery protocol

http://archives.postgresql.org/pgsql-hackers/2008-02/msg00939.php
http://archives.postgresql.org/pgsql-patches/2008-02/msg00097.php
http://archives.postgresql.org/pgsql-hackers/2008-03/msg01211.php
http://archives.postgresql.org/pgsql-patches/2008-04/msg00001.php

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Mathias Hasselmann wrote:
> > >
> > > > The patches were in my initial mail, but now I've also uploaded them to
> > > > my personal site for convenience:
> > > >
> > > > http://taschenorakel.de/files/pgsql-avahi-support/
> > >
> > > Hmm, a quick look at the third patch reveals that it is using the
> > > "threaded" Avahi client. That's a showstopper. Please consider using
> > > some other approach -- writing our own handlers for AvahiPoll would seem
> > > apropos.
> >
> > Based on the threading usage in this patch, I assume it is rejected, and
> > that we don't want a TODO item for this.
>
> This particular patch should be rejected, but we certainly do need a
> TODO item IMHO.
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +