Skip to content

Make host status persistent across restarts - #5252

Merged
vmamidi merged 2 commits into
apache:masterfrom
jrushford:host_status_persistence
Apr 9, 2019
Merged

vmamidi merged 2 commits into
apache:masterfrom
jrushford:host_status_persistence

Conversation

@jrushford

@jrushford jrushford commented Apr 8, 2019 •

Copy link
Copy Markdown
Contributor

Traffic Server doesn't retain the host status ( up/down) across Traffic Server restarts. This PR uses stats(records.snap) to retain the host status. Although stats is not the right place to store this information as HostDB is the process of being rewritten, records.snap seems to be a temporary alternative. This is a PR to fix issue #5248.

@jrushford jrushford added this to the 9.0.0 milestone Apr 8, 2019
@jrushford
jrushford requested a review from vmamidi April 8, 2019 22:40

@vmamidi vmamidi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Stats should be read while reading the parent.config.
  2. RecData from RecRecord should be used to get value of stat.
  3. Stats data should be merged with parents from parents.config.

Comment thread src/traffic_server/HostStatus.cc Resolved
Comment thread src/traffic_server/HostStatus.cc Resolved
Comment thread src/traffic_server/HostStatus.cc Resolved
Comment thread src/traffic_server/traffic_server.cc Resolved
Comment thread proxy/HostStatus.h Resolved
@jrushford
jrushford force-pushed the host_status_persistence branch from 8af233a to a301948 Compare April 9, 2019 18:35
HostStatus stats after a restart of trafficserver.
@jrushford
jrushford force-pushed the host_status_persistence branch from a301948 to b69ff6e Compare April 9, 2019 18:51
@jrushford jrushford changed the title DRAFT: This PR fixes #5248 - parent host status is not persistent This PR fixes #5248 - parent host status is not persistent Apr 9, 2019
@jrushford jrushford removed the WIP label Apr 9, 2019
@jrushford
jrushford marked this pull request as ready for review April 9, 2019 19:58
@vmamidi
vmamidi merged commit c1f8435 into apache:master Apr 9, 2019
@jrushford jrushford self-assigned this Apr 9, 2019
@vmamidi vmamidi changed the title This PR fixes #5248 - parent host status is not persistent This PR fixes #5248 - host status is not persistent across restarts Apr 9, 2019
@vmamidi vmamidi changed the title This PR fixes #5248 - host status is not persistent across restarts Make host status persistent across restarts Apr 9, 2019
@oknet

oknet commented Apr 30, 2019

Copy link
Copy Markdown
Member

The PR breaks SocksProxy.

The defaults socks server is set to UP (status: 2) during loadSocksConfiguration() which called by netProcessor.init():

Traffic Server 9.0.0 Apr 29 2019 20:13:46 bogon
traffic_server: using root directory '/usr/local/ats'
[Apr 30 00:15:33.600]  DEBUG: <DNS.cc:1785 (ink_dns_init)> (dns) ink_dns_init: called with init_called = 0
[Apr 30 00:15:33.600]  DEBUG: <Socks.cc:474 (loadSocksConfiguration)> (Socks) Socks Version 5
[Apr 30 00:15:33.600]  DEBUG: <Socks.cc:484 (loadSocksConfiguration)> (Socks) server connect timeout: 10 socks respnonse timeout 15
[Apr 30 00:15:33.600]  DEBUG: <Socks.cc:495 (loadSocksConfiguration)> (SocksProxy) Read SocksProxy info: accept_enabled = 1 accept_port = 10800 http_port = 80
[Apr 30 00:15:33.600]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_manual, id: -1
[Apr 30 00:15:33.600]  DEBUG: <HostStatus.cc:249 (createHostStat)> (host_statuses) stat name: proxy.process.host_status.172.22.21.211_active, id: 1
[Apr 30 00:15:33.600]  DEBUG: <HostStatus.cc:249 (createHostStat)> (host_statuses) stat name: proxy.process.host_status.172.22.21.211_local, id: 2
[Apr 30 00:15:33.654]  DEBUG: <HostStatus.cc:249 (createHostStat)> (host_statuses) stat name: proxy.process.host_status.172.22.21.211_manual, id: 3
[Apr 30 00:15:33.654]  DEBUG: <HostStatus.cc:249 (createHostStat)> (host_statuses) stat name: proxy.process.host_status.172.22.21.211_self_detect, id: 4
[Apr 30 00:15:33.654]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_manual, id: 3
[Apr 30 00:15:33.654]  DEBUG: <HostStatus.cc:168 (setHostStatus)> (host_statuses) set status up for :  name: 172.22.21.211, status: 2, reason_stat: proxy.process.host_status.172.22.21.211_manual
[Apr 30 00:15:33.654]  DEBUG: <HostStatus.cc:177 (setHostStatus)> (host_statuses) name: 172.22.21.211, status: 2
[Apr 30 00:15:33.673]  DEBUG: <Socks.cc:502 (loadSocksConfiguration)> (Socks) Socks Config File: /usr/local/ats/etc/trafficserver/socks.config
[Apr 30 00:15:33.676]  DEBUG: <Socks.cc:530 (loadSocksConfiguration)> (Socks) Socks Turned on

The defaults socks server is set to DOWN (status: 1) by HostStatus::instance().loadHostStatusFromStats().

[Apr 30 00:15:33.677]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_active, id: 1
[Apr 30 00:15:33.677]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_active, id: 1
[Apr 30 00:15:33.677]  DEBUG: <HostStatus.cc:172 (setHostStatus)> (host_statuses) set status down for :  name: 172.22.21.211, status: 1, reason_stat: proxy.process.host_status.172.22.21.211_active
[Apr 30 00:15:33.677]  DEBUG: <HostStatus.cc:177 (setHostStatus)> (host_statuses) name: 172.22.21.211, status: 1
[Apr 30 00:15:33.678]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_local, id: 2
[Apr 30 00:15:33.678]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_local, id: 2
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:172 (setHostStatus)> (host_statuses) set status down for :  name: 172.22.21.211, status: 1, reason_stat: proxy.process.host_status.172.22.21.211_local
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:177 (setHostStatus)> (host_statuses) name: 172.22.21.211, status: 1
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_manual, id: 3
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_manual, id: 3
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:172 (setHostStatus)> (host_statuses) set status down for :  name: 172.22.21.211, status: 1, reason_stat: proxy.process.host_status.172.22.21.211_manual
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:177 (setHostStatus)> (host_statuses) name: 172.22.21.211, status: 1
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_self_detect, id: 4
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:267 (getHostStatId)> (host_statuses) name: proxy.process.host_status.172.22.21.211_self_detect, id: 4
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:172 (setHostStatus)> (host_statuses) set status down for :  name: 172.22.21.211, status: 1, reason_stat: proxy.process.host_status.172.22.21.211_self_detect
[Apr 30 00:15:33.742]  DEBUG: <HostStatus.cc:177 (setHostStatus)> (host_statuses) name: 172.22.21.211, status: 1
1808   netProcessor.init();                     // ---> socks config loaded at here
1809   prep_HttpProxyServer();
...snip...
1862   } else {
1863     remapProcessor.start(num_remap_threads, stacksize);
1864     RecProcessStart();
1865     initCacheControl();
1866     IpAllow::startup();
1867     HostStatus::instance().loadHostStatusFromStats();    // ---> HostStatus persistent data loaded at here
1868     ParentConfig::startup();          // ---> parents proxy config loaded at here
1869 #ifdef SPLIT_DNS
1870     SplitDNSConfig::startup();
1871 #endif

@jrushford Does the HostStatus persistent data have to be loaded before the records ?

@zwoop

zwoop commented Mar 19, 2020

Copy link
Copy Markdown
Contributor

This has merge conflicts, and we'll need a new 8.1.x PR. Also, feel free to recommend / suggest other PRs that this depends on, such that it makes the back porting easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants