From: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
---|---|
To: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Jacob Champion <jchampion(at)timescale(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>, Michael Banck <mbanck(at)gmx(dot)net>, Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Re: [EXTERNAL] Support load balancing in libpq |
Date: | 2023-03-27 14:51:56 |
Message-ID: | CAGECzQQdVGE_5jG-e81OAqV=c8H75CoQJixj4J6ay=z5wBKvkg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > ```
> > if (conn->addr == NULL && conn->naddr != 0)
> > ```
Afaict this is not necessary, since getaddrinfo already returns an
error if the host could not be resolved to any addresses. A quick test
gives me this error:
error: could not translate host name "doesnotexist" to address: Name
or service not known
>
> ```
> + }
> + else
> + conn->load_balance_type = LOAD_BALANCE_DISABLE;
> ```
>
> The else branch is never executed.
I don't think that line is coverable then. There's definitely places
in the test suite where load_balance_hosts is not explicitly set. But
even in those cases I guess the argument parsing logic will use
DefaultLoadBalanceHosts instead of NULL as a value for
conn->load_balance_type.
> Strangely enough the body of the for loop is never executed either.
> Apparently only one address is used and there is nothing to shuffle?
>
> Here is the exact command I used to build the code coverage report:
I guess you didn't set up the hostnames in /etc/hosts as described in
004_load_balance_dns.pl. Then it's expected that the loop body isn't
covered. As discussed upthread, running this test manually is much
more cumbersome than is desirable, but it's still better than not
having the test at all, because it is run in CI.
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2023-03-27 15:23:34 | Re: MacOS: xsltproc fails with "warning: failed to load external entity" |
Previous Message | Tomas Vondra | 2023-03-27 14:46:09 | Re: logical decoding and replication of sequences, take 2 |