7 #include "XrdCl/XrdClFile.hh" 8 #include "XrdCl/XrdClDefaultEnv.hh" 9 #include "XrdCl/XrdClFileSystem.hh" 21 #include "Utilities/XrdAdaptor/src/XrdHostHandler.hh" 23 #define XRD_CL_MAX_CHUNK 512*1024 25 #define XRD_ADAPTOR_SHORT_OPEN_DELAY 5 27 #ifdef XRD_FAKE_OPEN_PROBE 28 #define XRD_ADAPTOR_OPEN_PROBE_PERCENT 100 29 #define XRD_ADAPTOR_LONG_OPEN_DELAY 20 31 #define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE 0 33 #define XRD_ADAPTOR_OPEN_PROBE_PERCENT 10 34 #define XRD_ADAPTOR_LONG_OPEN_DELAY 2*60 35 #define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE 100 38 #define XRD_ADAPTOR_CHUNK_THRESHOLD 1000 42 #include <mach/clock.h> 43 #include <mach/mach.h> 44 #define GET_CLOCK_MONOTONIC(ts) \ 46 clock_serv_t cclock; \ 47 mach_timespec_t mts; \ 48 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); \ 49 clock_get_time(cclock, &mts); \ 50 mach_port_deallocate(mach_task_self(), cclock); \ 51 ts.tv_sec = mts.tv_sec; \ 52 ts.tv_nsec = mts.tv_nsec; \ 55 #define GET_CLOCK_MONOTONIC(ts) \ 56 clock_gettime(CLOCK_MONOTONIC, &ts); 63 long long diff = (a.tv_sec - b.tv_sec) * 1000;
64 diff += (a.tv_nsec - b.tv_nsec) / 1e6;
78 XrdCl::Buffer *
buffer =
nullptr;
79 response->Get(buffer);
80 response->Set(static_cast<int*>(
nullptr));
103 file.GetProperty(
"LastURL", lastUrl);
104 if (jobId && !lastUrl.empty())
106 XrdCl::URL
url(lastUrl);
107 XrdCl::FileSystem fs(url);
108 if (!(fs.SendInfo(jobId, &
nullHandler, 30).IsOK()))
110 edm::LogWarning(
"XrdAdaptorInternal") <<
"Failed to send the monitoring information, monitoring ID is " << jobId <<
".";
112 edm::LogInfo(
"XrdAdaptorInternal") <<
"Set monitoring ID to " << jobId <<
".";
118 : m_serverToAdvertise(
nullptr),
119 m_timeout(XRD_DEFAULT_TIMEOUT),
120 m_nextInitialSourceToggle(
false),
124 m_distribution(0,100),
125 m_excluded_active_count(0)
135 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
136 if (env) {env->GetInt(
"StreamErrorWindow",
m_timeout);}
148 std::unique_ptr<XrdCl::File>
file;
150 bool validFile =
false;
151 const int retries = 5;
158 SyncHostResponseHandler handler;
159 XrdCl::XRootDStatus openStatus = file->Open(new_filename,
m_flags,
m_perms, &handler);
160 if (!openStatus.IsOK())
168 ex <<
"XrdCl::File::Open(name='" <<
m_name 169 <<
"', flags=0x" << std::hex <<
m_flags 171 <<
") => error '" << openStatus.ToStr()
172 <<
"' (errno=" << openStatus.errNo <<
", code=" << openStatus.code <<
")";
174 ex.
addAdditionalInfo(
"Remote server already encountered a fatal error; no redirections were performed.");
177 handler.WaitForResponse();
178 std::unique_ptr<XrdCl::XRootDStatus>
status = handler.GetStatus();
179 std::unique_ptr<XrdCl::HostList> hostList = handler.GetHosts();
192 ex <<
"XrdCl::File::Open(name='" <<
m_name 193 <<
"', flags=0x" << std::hex <<
m_flags 195 <<
") => error '" << status->ToStr()
196 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
200 file->GetProperty(
"DataServer", dataServer);
201 file->GetProperty(
"LastURL", lastUrl);
202 if (!dataServer.empty())
206 if (!lastUrl.empty())
209 edm::LogWarning(
"XrdAdaptorInternal") <<
"Failed to open file at URL " << lastUrl <<
".";
213 ex <<
". No additional data servers were found.";
216 if (!dataServer.empty())
222 if (lastUrl == new_filename)
224 edm::LogWarning(
"XrdAdaptorInternal") << lastUrl <<
", " << new_filename;
238 auto source = std::make_shared<Source>(ts,
std::move(file), excludeString);
270 std::unique_ptr<std::string> hostname(hostname_ptr);
282 auto hostname = std::make_unique<std::string>(
id);
294 std::string formatSites(std::vector<std::shared_ptr<Source> >
const& iSources) {
296 if (!iSources.empty()) {siteA = iSources[0]->Site();}
297 if (iSources.size() == 2) {siteB = iSources[1]->Site();}
299 if (!siteB.empty() && (siteB != siteA)) {siteList = siteA +
", " + siteB;}
306 std::vector<std::shared_ptr<Source> >
const& iNew,
309 auto siteList = formatSites(iNew);
310 if (!orig_site.empty() && (orig_site != siteList))
312 edm::LogWarning(
"XrdAdaptor") <<
"Data is served from " << siteList <<
" instead of original site " << orig_site;
315 auto oldSites = formatSites(iOld);
316 if (orig_site.empty() && (siteList != oldSites))
318 if (!oldSites.empty() )
319 edm::LogWarning(
"XrdAdaptor") <<
"Data is now served from " << siteList <<
" instead of previous " << oldSites;
327 std::vector<std::shared_ptr<Source>>& activeSources,
328 std::vector<std::shared_ptr<Source>>& inactiveSources)
350 std::vector<std::shared_ptr<Source>>& activeSources,
351 std::vector<std::shared_ptr<Source>>& inactiveSources)
const 353 if (activeSources.size() <
std::max(a, b)+1) {
return false;}
355 bool findNewSource =
false;
356 if ((activeSources[a]->getQuality() > 5130) ||
357 ((activeSources[
a]->getQuality() > 260) && (activeSources[b]->getQuality()*4 < activeSources[
a]->getQuality())))
360 << activeSources[
a]->PrettyID() <<
" from active sources due to poor quality (" 361 << activeSources[
a]->getQuality() <<
" vs " << activeSources[
b]->getQuality() <<
")" << std::endl;
362 if (activeSources[a]->getLastDowngrade().tv_sec != 0) {findNewSource =
true;}
363 activeSources[
a]->setLastDowngrade(now);
364 inactiveSources.emplace_back(activeSources[a]);
365 auto oldSources = activeSources;
366 activeSources.erase(activeSources.begin()+
a);
369 return findNewSource;
375 std::vector<std::shared_ptr<Source>>& activeSources,
376 std::vector<std::shared_ptr<Source>>& inactiveSources)
379 bool findNewSource =
false;
380 if (activeSources.size() <= 1)
382 findNewSource =
true;
384 else if (activeSources.size() > 1)
386 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Source 0 quality " << activeSources[0]->getQuality() <<
", source 1 quality " << activeSources[1]->getQuality() << std::endl;
387 findNewSource |=
compareSources(now, 0, 1, activeSources,inactiveSources);
388 findNewSource |=
compareSources(now, 1, 0,activeSources, inactiveSources);
392 std::vector<std::shared_ptr<Source> > eligibleInactiveSources; eligibleInactiveSources.reserve(inactiveSources.size());
393 for (
const auto &
source : inactiveSources)
397 auto bestInactiveSource = std::min_element(eligibleInactiveSources.begin(), eligibleInactiveSources.end(),
398 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
399 auto worstActiveSource = std::max_element(activeSources.cbegin(), activeSources.cend(),
400 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
401 if (bestInactiveSource != eligibleInactiveSources.end() && bestInactiveSource->get())
403 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Best inactive source: " <<(*bestInactiveSource)->PrettyID()
404 <<
", quality " << (*bestInactiveSource)->getQuality();
406 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Worst active source: " <<(*worstActiveSource)->PrettyID()
407 <<
", quality " << (*worstActiveSource)->getQuality();
410 if ((bestInactiveSource != eligibleInactiveSources.end()) && activeSources.size() == 1 && ((*bestInactiveSource)->getQuality() < 4*activeSources[0]->getQuality()))
412 auto oldSources = activeSources;
413 activeSources.push_back(*bestInactiveSource);
415 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
if (it->get() == bestInactiveSource->get()) {inactiveSources.erase(it);
break;}
417 else while ((bestInactiveSource != eligibleInactiveSources.end()) && (*worstActiveSource)->getQuality() > (*bestInactiveSource)->getQuality()+
XRD_ADAPTOR_SOURCE_QUALITY_FUDGE)
419 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Removing " << (*worstActiveSource)->PrettyID()
420 <<
" from active sources due to quality (" << (*worstActiveSource)->getQuality()
421 <<
") and promoting " << (*bestInactiveSource)->PrettyID() <<
" (quality: " 422 << (*bestInactiveSource)->getQuality() <<
")" << std::endl;
423 (*worstActiveSource)->setLastDowngrade(now);
424 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
if (it->get() == bestInactiveSource->get()) {inactiveSources.erase(it);
break;}
425 inactiveSources.emplace_back(
std::move(*worstActiveSource));
426 auto oldSources = activeSources;
427 activeSources.erase(worstActiveSource);
428 activeSources.emplace_back(
std::move(*bestInactiveSource));
430 eligibleInactiveSources.clear();
432 bestInactiveSource = std::min_element(eligibleInactiveSources.begin(), eligibleInactiveSources.end(),
433 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
434 worstActiveSource = std::max_element(activeSources.begin(), activeSources.end(),
435 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &
s2) {
return s1->getQuality() <
s2->getQuality();});
442 findNewSource =
true;
453 if (activeSources.size() == 2)
464 std::shared_ptr<XrdCl::File>
471 ex <<
"XrdAdaptor::RequestManager::getActiveFile(name='" <<
m_name 472 <<
"', flags=0x" << std::hex <<
m_flags 474 <<
") => Source used after fatal exception.";
475 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
488 sources.push_back(
source->ID());
498 sources.push_back(
source->PrettyID());
507 sources.push_back(
source);
514 std::vector<std::string> sources;
516 for (
auto const&
source : sources)
522 for (
auto const&
source : sources)
528 std::shared_ptr<Source>
531 std::shared_ptr<Source>
source =
nullptr;
550 ex <<
"XrdAdaptor::RequestManager::handle read(name='" <<
m_name 551 <<
"', flags=0x" << std::hex <<
m_flags 553 <<
") => Source used after fatal exception.";
554 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
573 std::vector<std::shared_ptr<Source>> activeSources, inactiveSources;
581 std::shared_ptr<void*> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
587 checkSources(now, c_ptr->getSize(), activeSources, inactiveSources);
591 source->handle(c_ptr);
592 return c_ptr->get_future();
598 std::stringstream ss;
607 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
":")) <<
",";
612 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
":")) <<
",";
618 ss << it.substr(0, it.find(
":")) <<
",";
623 return tmp_str.substr(0, tmp_str.size()-1);
634 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Successfully opened new source: " << source->PrettyID() << std::endl;
637 if (source->ID() ==
s->ID())
639 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Xrootd server returned excluded source " << source->PrettyID()
640 <<
"; ignoring" << std::endl;
649 if (source->ID() ==
s->ID())
651 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Xrootd server returned excluded inactive source " << source->PrettyID()
652 <<
"; ignoring" << std::endl;
657 if (m_activeSources.size() < 2)
660 m_activeSources.push_back(source);
666 m_inactiveSources.push_back(source);
671 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Got failure when trying to open a new source" << std::endl;
682 std::vector<std::shared_ptr<Source>> activeSources, inactiveSources;
689 std::shared_ptr<void*> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
703 if (activeSources.size() == 1)
705 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
706 checkSources(now, c_ptr->getSize(), activeSources,inactiveSources);
707 activeSources[0]->handle(c_ptr);
708 return c_ptr->get_future();
711 else if (activeSources.empty())
714 ex <<
"XrdAdaptor::RequestManager::handle readv(name='" <<
m_name 715 <<
"', flags=0x" << std::hex <<
m_flags 717 <<
") => Source used after fatal exception.";
718 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
723 assert(iolist.get());
724 auto req1 = std::make_shared<std::vector<IOPosBuffer>>();
725 auto req2 = std::make_shared<std::vector<IOPosBuffer>>();
728 checkSources(now, req1->size() + req2->size(), activeSources, inactiveSources);
730 if (activeSources.size() == 1)
732 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
733 activeSources[0]->handle(c_ptr);
734 return c_ptr->get_future();
737 std::shared_ptr<XrdAdaptor::ClientRequest> c_ptr1, c_ptr2;
738 std::future<IOSize> future1, future2;
742 activeSources[0]->handle(c_ptr1);
743 future1 = c_ptr1->get_future();
748 activeSources[1]->handle(c_ptr2);
749 future2 = c_ptr2->get_future();
751 if (!req1->empty() && !req2->empty())
753 std::future<IOSize> task = std::async(std::launch::deferred,
754 [](std::future<IOSize>
a, std::future<IOSize>
b){
767 return b.get() + a.get();
775 else if (!req1->empty()) {
return future1; }
776 else if (!req2->empty()) {
return future2; }
779 std::promise<IOSize>
p; p.set_value(0);
780 return p.get_future();
787 std::shared_ptr<Source> source_ptr = c_ptr->getCurrentSource();
790 if (c_status.code == XrdCl::errInvalidResponse)
792 edm::LogWarning(
"XrdAdaptorInternal") <<
"Invalid response when reading from " << source_ptr->PrettyID();
794 ex <<
"XrdAdaptor::RequestManager::requestFailure readv(name='" <<
m_name 795 <<
"', flags=0x" << std::hex <<
m_flags 797 <<
", old source=" << source_ptr->PrettyID()
798 <<
") => Invalid ReadV response from server";
799 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
803 edm::LogWarning(
"XrdAdaptorInternal") <<
"Request failure when reading from " << source_ptr->PrettyID();
825 std::shared_ptr<Source> new_source;
828 std::shared_future<std::shared_ptr<Source> > future =
m_open_handler->open();
840 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name 841 <<
"', flags=0x" << std::hex <<
m_flags 843 <<
", old source=" << source_ptr->PrettyID()
844 <<
") => timeout when waiting for file open";
845 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
853 new_source = future.get();
857 ex.
addContext(
"Handling XrdAdaptor::RequestManager::requestFailure()");
867 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name 868 <<
"', flags=0x" << std::hex <<
m_flags 870 <<
", old source=" << source_ptr->PrettyID()
871 <<
", new source=" << new_source->PrettyID() <<
") => Xrootd server returned an excluded source";
872 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
886 new_source->handle(c_ptr);
896 if (io.
size() > chunksize)
908 consumed = chunksize;
914 consumed = chunksize;
917 chunksize -= consumed;
920 void* newdata =
static_cast<char*
>(io.
data()) + consumed;
925 else if (io.
size() == 0)
931 output.push_back(io);
932 chunksize -= io.
size();
945 if (io.
size() > chunksize)
957 consumed = chunksize;
963 consumed = chunksize;
966 chunksize -= consumed;
969 void* newdata =
static_cast<char*
>(io.
data()) + consumed;
974 else if (io.
size() == 0)
980 output.push_back(io);
981 chunksize -= io.
size();
990 off_t last_offset = -1;
991 for (
const auto & it : req)
994 assert(it.offset() > last_offset);
995 last_offset = it.offset();
997 assert(it.offset() < 0x1ffffffffff);
999 assert(req.size() <= 1024);
1006 if (iolist.empty())
return;
1007 std::vector<IOPosBuffer> tmp_iolist(iolist.begin(), iolist.end());
1008 req1.reserve(iolist.size()/2+1);
1009 req2.reserve(iolist.size()/2+1);
1013 float q1 =
static_cast<float>(activeSources[0]->getQuality())+5;
1014 float q2 =
static_cast<float>(activeSources[1]->getQuality())+5;
1017 chunk1 =
std::max(static_cast<IOSize>(static_cast<float>(
XRD_CL_MAX_CHUNK)*(q2*q2/(q1*q1+q2*q2))), static_cast<IOSize>(1024));
1018 chunk2 =
std::max(static_cast<IOSize>(static_cast<float>(
XRD_CL_MAX_CHUNK)*(q1*q1/(q1*q1+q2*q2))), static_cast<IOSize>(1024));
1021 for (
const auto & it : iolist) size_orig += it.size();
1023 while (tmp_iolist.size()-front > 0)
1032 ex <<
"XrdAdaptor::RequestManager::splitClientRequest(name='" <<
m_name 1033 <<
"', flags=0x" << std::hex <<
m_flags 1035 <<
") => Unable to split request between active servers. This is an unexpected internal error and should be reported to CMSSW developers.";
1036 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
1038 std::stringstream ss; ss <<
"Original request size " << iolist.size() <<
"(" << size_orig <<
" bytes)";
1040 std::stringstream ss2; ss2 <<
"Quality source 1 " << q1-5 <<
", quality source 2: " << q2-5;
1053 assert(size_orig == size1 + size2);
1055 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;
1059 : m_manager(manager)
1075 std::shared_ptr<OpenHandler>
self =
m_self;
1083 std::shared_ptr<Source>
source;
1084 std::unique_ptr<XrdCl::XRootDStatus>
status(status_ptr);
1085 std::unique_ptr<XrdCl::HostList> hostList(hostList_ptr);
1096 std::unique_ptr<XrdCl::File> releaseFile;
1098 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1116 ex <<
"XrdCl::File::Open(name='" << manager->m_name
1117 <<
"', flags=0x" << std::hex << manager->m_flags
1118 <<
", permissions=0" << std::oct << manager->m_perms <<
std::dec 1119 <<
") => error '" << status->ToStr()
1120 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
1121 ex.
addContext(
"In XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts()");
1122 manager->addConnections(ex);
1124 m_promise.set_exception(std::make_exception_ptr(ex));
1127 manager->handleOpen(*status, source);
1133 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1137 return "(no open in progress)";
1140 m_file->GetProperty(
"DataServer", dataServer);
1141 if (dataServer.empty()) {
return "(unknown source)"; }
1145 std::shared_future<std::shared_ptr<Source> >
1152 ex <<
"XrdCl::File::Open() =>" 1153 <<
" error: OpenHandler called within an invalid RequestManager context." 1154 <<
" This is a logic error and should be reported to the CMSSW developers.";
1155 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1163 ex <<
"XrdCl::File::Open() => error: " 1164 <<
"OpenHandler called after it was deleted. This is a logic error " 1165 <<
"and should be reported to the CMSSW developers.";
1166 ex.
addContext(
"Calling XrdAdapter::RequestManager::OpenHandler::open()");
1183 std::lock_guard<std::recursive_mutex> sentry(
m_mutex);
1184 std::promise<std::shared_ptr<Source> > new_promise;
1190 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Trying to open URL: " << new_name;
1197 XrdCl::XRootDStatus
status;
1201 ex <<
"XrdCl::File::Open(name='" << new_name
1202 <<
"', flags=0x" << std::hex << manager.
m_flags 1204 <<
") => error '" << status.ToStr()
1205 <<
"' (errno=" << status.errNo <<
", code=" << status.code <<
")";
1206 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1210 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 HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override
void requestFailure(std::shared_ptr< XrdAdaptor::ClientRequest > c_ptr, XrdCl::Status &c_status)
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
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)