trafficserver git commit: Revert "TS-3710: ASAN crash in TLS with 6.0.0"
Repository: trafficserver Updated Branches: refs/heads/master d0f908da3 -> 5defa51cd Revert "TS-3710: ASAN crash in TLS with 6.0.0" This reverts commit f71d0685333d7853a7ca5ea98fc43b18de1f5488. Still seeing issues. Backing out this change until we get the whole issue figured out. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5defa51c Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5defa51c Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5defa51c Branch: refs/heads/master Commit: 5defa51cd3ddcce05b0be4aa3f7b9d5a6f87a111 Parents: d0f908d Author: shinrich Authored: Mon Jul 6 09:10:58 2015 -0500 Committer: shinrich Committed: Mon Jul 6 09:10:58 2015 -0500 -- iocore/net/SSLNextProtocolAccept.cc | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5defa51c/iocore/net/SSLNextProtocolAccept.cc -- diff --git a/iocore/net/SSLNextProtocolAccept.cc b/iocore/net/SSLNextProtocolAccept.cc index 7e85e9c..c4748c3 100644 --- a/iocore/net/SSLNextProtocolAccept.cc +++ b/iocore/net/SSLNextProtocolAccept.cc @@ -85,7 +85,7 @@ struct SSLNextProtocolTrampoline : public Continuation { case VC_EVENT_ERROR: case VC_EVENT_ACTIVE_TIMEOUT: case VC_EVENT_INACTIVITY_TIMEOUT: - netvc->do_io_close(); + netvc->do_io(VIO::CLOSE); delete this; return EVENT_ERROR; case VC_EVENT_READ_COMPLETE: @@ -96,15 +96,13 @@ struct SSLNextProtocolTrampoline : public Continuation { plugin = netvc->endpoint(); if (plugin) { - netvc->do_io_read(NULL, 0, NULL); // Disable the read IO that we started. send_plugin_event(plugin, NET_EVENT_ACCEPT, netvc); } else if (npnParent->endpoint) { // Route to the default endpoint - netvc->do_io_read(NULL, 0, NULL); // Disable the read IO that we started. send_plugin_event(npnParent->endpoint, NET_EVENT_ACCEPT, netvc); } else { // No handler, what should we do? Best to just kill the VC while we can. - netvc->do_io_close(); + netvc->do_io(VIO::CLOSE); } delete this; @@ -132,11 +130,11 @@ SSLNextProtocolAccept::mainEvent(int event, void *edata) // the endpoint that there is an accept to handle until the read completes // and we know which protocol was negotiated. netvc->registerNextProtocolSet(&this->protoset); -netvc->do_io_read(new SSLNextProtocolTrampoline(this, netvc->mutex), 0, this->buffer); +netvc->do_io(VIO::READ, new SSLNextProtocolTrampoline(this, netvc->mutex), 0, this->buffer, 0); netvc->set_session_accept_pointer(this); return EVENT_CONT; default: -netvc->do_io_close(); +netvc->do_io(VIO::CLOSE); return EVENT_DONE; } }
[2/2] trafficserver git commit: TS-3732: Add changelog make target to rel-candidate and improve error handling
TS-3732: Add changelog make target to rel-candidate and improve error handling (cherry picked from commit 29b439c19b20f851df42de20007dd0ea76b572dd) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cca283cb Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cca283cb Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cca283cb Branch: refs/heads/6.0.x Commit: cca283cb9ae48e0851f037d3b99c6c8d4e336e32 Parents: d5898eb Author: Phil Sorber Authored: Wed Jul 1 21:17:57 2015 -0600 Committer: Bryan Call Committed: Mon Jul 6 08:44:13 2015 -0700 -- Makefile.am| 4 ++-- tools/changelog.pl | 13 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca283cb/Makefile.am -- diff --git a/Makefile.am b/Makefile.am index 2b9c1f7..5610f31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,7 +55,7 @@ doxygen: changelog: ./tools/changelog.pl $(VERSION) > CHANGELOG-$(VERSION) - git add CHANGELOG-$(VERSION) && git commit -m "Adding CHANGELOG-$(VERSION)" + -git add CHANGELOG-$(VERSION) && git commit -m "Adding CHANGELOG-$(VERSION)" asf-dist: asf-distdir tardir=$(distdir) && $(am__tar) --mtime=./configure.ac | bzip2 -9 -c >$(distdir).tar.bz2 @@ -84,7 +84,7 @@ asf-dist-sign-rc: asf-dist-rc release: changelog asf-dist-sign git tag -fs -m "Release $(VERSION)" $(VERSION) -rel-candidate: asf-dist-sign-rc +rel-candidate: changelog asf-dist-sign-rc git tag -fs -m "Release Candidate $(VERSION)-rc$(RC)" $(VERSION)-rc$(RC) examples: all http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca283cb/tools/changelog.pl -- diff --git a/tools/changelog.pl b/tools/changelog.pl index c3d0173..2b400a4 100755 --- a/tools/changelog.pl +++ b/tools/changelog.pl @@ -52,8 +52,7 @@ sub jira_search $curl->setopt(CURLOPT_WRITEDATA, \$resp_body); $curl->setopt(CURLOPT_URL, $url . $endpoint); my $retcode = $curl->perform(); - if ($retcode == 0) { -my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); + if ($retcode == 0 && $curl->getinfo(CURLINFO_HTTP_CODE) == 200) { return from_json($resp_body); } @@ -68,6 +67,11 @@ do { $issues = jira_search($url, $jql, $count); + if (!defined($issues)) + { +exit 1; + } + foreach my $issue (@{ $issues->{issues} }) { if (defined($issue)) @@ -79,6 +83,11 @@ do } while ($count < $issues->{total}); +if (!defined($changelog)) +{ + exit 1; +} + print " -*- coding: utf-8 -*-\n\n"; print "Changes with Apache Traffic Server $fixversion\n";
[1/2] trafficserver git commit: TS-3732 Rename changelog.pl, move changelog Makefile.am target
Repository: trafficserver Updated Branches: refs/heads/6.0.x 703ccb710 -> cca283cb9 TS-3732 Rename changelog.pl, move changelog Makefile.am target (cherry picked from commit a2eb53553645f75530ba0e51b3124ae116cb72eb) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d5898eb1 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d5898eb1 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d5898eb1 Branch: refs/heads/6.0.x Commit: d5898eb1e81b67bbae087370db7cc8f8c599756c Parents: 703ccb7 Author: Leif Hedstrom Authored: Wed Jul 1 18:58:54 2015 -0700 Committer: Bryan Call Committed: Mon Jul 6 08:43:54 2015 -0700 -- Makefile.am| 6 +++- tools/changelog.pl | 92 + 2 files changed, 97 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d5898eb1/Makefile.am -- diff --git a/Makefile.am b/Makefile.am index f388e60..2b9c1f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,6 +53,10 @@ distclean-local: doxygen: @cd doc && $(MAKE) $(AM_MAKEFLAGS) $@ +changelog: + ./tools/changelog.pl $(VERSION) > CHANGELOG-$(VERSION) + git add CHANGELOG-$(VERSION) && git commit -m "Adding CHANGELOG-$(VERSION)" + asf-dist: asf-distdir tardir=$(distdir) && $(am__tar) --mtime=./configure.ac | bzip2 -9 -c >$(distdir).tar.bz2 @$(am__remove_distdir) @@ -77,7 +81,7 @@ asf-dist-sign-rc: asf-dist-rc sha1sum -b $(distdir)-rc$(RC).tar.bz2 >$(distdir)-rc$(RC).tar.bz2.sha1 gpg --armor --output $(distdir)-rc$(RC).tar.bz2.asc --detach-sig $(distdir)-rc$(RC).tar.bz2 -release: asf-dist-sign +release: changelog asf-dist-sign git tag -fs -m "Release $(VERSION)" $(VERSION) rel-candidate: asf-dist-sign-rc http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d5898eb1/tools/changelog.pl -- diff --git a/tools/changelog.pl b/tools/changelog.pl new file mode 100755 index 000..c3d0173 --- /dev/null +++ b/tools/changelog.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +use strict; +use warnings; + +use WWW::Curl::Easy; +use JSON; + +my $fixversion = shift; +my $url = "https://issues.apache.org/jira";; +my $jql = "project = TS AND status in (Resolved, Closed) AND fixVersion = $fixversion ORDER BY key ASC"; + +sub jira_search +{ + my $url = shift; + my $jql = shift; + my $index = shift; + my $endpoint = "/rest/api/2/search"; + + my $query = { +jql => $jql, +startAt => $index, +fields => [ + "summary", + "issuetype" +] + }; + + my $req_body = to_json($query); + my $resp_body; + my $curl = WWW::Curl::Easy->new; + + $curl->setopt(CURLOPT_POST, 1); + $curl->setopt(CURLOPT_POSTFIELDS, $req_body); + $curl->setopt(CURLOPT_HTTPHEADER, ['Content-Type: application/json']); + $curl->setopt(CURLOPT_WRITEDATA, \$resp_body); + $curl->setopt(CURLOPT_URL, $url . $endpoint); + my $retcode = $curl->perform(); + if ($retcode == 0) { +my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); +return from_json($resp_body); + } + + undef; +} + +my $count = 0; +my $changelog; +my $issues; + +do +{ + $issues = jira_search($url, $jql, $count); + + foreach my $issue (@{ $issues->{issues} }) + { +if (defined($issue)) +{ + push @{ $changelog->{$issue->{fields}{issuetype}{name}} }, {key => $issue->{key}, summary => $issue->{fields}{summary}}; + $count++; +} + } +} +while ($count < $issues->{total}); + +print " -*- coding: utf-8 -*-\n\n"; +print "Changes with Apache Traffic Server $fixversion\n"; + +foreach my $key (sort keys %{ $changelog }) +{ + print "\n$key:\n\n"; + foreach my $issue (@{ $changelog->{$key} }) + { +print " *) [$issue->{key}] $issue->{summary}\n\n"; + } +}
trafficserver git commit: TS-3731 Missed removing some reclaimable freelist configs
Repository: trafficserver Updated Branches: refs/heads/6.0.x cca283cb9 -> e95d2f379 TS-3731 Missed removing some reclaimable freelist configs (cherry picked from commit 758b5ebfca77d02ff78e6dc2042b093d7e2e2aba) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e95d2f37 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e95d2f37 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e95d2f37 Branch: refs/heads/6.0.x Commit: e95d2f379f61ff73be4f2c45f0445c65de6c6b52 Parents: cca283c Author: Leif Hedstrom Authored: Wed Jul 1 17:13:39 2015 -0700 Committer: Bryan Call Committed: Mon Jul 6 08:45:56 2015 -0700 -- mgmt/RecordsConfig.cc | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e95d2f37/mgmt/RecordsConfig.cc -- diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 0f9d8c8..8039eb6 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -1963,22 +1963,6 @@ static const RecordElement RecordsConfig[] = // //# - //# Using for Reclaimable InkFreeList memory pool - //# - // - {RECT_CONFIG, "proxy.config.allocator.enable_reclaim", RECD_INT, "1", RECU_NULL, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} - , - {RECT_CONFIG, "proxy.config.allocator.max_overage", RECD_INT, "3", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.allocator.reclaim_factor", RECD_FLOAT, "0.3", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.allocator.debug_filter", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, "[0-3]", RECA_NULL} - , - {RECT_CONFIG, "proxy.config.allocator.hugepages", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} - , - - // - //# //# Per-thread freelist / allocator controls //# // @@ -1987,6 +1971,8 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.allocator.thread_freelist_low_watermark", RECD_INT, "32", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} , + {RECT_CONFIG, "proxy.config.allocator.hugepages", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} + , // //#
trafficserver git commit: TS-3722 Eliminate the remnants of tstop, which is known only as traffic_top
Repository: trafficserver Updated Branches: refs/heads/6.0.x e95d2f379 -> 5194f8301 TS-3722 Eliminate the remnants of tstop, which is known only as traffic_top (cherry picked from commit 315371ae943c1bf1f6f7dd2b3a666a2230d49d7a) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5194f830 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5194f830 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5194f830 Branch: refs/heads/6.0.x Commit: 5194f8301506d25ff843d4351f626b500013016e Parents: e95d2f3 Author: Leif Hedstrom Authored: Mon Jun 29 14:01:17 2015 -0700 Committer: Bryan Call Committed: Mon Jul 6 08:48:40 2015 -0700 -- README | 8 cmd/traffic_top/Makefile.am | 8 ++-- cmd/traffic_top/stats.h | 2 +- configure.ac | 4 ++-- doc/locale/ja/LC_MESSAGES/reference/commands/tstop.en.po | 6 +++--- tools/lighttpd_mod_generator/mod_generator.c | 2 +- 6 files changed, 13 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5194f830/README -- diff --git a/README b/README index 78cce71..97a299b 100644 --- a/README +++ b/README @@ -115,8 +115,8 @@ plugins to build large scale web applications. flex (optional, required for e.g. WCCP) libhwloc-dev (optional, highly recommended) liblua5.1-dev or libluajit-5.1-dev (optional) -libncurses5-dev (optional, required for e.g.: tstop) -libcurl4-openssl-dev (optional, required for e.g.: tstop) +libncurses5-dev (optional, required for e.g.: traffic_top) +libcurl4-openssl-dev (optional, required for e.g.: traffic_top) Ubuntu EC2 9.10: NOTE: Alternately you may use the install scripts in 'contrib' which @@ -139,8 +139,8 @@ plugins to build large scale web applications. flex (optional) libhwloc-dev (optional, highly recommended) liblua-dev (optional) -libncurses5-dev (optional, required for e.g.: tstop) -libcurl3-openssl-dev (optional, required for e.g.: tstop) +libncurses5-dev (optional, required for e.g.: traffic_top) +libcurl3-openssl-dev (optional, required for e.g.: traffic_top) FreeBSD 7.2,8.0,9.0,9.1 GCC 4.2.1 compiler suite or clang. You can install the following http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5194f830/cmd/traffic_top/Makefile.am -- diff --git a/cmd/traffic_top/Makefile.am b/cmd/traffic_top/Makefile.am index f586bbe..de4bf02 100644 --- a/cmd/traffic_top/Makefile.am +++ b/cmd/traffic_top/Makefile.am @@ -15,8 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# We only build tstop if libcurses and libcurl are available. -if BUILD_TSTOP +# We only build traffic_top if libcurses and libcurl are available. +if BUILD_TRAFFIC_TOP AM_CPPFLAGS = \ $(iocore_include_dirs) \ @@ -40,8 +40,4 @@ traffic_top_LDADD = \ $(top_builddir)/mgmt/api/libtsmgmt.la \ @CURL_LIBS@ @CURSES_LIB@ -# Install a compatibility symlink because traffic_top was named tstop in previous releases. -install-exec-hook: - cd $(DESTDIR)$(bindir) && $(RM) tstop && $(LN_S) traffic_top tstop - endif http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5194f830/cmd/traffic_top/stats.h -- diff --git a/cmd/traffic_top/stats.h b/cmd/traffic_top/stats.h index 4b48bde..78d7f89 100644 --- a/cmd/traffic_top/stats.h +++ b/cmd/traffic_top/stats.h @@ -1,6 +1,6 @@ /** @file -Include file for the tstop stats. +Include file for the traffic_top stats. @section license License http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5194f830/configure.ac -- diff --git a/configure.ac b/configure.ac index ce9a8b6..d673a28 100644 --- a/configure.ac +++ b/configure.ac @@ -1080,9 +1080,9 @@ AX_WITH_CURSES CFLAGS="$__saved_CFLAGS" AX_LIB_CURL([7.19], [ -AM_CONDITIONAL([BUILD_TSTOP], [test "x$ax_cv_curses" = "xyes"]) +AM_CONDITIONAL([BUILD_TRAFFIC_TOP], [test "x$ax_cv_curses" = "xyes"]) ], [ -AM_CONDITIONAL([BUILD_TSTOP], [false]) +AM_CONDITIONAL([BUILD_TRAFFIC_TOP], [false]) ] ) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5194f830/doc/locale/ja/LC_MESSAGES/reference/commands/tstop.en.po -- diff --git a/doc/locale/ja/LC_MESSAGES/reference/commands/tstop.en.po b/doc/locale/
trafficserver git commit: Revert "TS-3237: Don't segregate DNS results by port."
Repository: trafficserver Updated Branches: refs/heads/6.0.x 5194f8301 -> e24062bde Revert "TS-3237: Don't segregate DNS results by port." Fixes: TS-3720 (cherry picked from commit 6e33c64c18f93efc6921e0573f87da03251164ed) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e24062bd Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e24062bd Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e24062bd Branch: refs/heads/6.0.x Commit: e24062bde7be2137a43e64bceced70a54b35ea2b Parents: 5194f83 Author: Thomas Jackson Authored: Wed Jul 1 11:35:10 2015 -0700 Committer: Bryan Call Committed: Mon Jul 6 08:50:53 2015 -0700 -- proxy/http/HttpSM.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24062bd/proxy/http/HttpSM.cc -- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 307a18f..0e37f22 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3935,12 +3935,16 @@ HttpSM::do_hostdb_lookup() } else { /* we aren't using SRV stuff... */ DebugSM("http_seq", "[HttpSM::do_hostdb_lookup] Doing DNS Lookup"); +// If there is not a current server, we must be looking up the origin +// server at the beginning of the transaction +int server_port = t_state.current.server ? t_state.current.server->port : t_state.server_info.port; + if (t_state.api_txn_dns_timeout_value != -1) { DebugSM("http_timeout", "beginning DNS lookup. allowing %d mseconds for DNS lookup", t_state.api_txn_dns_timeout_value); } HostDBProcessor::Options opt; - +opt.port = server_port; opt.flags = (t_state.cache_info.directives.does_client_permit_dns_storing) ? HostDBProcessor::HOSTDB_DO_NOT_FORCE_DNS : HostDBProcessor::HOSTDB_FORCE_DNS_RELOAD; opt.timeout = (t_state.api_txn_dns_timeout_value != -1) ? t_state.api_txn_dns_timeout_value : 0;
[2/2] trafficserver git commit: TS-3486: clang-format
TS-3486: clang-format (cherry picked from commit 1a160e13e4931fbaa522339c99abfad1ce9d638c) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7b4c7852 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7b4c7852 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7b4c7852 Branch: refs/heads/6.0.x Commit: 7b4c78527e6dc2061c79e1b442f37b176c0930f4 Parents: 97b9bc4 Author: Phil Sorber Authored: Mon Jun 29 16:18:14 2015 -0600 Committer: Bryan Call Committed: Mon Jul 6 08:54:27 2015 -0700 -- proxy/http/HttpSessionManager.cc | 11 +++ proxy/http/HttpSessionManager.h | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b4c7852/proxy/http/HttpSessionManager.cc -- diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc index 80067d6..5feb9c4 100644 --- a/proxy/http/HttpSessionManager.cc +++ b/proxy/http/HttpSessionManager.cc @@ -75,7 +75,8 @@ ServerSessionPool::match(HttpServerSession *ss, sockaddr const *addr, INK_MD5 co } HSMresult_t -ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_hash, TSServerSessionSharingMatchType match_style, HttpServerSession *&to_return) +ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_hash, TSServerSessionSharingMatchType match_style, + HttpServerSession *&to_return) { HSMresult_t zret = HSM_NOT_FOUND; if (TS_SERVER_SESSION_SHARING_MATCH_HOST == match_style) { @@ -265,7 +266,9 @@ HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUSED */, sockad // Now check to see if we have a connection in our shared connection pool EThread *ethread = this_ethread(); - ProxyMutex * pool_mutex = (TS_SERVER_SESSION_SHARING_POOL_THREAD == sm->t_state.http_config_param->server_session_sharing_pool) ? ethread->server_session_pool->mutex : m_g_pool->mutex; + ProxyMutex *pool_mutex = (TS_SERVER_SESSION_SHARING_POOL_THREAD == sm->t_state.http_config_param->server_session_sharing_pool) ? + ethread->server_session_pool->mutex : + m_g_pool->mutex; MUTEX_TRY_LOCK(lock, pool_mutex, ethread); if (lock.is_locked()) { if (TS_SERVER_SESSION_SHARING_POOL_THREAD == sm->t_state.http_config_param->server_session_sharing_pool) { @@ -278,9 +281,9 @@ HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUSED */, sockad if (to_return) { Debug("http_ss", "[%" PRId64 "] [acquire session] return session from shared pool", to_return->con_id); to_return->state = HSS_ACTIVE; - // Holding the pool lock and the sm lock + // Holding the pool lock and the sm lock // the attach_server_session will issue the do_io_read under the sm lock - // Must be careful to transfer the lock for the read vio because + // Must be careful to transfer the lock for the read vio because // the server VC may be moving between threads TS-3266 sm->attach_server_session(to_return); retval = HSM_DONE; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b4c7852/proxy/http/HttpSessionManager.h -- diff --git a/proxy/http/HttpSessionManager.h b/proxy/http/HttpSessionManager.h index a95ba56..8d82756 100644 --- a/proxy/http/HttpSessionManager.h +++ b/proxy/http/HttpSessionManager.h @@ -132,7 +132,8 @@ public: @return A pointer to the session or @c NULL if not matching session was found. */ - HSMresult_t acquireSession(sockaddr const *addr, INK_MD5 const &host_hash, TSServerSessionSharingMatchType match_style, HttpServerSession *&server_session); + HSMresult_t acquireSession(sockaddr const *addr, INK_MD5 const &host_hash, TSServerSessionSharingMatchType match_style, + HttpServerSession *&server_session); /** Release a session to to pool. */ void releaseSession(HttpServerSession *ss);
[1/2] trafficserver git commit: TS-3486: Crashes due to race condition on server sessions moving between threads. This closes #235
Repository: trafficserver Updated Branches: refs/heads/6.0.x e24062bde -> 7b4c78527 TS-3486: Crashes due to race condition on server sessions moving between threads. This closes #235 (cherry picked from commit a638d97019e1b3ef4e6ec53b93d81a96885cbb6e) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/97b9bc43 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/97b9bc43 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/97b9bc43 Branch: refs/heads/6.0.x Commit: 97b9bc43a0444f6c872e26e07549805d063e74ed Parents: e24062b Author: shinrich Authored: Fri Jun 26 13:11:40 2015 -0500 Committer: Bryan Call Committed: Mon Jul 6 08:54:26 2015 -0700 -- iocore/net/UnixNetVConnection.cc | 4 ++- proxy/http/HttpServerSession.cc | 1 - proxy/http/HttpSessionManager.cc | 56 ++- proxy/http/HttpSessionManager.h | 14 - 4 files changed, 39 insertions(+), 36 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/97b9bc43/iocore/net/UnixNetVConnection.cc -- diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index c4ec29c..9433973 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -247,7 +247,7 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread) MUTEX_TRY_LOCK_FOR(lock, s->vio.mutex, thread, s->vio._cont); - if (!lock.is_locked() || lock.get_mutex() != s->vio.mutex.m_ptr) { + if (!lock.is_locked()) { read_reschedule(nh, vc); return; } @@ -637,9 +637,11 @@ UnixNetVConnection::do_io_close(int alerrno /* = -1 */) read.vio.buffer.clear(); read.vio.nbytes = 0; read.vio.op = VIO::NONE; + read.vio._cont = NULL; write.vio.buffer.clear(); write.vio.nbytes = 0; write.vio.op = VIO::NONE; + write.vio._cont = NULL; EThread *t = this_ethread(); bool close_inline = !recursion && nh->mutex->thread_holding == t; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/97b9bc43/proxy/http/HttpServerSession.cc -- diff --git a/proxy/http/HttpServerSession.cc b/proxy/http/HttpServerSession.cc index 5b71cfe..7acaa5e 100644 --- a/proxy/http/HttpServerSession.cc +++ b/proxy/http/HttpServerSession.cc @@ -170,7 +170,6 @@ HttpServerSession::release() HSMresult_t r = httpSessionManager.release_session(this); - if (r == HSM_RETRY) { // Session could not be put in the session manager // due to lock contention http://git-wip-us.apache.org/repos/asf/trafficserver/blob/97b9bc43/proxy/http/HttpSessionManager.cc -- diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc index c490515..80067d6 100644 --- a/proxy/http/HttpSessionManager.cc +++ b/proxy/http/HttpSessionManager.cc @@ -74,11 +74,10 @@ ServerSessionPool::match(HttpServerSession *ss, sockaddr const *addr, INK_MD5 co (TS_SERVER_SESSION_SHARING_MATCH_HOST == match_style || ats_ip_addr_port_eq(ss->server_ip, addr)); } -HttpServerSession * -ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_hash, TSServerSessionSharingMatchType match_style) +HSMresult_t +ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_hash, TSServerSessionSharingMatchType match_style, HttpServerSession *&to_return) { - HttpServerSession *zret = NULL; - + HSMresult_t zret = HSM_NOT_FOUND; if (TS_SERVER_SESSION_SHARING_MATCH_HOST == match_style) { // This is broken out because only in this case do we check the host hash first. HostHashTable::Location loc = m_host_pool.find(hostname_hash); @@ -86,9 +85,9 @@ ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_ while (loc && port != ats_ip_port_cast(loc->server_ip)) ++loc; // scan for matching port. if (loc) { - zret = loc; + to_return = loc; m_host_pool.remove(loc); - m_ip_pool.remove(m_ip_pool.find(zret)); + m_ip_pool.remove(m_ip_pool.find(loc)); } } else if (TS_SERVER_SESSION_SHARING_MATCH_NONE != match_style) { // matching is not disabled. IPHashTable::Location loc = m_ip_pool.find(addr); @@ -100,9 +99,9 @@ ServerSessionPool::acquireSession(sockaddr const *addr, INK_MD5 const &hostname_ ++loc; } if (loc) { - zret = loc; + to_return = loc; m_ip_pool.remove(loc); - m_host_pool.remove(m_host_pool.find(zret)); + m_host_pool.remove(m_host_pool.find(loc)); } } return zret; @@ -238,6 +237,7 @@ HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUS
trafficserver git commit: Updated to show 99th percentile
Repository: trafficserver Updated Branches: refs/heads/master 5defa51cd -> 46156a8d8 Updated to show 99th percentile Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/46156a8d Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/46156a8d Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/46156a8d Branch: refs/heads/master Commit: 46156a8d8974ebf5df1832cd1bf2dd3650c1c489 Parents: 5defa51 Author: Bryan Call Authored: Mon Jul 6 11:17:30 2015 -0700 Committer: Bryan Call Committed: Mon Jul 6 11:17:30 2015 -0700 -- tools/slow_log_report.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/46156a8d/tools/slow_log_report.pl -- diff --git a/tools/slow_log_report.pl b/tools/slow_log_report.pl index 19cf8a1..597b2f5 100755 --- a/tools/slow_log_report.pl +++ b/tools/slow_log_report.pl @@ -36,7 +36,7 @@ sub addStat($$$) { sub displayStat($) { my($stats) = @_; - printf("%25s %10s %10s %10s %10s %10s %10s %10s\n", "key", "total", "count", "mean", "median", '95th', "min", "max"); + printf("%25s %10s %10s %10s %10s %10s %10s %10s %10s\n", 'key', 'total', 'count', 'mean', 'median', '95th', '99th', 'min', 'max'); foreach my $key ('ua_begin', 'ua_first_read', 'ua_read_header_done', 'cache_open_read_begin', 'cache_open_read_end', 'dns_lookup_begin', 'dns_lookup_end', 'server_connect', 'server_first_read', 'server_read_header_done', 'server_close', 'ua_close', 'sm_finish') { my $count = $stats->{$key}->{count}; @@ -49,12 +49,13 @@ sub displayStat($) { my @sorted = sort {$a <=> $b} @{$stats->{$key}->{values}}; my $median = $sorted[int($count/2)]; my $p95th = $sorted[int($count * .95)]; +my $p99th = $sorted[int($count * .99)]; my $min = $sorted[0]; my $max = $sorted[$count - 1]; my $mean = 0; $mean = $total / $count if $count > 0; -printf("%25s %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", $key, $total, $count, $mean, $median, $p95th, $min, $max); +printf("%25s %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", $key, $total, $count, $mean, $median, $p95th, $p99th, $min, $max); } print "NOTE: Times are in seconds\n"; }
[2/2] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4282d335 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4282d335 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4282d335 Branch: refs/heads/master Commit: 4282d335366d716fd0ee860e40446f7e49052d0f Parents: 00cb698 46156a8 Author: shinrich Authored: Mon Jul 6 18:34:24 2015 -0500 Committer: shinrich Committed: Mon Jul 6 18:34:24 2015 -0500 -- tools/slow_log_report.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --
[1/2] trafficserver git commit: Revert "TS-3656: Activating follow redirection in send server response hook does not work for post. This closes #215."
Repository: trafficserver Updated Branches: refs/heads/master 46156a8d8 -> 4282d3353 Revert "TS-3656: Activating follow redirection in send server response hook does not work for post. This closes #215." This reverts commit 46e47a90324ff8bfcbb22d40493e89463599. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/00cb6981 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/00cb6981 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/00cb6981 Branch: refs/heads/master Commit: 00cb6981e1ccad93e963018b7a75075bade32246 Parents: 5defa51 Author: shinrich Authored: Mon Jul 6 18:33:03 2015 -0500 Committer: shinrich Committed: Mon Jul 6 18:33:03 2015 -0500 -- proxy/http/HttpSM.cc | 34 +++--- proxy/http/HttpTunnel.cc | 27 --- proxy/http/HttpTunnel.h | 7 ++- 3 files changed, 49 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00cb6981/proxy/http/HttpSM.cc -- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index cbcc34b..afbdf3a 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1835,6 +1835,14 @@ HttpSM::state_read_server_response_header(int event, void *data) t_state.transact_return_point = HttpTransact::HandleResponse; t_state.api_next_action = HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR; +// if exceeded limit deallocate postdata buffers and disable redirection +if (enable_redirection && (redirection_tries < HttpConfig::m_master.number_of_redirections)) { + ++redirection_tries; +} else { + tunnel.deallocate_redirect_postdata_buffers(); + enable_redirection = false; +} + do_api_callout(); break; case PARSE_CONT: @@ -3155,6 +3163,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) ink_assert(ua_entry->vc == c->vc); if (close_connection) { // If the client could be pipelining, we need to set the ua_session into half close mode + if (t_state.client_info.pipeline_possible == true && c->producer->vc_type != HT_STATIC && event == VC_EVENT_WRITE_COMPLETE) { ua_session->set_half_close_flag(); } @@ -3404,6 +3413,8 @@ HttpSM::tunnel_handler_for_partial_post(int event, void * /* data ATS_UNUSED */) tunnel.deallocate_buffers(); tunnel.reset(); + tunnel.allocate_redirect_postdata_producer_buffer(); + t_state.redirect_info.redirect_in_process = false; if (post_failed) { @@ -5316,20 +5327,17 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type) // if redirect_in_process and redirection is enabled add static producer if (t_state.redirect_info.redirect_in_process && enable_redirection && - (tunnel.postbuf && tunnel.postbuf->postdata_copy_buffer_start != NULL)) { + (tunnel.postbuf && tunnel.postbuf->postdata_copy_buffer_start != NULL && tunnel.postbuf->postdata_producer_buffer != NULL)) { post_redirect = true; // copy the post data into a new producer buffer for static producer -int64_t alloc_index = buffer_size_to_index(t_state.hdr_info.request_content_length); -MIOBuffer *postdata_producer_buffer = new_MIOBuffer(alloc_index); -IOBufferReader *postdata_producer_reader = postdata_producer_buffer->alloc_reader(); - postdata_producer_buffer->write(tunnel.postbuf->postdata_copy_buffer_start); -int64_t post_bytes = postdata_producer_reader->read_avail(); + tunnel.postbuf->postdata_producer_buffer->write(tunnel.postbuf->postdata_copy_buffer_start); +int64_t post_bytes = tunnel.postbuf->postdata_producer_reader->read_avail(); transfered_bytes = post_bytes; -p = tunnel.add_producer(HTTP_TUNNEL_STATIC_PRODUCER, post_bytes, postdata_producer_reader, (HttpProducerHandler)NULL, HT_STATIC, -"redirect static agent post"); +p = tunnel.add_producer(HTTP_TUNNEL_STATIC_PRODUCER, post_bytes, tunnel.postbuf->postdata_producer_reader, +(HttpProducerHandler)NULL, HT_STATIC, "redirect static agent post"); // the tunnel has taken over the buffer and will free it -postdata_producer_buffer = NULL; -postdata_producer_reader = NULL; +tunnel.postbuf->postdata_producer_buffer = NULL; +tunnel.postbuf->postdata_producer_reader = NULL; } else { int64_t alloc_index; // content length is undefined, use default buffer size @@ -5358,8 +5366,6 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type) ua_buffer_reader->consume(client_request_body_bytes); p = tunnel.add_producer(ua_entry->vc, post_bytes - transfered_bytes, buf_start, &HttpSM::tunnel_handler_post_ua, HT_HTTP_CLIENT, "user agent post"); -
[1/2] trafficserver git commit: Add LastFailure to hostdb stats endpoint
Repository: trafficserver Updated Branches: refs/heads/master 4282d3353 -> 6e35feb88 Add LastFailure to hostdb stats endpoint This way you can have insight into hostdb's view of last_failures. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/6e35feb8 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/6e35feb8 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/6e35feb8 Branch: refs/heads/master Commit: 6e35feb88d4c6a0835b7c2013a315240b1adf23b Parents: 02678a1 Author: Thomas Jackson Authored: Thu Jul 2 18:24:28 2015 -0700 Committer: Thomas Jackson Committed: Mon Jul 6 17:07:22 2015 -0700 -- iocore/hostdb/HostDB.cc | 41 +- iocore/hostdb/I_HostDBProcessor.h | 2 ++ iocore/hostdb/P_HostDBProcessor.h | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6e35feb8/iocore/hostdb/HostDB.cc -- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 838d34f..037c437 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -870,6 +870,25 @@ HostDBProcessor::getbyname_re(Continuation *cont, const char *ahostname, int len return getby(cont, ahostname, len, 0, force_dns, opt.host_res_style, opt.timeout); } +Action * +HostDBProcessor::getbynameport_re(Continuation *cont, const char *ahostname, int len, Options const &opt) +{ + bool force_dns = false; + EThread *thread = this_ethread(); + ProxyMutex *mutex = thread->mutex; + + if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS) +force_dns = true; + else if (opt.flags & HOSTDB_FORCE_DNS_RELOAD) { +force_dns = (hostdb_re_dns_on_reload ? true : false); +if (force_dns) + HOSTDB_INCREMENT_DYN_STAT(hostdb_re_dns_on_reload_stat); + } + sockaddr sa; + ats_ip4_set(&sa, NULL, htons(opt.port)); + return getby(cont, ahostname, len, &sa, force_dns, opt.host_res_style, opt.timeout); +} + /* Support SRV records */ Action * @@ -2267,6 +2286,7 @@ struct ShowHostDB; typedef int (ShowHostDB::*ShowHostDBEventHandler)(int event, Event *data); struct ShowHostDB : public ShowCont { char *name; + uint16_t port; IpEndpoint ip; bool force; @@ -2294,10 +2314,12 @@ struct ShowHostDB : public ShowCont { showLookup(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) { SET_HANDLER(&ShowHostDB::showLookupDone); -if (name) - hostDBProcessor.getbyname_re(this, name, 0, - HostDBProcessor::Options().setFlags(force ? HostDBProcessor::HOSTDB_FORCE_DNS_ALWAYS : 0)); -else +if (name) { + HostDBProcessor::Options opts; + opts.port = port; + opts.flags = HostDBProcessor::HOSTDB_DO_NOT_FORCE_DNS; + hostDBProcessor.getbynameport_re(this, name, strlen(name), opts); +} else hostDBProcessor.getbyaddr_re(this, &ip.sa); return EVENT_CONT; } @@ -2312,6 +2334,7 @@ struct ShowHostDB : public ShowCont { r->reverse_dns ? "Reverse DNS" : "DNS")); CHECK_SHOW(show("%s%u\n", "App1", r->app.allotment.application1)); CHECK_SHOW(show("%s%u\n", "App2", r->app.allotment.application2)); +CHECK_SHOW(show("%s%u\n", "LastFailure", r->app.http_data.last_failure)); if (!rr) { CHECK_SHOW(show("%s%s\n", "Stale", r->is_ip_stale() ? "Yes" : "No")); CHECK_SHOW(show("%s%s\n", "Timed-Out", r->is_ip_timeout() ? "Yes" : "No")); @@ -2403,8 +2426,16 @@ register_ShowHostDB(Continuation *c, HTTPHdr *h) char *gn = NULL; if (s->sarg) gn = (char *)memchr(s->sarg, '=', strlen(s->sarg)); -if (gn) +if (gn) { s->name = gn + 1; + char *pos = strstr(s->name, "%3A"); + if (pos != NULL) { +s->port = atoi(pos + 3); +*pos = '\0'; // Null terminate name + } else { +s->port = 0; + } +} SET_CONTINUATION_HANDLER(s, &ShowHostDB::showLookup); } this_ethread()->schedule_imm(s); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6e35feb8/iocore/hostdb/I_HostDBProcessor.h -- diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h index 43051bf..ea46839 100644 --- a/iocore/hostdb/I_HostDBProcessor.h +++ b/iocore/hostdb/I_HostDBProcessor.h @@ -452,6 +452,8 @@ struct HostDBProcessor : public Processor { inkcoreapi Action *getbyname_re(Continuation *cont, const char *hostname, int len, Options const &opt = DEFAULT_OPTIONS); + Action *getbynameport_re(Continuation *cont, const char *hostname, int len, Options const &opt = DEFAULT_OPTIONS); + Action *getSRVbyname_imm(Continuation *cont, process_srv_info_pfn process_
[2/2] trafficserver git commit: Maintain and use a mapping of hostname -> IP to implement host file support
Maintain and use a mapping of hostname -> IP to implement host file support This allows the background thread to populate a map of overrides, which we simply inject in the lookup method-- in place of calling to DNS. Fixes: TS-3725 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/02678a1f Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/02678a1f Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/02678a1f Branch: refs/heads/master Commit: 02678a1f8c9abc92985fbf6d7bb8a4b02467ba6b Parents: 4282d33 Author: Thomas Jackson Authored: Wed Jul 1 16:52:55 2015 -0700 Committer: Thomas Jackson Committed: Mon Jul 6 17:07:22 2015 -0700 -- iocore/hostdb/HostDB.cc | 263 + iocore/hostdb/P_HostDBProcessor.h | 15 ++ 2 files changed, 51 insertions(+), 227 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02678a1f/iocore/hostdb/HostDB.cc -- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index c9c54d9..838d34f 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -238,6 +238,7 @@ HostDBCache::HostDBCache() max_hits = (1 << HOST_DB_HITS_BITS) - 1; version.ink_major = HOST_DB_CACHE_MAJOR_VERSION; version.ink_minor = HOST_DB_CACHE_MINOR_VERSION; + hosts_file_ptr = new RefCountedHostsFileMap(); } @@ -659,6 +660,21 @@ db_mark_for(IpAddr const &ip) HostDBInfo * probe(ProxyMutex *mutex, HostDBMD5 const &md5, bool ignore_timeout) { + // If we have an entry in our hosts file, we don't need to bother with DNS + Ptr current_host_file_map = hostDB.hosts_file_ptr; + + ts::ConstBuffer hname(md5.host_name, md5.host_len); + HostsFileMap::iterator find_result = current_host_file_map->hosts_file_map.find(hname); + if (find_result != current_host_file_map->hosts_file_map.end()) { +// TODO: Something to make this not local :/ +static HostDBInfo r; +r.round_robin = false; +r.reverse_dns = false; +r.is_srv = false; +ats_ip_set(r.ip(), (*find_result).second); +return &r; + } + ink_assert(this_ethread() == hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets))->thread_holding); if (hostdb_enable) { uint64_t folded_md5 = fold_md5(md5.hash); @@ -2527,19 +2543,6 @@ struct HostDBFileContinuation : public Continuation { HostDBFileContinuation() : Continuation(0) {} - int insertEvent(int event, void *data); - int removeEvent(int event, void *data); - - /// Set the current entry in the HostDB. - HostDBInfo *setDBEntry(); - /// Create and schedule an update continuation. - static void scheduleUpdate(int idx, ///< Pair index to process. - Keys *keys = 0 ///< Key table if any. - ); - /// Create and schedule a remove continuation. - static void scheduleRemove(int idx, ///< Index of current new key to check against. - Keys *keys ///< new valid keys - ); /// Finish update static void finish(Keys *keys ///< Valid keys from update. ); @@ -2562,21 +2565,9 @@ HostDBFileContinuation::destroy() // proceeding at a time in any case so we might as well make these // globals. int HostDBFileUpdateActive = 0; -// Contents of the host file. We keep this around because other data -// points in to it (to minimize allocations). -ats_scoped_str HostFileText; -// Accumulated pairs of -std::vector HostFilePairs; -// Entries from last update. -HostDBFileContinuation::Keys HostFileKeys; -/// Ordering operator for HostFilePair. -/// We want to group first by name and then by address family. -bool -CmpHostFilePair(HostFilePair const &lhs, HostFilePair const &rhs) -{ - int zret = strcasecmp(lhs.name, rhs.name); - return zret < 0 || (0 == zret && lhs.ip < rhs.ip); -} +// map of hostname -> IpAddr +Ptr parsed_hosts_file_ptr(new RefCountedHostsFileMap()); + // Actual ordering doesn't matter as long as it's consistent. bool CmpMD5(INK_MD5 const &lhs, INK_MD5 const &rhs) @@ -2584,185 +2575,6 @@ CmpMD5(INK_MD5 const &lhs, INK_MD5 const &rhs) return lhs[0] < rhs[0] || (lhs[0] == rhs[0] && lhs[1] < rhs[1]); } -/// Finish current update. -void -HostDBFileContinuation::finish(Keys *keys) -{ - HostFilePairs.clear(); - HostFileKeys.clear(); - if (keys) { -std::swap(*keys, HostFileKeys); // put the new keys in place and dump the previous. -delete keys; - } - - HostFileText = 0; - HostDBFileUpdateActive = 0; -} - -HostDBInfo * -HostDBFileContinuation::setDBEntry() -{ - HostDBInfo *r; - uint64_t folded_md5 = fold_md5(md5); - - // remove the old one to prevent buildup - if (0 != (r = hostDB.lookup_block(folded_