Commit 973f3f8c authored by Michael Davis's avatar Michael Davis
Browse files

[catalogue] Changes type of file owner user and group from string to numeric uid/gid

parent f4b6f623
......@@ -38,8 +38,8 @@ bool ArchiveFileRow::operator==(const ArchiveFileRow &rhs) const {
diskInstance == rhs.diskInstance &&
diskFileId == rhs.diskFileId &&
diskFilePath == rhs.diskFilePath &&
diskFileUser == rhs.diskFileUser &&
diskFileGroup == rhs.diskFileGroup &&
diskFileOwnerUid == rhs.diskFileOwnerUid &&
diskFileGid == rhs.diskFileGid &&
size == rhs.size &&
checksumType == rhs.checksumType &&
checksumValue == rhs.checksumValue &&
......@@ -56,8 +56,8 @@ std::ostream &operator<<(std::ostream &os, const ArchiveFileRow &obj) {
"diskInstance=" << obj.diskInstance <<
"diskFileId=" << obj.diskFileId <<
"diskFilePath=" << obj.diskFilePath <<
"diskFileUser=" << obj.diskFileUser <<
"diskFileGroup=" << obj.diskFileGroup <<
"diskFileOwnerUid=" << obj.diskFileOwnerUid <<
"diskFileGid=" << obj.diskFileGid <<
"size=" << obj.size <<
"checksumType=" << obj.checksumType << "checksumValue=" << obj.checksumValue <<
"storageClassName=" << obj.storageClassName <<
......
......@@ -69,14 +69,14 @@ struct ArchiveFileRow {
std::string diskFilePath;
/**
* The user name of the source disk file within its host disk system.
* The user ID of the owner of the source disk file within its host disk system.
*/
std::string diskFileUser;
uint32_t diskFileOwnerUid;
/**
* The group name of the source disk file within its host disk system.
* The group ID of the source disk file within its host disk system.
*/
std::string diskFileGroup;
uint32_t diskFileGid;
/**
* The uncompressed size of the tape file in bytes.
......
......@@ -52,7 +52,7 @@
#include "common/dataStructures/TapeCopyToPoolMap.hpp"
#include "common/dataStructures/TapeFile.hpp"
#include "common/dataStructures/UpdateFileInfoRequest.hpp"
#include "common/dataStructures/UserIdentity.hpp"
#include "common/dataStructures/RequesterIdentity.hpp"
#include "common/dataStructures/VidToTapeMap.hpp"
#include "common/dataStructures/WriteTestResult.hpp"
#include "common/exception/UserError.hpp"
......@@ -114,7 +114,7 @@ public:
virtual uint64_t checkAndGetNextArchiveFileId(
const std::string &diskInstanceName,
const std::string &storageClassName,
const common::dataStructures::UserIdentity &user) = 0;
const common::dataStructures::RequesterIdentity &user) = 0;
/**
* Returns the information required to queue an archive request.
......@@ -133,7 +133,7 @@ public:
virtual common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(
const std::string &diskInstanceName,
const std::string &storageClassName,
const common::dataStructures::UserIdentity &user) = 0;
const common::dataStructures::RequesterIdentity &user) = 0;
/**
* Returns the list of tapes that can be written to by a tape drive in the
......@@ -184,7 +184,7 @@ public:
virtual common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(
const std::string &diskInstanceName,
const uint64_t archiveFileId,
const common::dataStructures::UserIdentity &user,
const common::dataStructures::RequesterIdentity &user,
const optional<std::string> & activity,
log::LogContext &lc) = 0;
......
......@@ -68,12 +68,12 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeLabelled(vid, drive);}, m_maxTriesToConnect);
}
uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override {
uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->checkAndGetNextArchiveFileId(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
}
common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(const std::string &diskInstanceName,
const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override {
const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileQueueCriteria(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
}
......@@ -89,7 +89,7 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeMountedForArchive(vid, drive);}, m_maxTriesToConnect);
}
common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::UserIdentity& user, const optional<std::string>& activity, log::LogContext& lc) override {
common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const optional<std::string>& activity, log::LogContext& lc) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->prepareToRetrieveFile(diskInstanceName, archiveFileId, user, activity, lc);}, m_maxTriesToConnect);
}
......
This diff is collapsed.
......@@ -107,10 +107,10 @@ public:
void noSpaceLeftOnTape(const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void ping() override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
std::map<std::string, uint64_t> getSchemaVersion() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(const std::string &diskInstanceName,
const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::UserIdentity& user, const optional<std::string>& activity, log::LogContext& lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const optional<std::string>& activity, log::LogContext& lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void reclaimTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void setTapeDisabled(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool disabledValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void setTapeFull(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool fullValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
......@@ -205,8 +205,7 @@ common::dataStructures::Tape MysqlCatalogue::selectTapeForUpdate(rdbms::Conn &co
tape.comment = rset.columnString("USER_COMMENT");
common::dataStructures::UserIdentity creatorUI;
creatorUI.name = rset.columnString("CREATION_LOG_USER_NAME");
// std::string creatorUIname = rset.columnString("CREATION_LOG_USER_NAME");
common::dataStructures::EntryLog creationLog;
creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
......@@ -215,8 +214,7 @@ common::dataStructures::Tape MysqlCatalogue::selectTapeForUpdate(rdbms::Conn &co
tape.creationLog = creationLog;
common::dataStructures::UserIdentity updaterUI;
updaterUI.name = rset.columnString("LAST_UPDATE_USER_NAME");
// std::string updaterUIname = rset.columnString("LAST_UPDATE_USER_NAME");
common::dataStructures::EntryLog updateLog;
updateLog.username = rset.columnString("LAST_UPDATE_USER_NAME");
......@@ -320,8 +318,8 @@ void MysqlCatalogue::fileWrittenToTape(rdbms::Conn &conn, const TapeFileWritten
row.checksumValue = event.checksumValue;
row.storageClassName = event.storageClassName;
row.diskFilePath = event.diskFilePath;
row.diskFileUser = event.diskFileUser;
row.diskFileGroup = event.diskFileGroup;
row.diskFileOwnerUid = event.diskFileOwnerUid;
row.diskFileGid = event.diskFileGid;
insertArchiveFile(conn, row);
} catch(exception::DatabasePrimaryKeyError &) {
// Ignore this error
......@@ -437,8 +435,8 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
archiveFile->diskInstance = selectRset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = selectRset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = selectRset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = selectRset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = selectRset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = selectRset.columnString("CHECKSUM_VALUE");
......@@ -482,8 +480,8 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
.add("requestDiskInstance", diskInstanceName)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......@@ -547,8 +545,8 @@ void MysqlCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons
.add("diskInstance", archiveFile->diskInstance)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......
......@@ -269,8 +269,7 @@ common::dataStructures::Tape OracleCatalogue::selectTapeForUpdate(rdbms::Conn &c
tape.comment = rset.columnString("USER_COMMENT");
common::dataStructures::UserIdentity creatorUI;
creatorUI.name = rset.columnString("CREATION_LOG_USER_NAME");
//std::string creatorUIname = rset.columnString("CREATION_LOG_USER_NAME");
common::dataStructures::EntryLog creationLog;
creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
......@@ -279,8 +278,7 @@ common::dataStructures::Tape OracleCatalogue::selectTapeForUpdate(rdbms::Conn &c
tape.creationLog = creationLog;
common::dataStructures::UserIdentity updaterUI;
updaterUI.name = rset.columnString("LAST_UPDATE_USER_NAME");
//std::string updaterUIname = rset.columnString("LAST_UPDATE_USER_NAME");
common::dataStructures::EntryLog updateLog;
updateLog.username = rset.columnString("LAST_UPDATE_USER_NAME");
......@@ -537,8 +535,8 @@ void OracleCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn, const
archiveFileBatch.diskInstance.setFieldLenToValueLen(i, event.diskInstance);
archiveFileBatch.diskFileId.setFieldLenToValueLen(i, event.diskFileId);
archiveFileBatch.diskFilePath.setFieldLenToValueLen(i, event.diskFilePath);
archiveFileBatch.diskFileUser.setFieldLenToValueLen(i, event.diskFileUser);
archiveFileBatch.diskFileGroup.setFieldLenToValueLen(i, event.diskFileGroup);
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);
......@@ -555,8 +553,8 @@ void OracleCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn, const
archiveFileBatch.diskInstance.setFieldValue(i, event.diskInstance);
archiveFileBatch.diskFileId.setFieldValue(i, event.diskFileId);
archiveFileBatch.diskFilePath.setFieldValue(i, event.diskFilePath);
archiveFileBatch.diskFileUser.setFieldValue(i, event.diskFileUser);
archiveFileBatch.diskFileGroup.setFieldValue(i, event.diskFileGroup);
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);
......@@ -825,8 +823,8 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
archiveFile->diskInstance = selectRset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = selectRset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = selectRset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = selectRset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = selectRset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = selectRset.columnString("CHECKSUM_VALUE");
......@@ -870,8 +868,8 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("requestDiskInstance", diskInstanceName)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......@@ -932,8 +930,8 @@ void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con
.add("diskInstance", archiveFile->diskInstance)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......
......@@ -260,8 +260,7 @@ common::dataStructures::Tape PostgresCatalogue::selectTapeForUpdate(rdbms::Conn
tape.comment = rset.columnString("USER_COMMENT");
common::dataStructures::UserIdentity creatorUI;
creatorUI.name = rset.columnString("CREATION_LOG_USER_NAME");
//std::string creatorUIname = rset.columnString("CREATION_LOG_USER_NAME");
common::dataStructures::EntryLog creationLog;
creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
......@@ -270,8 +269,7 @@ common::dataStructures::Tape PostgresCatalogue::selectTapeForUpdate(rdbms::Conn
tape.creationLog = creationLog;
common::dataStructures::UserIdentity updaterUI;
updaterUI.name = rset.columnString("LAST_UPDATE_USER_NAME");
//std::string updaterUIname = rset.columnString("LAST_UPDATE_USER_NAME");
common::dataStructures::EntryLog updateLog;
updateLog.username = rset.columnString("LAST_UPDATE_USER_NAME");
......@@ -506,8 +504,8 @@ void PostgresCatalogue::idempotentBatchInsertArchiveFiles(rdbms::Conn &conn,
archiveFileBatch.diskInstance.setFieldValue(i, event.diskInstance);
archiveFileBatch.diskFileId.setFieldValue(i, event.diskFileId);
archiveFileBatch.diskFilePath.setFieldValue(i, event.diskFilePath);
archiveFileBatch.diskFileUser.setFieldValue(i, event.diskFileUser);
archiveFileBatch.diskFileGroup.setFieldValue(i, event.diskFileGroup);
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);
......@@ -756,8 +754,8 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
archiveFile->diskInstance = selectRset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = selectRset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = selectRset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = selectRset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = selectRset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = selectRset.columnString("CHECKSUM_VALUE");
......@@ -801,8 +799,8 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("requestDiskInstance", diskInstanceName)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......@@ -865,8 +863,8 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c
.add("diskInstance", archiveFile->diskInstance)
.add("diskFileId", archiveFile->diskFileId)
.add("diskFileInfo.path", archiveFile->diskFileInfo.path)
.add("diskFileInfo.owner", archiveFile->diskFileInfo.owner)
.add("diskFileInfo.group", archiveFile->diskFileInfo.group)
.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)
......
......@@ -774,7 +774,7 @@ bool RdbmsCatalogue::diskFilePathExists(rdbms::Conn &conn, const std::string &di
// diskFileUserExists
//------------------------------------------------------------------------------
bool RdbmsCatalogue::diskFileUserExists(rdbms::Conn &conn, const std::string &diskInstanceName,
const std::string &diskFileUser) const {
uint32_t diskFileOwnerUid) const {
try {
const char *const sql =
"SELECT "
......@@ -787,7 +787,7 @@ bool RdbmsCatalogue::diskFileUserExists(rdbms::Conn &conn, const std::string &di
"DISK_FILE_UID = :DISK_FILE_UID";
auto stmt = conn.createStmt(sql);
stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName);
stmt.bindString(":DISK_FILE_UID", diskFileUser);
stmt.bindUint64(":DISK_FILE_UID", diskFileOwnerUid);
auto rset = stmt.executeQuery();
return rset.next();
} catch(exception::UserError &) {
......@@ -802,7 +802,7 @@ bool RdbmsCatalogue::diskFileUserExists(rdbms::Conn &conn, const std::string &di
// diskFileGroupExists
//------------------------------------------------------------------------------
bool RdbmsCatalogue::diskFileGroupExists(rdbms::Conn &conn, const std::string &diskInstanceName,
const std::string &diskFileGroup) const {
uint32_t diskFileGid) const {
try {
const char *const sql =
"SELECT "
......@@ -815,7 +815,7 @@ bool RdbmsCatalogue::diskFileGroupExists(rdbms::Conn &conn, const std::string &d
"DISK_FILE_GID = :DISK_FILE_GID";
auto stmt = conn.createStmt(sql);
stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName);
stmt.bindString(":DISK_FILE_GID", diskFileGroup);
stmt.bindUint64(":DISK_FILE_GID", diskFileGid);
auto rset = stmt.executeQuery();
return rset.next();
} catch(exception::UserError &) {
......@@ -4247,8 +4247,8 @@ void RdbmsCatalogue::insertArchiveFile(rdbms::Conn &conn, const ArchiveFileRow &
stmt.bindString(":DISK_INSTANCE_NAME", row.diskInstance);
stmt.bindString(":DISK_FILE_ID", row.diskFileId);
stmt.bindString(":DISK_FILE_PATH", row.diskFilePath);
stmt.bindString(":DISK_FILE_UID", row.diskFileUser);
stmt.bindString(":DISK_FILE_GID", row.diskFileGroup);
stmt.bindUint64(":DISK_FILE_UID", row.diskFileOwnerUid);
stmt.bindUint64(":DISK_FILE_GID", row.diskFileGid);
stmt.bindUint64(":SIZE_IN_BYTES", row.size);
stmt.bindString(":CHECKSUM_TYPE", row.checksumType);
stmt.bindString(":CHECKSUM_VALUE", row.checksumValue);
......@@ -4279,15 +4279,15 @@ void RdbmsCatalogue::checkTapeFileSearchCriteria(const TapeFileSearchCriteria &s
}
}
if(searchCriteria.diskFileGroup && !searchCriteria.diskInstance) {
throw exception::UserError(std::string("Disk file group ") + searchCriteria.diskFileGroup.value() + " is ambiguous "
"without disk instance name");
if(searchCriteria.diskFileGid && !searchCriteria.diskInstance) {
throw exception::UserError(std::string("Disk file group ") + std::to_string(searchCriteria.diskFileGid.value()) +
" is ambiguous without disk instance name");
}
if(searchCriteria.diskInstance && searchCriteria.diskFileGroup) {
if(!diskFileGroupExists(conn, searchCriteria.diskInstance.value(), searchCriteria.diskFileGroup.value())) {
if(searchCriteria.diskInstance && searchCriteria.diskFileGid) {
if(!diskFileGroupExists(conn, searchCriteria.diskInstance.value(), searchCriteria.diskFileGid.value())) {
throw exception::UserError(std::string("Disk file group ") + searchCriteria.diskInstance.value() + "::" +
searchCriteria.diskFileGroup.value() + " does not exist");
std::to_string(searchCriteria.diskFileGid.value()) + " does not exist");
}
}
......@@ -4315,15 +4315,15 @@ void RdbmsCatalogue::checkTapeFileSearchCriteria(const TapeFileSearchCriteria &s
}
}
if(searchCriteria.diskFileUser && !searchCriteria.diskInstance) {
throw exception::UserError(std::string("Disk file user ") + searchCriteria.diskFileUser.value() + " is ambiguous "
"without disk instance name");
if(searchCriteria.diskFileOwnerUid && !searchCriteria.diskInstance) {
throw exception::UserError(std::string("Disk file user ") + std::to_string(searchCriteria.diskFileOwnerUid.value()) +
" is ambiguous without disk instance name");
}
if(searchCriteria.diskInstance && searchCriteria.diskFileUser) {
if(!diskFileUserExists(conn, searchCriteria.diskInstance.value(), searchCriteria.diskFileUser.value())) {
if(searchCriteria.diskInstance && searchCriteria.diskFileOwnerUid) {
if(!diskFileUserExists(conn, searchCriteria.diskInstance.value(), searchCriteria.diskFileOwnerUid.value())) {
throw exception::UserError(std::string("Disk file user ") + searchCriteria.diskInstance.value() + "::" +
searchCriteria.diskFileUser.value() + " does not exist");
std::to_string(searchCriteria.diskFileOwnerUid.value()) + " does not exist");
}
}
......@@ -4429,8 +4429,8 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getFilesForRepack
archiveFile.diskInstance = rset.columnString("DISK_INSTANCE_NAME");
archiveFile.diskFileId = rset.columnString("DISK_FILE_ID");
archiveFile.diskFileInfo.path = rset.columnString("DISK_FILE_PATH");
archiveFile.diskFileInfo.owner = rset.columnString("DISK_FILE_UID");
archiveFile.diskFileInfo.group = rset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile.checksumValue = rset.columnString("CHECKSUM_VALUE");
......@@ -4506,8 +4506,8 @@ common::dataStructures::ArchiveFileSummary RdbmsCatalogue::getTapeFileSummary(
searchCriteria.diskInstance ||
searchCriteria.diskFileId ||
searchCriteria.diskFilePath ||
searchCriteria.diskFileUser ||
searchCriteria.diskFileGroup ||
searchCriteria.diskFileOwnerUid ||
searchCriteria.diskFileGid ||
searchCriteria.storageClass ||
searchCriteria.vid ||
searchCriteria.tapeFileCopyNb ||
......@@ -4536,12 +4536,12 @@ common::dataStructures::ArchiveFileSummary RdbmsCatalogue::getTapeFileSummary(
sql += "ARCHIVE_FILE.DISK_FILE_PATH = :DISK_FILE_PATH";
addedAWhereConstraint = true;
}
if(searchCriteria.diskFileUser) {
if(searchCriteria.diskFileOwnerUid) {
if(addedAWhereConstraint) sql += " AND ";
sql += "ARCHIVE_FILE.DISK_FILE_UID = :DISK_FILE_UID";
addedAWhereConstraint = true;
}
if(searchCriteria.diskFileGroup) {
if(searchCriteria.diskFileGid) {
if(addedAWhereConstraint) sql += " AND ";
sql += "ARCHIVE_FILE.DISK_FILE_GID = :DISK_FILE_GID";
addedAWhereConstraint = true;
......@@ -4580,11 +4580,11 @@ common::dataStructures::ArchiveFileSummary RdbmsCatalogue::getTapeFileSummary(
if(searchCriteria.diskFilePath) {
stmt.bindString(":DISK_FILE_PATH", searchCriteria.diskFilePath.value());
}
if(searchCriteria.diskFileUser) {
stmt.bindString(":DISK_FILE_UID", searchCriteria.diskFileUser.value());
if(searchCriteria.diskFileOwnerUid) {
stmt.bindUint64(":DISK_FILE_UID", searchCriteria.diskFileOwnerUid.value());
}
if(searchCriteria.diskFileGroup) {
stmt.bindString(":DISK_FILE_GID", searchCriteria.diskFileGroup.value());
if(searchCriteria.diskFileGid) {
stmt.bindUint64(":DISK_FILE_GID", searchCriteria.diskFileGid.value());
}
if(searchCriteria.storageClass) {
stmt.bindString(":STORAGE_CLASS_NAME", searchCriteria.storageClass.value());
......@@ -4673,7 +4673,7 @@ void RdbmsCatalogue::tapeLabelled(const std::string &vid, const std::string &dri
// checkAndGetNextArchiveFileId
//------------------------------------------------------------------------------
uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskInstanceName,
const std::string &storageClassName, const common::dataStructures::UserIdentity &user) {
const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) {
try {
const auto storageClass = StorageClass(diskInstanceName, storageClassName);
const auto copyToPoolMap = getCachedTapeCopyToPoolMap(storageClass);
......@@ -4726,7 +4726,7 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns
//------------------------------------------------------------------------------
common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQueueCriteria(
const std::string &diskInstanceName,
const std::string &storageClassName, const common::dataStructures::UserIdentity &user) {
const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) {
try {
const StorageClass storageClass = StorageClass(diskInstanceName, storageClassName);
const common::dataStructures::TapeCopyToPoolMap copyToPoolMap = getCachedTapeCopyToPoolMap(storageClass);
......@@ -4915,7 +4915,7 @@ void RdbmsCatalogue::updateTape(
common::dataStructures::RetrieveFileQueueCriteria RdbmsCatalogue::prepareToRetrieveFile(
const std::string &diskInstanceName,
const uint64_t archiveFileId,
const common::dataStructures::UserIdentity &user,
const common::dataStructures::RequesterIdentity &user,
const optional<std::string>& activity,
log::LogContext &lc) {
try {
......@@ -5371,8 +5371,8 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskInstance = rset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = rset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = rset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = rset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = rset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = rset.columnString("CHECKSUM_VALUE");
......@@ -5464,8 +5464,8 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskInstance = rset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = rset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = rset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = rset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = rset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = rset.columnString("CHECKSUM_VALUE");
......@@ -5610,8 +5610,8 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskInstance = rset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = rset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = rset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = rset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = rset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = rset.columnString("CHECKSUM_VALUE");
......@@ -5707,8 +5707,8 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->diskInstance = rset.columnString("DISK_INSTANCE_NAME");
archiveFile->diskFileId = rset.columnString("DISK_FILE_ID");
archiveFile->diskFileInfo.path = rset.columnString("DISK_FILE_PATH");
archiveFile->diskFileInfo.owner = rset.columnString("DISK_FILE_UID");
archiveFile->diskFileInfo.group = rset.columnString("DISK_FILE_GID");
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_TYPE");
archiveFile->checksumValue = rset.columnString("CHECKSUM_VALUE");
......@@ -5813,8 +5813,8 @@ void RdbmsCatalogue::checkTapeFileWrittenFieldsAreSet(const std::string &calling
if(event.diskInstance.empty()) throw exception::Exception("diskInstance is an empty string");
if(event.diskFileId.empty()) throw exception::Exception("diskFileId is an empty string");
if(event.diskFilePath.empty()) throw exception::Exception("diskFilePath is an empty string");
if(event.diskFileUser.empty()) throw exception::Exception("diskFileUser is an empty string");
if(event.diskFileGroup.empty()) throw exception::Exception("diskFileGroup is an empty string");
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");
......
......@@ -116,7 +116,7 @@ public:
uint64_t checkAndGetNextArchiveFileId(
const std::string &diskInstanceName,
const std::string &storageClassName,
const common::dataStructures::UserIdentity &user) override;
const common::dataStructures::RequesterIdentity &user) override;
/**
* Returns the information required to queue an archive request.
......@@ -135,7 +135,7 @@ public:
common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(
const std::string &diskInstanceName,
const std::string &storageClassName,
const common::dataStructures::UserIdentity &user) override;
const common::dataStructures::RequesterIdentity &user) override;
/**
* Returns the list of tapes that can be written to by a tape drive in the
......@@ -179,7 +179,7 @@ public:
common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(
const std::string &diskInstanceName,
const uint64_t archiveFileId,
const common::dataStructures::UserIdentity &user,
const common::dataStructures::RequesterIdentity &user,
const optional<std::string> & activity,
log::LogContext &lc) override;
......@@ -703,26 +703,22 @@ protected:
/**
* Returns true if the specified disk file user exists.
*
* @param conn The database connection.
* @param diskInstanceName The name of the disk instance to which the disk
* file user belongs.
* @param diskFileUSer The name of the disk file user.
* @return True if the disk file user exists.