trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bgaff <...@git.apache.org>
Subject [GitHub] trafficserver pull request: Add ListAll for HostDB httpui endpoint
Date Mon, 13 Jul 2015 03:46:41 GMT
Github user bgaff commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/245#discussion_r34431846
  
    --- Diff: iocore/hostdb/HostDB.cc ---
    @@ -1801,6 +1828,39 @@ 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));
    +       }
    +     }
    +   }
    +
    --- End diff --
    
    I agree, I'll add rescheduling after iterating a few buckets.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message