From 68d807c915f3fe124e50e47fcc4080d1d3e5bb9d Mon Sep 17 00:00:00 2001 From: Andrew Hanushevsky Date: Mon, 18 Mar 2019 13:16:50 -0700 Subject: [PATCH] [SSI] Expose refresh flag for better request retry control. --- src/XrdSsi/XrdSsiRRAgent.hh | 8 ++++++++ src/XrdSsi/XrdSsiRequest.cc | 15 ++++++++++++++- src/XrdSsi/XrdSsiRequest.hh | 13 ++++++++++++- src/XrdSsi/XrdSsiSessReal.cc | 9 +++++++-- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/XrdSsi/XrdSsiRRAgent.hh b/src/XrdSsi/XrdSsiRRAgent.hh index 05f54d1f5dd..81671b2a8cd 100644 --- a/src/XrdSsi/XrdSsiRRAgent.hh +++ b/src/XrdSsi/XrdSsiRRAgent.hh @@ -47,6 +47,14 @@ static void Dispose(XrdSsiRequest &reqR) {reqR.Dispose();} static XrdSsiErrInfo &ErrInfoRef(XrdSsiRequest *rP) {return rP->errInfo;} +static bool isaRetry(XrdSsiRequest *rP) + {if (rP->flags & XrdSsiRequest::isaRetry) + {rP->flags &= ~XrdSsiRequest::isaRetry; + return true; + } + return false; + } + static void onServer(XrdSsiRequest *rP) {rP->onClient = false;} static XrdSsiRequest *Request(XrdSsiResponder *rP) {return rP->reqP;} diff --git a/src/XrdSsi/XrdSsiRequest.cc b/src/XrdSsi/XrdSsiRequest.cc index 334cbb6dfbf..7690364af54 100644 --- a/src/XrdSsi/XrdSsiRequest.cc +++ b/src/XrdSsi/XrdSsiRequest.cc @@ -52,7 +52,7 @@ XrdSsiMutex ubMutex(XrdSsiMutex::Recursive); XrdSsiRequest::XrdSsiRequest(const char *reqid, uint16_t tmo) : reqID(reqid), rrMutex(&XrdSsi::ubMutex), theRespond(0), rsvd1(0), epNode(0), - detTTL(0), tOut(0), onClient(true), rsvd2(0) {} + detTTL(0), tOut(0), onClient(true), flags(0) {} /******************************************************************************/ /* Private: C l e a n U p */ @@ -185,3 +185,16 @@ void XrdSsiRequest::ReleaseRequestBuffer() XrdSsiMutexMon lck(rrMutex); RelRequestBuffer(); } + +/******************************************************************************/ +/* S e t R e t r y */ +/******************************************************************************/ + +void XrdSsiRequest::SetRetry(bool onoff) +{ + +// Set flag as needed +// +if (onoff) flags |= isaRetry; + else flags &= ~isaRetry; +} diff --git a/src/XrdSsi/XrdSsiRequest.hh b/src/XrdSsi/XrdSsiRequest.hh index 8ae496c8b33..f722b2fa1b0 100644 --- a/src/XrdSsi/XrdSsiRequest.hh +++ b/src/XrdSsi/XrdSsiRequest.hh @@ -268,6 +268,16 @@ virtual void RelRequestBuffer() {} inline void SetDetachTTL(uint32_t dttl) {detTTL = dttl;} +//----------------------------------------------------------------------------- +//! Set request retry notification. If a non-default value is desired, it must +//! be set prior to calling XrdSsiService::ProcessRequest(). This is a one-time +//! request and retry mode is turned off in the request object afterwards. +//! +//! @param onoff True to turn retry on and false to turn it off. +//----------------------------------------------------------------------------- + + void SetRetry(bool onoff); + //----------------------------------------------------------------------------- //! Set timeout for initiating the request. If a non-default value is desired, //! it must be set prior to calling XrdSsiService::ProcessRequest(). @@ -302,6 +312,7 @@ const char *epNode; uint32_t detTTL; uint16_t tOut; bool onClient; -char rsvd2; +char flags; +static const int isaRetry = 1; }; #endif diff --git a/src/XrdSsi/XrdSsiSessReal.cc b/src/XrdSsi/XrdSsiSessReal.cc index e5999cfae6e..4c57bbf62f9 100644 --- a/src/XrdSsi/XrdSsiSessReal.cc +++ b/src/XrdSsi/XrdSsiSessReal.cc @@ -227,12 +227,17 @@ bool XrdSsiSessReal::Provision(XrdSsiRequest *reqP, const char *epURL) EPNAME("Provision"); XrdCl::XRootDStatus epStatus; XrdSsiMutexMon rHelp(&sessMutex); + XrdCl::OpenFlags::Flags oFlags = XrdCl::OpenFlags::Read; + +// Set retry flag as appropriate +// + if (XrdSsiRRAgent::isaRetry(reqP)) oFlags |= XrdCl::OpenFlags::Refresh; // Issue the open and if the open was started, return success. // DEBUG("Provisioning " <GetTimeOut());