7 #include "XrdCl/XrdClFile.hh"
8 #include "XrdCl/XrdClDefaultEnv.hh"
9 #include "XrdCl/XrdClFileSystem.hh"
19 #include "Utilities/XrdAdaptor/src/XrdHostHandler.hh"
21 #define XRD_CL_MAX_CHUNK 512*1024
23 #define XRD_ADAPTOR_SHORT_OPEN_DELAY 5
25 #ifdef XRD_FAKE_OPEN_PROBE
26 #define XRD_ADAPTOR_OPEN_PROBE_PERCENT 100
27 #define XRD_ADAPTOR_LONG_OPEN_DELAY 20
29 #define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE 0
31 #define XRD_ADAPTOR_OPEN_PROBE_PERCENT 10
32 #define XRD_ADAPTOR_LONG_OPEN_DELAY 2*60
33 #define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE 100
36 #define XRD_ADAPTOR_CHUNK_THRESHOLD 1000
40 #include <mach/clock.h>
41 #include <mach/mach.h>
42 #define GET_CLOCK_MONOTONIC(ts) \
44 clock_serv_t cclock; \
45 mach_timespec_t mts; \
46 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); \
47 clock_get_time(cclock, &mts); \
48 mach_port_deallocate(mach_task_self(), cclock); \
49 ts.tv_sec = mts.tv_sec; \
50 ts.tv_nsec = mts.tv_nsec; \
53 #define GET_CLOCK_MONOTONIC(ts) \
54 clock_gettime(CLOCK_MONOTONIC, &ts);
57 using namespace XrdAdaptor;
61 long long diff = (a.tv_sec - b.tv_sec) * 1000;
62 diff += (a.tv_nsec - b.tv_nsec) / 1e6;
76 XrdCl::Buffer *buffer =
nullptr;
77 response->Get(buffer);
78 response->Set(static_cast<int*>(
nullptr));
101 file.GetProperty(
"LastURL", lastUrl);
102 if (jobId && lastUrl.size())
104 XrdCl::URL
url(lastUrl);
105 XrdCl::FileSystem fs(url);
106 if (!(fs.SendInfo(jobId, &
nullHandler, 30).IsOK()))
108 edm::LogWarning(
"XrdAdaptorInternal") <<
"Failed to send the monitoring information, monitoring ID is " << jobId <<
".";
110 edm::LogInfo(
"XrdAdaptorInternal") <<
"Set monitoring ID to " << jobId <<
".";
116 : m_serverToAdvertise(
nullptr),
117 m_timeout(XRD_DEFAULT_TIMEOUT),
118 m_nextInitialSourceToggle(
false),
122 m_distribution(0,100),
123 m_excluded_active_count(0)
133 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
134 if (env) {env->GetInt(
"StreamErrorWindow",
m_timeout);}
146 std::unique_ptr<XrdCl::File>
file;
148 bool validFile =
false;
149 const int retries = 5;
156 SyncHostResponseHandler handler;
157 XrdCl::XRootDStatus openStatus = file->Open(new_filename,
m_flags,
m_perms, &handler);
158 if (!openStatus.IsOK())
166 ex <<
"XrdCl::File::Open(name='" <<
m_name
167 <<
"', flags=0x" << std::hex <<
m_flags
169 <<
") => error '" << openStatus.ToStr()
170 <<
"' (errno=" << openStatus.errNo <<
", code=" << openStatus.code <<
")";
172 ex.
addAdditionalInfo(
"Remote server already encountered a fatal error; no redirections were performed.");
175 handler.WaitForResponse();
176 std::unique_ptr<XrdCl::XRootDStatus>
status = handler.GetStatus();
177 std::unique_ptr<XrdCl::HostList> hostList = handler.GetHosts();
190 ex <<
"XrdCl::File::Open(name='" <<
m_name
191 <<
"', flags=0x" << std::hex <<
m_flags
193 <<
") => error '" << status->ToStr()
194 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
198 file->GetProperty(
"DataServer", dataServer);
199 file->GetProperty(
"LastURL", lastUrl);
200 if (dataServer.size())
207 edm::LogWarning(
"XrdAdaptorInternal") <<
"Failed to open file at URL " << lastUrl <<
".";
211 ex <<
". No additional data servers were found.";
214 if (dataServer.size())
220 if (lastUrl == new_filename)
222 edm::LogWarning(
"XrdAdaptorInternal") << lastUrl <<
", " << new_filename;
268 std::unique_ptr<std::string> hostname(hostname_ptr);
280 std::unique_ptr<std::string> hostname(
new std::string(
id));
292 std::string formatSites(std::vector<std::shared_ptr<Source> >
const& iSources) {
294 if (iSources.size()) {siteA = iSources[0]->Site();}
295 if (iSources.size() == 2) {siteB = iSources[1]->Site();}
297 if (siteB.size() && (siteB != siteA)) {siteList = siteA +
", " + siteB;}
304 std::vector<std::shared_ptr<Source> >
const& iNew,
307 auto siteList = formatSites(iNew);
308 if (orig_site.size() && (orig_site != siteList))
310 edm::LogWarning(
"XrdAdaptor") <<
"Data is served from " << siteList <<
" instead of original site " << orig_site;
313 auto oldSites = formatSites(iOld);
314 if (!orig_site.size() && (siteList != oldSites))
316 if (oldSites.size() >0 )
317 edm::LogWarning(
"XrdAdaptor") <<
"Data is now served from " << siteList <<
" instead of previous " << oldSites;
326 std::vector<std::shared_ptr<Source>>& inactiveSources)
349 std::vector<std::shared_ptr<Source>>& inactiveSources)
const
353 bool findNewSource =
false;
358 <<
activeSources[
a]->PrettyID() <<
" from active sources due to poor quality ("
360 if (
activeSources[a]->getLastDowngrade().tv_sec != 0) {findNewSource =
true;}
367 return findNewSource;
374 std::vector<std::shared_ptr<Source>>& inactiveSources)
377 bool findNewSource =
false;
380 findNewSource =
true;
390 std::vector<std::shared_ptr<Source> > eligibleInactiveSources; eligibleInactiveSources.reserve(inactiveSources.size());
391 for (
const auto &
source : inactiveSources)
395 auto bestInactiveSource = std::min_element(eligibleInactiveSources.begin(), eligibleInactiveSources.end(),
396 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
398 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
399 if (bestInactiveSource != eligibleInactiveSources.end() && bestInactiveSource->get())
401 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Best inactive source: " <<(*bestInactiveSource)->PrettyID()
402 <<
", quality " << (*bestInactiveSource)->getQuality();
404 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Worst active source: " <<(*worstActiveSource)->PrettyID()
405 <<
", quality " << (*worstActiveSource)->getQuality();
408 if ((bestInactiveSource != eligibleInactiveSources.end()) &&
activeSources.size() == 1 && ((*bestInactiveSource)->getQuality() < 4*
activeSources[0]->getQuality()))
413 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
if (it->get() == bestInactiveSource->get()) {inactiveSources.erase(it);
break;}
415 else while ((bestInactiveSource != eligibleInactiveSources.end()) && (*worstActiveSource)->getQuality() > (*bestInactiveSource)->getQuality()+
XRD_ADAPTOR_SOURCE_QUALITY_FUDGE)
417 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Removing " << (*worstActiveSource)->PrettyID()
418 <<
" from active sources due to quality (" << (*worstActiveSource)->getQuality()
419 <<
") and promoting " << (*bestInactiveSource)->PrettyID() <<
" (quality: "
420 << (*bestInactiveSource)->getQuality() <<
")" << std::endl;
421 (*worstActiveSource)->setLastDowngrade(now);
422 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
if (it->get() == bestInactiveSource->get()) {inactiveSources.erase(it);
break;}
423 inactiveSources.emplace_back(
std::move(*worstActiveSource));
428 eligibleInactiveSources.clear();
430 bestInactiveSource = std::min_element(eligibleInactiveSources.begin(), eligibleInactiveSources.end(),
431 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
433 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
440 findNewSource =
true;
462 std::shared_ptr<XrdCl::File>
469 ex <<
"XrdAdaptor::RequestManager::getActiveFile(name='" <<
m_name
470 <<
"', flags=0x" << std::hex <<
m_flags
472 <<
") => Source used after fatal exception.";
473 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
486 sources.push_back(
source->ID());
496 sources.push_back(
source->PrettyID());
505 sources.push_back(
source);
512 std::vector<std::string> sources;
514 for (
auto const&
source : sources)
520 for (
auto const&
source : sources)
526 std::shared_ptr<Source>
529 std::shared_ptr<Source>
source =
nullptr;
548 ex <<
"XrdAdaptor::RequestManager::handle read(name='" <<
m_name
549 <<
"', flags=0x" << std::hex <<
m_flags
551 <<
") => Source used after fatal exception.";
552 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
571 std::vector<std::shared_ptr<Source>>
activeSources, inactiveSources;
579 std::shared_ptr<void*> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
589 source->handle(c_ptr);
590 return c_ptr->get_future();
596 std::stringstream
ss;
605 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
":")) <<
",";
610 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
":")) <<
",";
616 ss << it.substr(0, it.find(
":")) <<
",";
621 return tmp_str.substr(0, tmp_str.size()-1);
629 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
632 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Successfully opened new source: " << source->PrettyID() << std::endl;
633 for (
const auto &
s : m_activeSources)
635 if (source->ID() ==
s->ID())
637 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Xrootd server returned excluded source " << source->PrettyID()
638 <<
"; ignoring" << std::endl;
639 unsigned returned_count = ++m_excluded_active_count;
645 for (
const auto &
s : m_inactiveSources)
647 if (source->ID() ==
s->ID())
649 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Xrootd server returned excluded inactive source " << source->PrettyID()
650 <<
"; ignoring" << std::endl;
655 if (m_activeSources.size() < 2)
657 auto oldSources = m_activeSources;
658 m_activeSources.push_back(source);
659 reportSiteChange(oldSources, m_activeSources);
660 queueUpdateCurrentServer(source->ID());
664 m_inactiveSources.push_back(source);
669 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Got failure when trying to open a new source" << std::endl;
680 std::vector<std::shared_ptr<Source>>
activeSources, inactiveSources;
682 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
683 activeSources = m_activeSources;
684 inactiveSources = m_inactiveSources;
687 std::shared_ptr<void*> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
688 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
689 m_activeSources =
std::move(activeSources);
690 m_inactiveSources =
std::move(inactiveSources);
693 updateCurrentServer();
701 if (activeSources.size() == 1)
704 checkSources(now, c_ptr->getSize(),
activeSources,inactiveSources);
705 activeSources[0]->handle(c_ptr);
706 return c_ptr->get_future();
709 else if (activeSources.empty())
712 ex <<
"XrdAdaptor::RequestManager::handle readv(name='" << m_name
713 <<
"', flags=0x" << std::hex << m_flags
714 <<
", permissions=0" << std::oct << m_perms <<
std::dec
715 <<
") => Source used after fatal exception.";
716 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
722 std::shared_ptr<std::vector<IOPosBuffer> > req1(
new std::vector<IOPosBuffer>);
723 std::shared_ptr<std::vector<IOPosBuffer> > req2(
new std::vector<IOPosBuffer>);
724 splitClientRequest(*iolist, *req1, *req2, activeSources);
726 checkSources(now, req1->size() + req2->size(),
activeSources, inactiveSources);
728 if (activeSources.size() == 1)
731 activeSources[0]->handle(c_ptr);
732 return c_ptr->get_future();
735 std::shared_ptr<XrdAdaptor::ClientRequest> c_ptr1, c_ptr2;
736 std::future<IOSize> future1, future2;
740 activeSources[0]->handle(c_ptr1);
741 future1 = c_ptr1->get_future();
746 activeSources[1]->handle(c_ptr2);
747 future2 = c_ptr2->get_future();
749 if (req1->size() && req2->size())
751 std::future<IOSize> task = std::async(std::launch::deferred,
752 [](std::future<IOSize>
a, std::future<IOSize>
b){
765 return b.get() + a.get();
773 else if (req1->size()) {
return future1; }
774 else if (req2->size()) {
return future2; }
777 std::promise<IOSize>
p; p.set_value(0);
778 return p.get_future();
785 std::shared_ptr<Source> source_ptr = c_ptr->getCurrentSource();
788 if (c_status.code == XrdCl::errInvalidResponse)
790 edm::LogWarning(
"XrdAdaptorInternal") <<
"Invalid response when reading from " << source_ptr->PrettyID();
792 ex <<
"XrdAdaptor::RequestManager::requestFailure readv(name='" <<
m_name
793 <<
"', flags=0x" << std::hex <<
m_flags
795 <<
", old source=" << source_ptr->PrettyID()
796 <<
") => Invalid ReadV response from server";
797 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
801 edm::LogWarning(
"XrdAdaptorInternal") <<
"Request failure when reading from " << source_ptr->PrettyID();
823 std::shared_ptr<Source> new_source;
826 std::shared_future<std::shared_ptr<Source> > future =
m_open_handler->open();
835 if (status == std::future_status::timeout)
838 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name
839 <<
"', flags=0x" << std::hex <<
m_flags
841 <<
", old source=" << source_ptr->PrettyID()
842 <<
") => timeout when waiting for file open";
843 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
851 new_source = future.get();
855 ex.
addContext(
"Handling XrdAdaptor::RequestManager::requestFailure()");
865 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name
866 <<
"', flags=0x" << std::hex <<
m_flags
868 <<
", old source=" << source_ptr->PrettyID()
869 <<
", new source=" << new_source->PrettyID() <<
") => Xrootd server returned an excluded source";
870 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
884 new_source->handle(c_ptr);
894 if (io.
size() > chunksize)
906 consumed = chunksize;
912 consumed = chunksize;
915 chunksize -= consumed;
918 void* newdata =
static_cast<char*
>(io.
data()) + consumed;
923 else if (io.
size() == 0)
929 output.push_back(io);
930 chunksize -= io.
size();
943 if (io.
size() > chunksize)
955 consumed = chunksize;
961 consumed = chunksize;
964 chunksize -= consumed;
967 void* newdata =
static_cast<char*
>(io.
data()) + consumed;
972 else if (io.
size() == 0)
978 output.push_back(io);
979 chunksize -= io.
size();
988 off_t last_offset = -1;
989 for (
const auto & it : req)
992 assert(it.offset() > last_offset);
993 last_offset = it.offset();
995 assert(it.offset() < 0x1ffffffffff);
997 assert(req.size() <= 1024);
1004 if (iolist.size() == 0)
return;
1005 std::vector<IOPosBuffer> tmp_iolist(iolist.begin(), iolist.end());
1006 req1.reserve(iolist.size()/2+1);
1007 req2.reserve(iolist.size()/2+1);
1015 chunk1 =
std::max(static_cast<IOSize>(static_cast<float>(
XRD_CL_MAX_CHUNK)*(q2*q2/(q1*q1+q2*q2))), static_cast<IOSize>(1024));
1016 chunk2 =
std::max(static_cast<IOSize>(static_cast<float>(
XRD_CL_MAX_CHUNK)*(q1*q1/(q1*q1+q2*q2))), static_cast<IOSize>(1024));
1019 for (
const auto & it : iolist) size_orig += it.size();
1021 while (tmp_iolist.size()-front > 0)
1030 ex <<
"XrdAdaptor::RequestManager::splitClientRequest(name='" << m_name
1031 <<
"', flags=0x" << std::hex << m_flags
1032 <<
", permissions=0" << std::oct << m_perms <<
std::dec
1033 <<
") => Unable to split request between active servers. This is an unexpected internal error and should be reported to CMSSW developers.";
1034 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
1036 std::stringstream
ss; ss <<
"Original request size " << iolist.size() <<
"(" << size_orig <<
" bytes)";
1038 std::stringstream ss2; ss2 <<
"Quality source 1 " << q1-5 <<
", quality source 2: " << q2-5;
1051 assert(size_orig == size1 + size2);
1053 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Original request size " << iolist.size() <<
" (" << size_orig <<
" bytes) split into requests size " << req1.size() <<
" (" << size1 <<
" bytes) and " << req2.size() <<
" (" << size2 <<
" bytes)" << std::endl;
1057 : m_manager(manager)
1074 std::unique_ptr<char, std::function<void(char*)>> outstanding_guard(
nullptr, [&](
char*){m_outstanding_open=
false;});
1076 std::shared_ptr<Source>
source;
1077 std::unique_ptr<XrdCl::XRootDStatus>
status(status_ptr);
1078 std::unique_ptr<XrdCl::HostList> hostList(hostList_ptr);
1081 std::shared_ptr<OpenHandler>
self = m_self;
1084 auto manager = m_manager.lock();
1093 std::unique_ptr<XrdCl::File> releaseFile;
1095 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1107 m_promise.set_value(source);
1113 ex <<
"XrdCl::File::Open(name='" << manager->m_name
1114 <<
"', flags=0x" << std::hex << manager->m_flags
1115 <<
", permissions=0" << std::oct << manager->m_perms <<
std::dec
1116 <<
") => error '" << status->ToStr()
1117 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
1118 ex.
addContext(
"In XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts()");
1119 manager->addConnections(ex);
1121 m_promise.set_exception(std::make_exception_ptr(ex));
1124 manager->handleOpen(*status, source);
1130 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1134 return "(no open in progress)";
1137 m_file->GetProperty(
"DataServer", dataServer);
1138 if (!dataServer.size()) {
return "(unknown source)"; }
1142 std::shared_future<std::shared_ptr<Source> >
1145 auto manager_ptr = m_manager.lock();
1149 ex <<
"XrdCl::File::Open() =>"
1150 <<
" error: OpenHandler called within an invalid RequestManager context."
1151 <<
" This is a logic error and should be reported to the CMSSW developers.";
1152 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1156 auto self_ptr = m_self_weak.lock();
1160 ex <<
"XrdCl::File::Open() => error: "
1161 <<
"OpenHandler called after it was deleted. This is a logic error "
1162 <<
"and should be reported to the CMSSW developers.";
1163 ex.
addContext(
"Calling XrdAdapter::RequestManager::OpenHandler::open()");
1176 if (m_outstanding_open)
1178 return m_shared_future;
1180 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1181 std::promise<std::shared_ptr<Source> > new_promise;
1182 m_promise.swap(new_promise);
1183 m_shared_future = m_promise.get_future().share();
1187 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Trying to open URL: " << new_name;
1189 m_outstanding_open =
true;
1192 std::unique_ptr<char, std::function<void(char*)>> exit_guard(
nullptr, [&](
char*){m_outstanding_open =
false; m_file.reset();});
1194 XrdCl::XRootDStatus
status;
1195 if (!(status = m_file->Open(new_name, manager.
m_flags, manager.
m_perms,
this)).IsOK())
1198 ex <<
"XrdCl::File::Open(name='" << new_name
1199 <<
"', flags=0x" << std::hex << manager.
m_flags
1201 <<
") => error '" << status.ToStr()
1202 <<
"' (errno=" << status.errNo <<
", code=" << status.code <<
")";
1203 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1207 exit_guard.release();
1210 return m_shared_future;
void setCurrentServer(const std::string &servername)
std::shared_future< std::shared_ptr< Source > > open()
std::shared_ptr< XrdCl::File > getActiveFile() const
void getDisabledSourceNames(std::vector< std::string > &sources) const
RequestManager(const std::string &filename, XrdCl::OpenFlags::Flags flags, XrdCl::Access::Mode perms)
#define GET_CLOCK_MONOTONIC(ts)
std::uniform_real_distribution< float > m_distribution
static void determineHostExcludeString(XrdCl::File &file, const XrdCl::HostList *hostList, std::string &exclude)
std::string prepareOpaqueString() const
std::vector< Variable::Flags > flags
OpenHandler(std::weak_ptr< RequestManager > manager)
virtual void handleOpen(XrdCl::XRootDStatus &status, std::shared_ptr< Source >)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
SendMonitoringInfoHandler nullHandler
static std::string const input
#define XRD_ADAPTOR_CHUNK_THRESHOLD
#define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE
static void SendMonitoringInfo(XrdCl::File &file)
void set_data(void *new_buffer)
void set_size(IOSize new_size)
void addConnections(cms::Exception &) const
void splitClientRequest(const std::vector< IOPosBuffer > &iolist, std::vector< IOPosBuffer > &req1, std::vector< IOPosBuffer > &req2, std::vector< std::shared_ptr< Source >> const &activeSources) const
void queueUpdateCurrentServer(const std::string &)
long long timeDiffMS(const timespec &a, const timespec &b)
bool compareSources(const timespec &now, unsigned a, unsigned b, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources) const
void set_offset(IOOffset new_offset)
static bool getDomain(const std::string &host, std::string &domain)
std::vector< std::shared_ptr< Source > > m_inactiveSources
static bool isDCachePool(XrdCl::File &file, const XrdCl::HostList *hostList=nullptr)
std::atomic< std::string * > m_serverToAdvertise
tbb::concurrent_unordered_set< std::string > m_disabledSourceStrings
void checkSourcesImpl(timespec &now, IOSize requestSize, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources)
#define XRD_ADAPTOR_OPEN_PROBE_PERCENT
XrdSiteStatisticsInformation * statsService
void addAdditionalInfo(std::string const &info)
timespec m_nextActiveSourceCheck
void getPrettyActiveSourceNames(std::vector< std::string > &sources) const
tbb::concurrent_unordered_set< std::shared_ptr< Source >, SourceHash > m_disabledSources
std::string current_source()
std::shared_ptr< OpenHandler > m_open_handler
IOOffset offset(void) const
void requestFailure(std::shared_ptr< XrdAdaptor::ClientRequest > c_ptr, XrdCl::Status &c_status)
virtual void HandleResponseWithHosts(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response, XrdCl::HostList *hostList) override
void getActiveSourceNames(std::vector< std::string > &sources) const
XrdCl::OpenFlags::Flags m_flags
virtual void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override
static std::shared_ptr< OpenHandler > getInstance(std::weak_ptr< RequestManager > manager)
static void consumeChunkFront(size_t &front, std::vector< IOPosBuffer > &input, std::vector< IOPosBuffer > &output, IOSize chunksize)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
#define XRD_ADAPTOR_LONG_OPEN_DELAY
std::vector< std::shared_ptr< Source > > m_activeSources
XrdCl::Access::Mode m_perms
void addContext(std::string const &context)
tbb::concurrent_unordered_set< std::string > m_disabledExcludeStrings
static const char * getJobID()
std::shared_ptr< Source > pickSingleSource()
static bool getXrootdSiteFromURL(std::string url, std::string &site)
static IOSize validateList(const std::vector< IOPosBuffer > req)
void updateCurrentServer()
#define XRD_ADAPTOR_SHORT_OPEN_DELAY
volatile std::atomic< bool > shutdown_flag false
static void consumeChunkBack(size_t front, std::vector< IOPosBuffer > &input, std::vector< IOPosBuffer > &output, IOSize chunksize)
void reportSiteChange(std::vector< std::shared_ptr< Source > > const &iOld, std::vector< std::shared_ptr< Source > > const &iNew, std::string orig_site=std::string{}) const
std::future< IOSize > handle(void *into, IOSize size, IOOffset off)
static bool getHostname(const std::string &id, std::string &hostname)
static std::string const source
void clearAdditionalInfo()
std::recursive_mutex m_source_mutex
bool m_nextInitialSourceToggle
timespec m_lastSourceCheck
void initialize(std::weak_ptr< RequestManager > selfref)
void checkSources(timespec &now, IOSize requestSize, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources)