Re: libpq should not look up all host addresses at once

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chapman Flack <chap(at)anastigmatix(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: libpq should not look up all host addresses at once
Date: 2018-08-12 06:26:15
Message-ID: 20180812062615.GA2619236@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 09, 2018 at 02:32:58PM -0400, Tom Lane wrote:
> Chapman Flack <chap(at)anastigmatix(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2018-08-12 06:48:15 Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid
Previous Message Pavel Stehule 2018-08-12 05:42:50 Re: [HACKERS] Optional message to user when terminating/cancelling backend