Skip to content

Commit

Permalink
Merge pull request #16 from stfc/rocky8temp
Browse files Browse the repository at this point in the history
Rocky8temp
  • Loading branch information
Jo-stfc authored Aug 4, 2024
2 parents defecac + 7764992 commit d03e7e3
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
5 changes: 5 additions & 0 deletions packaging/makesrpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ echo "[i] Working with version: $VERSION"
# Sanitize version to work with RPMs
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/
#-------------------------------------------------------------------------------
RELEASE=4
if test x`echo $VERSION | grep -E $RCEXP` != x; then
RELEASE=0.`echo $VERSION | sed 's/.*-rc/rc/'`
VERSION=`echo $VERSION | sed 's/-rc.*//'`
fi

VERSION=${VERSION#v} # remove "v" prefix
VERSION=${VERSION/-rc/~rc} # release candidates use ~ in RPMs
Expand Down
10 changes: 5 additions & 5 deletions src/XrdCks/XrdCksManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ int XrdCksManager::Del(const char *Pfn, XrdCksData &Cks)
int XrdCksManager::Get(const char *Pfn, XrdCksData &Cks)
{
XrdOucXAttr<XrdCksXAttr> xCS;
time_t MTime;
// not checking stale checksums as ceph file modification times constantly refresh on read
//time_t MTime;
int rc, nFault;

// Determine which checksum to get (we will accept unsupported ones as well)
Expand All @@ -473,13 +474,12 @@ int XrdCksManager::Get(const char *Pfn, XrdCksData &Cks)
Cks = xCS.Attr.Cks;

// Verify the file
//
if ((rc = ModTime(Pfn, MTime))) return rc;
// not done as ceph mod times are weird
// if ((rc = ModTime(Pfn, MTime))) return rc;

// Return result
//
return (Cks.fmTime != MTime || nFault
|| Cks.Length > XrdCksData::ValuSize || Cks.Length <= 0
return ( nFault || Cks.Length > XrdCksData::ValuSize || Cks.Length <= 0
? -ESTALE : int(Cks.Length));
}

Expand Down
44 changes: 37 additions & 7 deletions src/XrdCms/XrdCmsCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <random>

#include "XProtocol/YProtocol.hh"

Expand Down Expand Up @@ -1121,6 +1122,7 @@ int XrdCmsCluster::Select(SMask_t pmask, int &port, char *hbuff, int &hlen,
: SelbyLoadR(pmask, selR));

if (nP) hlen = nP->netIF.GetName(hbuff, port, nType) + 1;

else hlen = 0;
STMutex.UnLock();
return hlen != 1;
Expand Down Expand Up @@ -1792,10 +1794,17 @@ XrdCmsNode *XrdCmsCluster::SelbyLoad(SMask_t mask, XrdCmsSelector &selR)
XrdCmsNode *np, *sp = 0;
bool Multi = false, reqSS = (selR.needSpace & XrdCmsNode::allowsSS) != 0;

// Scan for a node (preset possible, suspended, overloaded, full, and dead)
//
selR.Reset(); SelTcnt++;
for (int i = 0; i <= STHi; i++)
// Scan for a node (preset possible, suspended, overloaded, full, and dead)
//
selR.Reset(); SelTcnt++;
int selCap = 1;
int randomSel=1;
bool useWR=(Config.P_randlb==1);
//default 0 to skip the node in random selection if the below checks fail
int Weighed[STMax] = { 0 };
//float scalingFactor = 1+(1-float(std::clamp(Config.P_fuzz,0,100))/100)*2;
for (int i = 0; i <= STHi; i++)
// Weighed[i] = 0;
if ((np = NodeTab[i]) && (np->NodeMask & mask))
{if (!(selR.needNet & np->hasNet)) {selR.xNoNet= true; continue;}
selR.nPick++;
Expand All @@ -1806,7 +1815,14 @@ XrdCmsNode *XrdCmsCluster::SelbyLoad(SMask_t mask, XrdCmsSelector &selR)
|| (reqSS && np->isNoStage)))
{selR.xFull = true; continue;}
if (!sp) sp = np;
else{if (selR.needSpace)
else{
if (useWR){
//add 1 to the inverse load, this is to allow some selection in case reported loads hit 100
int nload = 101 - np->myLoad;
selCap += nload;//static_cast<int>(nload + std::pow(nload, scalingFactor)/2);
Weighed[i] = selCap;
}
else{if (selR.needSpace)
{if (abs(sp->myMass - np->myMass) <= Config.P_fuzz)
{if (sp->RefW > (np->RefW+Config.DiskLinger)) sp=np;}
else if (sp->myMass > np->myMass) sp=np;
Expand All @@ -1822,8 +1838,22 @@ XrdCmsNode *XrdCmsCluster::SelbyLoad(SMask_t mask, XrdCmsSelector &selR)
}
Multi = true;
}
}
}

if (useWR){
// pick a random weighed node
//
static std::random_device rand_dev;
static std::default_random_engine generator(rand_dev());
static std::uniform_int_distribution<int> distr(randomSel,selCap);
randomSel = distr(generator);
for(int i=0;i<=STHi;i++){
if(randomSel<=Weighed[i]){
sp=NodeTab[i];
break;
}
}
}
// Check for overloaded node and return result
//
if (!sp) return calcDelay(selR);
Expand All @@ -1849,9 +1879,9 @@ XrdCmsNode *XrdCmsCluster::SelbyLoadR(SMask_t mask, XrdCmsSelector &selR)

selR.Reset();
SelTcnt++;

int totWeight = 0;


for (int i = 0; i <= STHi; ++i) {
NodeWeight[i] = 0; // make node unselectable first

Expand Down
1 change: 0 additions & 1 deletion src/XrdCms/XrdCmsCluster.hh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ static const int AltSize = 254; // We may revert to IP address
XrdSysRWLock STMutex; // Protects all node information variables
XrdCmsNode *NodeTab[STMax]; // Current set of nodes
int NodeWeight[STMax]; // Current set of load balancing weights

int STHi; // NodeTab high watermark
int Reserved;
RAtomic_llong SelWtot; // Total number of r/w selections (successful)
Expand Down
4 changes: 3 additions & 1 deletion src/XrdCms/XrdCmsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ void XrdCmsConfig::ConfigDefaults(void)
P_load = 0;
P_mem = 0;
P_pag = 0;
P_randlb = 0; // SelbyLoad algorithm choice
AskPerf = 10; // Every 10 pings
AskPing = 60; // Every 1 minute
PingTick = 0;
Expand Down Expand Up @@ -2651,7 +2652,8 @@ int XrdCmsConfig::xsched(XrdSysError *eDest, XrdOucStream &CFile)
{"refreset", -1, &RefReset},
{"affinity", -2, 0},
{"affpath", -3, 0},
{"tryhname", 1, &V_hntry}
{"tryhname", 1, &V_hntry},
{"randlb", 1, &P_randlb}
};
int numopts = sizeof(scopts)/sizeof(struct schedopts);

Expand Down
1 change: 1 addition & 0 deletions src/XrdCms/XrdCmsConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ int P_io; // % I/O Capacity in load factor
int P_load; // % MSC Capacity in load factor
int P_mem; // % MEM Capacity in load factor
int P_pag; // % PAG Capacity in load factor
int P_randlb; // enable weighted random load balancing

char DoMWChk; // When true (default) perform multiple write check
char DoHnTry; // When true (default) use hostnames for try redirs
Expand Down
1 change: 1 addition & 0 deletions src/XrdSciTokens/XrdSciTokensAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ class XrdAccSciTokens : public XrdAccAuthorize, public XrdSciTokensHelper,
xrd_rules.emplace_back(AOP_Mkdir, write_path);
xrd_rules.emplace_back(AOP_Rename, write_path);
xrd_rules.emplace_back(AOP_Insert, write_path);
xrd_rules.emplace_back(AOP_Stat, write_path);
xrd_rules.emplace_back(AOP_Update, write_path);
xrd_rules.emplace_back(AOP_Stat, write_path);
xrd_rules.emplace_back(AOP_Chmod, write_path);
Expand Down
2 changes: 1 addition & 1 deletion src/XrdXrootd/XrdXrootdProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int XrdXrootdProtocol::Process2()
switch(Request.header.requestid)
{case kXR_login: return do_Login();
case kXR_protocol: return do_Protocol();
case kXR_bind: return do_Bind();
//case kXR_bind: return do_Bind();
default: Response.Send(kXR_InvalidRequest,
"Invalid request; user not logged in");
return Link->setEtext("request without login");
Expand Down
1 change: 0 additions & 1 deletion src/XrdXrootd/XrdXrootdXeqPgrw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ int XrdXrootdProtocol::do_PgRIO()
iov[i++].iov_len = pgPageSize;
buff += pgPageSize;
}

// If this is an unaligned read, offset the unaligned segment in the buffer
// so that remaining pages are page-aligned. It will be reset when needed.
// We also calculate the actual length of the first read.
Expand Down

0 comments on commit d03e7e3

Please sign in to comment.