Repository: trafficserver Updated Branches: refs/heads/master 94f4083d0 -> 3c2f63faf
HostDB HTTP UI: Fix merge issue. This closes #240 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3c2f63fa Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3c2f63fa Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3c2f63fa Branch: refs/heads/master Commit: 3c2f63faf03b7a2ddd7a73542944e9c21caf2227 Parents: 94f4083 Author: Brian Geffon <bri...@apache.org> Authored: Wed Jul 15 00:29:55 2015 -0700 Committer: Brian Geffon <bri...@apache.org> Committed: Wed Jul 15 00:29:55 2015 -0700 ---------------------------------------------------------------------- iocore/hostdb/HostDB.cc | 86 ---------------------------------- iocore/hostdb/I_HostDBProcessor.h | 2 +- iocore/hostdb/P_HostDBProcessor.h | 3 +- 3 files changed, 3 insertions(+), 88 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c2f63fa/iocore/hostdb/HostDB.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 6abb7b0..0919b00 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -1039,15 +1039,6 @@ HostDBProcessor::getbyname_imm(Continuation *cont, process_hostdb_info_pfn proce } Action * -HostDBProcessor::getall(Continuation *cont) -{ - ink_assert(cont->mutex->thread_holding == this_ethread()); - EThread *thread = cont->mutex->thread_holding; - ProxyMutex *mutex = thread->mutex; - - HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat); - -Action * HostDBProcessor::iterate(Continuation *cont) { ink_assert(cont->mutex->thread_holding == this_ethread()); @@ -1076,24 +1067,6 @@ HostDBProcessor::iterate(Continuation *cont) return &c->action; } - HostDBContinuation *c = hostDBContAllocator.alloc(); - HostDBContinuation::Options copt; - copt.cont = cont; - copt.force_dns = false; - copt.timeout = 0; - copt.host_res_style = HOST_RES_NONE; - c->init(HostDBMD5(), copt); - SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::probeAllEvent); - - if (thread->mutex == cont->mutex) { - thread->schedule_in(c, HOST_DB_RETRY_PERIOD); - } else { - dnsProcessor.thread->schedule_imm(c); - } - - return &c->action; -} - static void do_setby(HostDBInfo *r, HostDBApplicationInfo *app, const char *hostname, IpAddr const &ip, bool is_srv = false) { @@ -1916,40 +1889,6 @@ HostDBContinuation::do_put_response(ClusterMachine *m, HostDBInfo *r, Continuati clusterProcessor.invoke_remote(m->pop_ClusterHandler(), PUT_HOSTINFO_CLUSTER_FUNCTION, (char *)&msg, len); } -int -HostDBContinuation::probeAllEvent(int event, Event *e) -{ - Debug("hostdb", "probeAllEvent event=%d eventp=%p", event, e); - ink_assert(!link.prev && !link.next); - EThread *t = e ? e->ethread : this_ethread(); - - MUTEX_TRY_LOCK_FOR(lock, action.mutex, t, action.continuation); - if (!lock.is_locked()) { - mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD); - return EVENT_CONT; - } - - if (action.cancelled) { - hostdb_cont_free(this); - return EVENT_DONE; - } - - for (int i = 0; i < hostDB.buckets; ++i) { - ProxyMutex *bucket_mutex = hostDB.lock_for_bucket(i); - SCOPED_MUTEX_LOCK(lock, bucket_mutex, t); - for (unsigned int l = 0; l < hostDB.levels; ++l) { - HostDBInfo *r = reinterpret_cast<HostDBInfo*>(hostDB.data + hostDB.level_offset[l] + hostDB.bucketsize[l] * i); - if (!r->deleted && !r->failed()) { - action.continuation->handleEvent(EVENT_INTERVAL, static_cast<void*>(r)); - } - } - } - - action.continuation->handleEvent(EVENT_DONE, NULL); - hostdb_cont_free(this); - return EVENT_DONE; -} - // // Probe state // @@ -2479,31 +2418,6 @@ struct ShowHostDB : public ShowCont { CHECK_SHOW(begin("HostDB All Records")); CHECK_SHOW(show("<hr>")); SET_HANDLER(&ShowHostDB::showAllEvent); - hostDBProcessor.getall(this); - return EVENT_CONT; - } - - int - showAllEvent(int event, Event *e) - { - HostDBInfo *r = (HostDBInfo *)e; - if (event == EVENT_INTERVAL) { - HostDBInfo *r = reinterpret_cast<HostDBInfo *>(e); - return showOne(r,false,event,e); - } else if (event == EVENT_DONE) { - return complete(event, e); - } else { - ink_assert(!"unexpected event"); - } - return EVENT_CONT; - } - - int - showAll(int event , Event *e) - { - CHECK_SHOW(begin("HostDB All Records")); - CHECK_SHOW(show("<hr>")); - SET_HANDLER(&ShowHostDB::showAllEvent); hostDBProcessor.iterate(this); return EVENT_CONT; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c2f63fa/iocore/hostdb/I_HostDBProcessor.h ---------------------------------------------------------------------- diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h index 37719f6..f5acf1f 100644 --- a/iocore/hostdb/I_HostDBProcessor.h +++ b/iocore/hostdb/I_HostDBProcessor.h @@ -475,7 +475,7 @@ struct HostDBProcessor : public Processor { Action *getbyname_imm(Continuation *cont, process_hostdb_info_pfn process_hostdb_info, const char *hostname, int len, Options const &opt = DEFAULT_OPTIONS); - Action *getall(Continuation *cont); + Action *iterate(Continuation *cont); /** Lookup Hostinfo by addr */ Action * http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c2f63fa/iocore/hostdb/P_HostDBProcessor.h ---------------------------------------------------------------------- diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h index 2b491c4..54c938a 100644 --- a/iocore/hostdb/P_HostDBProcessor.h +++ b/iocore/hostdb/P_HostDBProcessor.h @@ -470,6 +470,7 @@ struct HostDBContinuation : public Continuation { Continuation *from_cont; HostDBApplicationInfo app; int probe_depth; + int current_iterate_pos; ClusterMachine *past_probes[CONFIGURATION_HISTORY_PROBE_DEPTH]; // char name[MAXDNAME]; // int namelen; @@ -483,7 +484,7 @@ struct HostDBContinuation : public Continuation { unsigned int round_robin : 1; int probeEvent(int event, Event *e); - int probeAllEvent(int event, Event *e); + int iterateEvent(int event, Event *e); int clusterEvent(int event, Event *e); int clusterResponseEvent(int event, Event *e); int dnsEvent(int event, HostEnt *e);