Github user SolidWallOfCode commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/245#discussion_r34371196 --- 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 -- Can you considered doing 1 or some small finite number of buckets per event? Otherwise you're blocking a thread for potentially a long time.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---