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); 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;
236 auto source = std::make_shared<Source>(ts,
std::move(file), excludeString);
268 std::unique_ptr<std::string> hostname(hostname_ptr);
280 auto hostname = std::make_unique<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;
325 std::vector<std::shared_ptr<Source>>& activeSources,
326 std::vector<std::shared_ptr<Source>>& inactiveSources)
348 std::vector<std::shared_ptr<Source>>& activeSources,
349 std::vector<std::shared_ptr<Source>>& inactiveSources)
const 351 if (activeSources.size() <
std::max(a, b)+1) {
return false;}
353 bool findNewSource =
false;
354 if ((activeSources[a]->getQuality() > 5130) ||
355 ((activeSources[
a]->getQuality() > 260) && (activeSources[b]->getQuality()*4 < activeSources[
a]->getQuality())))
358 << activeSources[
a]->PrettyID() <<
" from active sources due to poor quality (" 359 << activeSources[
a]->getQuality() <<
" vs " << activeSources[
b]->getQuality() <<
")" << std::endl;
360 if (activeSources[a]->getLastDowngrade().tv_sec != 0) {findNewSource =
true;}
361 activeSources[
a]->setLastDowngrade(now);
362 inactiveSources.emplace_back(activeSources[a]);
363 auto oldSources = activeSources;
364 activeSources.erase(activeSources.begin()+
a);
367 return findNewSource;
373 std::vector<std::shared_ptr<Source>>& activeSources,
374 std::vector<std::shared_ptr<Source>>& inactiveSources)
377 bool findNewSource =
false;
378 if (activeSources.size() <= 1)
380 findNewSource =
true;
382 else if (activeSources.size() > 1)
384 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Source 0 quality " << activeSources[0]->getQuality() <<
", source 1 quality " << activeSources[1]->getQuality() << std::endl;
385 findNewSource |=
compareSources(now, 0, 1, activeSources,inactiveSources);
386 findNewSource |=
compareSources(now, 1, 0,activeSources, inactiveSources);
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();});
397 auto worstActiveSource = std::max_element(activeSources.cbegin(), activeSources.cend(),
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()))
410 auto oldSources = activeSources;
411 activeSources.push_back(*bestInactiveSource);
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));
424 auto oldSources = activeSources;
425 activeSources.erase(worstActiveSource);
426 activeSources.emplace_back(
std::move(*bestInactiveSource));
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();});
432 worstActiveSource = std::max_element(activeSources.begin(), activeSources.end(),
433 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
440 findNewSource =
true;
451 if (activeSources.size() == 2)
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 *) {
585 checkSources(now, c_ptr->getSize(), activeSources, inactiveSources);
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);
632 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Successfully opened new source: " << source->PrettyID() << std::endl;
635 if (source->ID() ==
s->ID())
637 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Xrootd server returned excluded source " << source->PrettyID()
638 <<
"; ignoring" << std::endl;
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)
658 m_activeSources.push_back(source);
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;
687 std::shared_ptr<void*> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
701 if (activeSources.size() == 1)
703 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
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 715 <<
") => Source used after fatal exception.";
716 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
721 assert(iolist.get());
722 auto req1 = std::make_shared<std::vector<IOPosBuffer>>();
723 auto req2 = std::make_shared<std::vector<IOPosBuffer>>();
726 checkSources(now, req1->size() + req2->size(), activeSources, inactiveSources);
728 if (activeSources.size() == 1)
730 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
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();
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);
1011 float q1 =
static_cast<float>(activeSources[0]->getQuality())+5;
1012 float q2 =
static_cast<float>(activeSources[1]->getQuality())+5;
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 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)
1077 std::shared_ptr<Source>
source;
1078 std::unique_ptr<XrdCl::XRootDStatus>
status(status_ptr);
1079 std::unique_ptr<XrdCl::HostList> hostList(hostList_ptr);
1082 std::shared_ptr<OpenHandler>
self =
m_self;
1094 std::unique_ptr<XrdCl::File> releaseFile;
1096 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1114 ex <<
"XrdCl::File::Open(name='" << manager->m_name
1115 <<
"', flags=0x" << std::hex << manager->m_flags
1116 <<
", permissions=0" << std::oct << manager->m_perms <<
std::dec 1117 <<
") => error '" << status->ToStr()
1118 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
1119 ex.
addContext(
"In XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts()");
1120 manager->addConnections(ex);
1122 m_promise.set_exception(std::make_exception_ptr(ex));
1125 manager->handleOpen(*status, source);
1131 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1135 return "(no open in progress)";
1138 m_file->GetProperty(
"DataServer", dataServer);
1139 if (!dataServer.size()) {
return "(unknown source)"; }
1143 std::shared_future<std::shared_ptr<Source> >
1150 ex <<
"XrdCl::File::Open() =>" 1151 <<
" error: OpenHandler called within an invalid RequestManager context." 1152 <<
" This is a logic error and should be reported to the CMSSW developers.";
1153 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1161 ex <<
"XrdCl::File::Open() => error: " 1162 <<
"OpenHandler called after it was deleted. This is a logic error " 1163 <<
"and should be reported to the CMSSW developers.";
1164 ex.
addContext(
"Calling XrdAdapter::RequestManager::OpenHandler::open()");
1181 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1182 std::promise<std::shared_ptr<Source> > new_promise;
1188 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Trying to open URL: " << new_name;
1195 XrdCl::XRootDStatus
status;
1199 ex <<
"XrdCl::File::Open(name='" << new_name
1200 <<
"', flags=0x" << std::hex << manager.
m_flags 1202 <<
") => error '" << status.ToStr()
1203 <<
"' (errno=" << status.errNo <<
", code=" << status.code <<
")";
1204 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1208 exit_guard.release();
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
std::atomic< bool > m_outstanding_open
OpenHandler(std::weak_ptr< RequestManager > manager)
std::shared_ptr< OpenHandler > m_self
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)
std::weak_ptr< OpenHandler > m_self_weak
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
std::shared_future< std::shared_ptr< Source > > m_shared_future
void queueUpdateCurrentServer(const std::string &)
std::weak_ptr< RequestManager > m_manager
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
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
std::recursive_mutex m_mutex
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)
#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
std::atomic< unsigned > m_excluded_active_count
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()
std::unique_ptr< XrdCl::File > m_file
#define XRD_ADAPTOR_SHORT_OPEN_DELAY
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)
std::promise< std::shared_ptr< Source > > m_promise
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)