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 @@ -1075,6 +1075,15 @@ Parent Proxy Configuration

The timeout value (in seconds) for parent cache connection attempts.

.. 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 @@ -151,6 +151,7 @@ The following configurations (from ``records.config``) are overridable.
| :ts:cv:`proxy.config.http.number_of_redirections`
| :ts:cv:`proxy.config.http.cache.max_open_write_retries`
| :ts:cv:`proxy.config.http.redirect_use_orig_cache_key`
| :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`

Examples
========
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 @@ -681,6 +681,7 @@ typedef enum {
TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
TS_CONFIG_LAST_ENTRY
} TSOverridableConfigKey;

Expand Down
4 changes: 3 additions & 1 deletion mgmt/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.forward.proxy_auth_to_parent", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, 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 @@ -120,6 +120,7 @@ typedef enum {
TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
TS_LUA_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
} TSLuaOverridableConfigKey;

typedef enum {
Expand Down Expand Up @@ -230,6 +231,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN),
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 @@ -7979,6 +7979,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
typ = OVERRIDABLE_TYPE_INT;
ret = &overridableHttpConfig->transaction_active_timeout_in;
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 @@ -8521,6 +8524,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 @@ -7487,6 +7487,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
"proxy.config.http.uncacheable_requests_bypass_parent",
"proxy.config.http.parent_proxy.total_connect_attempts",
"proxy.config.http.transaction_active_timeout_in",
"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 @@ -959,6 +959,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 @@ -1232,6 +1233,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
6 changes: 6 additions & 0 deletions proxy/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ struct OverridableHttpConfigParams {
flow_control_enabled(0),
accept_encoding_filter_enabled(0),
normalize_ae_gzip(0),
parent_failures_update_hostdb(0),
negative_caching_lifetime(1800),
negative_revalidating_lifetime(1800),
sock_recv_buffer_size_out(0),
Expand Down Expand Up @@ -555,6 +556,11 @@ struct OverridableHttpConfigParams {
////////////////////////////////
MgmtByte normalize_ae_gzip;

//////////////////////////
// hostdb/dns variables //
//////////////////////////
MgmtByte parent_failures_update_hostdb;

////////////////////////////////
// Negative cache lifetimes //
////////////////////////////////
Expand Down
6 changes: 5 additions & 1 deletion proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3603,7 +3603,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