aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-15 11:55:30 +0200
committerGitHub Enterprise <[email protected]>2024-08-15 11:55:30 +0200
commit4cec2ba76320e404452599c693982d32f29a9269 (patch)
tree9108b046dd7b180210d82f443bbdb56dba583e68 /src
parent5.5.4-pre1 (diff)
downloadzen-4cec2ba76320e404452599c693982d32f29a9269.tar.xz
zen-4cec2ba76320e404452599c693982d32f29a9269.zip
adds more information in log when oplog rename/delete fails (#117)
* adds more information in log when oplog rename/delete fails * warn if we fail to delete dropped directory * close oplog storage file inside try/catch * don't try to flush closed files
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp31
-rw-r--r--src/zenutil/basicfile.cpp4
2 files changed, 29 insertions, 6 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index d41498a61..676c562ee 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -60,12 +60,14 @@ namespace {
{
if (!DeleteDirectories(DroppedBucketPath))
{
- ZEN_INFO("Drop directory {} already exists and but and not be removed, attempting different name.", DroppedBucketPath);
+ ZEN_INFO("Drop directory '{}' for '{}' already exists but could not be removed, attempting different name.",
+ DroppedBucketPath,
+ Dir);
continue;
}
if (std::filesystem::exists(DroppedBucketPath))
{
- ZEN_INFO("Drop directory {} still exists after remove, attempting different name.", DroppedBucketPath);
+ ZEN_INFO("Drop directory '{}' for '{}' still exists after remove, attempting different name.", DroppedBucketPath, Dir);
continue;
}
}
@@ -82,12 +84,19 @@ namespace {
}
if (std::filesystem::exists(DroppedBucketPath))
{
- ZEN_INFO("Drop directory {} exists and can not be overwritten, attempting different name.", DroppedBucketPath);
+ ZEN_INFO("Can't rename '{}' to still existing drop directory '{}'. Reason: '{}'. Attempting different name.",
+ Dir,
+ DroppedBucketPath,
+ Ec.message());
break;
}
if (++RenameAttempt == 10)
{
- ZEN_INFO("Can't rename '{}' to drop directory '{}'. Reason: {}.", Dir, DroppedBucketPath, Ec.message());
+ ZEN_INFO("Can't rename '{}' to drop directory '{}' after {} attempts. Reason: {}.",
+ Dir,
+ DroppedBucketPath,
+ RenameAttempt,
+ Ec.message());
return false;
}
ZEN_INFO("Can't rename '{}' to drop directory '{}', pausing and retrying. Reason: {}.",
@@ -275,6 +284,8 @@ struct ProjectStore::OplogStorage : public RefCounted
try
{
Flush();
+ m_Oplog.Close();
+ m_OpBlobs.Close();
}
catch (const std::exception& Ex)
{
@@ -2330,7 +2341,11 @@ ProjectStore::Project::DeleteOplog(std::string_view OplogId)
// Erase content on disk
if (!DeletePath.empty())
{
- return OplogStorage::Delete(DeletePath);
+ if (!OplogStorage::Delete(DeletePath))
+ {
+ ZEN_WARN("Failed to remove old oplog path '{}'", DeletePath);
+ return false;
+ }
}
return true;
}
@@ -3073,7 +3088,11 @@ ProjectStore::DeleteProject(std::string_view ProjectId)
if (!DeletePath.empty())
{
- DeleteDirectories(DeletePath);
+ if (!DeleteDirectories(DeletePath))
+ {
+ ZEN_WARN("Failed to remove old project path '{}'", DeletePath);
+ return false;
+ }
}
return true;
diff --git a/src/zenutil/basicfile.cpp b/src/zenutil/basicfile.cpp
index d837c2caf..266146ca1 100644
--- a/src/zenutil/basicfile.cpp
+++ b/src/zenutil/basicfile.cpp
@@ -359,6 +359,10 @@ BasicFile::WriteAll(IoBuffer Data, std::error_code& Ec)
void
BasicFile::Flush()
{
+ if (m_FileHandle == nullptr)
+ {
+ return;
+ }
#if ZEN_PLATFORM_WINDOWS
FlushFileBuffers(m_FileHandle);
#else