Commit 6517392e authored by Cedric CAFFY's avatar Cedric CAFFY Committed by Eric Cano
Browse files

Added informations displayed by repack ls command

parent dd45743d
......@@ -49,6 +49,16 @@ struct RepackInfo {
Failed = 8,
Undefined = 999
} status;
uint64_t totalFilesToArchive;
uint64_t totalBytesToArchive;
uint64_t totalFilesToRetrieve;
uint64_t totalBytesToRetrieve;
uint64_t failedFilesToArchive;
uint64_t failedBytesToArchive;
uint64_t failedFilesToRetrieve;
uint64_t failedBytesToRetrieve;
uint64_t lastExpandedFseq;
uint64_t userProvidedFiles;
// std::string tag;
// uint64_t totalFiles;
// uint64_t totalSize;
......
......@@ -125,6 +125,16 @@ common::dataStructures::RepackInfo RepackRequest::getInfo() {
ret.vid = m_payload.vid();
ret.status = (RepackInfo::Status) m_payload.status();
ret.repackBufferBaseURL = m_payload.buffer_url();
ret.totalFilesToArchive = m_payload.totalfilestoarchive();
ret.totalBytesToArchive = m_payload.totalbytestoarchive();
ret.totalFilesToRetrieve = m_payload.totalfilestoretrieve();
ret.totalBytesToRetrieve = m_payload.totalbytestoretrieve();
ret.failedFilesToArchive = m_payload.failedtoarchivefiles();
ret.failedBytesToArchive = m_payload.failedtoarchivebytes();
ret.failedFilesToRetrieve = m_payload.failedtoretrievefiles();
ret.failedBytesToRetrieve = m_payload.failedtoretrievebytes();
ret.lastExpandedFseq = m_payload.lastexpandedfseq();
ret.userProvidedFiles = m_payload.userprovidedfiles();
if (m_payload.move_mode()) {
if (m_payload.add_copies_mode()) {
ret.type = RepackInfo::Type::MoveAndAddCopies;
......@@ -134,7 +144,7 @@ common::dataStructures::RepackInfo RepackRequest::getInfo() {
} else if (m_payload.add_copies_mode()) {
ret.type = RepackInfo::Type::AddCopiesOnly;
} else {
throw exception::Exception("In RepackRequest::getInfo(): unexpcted mode: neither expand nor repack.");
throw exception::Exception("In RepackRequest::getInfo(): unexpected mode: neither expand nor repack.");
}
return ret;
}
......
......@@ -2064,6 +2064,13 @@ uint64_t OStoreDB::RepackRequest::getLastExpandedFSeq() {
return m_repackRequest.getLastExpandedFSeq();
}
void OStoreDB::RepackRequest::setLastExpandedFSeq(uint64_t fseq){
objectstore::ScopedExclusiveLock rrl (m_repackRequest);
m_repackRequest.fetch();
m_repackRequest.setLastExpandedFSeq(fseq);
m_repackRequest.commit();
}
//------------------------------------------------------------------------------
// OStoreDB::RepackRequest::addSubrequests()
//------------------------------------------------------------------------------
......
......@@ -347,6 +347,7 @@ public:
void expandDone() override;
void fail() override;
uint64_t getLastExpandedFSeq() override;
void setLastExpandedFSeq(uint64_t fseq) override;
void setTotalStats(const TotalStatsFiles& stats) override;
private:
......
......@@ -503,6 +503,7 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
repackRequest->m_dbReq->setTotalStats(totalStatsFile);
repackRequest->m_dbReq->addSubrequests(retrieveSubrequests, archiveRoutesMap, fSeq - 1, lc);
fSeq = std::max(fSeq, maxAddedFSeq + 1);
repackRequest->m_dbReq->setLastExpandedFSeq(fSeq);
}
}
......
......@@ -433,6 +433,7 @@ public:
public:
cta::common::dataStructures::RepackInfo repackInfo;
virtual uint64_t getLastExpandedFSeq() = 0;
virtual void setLastExpandedFSeq(uint64_t fseq) = 0;
struct Subrequest {
uint64_t fSeq;
cta::common::dataStructures::ArchiveFile archiveFile;
......
......@@ -1454,24 +1454,28 @@ void RequestMessage::processRepack_Ls(const cta::admin::AdminCmd &admincmd, cta:
{
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {
"vid","files","size","type","to retrieve","to archive","failed","archived","status","name","host","time"
"vid","file buffer URL","UserProvidedFiles","FilesToRetrieve","BytesToRetrieve","FilesToArchive","BytesToArchive","FailedToRetrieve (files)","FailedToRetrieve (bytes)","FailedToArchive (files)","FailedToArchive (bytes)","LastExpandedFSeq","status"//,"name","host","time"
};
if(has_flag(OptionBoolean::SHOW_HEADER)) responseTable.push_back(header);
for(auto it = list.cbegin(); it != list.cend(); it++)
{
std::vector<std::string> currentRow;
currentRow.push_back(it->vid);
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->totalFiles)));
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->totalSize)));
currentRow.push_back(common::dataStructures::toString(it->type));
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->filesToRetrieve)));//change names
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->filesToArchive)));
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->filesFailed)));
currentRow.push_back("0");//std::to_string(static_cast<unsigned long long>(it->filesArchived)));
currentRow.push_back(utils::midEllipsis(it->repackBufferBaseURL,40));//std::to_string(static_cast<unsigned long long>(it->totalFiles)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->userProvidedFiles)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalFilesToRetrieve)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalBytesToRetrieve)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalFilesToArchive)));//std::to_string(static_cast<unsigned long long>(it->totalSize)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalBytesToArchive)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->failedFilesToRetrieve)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->failedBytesToRetrieve)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->failedFilesToArchive)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->failedBytesToArchive)));
currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->lastExpandedFseq)));//std::to_string(static_cast<unsigned long long>(it->filesArchived)));
currentRow.push_back(common::dataStructures::toString(it->status));
currentRow.push_back("-");//it->creationLog.username);
currentRow.push_back("-");//it->creationLog.host);
currentRow.push_back("-");//timeToString(it->creationLog.time));
//currentRow.push_back("-");//it->creationLog.username);
//currentRow.push_back("-");//it->creationLog.host);
//currentRow.push_back("-");//timeToString(it->creationLog.time));
responseTable.push_back(currentRow);
}
cmdlineOutput << formatResponse(responseTable);
......
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