Re: [EXTERNAL] Support load balancing in libpq

Поиск
Список
Период
Сортировка
От Jelte Fennema
Тема Re: [EXTERNAL] Support load balancing in libpq
Дата
Msg-id CAGECzQQdVGE_5jG-e81OAqV=c8H75CoQJixj4J6ay=z5wBKvkg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [EXTERNAL] Support load balancing in libpq  (Aleksander Alekseev <aleksander@timescale.com>)
Ответы Re: [EXTERNAL] Support load balancing in libpq  (Aleksander Alekseev <aleksander@timescale.com>)
Список 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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: logical decoding and replication of sequences, take 2
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: MacOS: xsltproc fails with "warning: failed to load external entity"