From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Chapman Flack <chap@anastigmatix.net>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: libpq should not look up all host addresses at once
Date: Sun, 12 Aug 2018 06:26:15 +0000
Message-ID: <20180812062615.GA2619236@rfd.leadboat.com> (raw)
In-Reply-To: <14647.1533839578@sss.pgh.pa.us>
References: <4913.1533827102@sss.pgh.pa.us>
<641169e3-0410-1317-c997-ceec24ff117a@anastigmatix.net>
<14647.1533839578@sss.pgh.pa.us>
On Thu, Aug 09, 2018 at 02:32:58PM -0400, Tom Lane wrote:
> Chapman Flack <chap@anastigmatix.net> writes:
> > On 08/09/2018 11:05 AM, Tom Lane wrote:
> >> So I think what this code should do is (1) look up each hostname as it
> >> needs it, not all at once, and (2) proceed on to the next hostname
> >> if it gets a DNS lookup failure, not fail the whole connection attempt
> >> immediately. As attached.
>
> > Would it be worth the complexity to be a little async about it,
> > fling a few DNS requests out, and try the hosts in the order the
> > responses come back?
>
> It would be nice if an async connection request didn't have to block during
> DNS lookups ... but I don't know of any portable library API for async DNS
> requests
https://c-ares.haxx.se/ is the async DNS API that I've experienced. It works
well if you really need such a thing, but I haven't needed it in libpq.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, chap@anastigmatix.net, pgsql-hackers@lists.postgresql.org
Subject: Re: libpq should not look up all host addresses at once
In-Reply-To: <20180812062615.GA2619236@rfd.leadboat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox