Skip to content

Commit

Permalink
[Server] Remove support for old-style FRM and OSS spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jun 20, 2020
1 parent e605a61 commit 3469652
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 863 deletions.
1 change: 0 additions & 1 deletion src/XrdFrm.cmake
Expand Up @@ -29,7 +29,6 @@ add_executable(
frm_admin
XrdFrm/XrdFrmAdminAudit.cc
XrdFrm/XrdFrmAdmin.cc XrdFrm/XrdFrmAdmin.hh
XrdFrm/XrdFrmAdminConvert.cc
XrdFrm/XrdFrmAdminFiles.cc
XrdFrm/XrdFrmAdminFind.cc
XrdFrm/XrdFrmAdminMain.cc
Expand Down
2 changes: 0 additions & 2 deletions src/XrdFrm/XrdFrmAdmin.cc
Expand Up @@ -283,7 +283,6 @@ int XrdFrmAdmin::Find()
else if (Abbrev(Opt.Args[0], "mmapped", 4)) return FindMmap(Spec);
else if (Abbrev(Opt.Args[0], "nocs", 4)) return FindNocs(Spec);
else if (Abbrev(Opt.Args[0], "nochksum", 8)) return FindNocs(Spec);
else if (Abbrev(Opt.Args[0], "nolkfiles", 4)) return FindNolk(Spec);
else if (Abbrev(Opt.Args[0], "pinned", 3)) return FindPins(Spec);
else if (Abbrev(Opt.Args[0], "unmigrated",4)) return FindUnmi(Spec);

Expand Down Expand Up @@ -711,7 +710,6 @@ int XrdFrmAdmin::xeqArgs(char *Cmd)
}
CmdTab[] = {{"audit", 5, 5, &XrdFrmAdmin::Audit},
{"chksum", 6, 6, &XrdFrmAdmin::Chksum},
{"convert",7, 7, &XrdFrmAdmin::Convert},
{"exit", 4, 4, &XrdFrmAdmin::Quit},
{"find", 1, 4, &XrdFrmAdmin::Find},
{"help", 1, 4, &XrdFrmAdmin::Help},
Expand Down
19 changes: 1 addition & 18 deletions src/XrdFrm/XrdFrmAdmin.hh
Expand Up @@ -92,8 +92,6 @@ int AuditNameNF(XrdFrmFileset *sP);
int AuditNameNL(XrdFrmFileset *sP);
int AuditNames();
int AuditNameXA(XrdFrmFileset *sP);
int AuditNameXB(XrdFrmFileset *sP); // runOld
int AuditNameXL(XrdFrmFileset *sP, int dorm); // runOld
int AuditRemove(XrdFrmFileset *sP);
int AuditSpace();
int AuditSpaceAX(const char *Path);
Expand All @@ -102,8 +100,6 @@ int AuditSpaceAXDC(const char *Path, XrdOucNSWalk::NSEnt *nP);
int AuditSpaceAXDL(int dorm, const char *Path, const char *Dest);
int AuditSpaceXA(const char *Space, const char *Path);
int AuditSpaceXA(XrdFrmFileset *sP);
int AuditSpaceXB(const char *Space, const char *Path); // runOld
int AuditSpaceXANB(XrdFrmFileset *sP); // runOld
int AuditUsage();
int AuditUsage(char *Space);
int AuditUsageAX(const char *Path);
Expand All @@ -116,7 +112,6 @@ void ChksumPrint(const char *Lfn, int rc);
int FindFail(XrdOucArgs &Spec);
int FindMmap(XrdOucArgs &Spec);
int FindNocs(XrdOucArgs &Spec);
int FindNolk(XrdOucArgs &Spec);
int FindPins(XrdOucArgs &Spec);
int FindPins(XrdFrmFileset *sP);
int FindUnmi(XrdOucArgs &Spec);
Expand Down Expand Up @@ -172,23 +167,11 @@ int UnlinkFile(const char *lclPath);
int VerifyAll(char *path);
char VerifyMP(const char *func, const char *path);

// The following are for runOld conversion purposes and will be removed
//
int Convert();
int ConvTest(int doNames, int doSpaces);
int New2Old(int doNames, int doSpaces);
int Old2New(int doNames, int doSpaces);
int o2nFiles(XrdFrmFileset *sP, int &numOld);
int o2nSpace(XrdFrmFileset *sP, const char *Space);
XrdOucTList *x2xPaths();
int x2xRemove(const char *Type, const char *Path, int cvt=0);
XrdOucTList *x2xSpaces();

static const char *AuditHelp;
static const char *ChksumHelp;
static const char *FindHelp;
static const char *HelpHelp;
static const char *MakeLFHelp;
static const char *MakeLFHelp; // runOld
static const char *MarkHelp;
static const char *MmapHelp;
static const char *MvHelp;
Expand Down
160 changes: 7 additions & 153 deletions src/XrdFrm/XrdFrmAdminAudit.cc
Expand Up @@ -126,10 +126,8 @@ int XrdFrmAdmin::AuditNameNF(XrdFrmFileset *sP)

int XrdFrmAdmin::AuditNameNL(XrdFrmFileset *sP)
{
static const char *noCPT = (Config.runNew ? "No copy time for: "
: "Missing lock file: ");
static const char *mkCPT = (Config.runNew ? "Set copy time?"
: "Create lock file?");
static const char *noCPT = "No copy time for: ";
static const char *mkCPT = "Set copy time?";
char Resp;

// Indicate what is wrong
Expand All @@ -145,18 +143,11 @@ int XrdFrmAdmin::AuditNameNL(XrdFrmFileset *sP)
if (Resp != 'y') return Resp != 'a';
}

// Set copy time or create a lock file
// Set copy time
//
if (Config.runNew)
{if (XrdFrcUtils::updtCpy(sP->basePath(),(Opt.MPType == 'p' ? 0 : -113)))
{numFix++;
Msg("Copy time set.");
}
} else {
if (mkFile(mkLF|isPFN, sP->basePath()))
{numFix++;
Msg("Lock file created.");
}
if (XrdFrcUtils::updtCpy(sP->basePath(),(Opt.MPType == 'p' ? 0 : -113)))
{numFix++;
Msg("Copy time set.");
}
return 1;
}
Expand Down Expand Up @@ -190,7 +181,7 @@ int XrdFrmAdmin::AuditNames()
if (Act && Opt.MPType && !(sP->cpyInfo.Attr.cpyTime))
Act = AuditNameNL(sP);
if (Act && sP->baseFile()->Link && isXA(sP->baseFile()))
Act = Config.runNew ? AuditNameXA(sP) : AuditNameXB(sP);
Act = AuditNameXA(sP);
}
delete sP;
}
Expand Down Expand Up @@ -251,79 +242,6 @@ int XrdFrmAdmin::AuditNameXA(XrdFrmFileset *sP)
return 1;
}

/******************************************************************************/
/* A u d i t N a m e X B */
/******************************************************************************/

int XrdFrmAdmin::AuditNameXB(XrdFrmFileset *sP)
{
struct stat buf;
char Path[1032], lkbuff[1032];
int n;

// Make sure there is a PFN file here
//
strcpy(Path, sP->baseFile()->Link); strcat(Path, ".pfn");
if (lstat(Path,&buf))
{if (errno != ENOENT)
{Emsg(errno, "stat ", Path); return AuditNameXL(sP,-1);}
Msg("Missing pfn link to ", sP->basePath());
return AuditNameXL(sP,0);
}

// Make sure the PFN file is a link
//
if ((buf.st_mode & S_IFMT) != S_IFLNK)
{Msg("Invalid pfn file for ", sP->basePath());
return AuditNameXL(sP,1);
}

// Make sure the link points to the right file
//
if ((n = readlink(Path, lkbuff, sizeof(lkbuff)-1)) < 0)
{Emsg(errno, "read link from ", Path); return AuditNameXL(sP,-1);}
lkbuff[n] = '\0';
if (strcmp(sP->basePath(), lkbuff))
{Msg("Incorrect pfn link to ", sP->basePath());
return AuditNameXL(sP,1);
}

// All is well
//
return 1;
}

/******************************************************************************/
/* A u d i t N a m e X L */
/******************************************************************************/

int XrdFrmAdmin::AuditNameXL(XrdFrmFileset *sP, int dorm)
{
char Resp, Path[1032];

// Return if no fix is needed, otherwise check if we should ask before doing it
//
numProb++;
if (!Opt.Fix || dorm < 0) return 1;
if (!Opt.Force)
{if (dorm)
Resp = XrdFrcUtils::Ask('n', "Recreate pfn symlink?");
else
Resp = XrdFrcUtils::Ask('y', "Create pfn symlink?");
if (Resp != 'y') return Resp != 'a';
}

// Create the pfn symlink
//
strcpy(Path, sP->baseFile()->Link); strcat(Path, ".pfn");
if (dorm) unlink(Path);
if (symlink(sP->basePath(), Path))
{Emsg(errno, "create symlink ", Path); return 1;}
Msg("pfn symlink created.");
numFix++;
return 1;
}

/******************************************************************************/
/* A u d i t R e m o v e */
/******************************************************************************/
Expand Down Expand Up @@ -662,70 +580,6 @@ int XrdFrmAdmin::AuditSpaceXA(XrdFrmFileset *sP)
numBLost += sP->baseFile()->Stat.st_size;
return Resp != 'a';
}

/******************************************************************************/
/* A u d i t S p a c e X B */
/******************************************************************************/

int XrdFrmAdmin::AuditSpaceXB(const char *Space, const char *Path)
{
XrdFrmFileset *sP;
XrdFrmFiles *fP;
char tmpv[8], *buff;
int ec = 0, Act = 1;

// Construct the right space path and get a files object
//
buff = XrdOssPath::genPath(Path, Space, tmpv);
fP = new XrdFrmFiles(buff, XrdFrmFiles::Recursive | XrdFrmFiles::NoAutoDel);

// Go and check out the files
//
while(Act && (sP = fP->Get(ec,1)))
{ if (!(sP->baseFile())) Act = AuditNameNB(sP);
else if (!(sP-> pfnFile())) Act = AuditSpaceXANB(sP);
else {numFiles++; numBytes += sP->baseFile()->Stat.st_size;}
delete sP;
}

// All done
//
if (ec) finalRC = 4;
free(buff);
delete fP;
return Act;
}

/******************************************************************************/
/* A u d i t S p a c e X A N B */
/******************************************************************************/

int XrdFrmAdmin::AuditSpaceXANB(XrdFrmFileset *sP)
{
char Resp;

// Update statistics which we may have to correct later
//
numProb++; numFiles++; numBytes += sP->baseFile()->Stat.st_size;

// Report what is orphaned
//
Msg("Missing pfn file for data file ", sP->basePath());

// Return if no fix is needed, otherwise check if we should ask before removal
//
if (!Opt.Fix) return -1;
if (!Opt.Force)
{Resp = XrdFrcUtils::Ask('n', "Remove data file?");
if (Resp != 'y') return Resp != 'a';
}

// Remove the file
//
if (unlink(sP->basePath())) Emsg(errno,"remove data file ", sP->basePath());
else {numFix++; numFiles--; numBytes -= sP->baseFile()->Stat.st_size;}
return 1;
}

/******************************************************************************/
/* A u d i t U s a g e */
Expand Down

0 comments on commit 3469652

Please sign in to comment.