Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/admin-guide/files/records.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,15 @@ Parent Proxy Configuration

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0
:reloadable:
:overridable:

Enables (``1``) or disables (``0``) marking parent proxies down in hostdb when a connection
error is detected. Normally parent selection manages parent proxies and will mark them as unavailable
as needed. But when parents are defined in dns with multiple ip addresses, it may be useful to mark the
failing ip down in hostdb. In this case you would enable these updates.

.. ts:cv:: CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
:reloadable:
:overridable:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ c:member:`TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS` :ts:cv:`prox
c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS` :ts:cv:`proxy.config.http.origin_max_connections`
c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE` :ts:cv:`proxy.config.http.origin_max_connections_queue`
c:member:`TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS` :ts:cv:`proxy.config.http.parent_proxy.total_connect_attempts`
c:member:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB` :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`
c:member:`TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED` :ts:cv:`proxy.config.http.post.check.content_length.enabled`
c:member:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.post_connect_attempts_timeout`
c:member:`TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY` :ts:cv:`proxy.config.http.redirect_use_orig_cache_key`
Expand Down
1 change: 1 addition & 0 deletions lib/ts/apidefs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ typedef enum {
TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
TS_CONFIG_SSL_CERT_FILENAME,
TS_CONFIG_SSL_CERT_FILEPATH,
TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
TS_CONFIG_LAST_ENTRY
} TSOverridableConfigKey;

Expand Down
2 changes: 2 additions & 0 deletions mgmt/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.forward.proxy_auth_to_parent", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,

Expand Down
2 changes: 2 additions & 0 deletions plugins/experimental/ts_lua/ts_lua_http_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ typedef enum {
TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
TS_LUA_CONFIG_SSL_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME,
TS_LUA_CONFIG_SSL_CERT_FILEPATH = TS_CONFIG_SSL_CERT_FILEPATH,
TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
} TSLuaOverridableConfigKey;

typedef enum {
Expand Down Expand Up @@ -238,6 +239,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILENAME),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILEPATH),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
};

Expand Down
8 changes: 8 additions & 0 deletions proxy/InkAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8150,6 +8150,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
typ = OVERRIDABLE_TYPE_STRING;
ret = &overridableHttpConfig->client_cert_filepath;
break;
case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB:
ret = &overridableHttpConfig->parent_failures_update_hostdb;
break;
// This helps avoiding compiler warnings, yet detect unhandled enum members.
case TS_CONFIG_NULL:
case TS_CONFIG_LAST_ENTRY:
Expand Down Expand Up @@ -8769,6 +8772,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,

case 47:
switch (name[length - 1]) {
case 'b':
if (!strncmp(name, "proxy.config.http.parent_proxy.mark_down_hostdb", length)) {
cnf = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB;
}
break;
case 'd':
if (!strncmp(name, "proxy.config.http.negative_revalidating_enabled", length)) {
cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED;
Expand Down
1 change: 1 addition & 0 deletions proxy/InkAPITest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7621,6 +7621,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
"proxy.config.http.forward_connect_method",
"proxy.config.ssl.client.cert.filename",
"proxy.config.ssl.client.cert.path",
"proxy.config.http.parent_proxy.mark_down_hostdb",
};

REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
Expand Down
2 changes: 2 additions & 0 deletions proxy/http/HttpConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ HttpConfig::startup()
HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts");
HttpEstablishStaticConfigLongLong(c.per_parent_connect_attempts, "proxy.config.http.parent_proxy.per_parent_connect_attempts");
HttpEstablishStaticConfigLongLong(c.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout");
HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb");

HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out");
HttpEstablishStaticConfigLongLong(c.oride.sock_send_buffer_size_out, "proxy.config.net.sock_send_buffer_size_out");
Expand Down Expand Up @@ -1255,6 +1256,7 @@ HttpConfig::reconfigure()
params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts;
params->per_parent_connect_attempts = m_master.per_parent_connect_attempts;
params->parent_connect_timeout = m_master.parent_connect_timeout;
params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb;

params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out;
params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out;
Expand Down
2 changes: 2 additions & 0 deletions proxy/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ struct OverridableHttpConfigParams {
flow_control_enabled(0),
normalize_ae_gzip(0),
srv_enabled(0),
parent_failures_update_hostdb(0),
cache_open_write_fail_action(0),
post_check_content_length_enabled(1),
redirection_enabled(0),
Expand Down Expand Up @@ -563,6 +564,7 @@ struct OverridableHttpConfigParams {
// hostdb/dns variables //
//////////////////////////
MgmtByte srv_enabled;
MgmtByte parent_failures_update_hostdb;

MgmtByte cache_open_write_fail_action;

Expand Down
6 changes: 5 additions & 1 deletion proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3571,7 +3571,11 @@ HttpTransact::handle_response_from_parent(State *s)
ink_assert(s->hdr_info.server_request.valid());

s->current.server->connect_result = ENOTCONN;
s->state_machine->do_hostdb_update_if_necessary();
// only mark the parent down in hostdb if the configuration allows it,
// see proxy.config.http.parent_proxy.mark_down_hostdb in records.config.
if (s->txn_conf->parent_failures_update_hostdb) {
s->state_machine->do_hostdb_update_if_necessary();
}

char addrbuf[INET6_ADDRSTRLEN];
DebugTxn("http_trans", "[%d] failed to connect to parent %s", s->current.attempts,
Expand Down