Commit 73322b7b authored by Eric Cano's avatar Eric Cano
Browse files

Simplified the data archive file data structure.

Replaced the map of tape files with a list as the assumption that we have one copy per copyNb is no more valid with repack.
parent 6597daaa
......@@ -83,43 +83,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> ArchiveFileBuilder::append(
}
// Append the tape file
const auto tapeFileMapItor = tapeFile.tapeFiles.begin();
const auto vid = tapeFileMapItor->second.vid;
const auto fSeq = tapeFileMapItor->second.fSeq;
const auto blockId = tapeFileMapItor->second.blockId;
const auto copyNbOfTapeFileToAppend = tapeFileMapItor->first;
if(m_archiveFile->tapeFiles.find(copyNbOfTapeFileToAppend) != m_archiveFile->tapeFiles.end()) {
// Found two tape files for the same archive file with the same copy
// number
// Ignore for now any inconsistencies in the copy number of the tape file
// exception::Exception ex;
// ex.getMessage() << __FUNCTION__ << " failed: Found two tape files for the same archive file with the same copy"
// " numbers: archiveFileID=" << tapeFile.archiveFileID << " copyNb=" << copyNbOfTapeFileToAppend;
// throw ex;
// Create a unique copy number to replace the original duplicate
uint64_t maxCopyNb = 0;
for(const auto maplet: m_archiveFile->tapeFiles) {
if(maplet.first > maxCopyNb) {
maxCopyNb = maplet.first;
}
}
const uint64_t workaroundCopyNb = maxCopyNb + 1;
{
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("archiveFileID", tapeFile.archiveFileID));
params.push_back(cta::log::Param("duplicateCopyNb", copyNbOfTapeFileToAppend));
params.push_back(cta::log::Param("workaroundCopyNb", workaroundCopyNb));
params.push_back(cta::log::Param("tapeVid", vid));
params.push_back(cta::log::Param("fSeq", fSeq));
params.push_back(cta::log::Param("blockId", blockId));
m_log(cta::log::WARNING, "Found a duplicate tape copy number when listing archive files", params);
}
m_archiveFile->tapeFiles[workaroundCopyNb] = tapeFileMapItor->second;
} else {
m_archiveFile->tapeFiles[copyNbOfTapeFileToAppend] = tapeFileMapItor->second;
}
m_archiveFile->tapeFiles.push_back(tapeFile.tapeFiles.front());
// There could be more tape files so return incomplete
return std::unique_ptr<common::dataStructures::ArchiveFile>();
......
This diff is collapsed.
......@@ -406,7 +406,9 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -455,10 +457,14 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
tapeFile.compressedSize = selectRset.columnUint64("COMPRESSED_SIZE_IN_BYTES");
tapeFile.copyNb = selectRset.columnUint64("COPY_NB");
tapeFile.creationTime = selectRset.columnUint64("TAPE_FILE_CREATION_TIME");
if (!selectRset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = selectRset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = selectRset.columnUint64("SSBY_FSEQ");
}
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
archiveFile->tapeFiles[selectRset.columnUint64("COPY_NB")] = tapeFile;
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -489,15 +495,17 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
.add("selectFromArchiveFileTime", selectFromArchiveFileTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::WARNING, "Failed to delete archive file because the disk instance of the request does not match that "
......@@ -555,15 +563,17 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
.add("commitTime", commitTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::INFO, "Archive file deleted from CTA catalogue");
......
......@@ -772,7 +772,9 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -827,8 +829,12 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
tapeFile.creationTime = selectRset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
archiveFile->tapeFiles[selectRset.columnUint64("COPY_NB")] = tapeFile;
if (!selectRset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = selectRset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = selectRset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -859,15 +865,17 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("selectFromArchiveFileTime", selectFromArchiveFileTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::WARNING, "Failed to delete archive file because the disk instance of the request does not match that "
......@@ -922,15 +930,17 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("commitTime", commitTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::INFO, "Archive file deleted from CTA catalogue");
......
......@@ -699,7 +699,9 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -752,8 +754,12 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
tapeFile.creationTime = selectRset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
if (!selectRset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = selectRset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = selectRset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles[selectRset.columnUint64("COPY_NB")] = tapeFile;
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -784,15 +790,18 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("selectFromArchiveFileTime", selectFromArchiveFileTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::WARNING, "Failed to delete archive file because the disk instance of the request does not match that "
......@@ -848,15 +857,17 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("commitTime", commitTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::INFO, "Archive file deleted from CTA catalogue");
......
......@@ -4116,7 +4116,9 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getFilesForRepack
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME, "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ,"
"TAPE.TAPE_POOL_NAME AS TAPE_POOL_NAME "
"FROM "
"ARCHIVE_FILE "
......@@ -4163,8 +4165,12 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getFilesForRepack
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_VID");
}
archiveFile.tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
archiveFile.tapeFiles.push_back(tapeFile);
archiveFiles.push_back(archiveFile);
......@@ -4911,22 +4917,7 @@ void RdbmsCatalogue::insertTapeFile(
const common::dataStructures::TapeFile &tapeFile,
const uint64_t archiveFileId) {
rdbms::AutoRollback autoRollback(conn);
bool updateSupersededNeeded = false;
try{
{
const char *const sql =
"SELECT VID FROM TAPE_FILE "
"WHERE "
" TAPE_FILE.ARCHIVE_FILE_ID=:ARCHIVE_FILE_ID AND"
" TAPE_FILE.COPY_NB=:COPY_NB";
auto stmt = conn.createStmt(sql);
stmt.bindUint64(":ARCHIVE_FILE_ID",archiveFileId);
stmt.bindUint64(":COPY_NB",tapeFile.copyNb);
auto result = stmt.executeQuery();
if(result.next()){
updateSupersededNeeded = true;
}
}
{
const time_t now = time(nullptr);
const char *const sql =
......@@ -4955,31 +4946,28 @@ void RdbmsCatalogue::insertTapeFile(
stmt.bindUint64(":COPY_NB", tapeFile.copyNb);
stmt.bindUint64(":CREATION_TIME", now);
stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId);
stmt.executeNonQuery();
if(!updateSupersededNeeded){
conn.commit();
}
}
}
{
if(updateSupersededNeeded){
const char *const sql =
"UPDATE TAPE_FILE SET "
"SUPERSEDED_BY_VID=:NEW_VID, " //VID of the new file
"SUPERSEDED_BY_FSEQ=:NEW_FSEQ " //FSEQ of the new file
"WHERE"
" TAPE_FILE.ARCHIVE_FILE_ID=:ARCHIVE_FILE_ID AND"
" TAPE_FILE.COPY_NB=:COPY_NB";
auto stmt = conn.createStmt(sql);
stmt.bindString(":NEW_VID",tapeFile.vid);
stmt.bindUint64(":NEW_FSEQ",tapeFile.fSeq);
stmt.bindUint64(":ARCHIVE_FILE_ID",archiveFileId);
stmt.bindUint64(":COPY_NB",tapeFile.copyNb);
stmt.executeNonQuery();
conn.commit();
}
const char *const sql =
"UPDATE TAPE_FILE SET "
"SUPERSEDED_BY_VID=:NEW_VID, " //VID of the new file
"SUPERSEDED_BY_FSEQ=:NEW_FSEQ " //FSEQ of the new file
"WHERE"
" TAPE_FILE.ARCHIVE_FILE_ID=:ARCHIVE_FILE_ID AND"
" TAPE_FILE.COPY_NB=:COPY_NB AND"
" ( TAPE_FILE.VID <> :NEW_VID2 OR TAPE_FILE.FSEQ <> :NEW_FSEQ2 )";
auto stmt = conn.createStmt(sql);
stmt.bindString(":NEW_VID",tapeFile.vid);
stmt.bindUint64(":NEW_FSEQ",tapeFile.fSeq);
stmt.bindString(":NEW_VID2",tapeFile.vid);
stmt.bindUint64(":NEW_FSEQ2",tapeFile.fSeq);
stmt.bindUint64(":ARCHIVE_FILE_ID",archiveFileId);
stmt.bindUint64(":COPY_NB",tapeFile.copyNb);
stmt.executeNonQuery();
}
conn.commit();
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
......@@ -5073,7 +5061,9 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -5118,8 +5108,12 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -5157,7 +5151,9 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -5205,8 +5201,12 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
archiveFile->tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -5246,7 +5246,9 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -5293,8 +5295,12 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
archiveFile->tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......@@ -5334,7 +5340,9 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
"TAPE_FILE.BLOCK_ID AS BLOCK_ID,"
"TAPE_FILE.COMPRESSED_SIZE_IN_BYTES AS COMPRESSED_SIZE_IN_BYTES,"
"TAPE_FILE.COPY_NB AS COPY_NB,"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME "
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME,"
"TAPE_FILE.SUPERSEDED_BY_VID AS SSBY_VID,"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SSBY_FSEQ "
"FROM "
"ARCHIVE_FILE "
"INNER JOIN STORAGE_CLASS ON "
......@@ -5384,8 +5392,12 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
archiveFile->tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
}
archiveFile->tapeFiles.push_back(tapeFile);
}
}
......
......@@ -65,7 +65,7 @@ namespace {
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
archiveFile.tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
archiveFile.tapeFiles.push_back(tapeFile);
}
return archiveFile;
......
......@@ -65,7 +65,7 @@ namespace {
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
archiveFile.tapeFiles[rset.columnUint64("COPY_NB")] = tapeFile;
archiveFile.tapeFiles.push_back(tapeFile);
}
return archiveFile;
......
......@@ -96,15 +96,17 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("getArchiveFileTime", getArchiveFileTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::WARNING, "Failed to delete archive file because the disk instance of the request does not match that "
......@@ -163,15 +165,17 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("commitTime", commitTime);
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
tapeCopyLogStream << "copy number: " << it->copyNb
<< " vid: " << it->vid
<< " fSeq: " << it->fSeq
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " compressedSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
spc.add("TAPE FILE", tapeCopyLogStream.str());
}
lc.log(log::INFO, "Archive file deleted from CTA catalogue");
......
......@@ -405,10 +405,12 @@ void CtaAdminCmd::printAfLsHeader()
<< std::setfill(' ') << std::setw(12) << std::right << "size" << ' '
<< std::setfill(' ') << std::setw(13) << std::right << "checksum type" << ' '
<< std::setfill(' ') << std::setw(14) << std::right << "checksum value" << ' '
<< std::setfill(' ') << std::setw(13) << std::right << "storage class" << ' '
<< std::setfill(' ') << std::setw(16) << std::right << "storage class" << ' '
<< std::setfill(' ') << std::setw(8) << std::right << "owner" << ' '
<< std::setfill(' ') << std::setw(8) << std::right << "group" << ' '
<< std::setfill(' ') << std::setw(13) << std::right << "creation time" << ' '
<< std::setfill(' ') << std::setw(7) << std::right << "ss vid" << ' '
<< std::setfill(' ') << std::setw(7) << std::right << "ss fseq" << ' '
<< "path"
<< TEXT_NORMAL << std::endl;
}
......@@ -425,11 +427,19 @@ void CtaAdminCmd::print(const cta::admin::ArchiveFileLsItem &afls_item)
<< std::setfill(' ') << std::setw(12) << std::right << afls_item.af().size() << ' '
<< std::setfill(' ') << std::setw(13) << std::right << afls_item.af().cs().type() << ' '
<< std::setfill(' ') << std::setw(14) << std::right << afls_item.af().cs().value() << ' '
<< std::setfill(' ') << std::setw(13) << std::right << afls_item.af().storage_class() << ' '
<< std::setfill(' ') << std::setw(16) << std::right << afls_item.af().storage_class() << ' '
<< std::setfill(' ') << std::setw(8) << std::right << afls_item.af().df().owner() << ' '
<< std::setfill(' ') << std::setw(8) << std::right << afls_item.af().df().group() << ' '
<< std::setfill(' ') << std::setw(13) << std::right << afls_item.af().creation_time() << ' '
<< afls_item.af().df().path()