9 #include "XrdCl/XrdClFile.hh"
10 #include "XrdCl/XrdClDefaultEnv.hh"
11 #include "XrdCl/XrdClFileSystem.hh"
23 #include "Utilities/XrdAdaptor/src/XrdHostHandler.hh"
29 #ifdef XRD_FAKE_OPEN_PROBE
43 #include <mach/clock.h>
44 #include <mach/mach.h>
45 #define GET_CLOCK_MONOTONIC(ts) \
47 clock_serv_t cclock; \
48 mach_timespec_t mts; \
49 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); \
50 clock_get_time(cclock, &mts); \
51 mach_port_deallocate(mach_task_self(), cclock); \
52 ts.tv_sec = mts.tv_sec; \
53 ts.tv_nsec = mts.tv_nsec; \
56 #define GET_CLOCK_MONOTONIC(ts) clock_gettime(CLOCK_MONOTONIC, &ts);
59 using namespace XrdAdaptor;
60 using namespace edm::storage;
63 long long diff = (a.tv_sec - b.tv_sec) * 1000;
64 diff += (a.tv_nsec - b.tv_nsec) / 1e6;
75 XrdCl::Buffer *
buffer =
nullptr;
76 response->Get(buffer);
77 response->Set(static_cast<int *>(
nullptr));
104 file.GetProperty(
"LastURL", lastUrl);
105 if (jobId && !lastUrl.empty()) {
107 XrdCl::FileSystem fs(url);
108 if (!(fs.SendInfo(jobId, &
nullHandler, 30).IsOK())) {
110 <<
"Failed to send the monitoring information, monitoring ID is " << jobId <<
".";
112 edm::LogInfo(
"XrdAdaptorInternal") <<
"Set monitoring ID to " << jobId <<
".";
117 : m_serverToAdvertise(nullptr),
118 m_timeout(XRD_DEFAULT_TIMEOUT),
119 m_nextInitialSourceToggle(
false),
123 m_distribution(0, 100),
124 m_excluded_active_count(0) {}
129 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
131 env->GetInt(
"StreamErrorWindow",
m_timeout);
142 std::unique_ptr<XrdCl::File>
file;
144 bool validFile =
false;
145 const int retries = 5;
147 for (
int idx = 0; idx < retries; idx++) {
148 file = std::make_unique<XrdCl::File>();
151 m_name + (!opaque.empty() ? ((
m_name.find(
'?') ==
m_name.npos) ?
"?" :
"&") + opaque :
"");
152 SyncHostResponseHandler handler;
153 XrdCl::XRootDStatus openStatus = file->Open(new_filename,
m_flags,
m_perms, &handler);
162 ex <<
"XrdCl::File::Open(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags <<
", permissions=0"
163 << std::oct <<
m_perms <<
std::dec <<
") => error '" << openStatus.ToStr() <<
"' (errno=" << openStatus.errNo
164 <<
", code=" << openStatus.code <<
")";
166 ex.
addAdditionalInfo(
"Remote server already encountered a fatal error; no redirections were performed.");
169 handler.WaitForResponse();
170 std::unique_ptr<XrdCl::XRootDStatus>
status = handler.GetStatus();
171 std::unique_ptr<XrdCl::HostList> hostList = handler.GetHosts();
174 if (status->IsOK()) {
181 ex <<
"XrdCl::File::Open(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags <<
", permissions=0"
182 << std::oct <<
m_perms <<
std::dec <<
") => error '" << status->ToStr() <<
"' (errno=" << status->errNo
183 <<
", code=" << status->code <<
")";
187 file->GetProperty(
"DataServer", dataServer);
188 file->GetProperty(
"LastURL", lastUrl);
189 if (!dataServer.empty()) {
192 if (!lastUrl.empty()) {
194 edm::LogWarning(
"XrdAdaptorInternal") <<
"Failed to open file at URL " << lastUrl <<
".";
198 ex <<
". No additional data servers were found.";
201 if (!dataServer.empty()) {
206 if (lastUrl == new_filename) {
207 edm::LogWarning(
"XrdAdaptorInternal") << lastUrl <<
", " << new_filename;
220 auto source = std::make_shared<Source>(ts,
std::move(file), excludeString);
251 std::unique_ptr<std::string> hostname(hostname_ptr);
260 auto hostname = std::make_unique<std::string>(
id);
272 if (!iSources.empty()) {
273 siteA = iSources[0]->Site();
275 if (iSources.size() == 2) {
276 siteB = iSources[1]->Site();
279 if (!siteB.empty() && (siteB != siteA)) {
280 siteList = siteA +
", " + siteB;
289 auto siteList = formatSites(iNew);
290 if (!orig_site.empty() && (orig_site != siteList)) {
291 edm::LogWarning(
"XrdAdaptor") <<
"Data is served from " << siteList <<
" instead of original site " << orig_site;
293 auto oldSites = formatSites(iOld);
294 if (orig_site.empty() && (siteList != oldSites)) {
295 if (!oldSites.empty())
296 edm::LogWarning(
"XrdAdaptor") <<
"Data is now served from " << siteList <<
" instead of previous " << oldSites;
304 std::vector<std::shared_ptr<Source>> &inactiveSources) {
323 std::vector<std::shared_ptr<Source>> &inactiveSources)
const {
328 bool findNewSource =
false;
333 <<
"Removing " <<
activeSources[
a]->PrettyID() <<
" from active sources due to poor quality ("
336 findNewSource =
true;
344 return findNewSource;
350 std::vector<std::shared_ptr<Source>> &inactiveSources) {
351 bool findNewSource =
false;
353 findNewSource =
true;
356 <<
", source 1 quality " <<
activeSources[1]->getQuality() << std::endl;
362 std::vector<std::shared_ptr<Source>> eligibleInactiveSources;
363 eligibleInactiveSources.reserve(inactiveSources.size());
364 for (
const auto &
source : inactiveSources) {
366 eligibleInactiveSources.push_back(
source);
369 auto bestInactiveSource =
370 std::min_element(eligibleInactiveSources.begin(),
371 eligibleInactiveSources.end(),
372 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &s2) {
373 return s1->getQuality() < s2->getQuality();
375 auto worstActiveSource = std::max_element(
activeSources.cbegin(),
377 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &s2) {
378 return s1->getQuality() < s2->getQuality();
380 if (bestInactiveSource != eligibleInactiveSources.end() && bestInactiveSource->get()) {
381 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Best inactive source: " << (*bestInactiveSource)->PrettyID()
382 <<
", quality " << (*bestInactiveSource)->getQuality();
384 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Worst active source: " << (*worstActiveSource)->PrettyID()
385 <<
", quality " << (*worstActiveSource)->getQuality();
388 if ((bestInactiveSource != eligibleInactiveSources.end()) &&
activeSources.size() == 1 &&
389 ((*bestInactiveSource)->getQuality() < 4 *
activeSources[0]->getQuality())) {
393 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
394 if (it->get() == bestInactiveSource->get()) {
395 inactiveSources.erase(it);
399 while ((bestInactiveSource != eligibleInactiveSources.end()) &&
400 (*worstActiveSource)->getQuality() >
403 <<
"Removing " << (*worstActiveSource)->PrettyID() <<
" from active sources due to quality ("
404 << (*worstActiveSource)->getQuality() <<
") and promoting " << (*bestInactiveSource)->PrettyID()
405 <<
" (quality: " << (*bestInactiveSource)->getQuality() <<
")" << std::endl;
406 (*worstActiveSource)->setLastDowngrade(now);
407 for (
auto it = inactiveSources.begin(); it != inactiveSources.end(); it++)
408 if (it->get() == bestInactiveSource->get()) {
409 inactiveSources.erase(it);
412 inactiveSources.emplace_back(*worstActiveSource);
417 eligibleInactiveSources.clear();
418 for (
const auto &
source : inactiveSources)
420 eligibleInactiveSources.push_back(
source);
421 bestInactiveSource = std::min_element(eligibleInactiveSources.begin(),
422 eligibleInactiveSources.end(),
423 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &s2) {
424 return s1->getQuality() < s2->getQuality();
428 [](
const std::shared_ptr<Source> &s1,
const std::shared_ptr<Source> &s2) {
429 return s1->getQuality() < s2->getQuality();
435 findNewSource =
true;
457 ex <<
"XrdAdaptor::RequestManager::getActiveFile(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags
458 <<
", permissions=0" << std::oct <<
m_perms <<
std::dec <<
") => Source used after fatal exception.";
459 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
470 sources.push_back(
source->ID());
478 sources.push_back(
source->PrettyID());
485 sources.push_back(
source);
490 std::vector<std::string> sources;
492 for (
auto const &
source : sources) {
497 for (
auto const &
source : sources) {
503 std::shared_ptr<Source>
source =
nullptr;
516 ex <<
"XrdAdaptor::RequestManager::handle read(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags
517 <<
", permissions=0" << std::oct <<
m_perms <<
std::dec <<
") => Source used after fatal exception.";
518 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
533 std::vector<std::shared_ptr<Source>>
activeSources, inactiveSources;
541 std::shared_ptr<void *> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
551 source->handle(c_ptr);
552 return c_ptr->get_future();
556 std::stringstream
ss;
564 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
':')) <<
",";
568 ss << it->ExcludeID().substr(0, it->ExcludeID().find(
':')) <<
",";
573 ss << it.substr(0, it.find(
':')) <<
",";
577 return tmp_str.substr(0, tmp_str.size() - 1);
583 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
585 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Successfully opened new source: " << source->PrettyID() << std::endl;
586 for (
const auto &
s : m_activeSources) {
587 if (source->ID() ==
s->ID()) {
589 <<
"Xrootd server returned excluded source " << source->PrettyID() <<
"; ignoring" << std::endl;
590 unsigned returned_count = ++m_excluded_active_count;
592 if (returned_count >= 3) {
598 for (
const auto &
s : m_inactiveSources) {
599 if (source->ID() ==
s->ID()) {
601 <<
"Xrootd server returned excluded inactive source " << source->PrettyID() <<
"; ignoring" << std::endl;
606 if (m_activeSources.size() < 2) {
607 auto oldSources = m_activeSources;
608 m_activeSources.push_back(source);
609 reportSiteChange(oldSources, m_activeSources);
610 queueUpdateCurrentServer(source->ID());
612 m_inactiveSources.push_back(source);
615 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Got failure when trying to open a new source" << std::endl;
624 std::vector<std::shared_ptr<Source>>
activeSources, inactiveSources;
626 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
627 activeSources = m_activeSources;
628 inactiveSources = m_inactiveSources;
631 std::shared_ptr<void *> guard(
nullptr, [
this, &activeSources, &inactiveSources](
void *) {
632 std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
633 m_activeSources =
std::move(activeSources);
634 m_inactiveSources =
std::move(inactiveSources);
637 updateCurrentServer();
645 if (activeSources.size() == 1) {
646 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
647 checkSources(now, c_ptr->getSize(),
activeSources, inactiveSources);
648 activeSources[0]->handle(c_ptr);
649 return c_ptr->get_future();
652 else if (activeSources.empty()) {
654 ex <<
"XrdAdaptor::RequestManager::handle readv(name='" << m_name <<
"', flags=0x" << std::hex << m_flags
655 <<
", permissions=0" << std::oct << m_perms <<
std::dec <<
") => Source used after fatal exception.";
656 ex.
addContext(
"In XrdAdaptor::RequestManager::handle()");
662 auto req1 = std::make_shared<std::vector<IOPosBuffer>>();
663 auto req2 = std::make_shared<std::vector<IOPosBuffer>>();
664 splitClientRequest(*iolist, *req1, *req2, activeSources);
666 checkSources(now, req1->size() + req2->size(),
activeSources, inactiveSources);
668 if (activeSources.size() == 1) {
669 auto c_ptr = std::make_shared<XrdAdaptor::ClientRequest>(*
this, iolist);
670 activeSources[0]->handle(c_ptr);
671 return c_ptr->get_future();
674 std::shared_ptr<XrdAdaptor::ClientRequest> c_ptr1, c_ptr2;
675 std::future<IOSize> future1, future2;
676 if (!req1->empty()) {
678 activeSources[0]->handle(c_ptr1);
679 future1 = c_ptr1->get_future();
681 if (!req2->empty()) {
683 activeSources[1]->handle(c_ptr2);
684 future2 = c_ptr2->get_future();
686 if (!req1->empty() && !req2->empty()) {
687 std::future<IOSize> task = std::async(
688 std::launch::deferred,
689 [](std::future<IOSize>
a, std::future<IOSize>
b) {
703 return b.get() + a.get();
710 }
else if (!req1->empty()) {
712 }
else if (!req2->empty()) {
715 std::promise<IOSize>
p;
717 return p.get_future();
722 std::shared_ptr<Source> source_ptr = c_ptr->getCurrentSource();
725 if (c_status.code == XrdCl::errInvalidResponse) {
726 edm::LogWarning(
"XrdAdaptorInternal") <<
"Invalid response when reading from " << source_ptr->PrettyID();
728 ex <<
"XrdAdaptor::RequestManager::requestFailure readv(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags
729 <<
", permissions=0" << std::oct <<
m_perms <<
std::dec <<
", old source=" << source_ptr->PrettyID()
730 <<
") => Invalid ReadV response from server";
731 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
735 edm::LogWarning(
"XrdAdaptorInternal") <<
"Request failure when reading from " << source_ptr->PrettyID();
754 std::shared_ptr<Source> new_source;
756 std::shared_future<std::shared_ptr<Source>> future =
m_open_handler->open();
767 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags
768 <<
", permissions=0" << std::oct <<
m_perms <<
std::dec <<
", old source=" << source_ptr->PrettyID()
769 <<
") => timeout when waiting for file open";
770 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
775 new_source = future.get();
777 ex.
addContext(
"Handling XrdAdaptor::RequestManager::requestFailure()");
787 ex <<
"XrdAdaptor::RequestManager::requestFailure Open(name='" <<
m_name <<
"', flags=0x" << std::hex <<
m_flags
788 <<
", permissions=0" << std::oct <<
m_perms <<
std::dec <<
", old source=" << source_ptr->PrettyID()
789 <<
", new source=" << new_source->PrettyID() <<
") => Xrootd server returned an excluded source";
790 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
802 new_source->handle(c_ptr);
806 std::vector<IOPosBuffer> &
input,
807 std::vector<IOPosBuffer> &
output,
812 if (io.
size() > chunksize) {
820 consumed = chunksize;
824 consumed = chunksize;
827 chunksize -= consumed;
830 void *newdata =
static_cast<char *
>(io.
data()) + consumed;
834 }
else if (io.
size() == 0) {
837 output.push_back(io);
838 chunksize -= io.
size();
845 std::vector<IOPosBuffer> &
input,
846 std::vector<IOPosBuffer> &
output,
851 if (io.
size() > chunksize) {
859 consumed = chunksize;
863 consumed = chunksize;
866 chunksize -= consumed;
869 void *newdata =
static_cast<char *
>(io.
data()) + consumed;
873 }
else if (io.
size() == 0) {
876 output.push_back(io);
877 chunksize -= io.
size();
885 off_t last_offset = -1;
886 for (
const auto &it : req) {
888 assert(it.offset() > last_offset);
889 last_offset = it.offset();
891 assert(it.offset() < 0x1ffffffffff);
893 assert(req.size() <= 1024);
898 std::vector<IOPosBuffer> &req1,
899 std::vector<IOPosBuffer> &req2,
903 std::vector<IOPosBuffer> tmp_iolist(iolist.begin(), iolist.end());
904 req1.reserve(iolist.size() / 2 + 1);
905 req2.reserve(iolist.size() / 2 + 1);
909 float q1 =
static_cast<float>(
activeSources[0]->getQuality()) + 5;
910 float q2 =
static_cast<float>(
activeSources[1]->getQuality()) + 5;
914 static_cast<IOSize>(1024));
916 static_cast<IOSize>(1024));
919 for (
const auto &it : iolist)
920 size_orig += it.size();
922 while (tmp_iolist.size() - front > 0) {
931 ex <<
"XrdAdaptor::RequestManager::splitClientRequest(name='" << m_name <<
"', flags=0x" << std::hex << m_flags
932 <<
", permissions=0" << std::oct << m_perms <<
std::dec
933 <<
") => Unable to split request between active servers. This is an unexpected internal error and should be "
934 "reported to CMSSW developers.";
935 ex.
addContext(
"In XrdAdaptor::RequestManager::requestFailure()");
937 std::stringstream
ss;
938 ss <<
"Original request size " << iolist.size() <<
"(" << size_orig <<
" bytes)";
940 std::stringstream ss2;
941 ss2 <<
"Quality source 1 " << q1 - 5 <<
", quality source 2: " << q2 - 5;
953 return left.
offset() < right.offset();
956 return left.
offset() < right.offset();
962 assert(size_orig == size1 + size2);
964 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Original request size " << iolist.size() <<
" (" << size_orig
965 <<
" bytes) split into requests size " << req1.size() <<
" (" << size1
966 <<
" bytes) and " << req2.size() <<
" (" << size2 <<
" bytes)" << std::endl;
977 XrdCl::HostList *hostList_ptr) {
979 std::shared_ptr<OpenHandler>
self = m_self;
985 std::unique_ptr<OpenHandler, std::function<void(OpenHandler *)>> outstanding_guard(
986 this, [&](
OpenHandler *) { m_outstanding_open =
false; });
988 std::shared_ptr<Source>
source;
989 std::unique_ptr<XrdCl::XRootDStatus>
status(status_ptr);
990 std::unique_ptr<XrdCl::HostList> hostList(hostList_ptr);
992 auto manager = m_manager.lock();
1000 std::unique_ptr<XrdCl::File> releaseFile;
1002 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1004 if (status->IsOK()) {
1013 m_promise.set_value(source);
1017 ex <<
"XrdCl::File::Open(name='" << manager->m_name <<
"', flags=0x" << std::hex << manager->m_flags
1018 <<
", permissions=0" << std::oct << manager->m_perms <<
std::dec <<
") => error '" << status->ToStr()
1019 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
")";
1020 ex.
addContext(
"In XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts()");
1021 manager->addConnections(ex);
1023 m_promise.set_exception(std::make_exception_ptr(ex));
1026 manager->handleOpen(*status, source);
1030 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1032 if (!m_file.get()) {
1033 return "(no open in progress)";
1036 m_file->GetProperty(
"DataServer", dataServer);
1037 if (dataServer.empty()) {
1038 return "(unknown source)";
1044 auto manager_ptr = m_manager.lock();
1047 ex <<
"XrdCl::File::Open() =>"
1048 <<
" error: OpenHandler called within an invalid RequestManager context."
1049 <<
" This is a logic error and should be reported to the CMSSW developers.";
1050 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1054 auto self_ptr = m_self_weak.lock();
1057 ex <<
"XrdCl::File::Open() => error: "
1058 <<
"OpenHandler called after it was deleted. This is a logic error "
1059 <<
"and should be reported to the CMSSW developers.";
1060 ex.
addContext(
"Calling XrdAdapter::RequestManager::OpenHandler::open()");
1073 if (m_outstanding_open) {
1074 return m_shared_future;
1076 std::lock_guard<std::recursive_mutex> sentry(m_mutex);
1077 std::promise<std::shared_ptr<Source>> new_promise;
1078 m_promise.swap(new_promise);
1079 m_shared_future = m_promise.get_future().share();
1083 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Trying to open URL: " << new_name;
1084 m_file = std::make_unique<XrdCl::File>();
1085 m_outstanding_open =
true;
1088 std::unique_ptr<OpenHandler, std::function<void(OpenHandler *)>> exit_guard(
this, [&](
OpenHandler *) {
1089 m_outstanding_open =
false;
1093 XrdCl::XRootDStatus
status;
1094 if (!(status = m_file->Open(new_name, manager.
m_flags, manager.
m_perms,
this)).IsOK()) {
1096 ex <<
"XrdCl::File::Open(name='" << new_name <<
"', flags=0x" << std::hex << manager.
m_flags <<
", permissions=0"
1097 << std::oct << manager.
m_perms <<
std::dec <<
") => error '" << status.ToStr() <<
"' (errno=" << status.errNo
1098 <<
", code=" << status.code <<
")";
1099 ex.
addContext(
"Calling XrdAdaptor::RequestManager::OpenHandler::open()");
1103 exit_guard.release();
1106 return m_shared_future;
Log< level::Info, true > LogVerbatim
static constexpr int XRD_ADAPTOR_OPEN_PROBE_PERCENT
std::shared_future< std::shared_ptr< Source > > open()
std::shared_ptr< XrdCl::File > getActiveFile() const
uint16_t *__restrict__ id
void getDisabledSourceNames(std::vector< std::string > &sources) const
#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
static constexpr int XRD_CL_MAX_CHUNK
void set_size(IOSize new_size)
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)
void set_offset(IOOffset new_offset)
SendMonitoringInfoHandler nullHandler
static std::string const input
static void SendMonitoringInfo(XrdCl::File &file)
OpenHandler(const OpenHandler &)=delete
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
static constexpr int XRD_ADAPTOR_LONG_OPEN_DELAY
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)
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)
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::atomic< std::string * > m_serverToAdvertise
std::string current_source()
std::shared_ptr< OpenHandler > m_open_handler
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
Log< level::Info, false > LogInfo
XrdCl::OpenFlags::Flags m_flags
static std::shared_ptr< OpenHandler > getInstance(std::weak_ptr< RequestManager > manager)
void setCurrentServer(const std::string &urlOrLfn, const std::string &servername)
static void consumeChunkFront(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::vector< std::shared_ptr< Source > > m_activeSources
XrdCl::Access::Mode m_perms
void addContext(std::string const &context)
static constexpr int XRD_ADAPTOR_SHORT_OPEN_DELAY
static constexpr int XRD_ADAPTOR_SOURCE_QUALITY_FUDGE
tbb::concurrent_unordered_set< std::string > m_disabledExcludeStrings
static const char * getJobID()
void set_data(void *new_buffer)
std::shared_ptr< Source > pickSingleSource()
static constexpr int XRD_ADAPTOR_CHUNK_THRESHOLD
static bool getXrootdSiteFromURL(std::string url, std::string &site)
static IOSize validateList(const std::vector< IOPosBuffer > req)
void updateCurrentServer()
edm::storage::IOSize IOSize
Log< level::Warning, false > LogWarning
static void consumeChunkBack(size_t front, std::vector< IOPosBuffer > &input, std::vector< IOPosBuffer > &output, IOSize chunksize)
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()
RequestManager(const RequestManager &)=delete
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)