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

Adding fbuff argument to monitoring to restrict maximum size of fstream packet #1234

Merged
merged 2 commits into from
Jul 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/XrdXrootd/XrdXrootdConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,7 @@ int XrdXrootdProtocol::xlog(XrdOucStream &Config)

Purpose: Parse directive: monitor [all] [auth] [flush [io] <sec>]
[fstat <sec> [lfn] [ops] [ssq] [xfr <n>]
[fbuff <sz>]
[ident <sec>] [mbuff <sz>] [rbuff <sz>]
[rnums <cnt>] [window <sec>]
dest [Events] <host:port>
Expand All @@ -1362,6 +1363,7 @@ int XrdXrootdProtocol::xlog(XrdOucStream &Config)
ssq - computes the sum of squares for the ops rec
xfr <n>- inserts i/o stats for open files every
<sec>*<n>. Minimum is 1.
fbsz <sz> size of message buffer for file stream monitoring.
ident <sec> time (seconds, M, H) between identification records.
mbuff <sz> size of message buffer for event trace monitoring.
rbuff <sz> size of message buffer for redirection monitoring.
Expand Down Expand Up @@ -1389,7 +1391,7 @@ int XrdXrootdProtocol::xmon(XrdOucStream &Config)
};
char *val = 0, *cp, *monDest[2] = {0, 0};
long long tempval;
int i, monFlash = 0, monFlush=0, monMBval=0, monRBval=0, monWWval=0;
int i, monFlash = 0, monFlush=0, monMBval=0, monRBval=0, monWWval=0, monFbsz=0;
int monIdent = 3600, xmode=0, monMode[2] = {0, 0}, mrType, *flushDest;
int monRnums = 0, monFSint = 0, monFSopt = 0, monFSion = 0;
int haveWord = 0;
Expand Down Expand Up @@ -1441,6 +1443,15 @@ int XrdXrootdProtocol::xmon(XrdOucStream &Config)
if (mrType) monRBval = static_cast<int>(tempval);
else monMBval = static_cast<int>(tempval);
}
else if (!strcmp("fbsz", val))
{if (!(val = Config.GetWord()))
{eDest.Emsg("Config", "monitor fbsz value not specified");
return 1;
}
if (XrdOuca2x::a2sz(eDest,"monitor fbsz", val,
&tempval, 1024, 65472)) return 1;
monFbsz = static_cast<int>(tempval);
}
else if (!strcmp("ident", val))
{if (!(val = Config.GetWord()))
{eDest.Emsg("Config", "monitor ident value not specified");
Expand Down Expand Up @@ -1528,7 +1539,7 @@ int XrdXrootdProtocol::xmon(XrdOucStream &Config)
// Set the monitor defaults
//
XrdXrootdMonitor::Defaults(monMBval, monRBval, monWWval,
monFlush, monFlash, monIdent, monRnums,
monFlush, monFlash, monIdent, monRnums, monFbsz,
monFSint, monFSopt, monFSion);

if (monDest[0]) monMode[0] |= (monMode[0] ? xmode : XROOTD_MON_FILE|xmode);
Expand Down
12 changes: 7 additions & 5 deletions src/XrdXrootd/XrdXrootdMonFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int XrdXrootdMonFile::repTime = 0;
int XrdXrootdMonFile::fmHWM =-1;
int XrdXrootdMonFile::crecSize = 0;
int XrdXrootdMonFile::xfrCnt = 0;
int XrdXrootdMonFile::fBsz = 65472;
int XrdXrootdMonFile::xfrRem = 0;
XrdXrootdMonFileXFR XrdXrootdMonFile::xfrRec;
short XrdXrootdMonFile::crecNLen = 0;
Expand Down Expand Up @@ -174,14 +175,15 @@ void XrdXrootdMonFile::Close(XrdXrootdFileStats *fsP, bool isDisc)
/* D e f a u l t s */
/******************************************************************************/

void XrdXrootdMonFile::Defaults(int intv, int opts, int xfrcnt)
void XrdXrootdMonFile::Defaults(int intv, int opts, int xfrcnt, int fbsz)
{

// Set the reporting interval and I/O counter
//
repTime = intv;
xfrCnt = xfrcnt;
xfrRem = xfrcnt;
fBsz = (fbsz <= 0 ? 65472 : fbsz);

// Expand out the options
//
Expand Down Expand Up @@ -319,15 +321,15 @@ void XrdXrootdMonFile::DoXFR(XrdXrootdFileStats *fsP)
/* I n i t */
/******************************************************************************/

bool XrdXrootdMonFile::Init(int bfsz)
bool XrdXrootdMonFile::Init()
{
XrdXrootdMonFile *mfP;
int alignment, pagsz = getpagesize();

// Allocate a socket buffer
//
alignment = (bfsz < pagsz ? 1024 : pagsz);
if (posix_memalign((void **)&repBuff, alignment, bfsz))
alignment = (fBsz < pagsz ? 1024 : pagsz);
if (posix_memalign((void **)&repBuff, alignment, fBsz))
{XrdXrootdMonInfo::eDest->Emsg("MonFile", "Unable to allocate monitor buffer.");
return false;
}
Expand All @@ -353,7 +355,7 @@ bool XrdXrootdMonFile::Init(int bfsz)

// Calculate the end nut the next slot always starts with a null pointer
//
repLast = repBuff+bfsz-1;
repLast = repBuff+fBsz-1;
repNext = 0;

// Calculate the close record size and the initial flags
Expand Down
5 changes: 3 additions & 2 deletions src/XrdXrootd/XrdXrootdMonFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public:

static void Close(XrdXrootdFileStats *fsP, bool isDisc=false);

static void Defaults(int intv, int opts, int iocnt);
static void Defaults(int intv, int opts, int iocnt, int fbsz);

static void Disc(unsigned int usrID);

void DoIt();

static bool Init(int bfsz=65472);
static bool Init();

static void Open(XrdXrootdFileStats *fsP,
const char *Path, unsigned int uDID, bool isRW);
Expand Down Expand Up @@ -83,6 +83,7 @@ static int repTime;
static int fmHWM;
static int crecSize;
static int xfrCnt;
static int fBsz;
static int xfrRem;
static XrdXrootdMonFileXFR xfrRec;
static short crecNLen;
Expand Down
4 changes: 2 additions & 2 deletions src/XrdXrootd/XrdXrootdMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void XrdXrootdMonitor::Defaults(char *dest1, int mode1, char *dest2, int mode2)

void XrdXrootdMonitor::Defaults(int msz, int rsz, int wsz,
int flush, int flash, int idt, int rnm,
int fsint, int fsopt, int fsion)
int fbsz, int fsint, int fsopt, int fsion)
{

// Set default window size and flush time
Expand All @@ -467,7 +467,7 @@ void XrdXrootdMonitor::Defaults(int msz, int rsz, int wsz,

// Set the fstat defaults
//
XrdXrootdMonFile::Defaults(fsint, fsopt, fsion);
XrdXrootdMonFile::Defaults(fsint, fsopt, fsion, fbsz);
monFSTAT = fsint != 0;

// Set default monitor buffer size
Expand Down
2 changes: 1 addition & 1 deletion src/XrdXrootd/XrdXrootdMonitor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ inline void Add_wr(kXR_unt32 dictid,
static void Defaults(char *dest1, int m1, char *dest2, int m2);
static void Defaults(int msz, int rsz, int wsz,
int flush, int flash, int iDent, int rnm,
int fsint=0, int fsopt=0, int fsion=0);
int fbsz, int fsint=0, int fsopt=0, int fsion=0);

static int Flushing() {return autoFlush;}

Expand Down