Commit cae2e4f3 authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#139 cta af ls --vid XXXXX command times out if there are many files on a tape

Added the XrdCtaFile::m_listingArchiveFiles member variable and
factorized XrdCtaFile::readFromCmdlineOutput() out from
XrdCtaFile::read() so that in the future the XrdCtaFile::read()
method will be able to treat the listing of archive files
differently from other cta commands.

Currently none of the cta commands are incrementally generating
and streaming large result sets back to the cta command-line
tool.  All commands are generating the entire result in the
constructor of XrdCtaFile.  The result is streamed back to the
cta command-line tool, but the result is generated in one
single stepi before any streaming starts.

The listing of archive files is being gradually modified to
incrementaly generate the result in each call to
XrdCtaFile::read().  This commit is one step in this
larger modification.
parent 68c39bd6
Pipeline #32506 failed with stages
in 2 minutes and 19 seconds
......@@ -268,6 +268,18 @@ int XrdCtaFile::getMmap(void **Addr, off_t &Size) {
// read
//------------------------------------------------------------------------------
XrdSfsXferSize XrdCtaFile::read(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize size) {
if (m_listingArchiveFiles) {
// Temporarily treat the "cta archive ls" command the same as all the others
return readFromCmdlineOutput(offset, buffer, size);
} else {
return readFromCmdlineOutput(offset, buffer, size);
}
}
//------------------------------------------------------------------------------
// readFromCmdlineOutput
//------------------------------------------------------------------------------
XrdSfsXferSize XrdCtaFile::readFromCmdlineOutput(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize size) {
if(0 > offset) {
error.setErrInfo(EINVAL, "The value of offset is negative");
return SFS_ERROR;
......@@ -1611,6 +1623,7 @@ std::string XrdCtaFile::xCom_archivefile() {
checkOptions(help.str());
}
if(!summary) {
m_listingArchiveFiles = true;
std::unique_ptr<cta::catalogue::ArchiveFileItor> itor = m_catalogue->getArchiveFileItor(searchCriteria);
if(itor->hasMore()) {
std::vector<std::vector<std::string>> responseTable;
......
......@@ -117,6 +117,21 @@ protected:
*/
bool m_suppressOptionalOptionsWarning;
/**
* Set to true when the current command is to list archive files.
*/
bool m_listingArchiveFiles = false;
/**
* Reads the command result from the m_cmdlineOutput member variable.
*
* @param offset
* @param buffer
* @param size
* @return
*/
virtual XrdSfsXferSize readFromCmdlineOutput(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize size);
/**
* Decodes a string in base 64
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment