Skip to content

Commit b453d03

Browse files
jrushf1239kjrushf1239k
authored andcommitted
TS-4747: make marking parent proxies down in hostdb configurable.
1 parent 924f15c commit b453d03

10 files changed

Lines changed: 33 additions & 1 deletion

File tree

doc/admin-guide/files/records.config.en.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,15 @@ Parent Proxy Configuration
12671267

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

1270+
.. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0
1271+
:reloadable:
1272+
:overridable:
1273+
1274+
Enables (``1``) or disables (``0``) marking parent proxies down in hostdb when a connection
1275+
error is detected. Normally parent selection manages parent proxies and will mark them as unavailable
1276+
as needed. But when parents are defined in dns with multiple ip addresses, it may be useful to mark the
1277+
failing ip down in hostdb. In this case you would enable these updates.
1278+
12701279
.. ts:cv:: CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
12711280
:reloadable:
12721281
:overridable:

doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ c:member:`TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS` :ts:cv:`prox
140140
c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS` :ts:cv:`proxy.config.http.origin_max_connections`
141141
c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE` :ts:cv:`proxy.config.http.origin_max_connections_queue`
142142
c:member:`TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS` :ts:cv:`proxy.config.http.parent_proxy.total_connect_attempts`
143+
c:member:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB` :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`
143144
c:member:`TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED` :ts:cv:`proxy.config.http.post.check.content_length.enabled`
144145
c:member:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.post_connect_attempts_timeout`
145146
c:member:`TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY` :ts:cv:`proxy.config.http.redirect_use_orig_cache_key`

lib/ts/apidefs.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ typedef enum {
745745
TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
746746
TS_CONFIG_SSL_CERT_FILENAME,
747747
TS_CONFIG_SSL_CERT_FILEPATH,
748+
TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
748749
TS_CONFIG_LAST_ENTRY
749750
} TSOverridableConfigKey;
750751

mgmt/RecordsConfig.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ static const RecordElement RecordsConfig[] =
518518
,
519519
{RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
520520
,
521+
{RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
522+
,
521523
{RECT_CONFIG, "proxy.config.http.forward.proxy_auth_to_parent", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
522524
,
523525

plugins/experimental/ts_lua/ts_lua_http_config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ typedef enum {
124124
TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
125125
TS_LUA_CONFIG_SSL_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME,
126126
TS_LUA_CONFIG_SSL_CERT_FILEPATH = TS_CONFIG_SSL_CERT_FILEPATH,
127+
TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
127128
} TSLuaOverridableConfigKey;
128129

129130
typedef enum {
@@ -238,6 +239,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
238239
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD),
239240
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILENAME),
240241
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILEPATH),
242+
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB),
241243
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
242244
};
243245

proxy/InkAPI.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8153,6 +8153,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
81538153
typ = OVERRIDABLE_TYPE_STRING;
81548154
ret = &overridableHttpConfig->client_cert_filepath;
81558155
break;
8156+
case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB:
8157+
ret = &overridableHttpConfig->parent_failures_update_hostdb;
8158+
break;
81568159
// This helps avoiding compiler warnings, yet detect unhandled enum members.
81578160
case TS_CONFIG_NULL:
81588161
case TS_CONFIG_LAST_ENTRY:
@@ -8772,6 +8775,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
87728775

87738776
case 47:
87748777
switch (name[length - 1]) {
8778+
case 'b':
8779+
if (!strncmp(name, "proxy.config.http.parent_proxy.mark_down_hostdb", length)) {
8780+
cnf = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB;
8781+
}
8782+
break;
87758783
case 'd':
87768784
if (!strncmp(name, "proxy.config.http.negative_revalidating_enabled", length)) {
87778785
cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED;

proxy/InkAPITest.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7621,6 +7621,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
76217621
"proxy.config.http.forward_connect_method",
76227622
"proxy.config.ssl.client.cert.filename",
76237623
"proxy.config.ssl.client.cert.path",
7624+
"proxy.config.http.parent_proxy.mark_down_hostdb",
76247625
};
76257626

76267627
REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)

proxy/http/HttpConfig.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ HttpConfig::startup()
972972
HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts");
973973
HttpEstablishStaticConfigLongLong(c.per_parent_connect_attempts, "proxy.config.http.parent_proxy.per_parent_connect_attempts");
974974
HttpEstablishStaticConfigLongLong(c.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout");
975+
HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb");
975976

976977
HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out");
977978
HttpEstablishStaticConfigLongLong(c.oride.sock_send_buffer_size_out, "proxy.config.net.sock_send_buffer_size_out");
@@ -1255,6 +1256,7 @@ HttpConfig::reconfigure()
12551256
params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts;
12561257
params->per_parent_connect_attempts = m_master.per_parent_connect_attempts;
12571258
params->parent_connect_timeout = m_master.parent_connect_timeout;
1259+
params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb;
12581260

12591261
params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out;
12601262
params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out;

proxy/http/HttpConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ struct OverridableHttpConfigParams {
410410
flow_control_enabled(0),
411411
normalize_ae_gzip(0),
412412
srv_enabled(0),
413+
parent_failures_update_hostdb(0),
413414
cache_open_write_fail_action(0),
414415
post_check_content_length_enabled(1),
415416
redirection_enabled(0),
@@ -563,6 +564,7 @@ struct OverridableHttpConfigParams {
563564
// hostdb/dns variables //
564565
//////////////////////////
565566
MgmtByte srv_enabled;
567+
MgmtByte parent_failures_update_hostdb;
566568

567569
MgmtByte cache_open_write_fail_action;
568570

proxy/http/HttpTransact.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3571,7 +3571,11 @@ HttpTransact::handle_response_from_parent(State *s)
35713571
ink_assert(s->hdr_info.server_request.valid());
35723572

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

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

0 commit comments

Comments
 (0)