diff options
Diffstat (limited to 'lib/backupstore/BackupStoreRefCountDatabase.cpp')
-rw-r--r-- | lib/backupstore/BackupStoreRefCountDatabase.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/backupstore/BackupStoreRefCountDatabase.cpp b/lib/backupstore/BackupStoreRefCountDatabase.cpp index f6db2ca4..642e260c 100644 --- a/lib/backupstore/BackupStoreRefCountDatabase.cpp +++ b/lib/backupstore/BackupStoreRefCountDatabase.cpp @@ -61,7 +61,11 @@ std::string BackupStoreRefCountDatabase::GetFilename(const ASSERT(RootDir[RootDir.size() - 1] == '/' || RootDir[RootDir.size() - 1] == DIRECTORY_SEPARATOR_ASCHAR); +<<<<<<< HEAD std::string fn(RootDir + "refcount.db"); +======= + std::string fn(RootDir + REFCOUNT_FILENAME ".db"); +>>>>>>> 0.12 RaidFileController &rcontroller(RaidFileController::GetController()); RaidFileDiscSet rdiscSet(rcontroller.GetDiscSet(rAccount.GetDiscSet())); return RaidFileUtil::MakeWriteFileName(rdiscSet, fn); @@ -91,9 +95,15 @@ void BackupStoreRefCountDatabase::Create(const // Open the file for writing if (FileExists(Filename) && !AllowOverwrite) { +<<<<<<< HEAD BOX_ERROR("Attempted to overwrite refcount database file: " << Filename); THROW_EXCEPTION(RaidFileException, CannotOverwriteExistingFile); +======= + THROW_FILE_ERROR("Failed to overwrite refcount database: " + "not allowed here", Filename, RaidFileException, + CannotOverwriteExistingFile); +>>>>>>> 0.12 } int flags = O_CREAT | O_BINARY | O_RDWR; @@ -134,14 +144,26 @@ std::auto_ptr<BackupStoreRefCountDatabase> BackupStoreRefCountDatabase::Load( refcount_StreamFormat hdr; if(!dbfile->ReadFullBuffer(&hdr, sizeof(hdr), 0 /* not interested in bytes read if this fails */)) { +<<<<<<< HEAD THROW_EXCEPTION(BackupStoreException, CouldNotLoadStoreInfo) +======= + THROW_FILE_ERROR("Failed to read refcount database: " + "short read", filename, BackupStoreException, + CouldNotLoadStoreInfo); +>>>>>>> 0.12 } // Check it if(ntohl(hdr.mMagicValue) != REFCOUNT_MAGIC_VALUE || (int32_t)ntohl(hdr.mAccountID) != rAccount.GetID()) { +<<<<<<< HEAD THROW_EXCEPTION(BackupStoreException, BadStoreInfoOnLoad) +======= + THROW_FILE_ERROR("Failed to read refcount database: " + "bad magic number", filename, BackupStoreException, + BadStoreInfoOnLoad); +>>>>>>> 0.12 } // Make new object @@ -158,6 +180,7 @@ std::auto_ptr<BackupStoreRefCountDatabase> BackupStoreRefCountDatabase::Load( // -------------------------------------------------------------------------- // // Function +<<<<<<< HEAD // Name: BackupStoreRefCountDatabase::Save() // Purpose: Save modified info back to disc // Created: 2003/08/28 @@ -241,6 +264,8 @@ void BackupStoreRefCountDatabase::Save() // -------------------------------------------------------------------------- // // Function +======= +>>>>>>> 0.12 // Name: BackupStoreRefCountDatabase::GetRefCount(int64_t // ObjectID) // Purpose: Get the number of references to the specified object @@ -255,10 +280,17 @@ BackupStoreRefCountDatabase::GetRefCount(int64_t ObjectID) const if (GetSize() < offset + GetEntrySize()) { +<<<<<<< HEAD BOX_ERROR("attempted read of unknown refcount for object " << BOX_FORMAT_OBJECTID(ObjectID)); THROW_EXCEPTION(BackupStoreException, UnknownObjectRefCountRequested); +======= + THROW_FILE_ERROR("Failed to read refcount database: " + "attempted read of unknown refcount for object " << + BOX_FORMAT_OBJECTID(ObjectID), mFilename, + BackupStoreException, UnknownObjectRefCountRequested); +>>>>>>> 0.12 } mapDatabaseFile->Seek(offset, SEEK_SET); @@ -267,9 +299,15 @@ BackupStoreRefCountDatabase::GetRefCount(int64_t ObjectID) const if (mapDatabaseFile->Read(&refcount, sizeof(refcount)) != sizeof(refcount)) { +<<<<<<< HEAD BOX_LOG_SYS_ERROR("short read on refcount database: " << mFilename); THROW_EXCEPTION(BackupStoreException, CouldNotLoadStoreInfo); +======= + THROW_FILE_ERROR("Failed to read refcount database: " + "short read at offset " << offset, mFilename, + BackupStoreException, CouldNotLoadStoreInfo); +>>>>>>> 0.12 } return ntohl(refcount); |