Commit 8eda7cda authored by Michael Davis's avatar Michael Davis
Browse files

[checksum] Changes all references to ChecksumType/Value to new ChecksumBlob

parent f40968e1
......@@ -17,7 +17,6 @@
*/
#include "catalogue/ArchiveFileRow.hpp"
#include "common/dataStructures/utils.hpp"
namespace cta {
namespace catalogue {
......
......@@ -17,6 +17,11 @@ cmake_minimum_required (VERSION 2.6)
include_directories (${ORACLE-INSTANTCLIENT_INCLUDE_DIRS})
#
# Compiled protocol buffers (for ChecksumBlob)
#
include_directories(${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
set (CATALOGUE_LIB_SRC_FILES
......@@ -64,10 +69,12 @@ set (CATALOGUE_LIB_SRC_FILES
UserSpecifiedAnEmptyStringVid.cpp
UserSpecifiedAnEmptyStringVo.cpp
UserSpecifiedAZeroCapacity.cpp
UserSpecifiedAZeroCopyNb.cpp)
UserSpecifiedAZeroCopyNb.cpp
${CMAKE_BINARY_DIR}/eos_cta/cta_common.pb.cc)
add_library (ctacatalogue SHARED
${CATALOGUE_LIB_SRC_FILES})
set_property(TARGET ctacatalogue PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctacatalogue PROPERTY VERSION "${CTA_LIBVERSION}")
......@@ -196,7 +203,8 @@ add_executable(cta-catalogue-schema-create
MysqlCatalogueSchema.cpp)
target_link_libraries (cta-catalogue-schema-create
ctacatalogue)
ctacatalogue
${PROTOBUF3_LIBRARIES})
set_property (TARGET cta-catalogue-schema-create APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
......@@ -209,7 +217,8 @@ add_executable(cta-catalogue-schema-drop
DropSchemaCmdMain.cpp)
target_link_libraries (cta-catalogue-schema-drop
ctacatalogue)
ctacatalogue
${PROTOBUF3_LIBRARIES})
set_property (TARGET cta-catalogue-schema-drop APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
......@@ -222,7 +231,8 @@ add_executable(cta-database-poll
PollDatabaseCmdMain.cpp)
target_link_libraries (cta-database-poll
ctacatalogue)
ctacatalogue
${PROTOBUF3_LIBRARIES})
set_property (TARGET cta-database-poll APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
......@@ -235,7 +245,8 @@ add_executable(cta-catalogue-admin-user-create
CreateAdminUserCmdMain.cpp)
target_link_libraries (cta-catalogue-admin-user-create
ctacatalogue)
ctacatalogue
${PROTOBUF3_LIBRARIES})
set_property (TARGET cta-catalogue-admin-user-create APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
......
This diff is collapsed.
......@@ -24,8 +24,6 @@
#include "common/exception/DatabasePrimaryKeyError.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/UserError.hpp"
#include "common/ChecksumTypeMismatch.hpp"
#include "common/ChecksumValueMismatch.hpp"
#include "common/make_unique.hpp"
#include "common/threading/MutexLocker.hpp"
#include "common/Timer.hpp"
......@@ -347,7 +345,7 @@ void MysqlCatalogue::fileWrittenToTape(rdbms::Conn &conn, const TapeFileWritten
throw ex;
}
validateChecksumBlob(archiveFile->checksumBlob, event.checksumBlob);
archiveFile->checksumBlob.validate(event.checksumBlob);
// Insert the tape file
common::dataStructures::TapeFile tapeFile;
......@@ -424,7 +422,7 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
archiveFile->diskFileInfo.owner_uid = selectRset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = selectRset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = selectRset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumBlob = selectRset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(selectRset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = selectRset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = selectRset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = selectRset.columnUint64("RECONCILIATION_TIME");
......
......@@ -23,8 +23,6 @@
#include "common/exception/Exception.hpp"
#include "common/exception/LostDatabaseConnection.hpp"
#include "common/exception/UserError.hpp"
#include "common/ChecksumTypeMismatch.hpp"
#include "common/ChecksumValueMismatch.hpp"
#include "common/make_unique.hpp"
#include "common/threading/MutexLocker.hpp"
#include "common/Timer.hpp"
......@@ -83,8 +81,7 @@ namespace {
rdbms::wrapper::OcciColumn diskFileUser;
rdbms::wrapper::OcciColumn diskFileGroup;
rdbms::wrapper::OcciColumn size;
rdbms::wrapper::OcciColumn checksumType;
rdbms::wrapper::OcciColumn checksumValue;
rdbms::wrapper::OcciColumn checksumBlob;
rdbms::wrapper::OcciColumn storageClassName;
rdbms::wrapper::OcciColumn creationTime;
rdbms::wrapper::OcciColumn reconciliationTime;
......@@ -103,7 +100,7 @@ namespace {
diskFileUser("DISK_FILE_UID", nbRows),
diskFileGroup("DISK_FILE_GID", nbRows),
size("SIZE_IN_BYTES", nbRows),
checksumType("CHECKSUM_BLOB", nbRows),
checksumBlob("CHECKSUM_BLOB", nbRows),
storageClassName("STORAGE_CLASS_NAME", nbRows),
creationTime("CREATION_TIME", nbRows),
reconciliationTime("RECONCILIATION_TIME", nbRows) {
......@@ -411,19 +408,7 @@ void OracleCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer>
throw ex;
}
if(fileSizeAndChecksum.checksumType != event.checksumType) {
catalogue::ChecksumTypeMismatch ex;
ex.getMessage() << __FUNCTION__ << ": Checksum type mismatch: expected=" << fileSizeAndChecksum.checksumType <<
", actual=" << event.checksumType << ": " << fileContext.str();
throw ex;
}
if(fileSizeAndChecksum.checksumValue != event.checksumValue) {
catalogue::ChecksumValueMismatch ex;
ex.getMessage() << __FUNCTION__ << ": Checksum value mismatch: expected=" << fileSizeAndChecksum.checksumValue
<< ", actual=" << event.checksumValue << ": " << fileContext.str();
throw ex;
}
fileSizeAndChecksum.checksumBlob.validate(event.checksumBlob);
}
// Store the value of each field
......@@ -537,8 +522,7 @@ void OracleCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn, const
archiveFileBatch.diskFileUser.setFieldLenToValueLen(i, event.diskFileOwnerUid);
archiveFileBatch.diskFileGroup.setFieldLenToValueLen(i, event.diskFileGid);
archiveFileBatch.size.setFieldLenToValueLen(i, event.size);
archiveFileBatch.checksumType.setFieldLenToValueLen(i, event.checksumType);
archiveFileBatch.checksumValue.setFieldLenToValueLen(i, event.checksumValue);
archiveFileBatch.checksumBlob.setFieldLenToValueLen(i, event.checksumBlob);
archiveFileBatch.storageClassName.setFieldLenToValueLen(i, event.storageClassName);
archiveFileBatch.creationTime.setFieldLenToValueLen(i, now);
archiveFileBatch.reconciliationTime.setFieldLenToValueLen(i, now);
......@@ -555,8 +539,7 @@ void OracleCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn, const
archiveFileBatch.diskFileUser.setFieldValue(i, event.diskFileOwnerUid);
archiveFileBatch.diskFileGroup.setFieldValue(i, event.diskFileGid);
archiveFileBatch.size.setFieldValue(i, event.size);
archiveFileBatch.checksumType.setFieldValue(i, event.checksumType);
archiveFileBatch.checksumValue.setFieldValue(i, event.checksumValue);
archiveFileBatch.checksumBlob.setFieldValue(i, event.checksumBlob.serialize());
archiveFileBatch.storageClassName.setFieldValue(i, event.storageClassName);
archiveFileBatch.creationTime.setFieldValue(i, now);
archiveFileBatch.reconciliationTime.setFieldValue(i, now);
......@@ -604,8 +587,7 @@ void OracleCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn, const
occiStmt.setColumn(archiveFileBatch.diskFileUser);
occiStmt.setColumn(archiveFileBatch.diskFileGroup);
occiStmt.setColumn(archiveFileBatch.size);
occiStmt.setColumn(archiveFileBatch.checksumType);
occiStmt.setColumn(archiveFileBatch.checksumValue);
occiStmt.setColumn(archiveFileBatch.checksumBlob);
occiStmt.setColumn(archiveFileBatch.storageClassName);
occiStmt.setColumn(archiveFileBatch.creationTime);
occiStmt.setColumn(archiveFileBatch.reconciliationTime);
......@@ -702,7 +684,7 @@ std::map<uint64_t, OracleCatalogue::FileSizeAndChecksum> OracleCatalogue::select
FileSizeAndChecksum fileSizeAndChecksum;
fileSizeAndChecksum.fileSize = rset.columnUint64("SIZE_IN_BYTES");
fileSizeAndChecksum.checksumType = rset.columnString("CHECKSUM_BLOB");
fileSizeAndChecksum.checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
fileSizesAndChecksums[archiveFileId] = fileSizeAndChecksum;
}
......@@ -820,7 +802,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
archiveFile->diskFileInfo.owner_uid = selectRset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = selectRset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = selectRset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = selectRset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(selectRset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = selectRset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = selectRset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = selectRset.columnUint64("RECONCILIATION_TIME");
......@@ -836,8 +818,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
tapeFile.fileSize = selectRset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = selectRset.columnUint64("COPY_NB");
tapeFile.creationTime = selectRset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!selectRset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = selectRset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = selectRset.columnUint64("SSBY_FSEQ");
......@@ -864,8 +845,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -880,8 +860,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->fileSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " checksumBlob: " << it->checksumBlob //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
......@@ -926,8 +905,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -945,8 +923,7 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->compressedSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " checksumBlob: " << it->checksumBlob //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
......
......@@ -146,8 +146,7 @@ private:
*/
struct FileSizeAndChecksum {
uint64_t fileSize;
std::string checksumType;
std::string checksumValue;
ChecksumBlob checksumBlob;
};
/**
......
......@@ -23,8 +23,6 @@
#include "common/exception/Exception.hpp"
#include "common/exception/LostDatabaseConnection.hpp"
#include "common/exception/UserError.hpp"
#include "common/ChecksumTypeMismatch.hpp"
#include "common/ChecksumValueMismatch.hpp"
#include "common/make_unique.hpp"
#include "common/Timer.hpp"
#include "common/utils/utils.hpp"
......@@ -82,8 +80,7 @@ namespace {
rdbms::wrapper::PostgresColumn diskFileUser;
rdbms::wrapper::PostgresColumn diskFileGroup;
rdbms::wrapper::PostgresColumn size;
rdbms::wrapper::PostgresColumn checksumType;
rdbms::wrapper::PostgresColumn checksumValue;
rdbms::wrapper::PostgresColumn checksumBlob;
rdbms::wrapper::PostgresColumn storageClassName;
rdbms::wrapper::PostgresColumn creationTime;
rdbms::wrapper::PostgresColumn reconciliationTime;
......@@ -102,7 +99,7 @@ namespace {
diskFileUser("DISK_FILE_UID", nbRows),
diskFileGroup("DISK_FILE_GID", nbRows),
size("SIZE_IN_BYTES", nbRows),
checksumType("CHECKSUM_BLOB", nbRows),
checksumBlob("CHECKSUM_BLOB", nbRows),
storageClassName("STORAGE_CLASS_NAME", nbRows),
creationTime("CREATION_TIME", nbRows),
reconciliationTime("RECONCILIATION_TIME", nbRows) {
......@@ -398,19 +395,7 @@ void PostgresCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer
throw ex;
}
if(fileSizeAndChecksum.checksumType != event.checksumType) {
catalogue::ChecksumTypeMismatch ex;
ex.getMessage() << __FUNCTION__ << ": Checksum type mismatch: expected=" << fileSizeAndChecksum.checksumType <<
", actual=" << event.checksumType << ": " << fileContext.str();
throw ex;
}
if(fileSizeAndChecksum.checksumValue != event.checksumValue) {
catalogue::ChecksumValueMismatch ex;
ex.getMessage() << __FUNCTION__ << ": Checksum value mismatch: expected=" << fileSizeAndChecksum.checksumValue
<< ", actual=" << event.checksumValue << ": " << fileContext.str();
throw ex;
}
fileSizeAndChecksum.checksumBlob.validate(event.checksumBlob);
}
// Store the value of each field
......@@ -506,8 +491,7 @@ void PostgresCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn,
archiveFileBatch.diskFileUser.setFieldValue(i, event.diskFileOwnerUid);
archiveFileBatch.diskFileGroup.setFieldValue(i, event.diskFileGid);
archiveFileBatch.size.setFieldValue(i, event.size);
archiveFileBatch.checksumType.setFieldValue(i, event.checksumType);
archiveFileBatch.checksumValue.setFieldValue(i, event.checksumValue);
archiveFileBatch.checksumBlob.setFieldValue(i, event.checksumBlob.serialize());
archiveFileBatch.storageClassName.setFieldValue(i, event.storageClassName);
archiveFileBatch.creationTime.setFieldValue(i, now);
archiveFileBatch.reconciliationTime.setFieldValue(i, now);
......@@ -550,8 +534,7 @@ void PostgresCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn,
postgresStmt.setColumn(archiveFileBatch.diskFileUser);
postgresStmt.setColumn(archiveFileBatch.diskFileGroup);
postgresStmt.setColumn(archiveFileBatch.size);
postgresStmt.setColumn(archiveFileBatch.checksumType);
postgresStmt.setColumn(archiveFileBatch.checksumValue);
postgresStmt.setColumn(archiveFileBatch.checksumBlob);
postgresStmt.setColumn(archiveFileBatch.storageClassName);
postgresStmt.setColumn(archiveFileBatch.creationTime);
postgresStmt.setColumn(archiveFileBatch.reconciliationTime);
......@@ -641,7 +624,7 @@ std::map<uint64_t, PostgresCatalogue::FileSizeAndChecksum> PostgresCatalogue::se
FileSizeAndChecksum fileSizeAndChecksum;
fileSizeAndChecksum.fileSize = rset.columnUint64("SIZE_IN_BYTES");
fileSizeAndChecksum.checksumType = rset.columnString("CHECKSUM_BLOB");
fileSizeAndChecksum.checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
fileSizesAndChecksums[archiveFileId] = fileSizeAndChecksum;
}
......@@ -749,7 +732,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
archiveFile->diskFileInfo.owner_uid = selectRset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = selectRset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = selectRset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = selectRset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(selectRset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = selectRset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = selectRset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = selectRset.columnUint64("RECONCILIATION_TIME");
......@@ -765,8 +748,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
tapeFile.fileSize = selectRset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = selectRset.columnUint64("COPY_NB");
tapeFile.creationTime = selectRset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!selectRset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = selectRset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = selectRset.columnUint64("SSBY_FSEQ");
......@@ -793,8 +775,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -809,8 +790,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->fileSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " checksumBlob: " << it->checksumBlob //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
......@@ -857,8 +837,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -876,8 +855,7 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->fileSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " checksumBlob: " << it->checksumBlob //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
......
......@@ -155,8 +155,7 @@ private:
*/
struct FileSizeAndChecksum {
uint64_t fileSize;
std::string checksumType;
std::string checksumValue;
ChecksumBlob checksumBlob;
};
/**
......
......@@ -4248,7 +4248,7 @@ void RdbmsCatalogue::insertArchiveFile(rdbms::Conn &conn, const ArchiveFileRow &
stmt.bindUint64(":DISK_FILE_UID", row.diskFileOwnerUid);
stmt.bindUint64(":DISK_FILE_GID", row.diskFileGid);
stmt.bindUint64(":SIZE_IN_BYTES", row.size);
stmt.bindString(":CHECKSUM_BLOB", row.checksumType);
stmt.bindString(":CHECKSUM_BLOB", row.checksumBlob.serialize());
stmt.bindString(":STORAGE_CLASS_NAME", row.storageClassName);
stmt.bindUint64(":CREATION_TIME", now);
stmt.bindUint64(":RECONCILIATION_TIME", now);
......@@ -4428,7 +4428,7 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getFilesForRepack
archiveFile.diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile.diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile.fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile.checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile.checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile.storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile.creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile.reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -4440,8 +4440,7 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getFilesForRepack
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile.checksumBlob; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_VID");
......@@ -5368,7 +5367,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -5384,8 +5383,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
......@@ -5459,7 +5457,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -5475,8 +5473,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
......@@ -5603,7 +5600,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -5619,8 +5616,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
......@@ -5698,7 +5694,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile->diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile->fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile->checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile->checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile->storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile->creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile->reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -5714,8 +5710,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile->checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile->checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile->checksumBlob; // Duplicated for convenience
if (!rset.columnIsNull("SSBY_VID")) {
tapeFile.supersededByVid = rset.columnString("SSBY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SSBY_FSEQ");
......@@ -5803,8 +5798,7 @@ void RdbmsCatalogue::checkTapeFileWrittenFieldsAreSet(const std::string &calling
if(0 == event.diskFileOwnerUid) throw exception::Exception("diskFileOwnerUid is 0");
if(0 == event.diskFileGid) throw exception::Exception("diskFileGid is 0");
if(0 == event.size) throw exception::Exception("size is 0");
if(event.checksumType.empty()) throw exception::Exception("checksumType is an empty string");
if(event.checksumValue.empty()) throw exception::Exception("checksumValue is an empty string");
if(event.checksumBlob.length() == 0) throw exception::Exception("checksumBlob is an empty string");
if(event.storageClassName.empty()) throw exception::Exception("storageClassName is an empty string");
if(event.vid.empty()) throw exception::Exception("vid is an empty string");
if(0 == event.fSeq) throw exception::Exception("fSeq is 0");
......
......@@ -47,7 +47,7 @@ namespace {
archiveFile.diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile.diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile.fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile.checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile.checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile.storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile.creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile.reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -61,8 +61,7 @@ namespace {
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile.checksumBlob; // Duplicated for convenience
archiveFile.tapeFiles.push_back(tapeFile);
}
......
......@@ -47,7 +47,7 @@ namespace {
archiveFile.diskFileInfo.owner_uid = rset.columnUint64("DISK_FILE_UID");
archiveFile.diskFileInfo.gid = rset.columnUint64("DISK_FILE_GID");
archiveFile.fileSize = rset.columnUint64("SIZE_IN_BYTES");
archiveFile.checksumType = rset.columnString("CHECKSUM_BLOB");
archiveFile.checksumBlob.deserialize(rset.columnString("CHECKSUM_BLOB"));
archiveFile.storageClass = rset.columnString("STORAGE_CLASS_NAME");
archiveFile.creationTime = rset.columnUint64("ARCHIVE_FILE_CREATION_TIME");
archiveFile.reconciliationTime = rset.columnUint64("RECONCILIATION_TIME");
......@@ -61,8 +61,7 @@ namespace {
tapeFile.fileSize = rset.columnUint64("LOGICAL_SIZE_IN_BYTES");
tapeFile.copyNb = rset.columnUint64("COPY_NB");
tapeFile.creationTime = rset.columnUint64("TAPE_FILE_CREATION_TIME");
tapeFile.checksumType = archiveFile.checksumType; // Duplicated for convenience
tapeFile.checksumValue = archiveFile.checksumValue; // Duplicated for convenience
tapeFile.checksumBlob = archiveFile.checksumBlob; // Duplicated for convenience
if(!rset.columnIsNull("SUPERSEDED_BY_VID") && !rset.columnIsNull("SUPERSEDED_BY_FSEQ")){
tapeFile.supersededByVid = rset.columnString("SUPERSEDED_BY_VID");
tapeFile.supersededByFSeq = rset.columnUint64("SUPERSEDED_BY_FSEQ");
......
......@@ -24,8 +24,6 @@
#include "common/exception/DatabasePrimaryKeyError.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/UserError.hpp"
#include "common/ChecksumTypeMismatch.hpp"
#include "common/ChecksumValueMismatch.hpp"
#include "common/make_unique.hpp"
#include "common/threading/MutexLocker.hpp"
#include "common/Timer.hpp"
......@@ -87,8 +85,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -102,8 +99,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->fileSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field
<< " checksumBlob: " << it->checksumBlob //this shouldn't be here: repeated field
<< " copyNb: " << it->copyNb //this shouldn't be here: repeated field
<< " supersededByVid: " << it->supersededByVid
<< " supersededByFSeq: " << it->supersededByFSeq;
......@@ -153,8 +149,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("diskFileInfo.owner_uid", archiveFile->diskFileInfo.owner_uid)
.add("diskFileInfo.gid", archiveFile->diskFileInfo.gid)
.add("fileSize", std::to_string(archiveFile->fileSize))
.add("checksumType", archiveFile->checksumType)
.add("checksumValue", archiveFile->checksumValue)
.add("checksumBlob", archiveFile->checksumBlob)
.add("creationTime", std::to_string(archiveFile->creationTime))
.add("reconciliationTime", std::to_string(archiveFile->reconciliationTime))
.add("storageClass", archiveFile->storageClass)
......@@ -171,8 +166,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
<< " blockId: " << it->blockId
<< " creationTime: " << it->creationTime
<< " fileSize: " << it->fileSize
<< " checksumType: " << it->checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->checksumValue //this shouldn't be here: repeated field