Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XrdAdaptor] Delay additional source acquisition when redirect limit error is returned. #35498

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions Utilities/XrdAdaptor/src/XrdRequestManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SendMonitoringInfoHandler : public XrdCl::ResponseHandler {

SendMonitoringInfoHandler(const std::string &url) : m_fs(url) {}

XrdCl::FileSystem& fs() { return m_fs; }
XrdCl::FileSystem &fs() { return m_fs; }
};

static void SendMonitoringInfo(XrdCl::File &file) {
Expand Down Expand Up @@ -121,6 +121,7 @@ RequestManager::RequestManager(const std::string &filename, XrdCl::OpenFlags::Fl
: m_serverToAdvertise(nullptr),
m_timeout(XRD_DEFAULT_TIMEOUT),
m_nextInitialSourceToggle(false),
m_redirectLimitDelayScale(1),
m_name(filename),
m_flags(flags),
m_perms(perms),
Expand Down Expand Up @@ -594,6 +595,7 @@ void XrdAdaptor::RequestManager::handleOpen(XrdCl::XRootDStatus &status, std::sh
std::lock_guard<std::recursive_mutex> sentry(m_source_mutex);
if (status.IsOK()) {
edm::LogVerbatim("XrdAdaptorInternal") << "Successfully opened new source: " << source->PrettyID() << std::endl;
m_redirectLimitDelayScale = 1;
for (const auto &s : m_activeSources) {
if (source->ID() == s->ID()) {
edm::LogVerbatim("XrdAdaptorInternal")
Expand Down Expand Up @@ -624,7 +626,12 @@ void XrdAdaptor::RequestManager::handleOpen(XrdCl::XRootDStatus &status, std::sh
}
} else { // File-open failure - wait at least 120s before next attempt.
edm::LogVerbatim("XrdAdaptorInternal") << "Got failure when trying to open a new source" << std::endl;
m_nextActiveSourceCheck.tv_sec += XRD_ADAPTOR_LONG_OPEN_DELAY - XRD_ADAPTOR_SHORT_OPEN_DELAY;
int delayScale = 1;
if (status.status == XrdCl::errRedirectLimit) {
m_redirectLimitDelayScale = std::min(2 * m_redirectLimitDelayScale, 100);
delayScale = m_redirectLimitDelayScale;
}
m_nextActiveSourceCheck.tv_sec += delayScale * XRD_ADAPTOR_LONG_OPEN_DELAY - XRD_ADAPTOR_SHORT_OPEN_DELAY;
}
}

Expand Down Expand Up @@ -1030,14 +1037,6 @@ void XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts(XrdCl::XRo
<< "' (errno=" << status->errNo << ", code=" << status->code << ")";
ex.addContext("In XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts()");
manager->addConnections(ex);

// Brian, should we do something like this:
// if (status.status == XrdCl::errRedirectLimit) {
// // The following method does not exist (yet), would probaly need a multiplier for OPEN_DELAY.
// // Note that with XCache cluster one will never get multiple sources.
// manager->increaseMultiSourceInterval();
// }

m_promise.set_exception(std::make_exception_ptr(ex));
}
}
Expand Down
1 change: 1 addition & 0 deletions Utilities/XrdAdaptor/src/XrdRequestManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ namespace XrdAdaptor {
bool m_nextInitialSourceToggle;
// The time when the next active source check should be performed.
timespec m_nextActiveSourceCheck;
int m_redirectLimitDelayScale;
bool searchMode;

const std::string m_name;
Expand Down