Skip to content

Commit

Permalink
[Server] Additional refinements for controlling server reselection.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed May 7, 2019
1 parent 9fd293c commit cfdf448
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/XProtocol/YProtocol.hh
Expand Up @@ -509,7 +509,9 @@ enum {kYR_refresh = 0x00000001,
kYR_trySVER = 0x00030000, // Retry due to server error (triedrc=srverr)
kYR_tryMASK = 0x00030000, // Mask to isolate retry reason
kYR_trySHFT = 16, // Amount to shift right
kYR_tryRSEL = 0x00040000, // Retry for reselection (triedrc=resel)
kYR_tryRSEL = 0x00040000, // Retry for reselection LCL (triedrc=resel)
kYR_tryRSEG = 0x00080000, // Retry for reselection GBL (triedrc=resel)
kYR_tryMSRC = 0x000C0000, // Retry for multisource operation
kYR_aWeak = 0x00100000, // Affinity: weak
kYR_aStrong = 0x00200000, // Affinity: strong
kYR_aStrict = 0x00300000, // Affinity: strict
Expand Down
1 change: 1 addition & 0 deletions src/XrdCms/XrdCmsCluster.hh
Expand Up @@ -185,6 +185,7 @@ void ResetRef(SMask_t smask);
// Called to select the best possible node to serve a file (two forms)
//
static const int RetryErr = -3;
static const int RetryOut = -4;
int Select(XrdCmsSelect &Sel);

int Select(SMask_t pmask, int &port, char *hbuff, int &hlen,
Expand Down
2 changes: 2 additions & 0 deletions src/XrdCms/XrdCmsFinder.cc
Expand Up @@ -422,6 +422,8 @@ int XrdCmsFinderRMT::Locate(XrdOucErrInfo &Resp, const char *path, int flags,
Data.Opts |= CmsSelectRequest::kYR_trySVER;
else if (!strcmp(triedRC, "resel"))
Data.Opts |= CmsSelectRequest::kYR_tryRSEL;
else if (!strcmp(triedRC, "reseg"))
Data.Opts |= CmsSelectRequest::kYR_tryRSEG;
}
}

Expand Down
24 changes: 14 additions & 10 deletions src/XrdCms/XrdCmsNode.cc
Expand Up @@ -1059,17 +1059,19 @@ int XrdCmsNode::do_SelAvoid(XrdCmsRRData &Arg, XrdCmsSelect &Sel,
// This is a standard cluster, check if client is expanding the server base
// and whether or not this is allowed in this cluster.
//
if ((Arg.Opts & CmsSelectRequest::kYR_tryRSEL) && !Config.MultiSrc)
if ((Arg.Opts & CmsSelectRequest::kYR_tryMSRC) && !Config.MultiSrc)
{if (Config.msRdrHost)
{strcpy(Sel.Resp.Data, Config.msRdrHost); // Gauranteed to fit!
Sel.Resp.DLen = Config.msRdrHLen;
Sel.Resp.Port = Config.msRdrPort;
doRedir = true;
} else {
strncpy(Sel.Resp.Data, msrcmsg, sizeof(Sel.Resp.Data));
Sel.Resp.DLen = msrclen;
return -1;
}
return -1;
strncpy(Sel.Resp.Data, msrcmsg, sizeof(Sel.Resp.Data));
Sel.Resp.DLen = msrclen;
if (Arg.Opts & CmsSelectRequest::kYR_tryRSEL) Sel.Resp.Port = kYR_EPERM;
else Sel.Resp.Port = kYR_ENOENT;
return XrdCmsCluster::RetryOut;
}

// Check if we exceeded the retry count
Expand Down Expand Up @@ -1184,11 +1186,13 @@ const char *XrdCmsNode::do_Select(XrdCmsRRData &Arg)
DEBUGR("delay " <<rc <<' ' <<Arg.Path);
} else {
Arg.Request.rrCode = kYR_error;
if (rc != XrdCmsCluster::RetryErr) Sel.Resp.Port = kYR_ENOENT;
else {int rtRC = (Arg.Opts & CmsSelectRequest::kYR_tryMASK)
>> CmsSelectRequest::kYR_trySHFT;
Sel.Resp.Port = rtEC[rtRC];
}
if (rc != XrdCmsCluster::RetryOut)
{if (rc != XrdCmsCluster::RetryErr) Sel.Resp.Port = kYR_ENOENT;
else {int rtRC = (Arg.Opts & CmsSelectRequest::kYR_tryMASK)
>> CmsSelectRequest::kYR_trySHFT;
Sel.Resp.Port = rtEC[rtRC];
}
}
DEBUGR("failed; " <<Sel.Resp.Data << ' ' <<Arg.Path);
}
} else if (!Sel.Resp.DLen) return 0;
Expand Down

0 comments on commit cfdf448

Please sign in to comment.