aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/zenremoteprojectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-08-01 08:51:18 +0200
committerGitHub <[email protected]>2023-08-01 08:51:18 +0200
commitd7419eb4901ec589a5dcec683b8dc052bd6d896e (patch)
treec1b52e427c380363315c64f350ba45ab7a9693ae /src/zenserver/projectstore/zenremoteprojectstore.cpp
parentcatch exceptions when scheduling GC and when writing GC scheduling state (#339) (diff)
downloadzen-d7419eb4901ec589a5dcec683b8dc052bd6d896e.tar.xz
zen-d7419eb4901ec589a5dcec683b8dc052bd6d896e.zip
add requested item in oplog remote op (#340)
* add more context for oplog import/export errors
Diffstat (limited to 'src/zenserver/projectstore/zenremoteprojectstore.cpp')
-rw-r--r--src/zenserver/projectstore/zenremoteprojectstore.cpp67
1 files changed, 57 insertions, 10 deletions
diff --git a/src/zenserver/projectstore/zenremoteprojectstore.cpp b/src/zenserver/projectstore/zenremoteprojectstore.cpp
index 05df1e118..d2ebc1484 100644
--- a/src/zenserver/projectstore/zenremoteprojectstore.cpp
+++ b/src/zenserver/projectstore/zenremoteprojectstore.cpp
@@ -58,6 +58,11 @@ public:
if (Result.ErrorCode)
{
+ Result.Reason = fmt::format("Failed saving oplog container to {}/{}/{}. Reason: '{}'",
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ Result.Reason);
Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
return Result;
}
@@ -107,7 +112,16 @@ public:
Session->SetReadCallback(cpr::ReadCallback(gsl::narrow<cpr::cpr_off_t>(SizeLeft), ReadCallback));
cpr::Response Response = Session->Post();
SaveAttachmentResult Result = SaveAttachmentResult{ConvertResult(Response)};
- Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
+ if (Result.ErrorCode)
+ {
+ Result.Reason = fmt::format("Failed saving oplog attachment to {}/{}/{}/{}. Reason: '{}'",
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ RawHash,
+ Result.Reason);
+ }
+ Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
return Result;
}
@@ -153,7 +167,16 @@ public:
Session->SetReadCallback(cpr::ReadCallback(gsl::narrow<cpr::cpr_off_t>(SizeLeft), ReadCallback));
cpr::Response Response = Session->Post();
SaveAttachmentsResult Result = SaveAttachmentsResult{ConvertResult(Response)};
- Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
+ if (Result.ErrorCode)
+ {
+ Result.Reason = fmt::format("Failed saving {} oplog attachments to {}/{}/{}. Reason: '{}'",
+ Chunks.size(),
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ Result.Reason);
+ }
+ Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
return Result;
}
@@ -198,6 +221,15 @@ public:
std::pair<IoHash, CompressedBuffer>{Attachment.GetHash(), Attachment.AsCompressedBinary().MakeOwned()});
}
}
+ else
+ {
+ Result.Reason = fmt::format("Failed fetching {} oplog attachments from {}/{}/{}. Reason: '{}'",
+ RawHashes.size(),
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ Result.Reason);
+ }
Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
return Result;
};
@@ -225,18 +257,24 @@ public:
cpr::Response Response = Session->Get();
LoadContainerResult Result = LoadContainerResult{ConvertResult(Response)};
- if (!Result.ErrorCode)
+ if (Result.ErrorCode)
+ {
+ Result.Reason = fmt::format("Failed fetching oplog container from {}/{}/{}. Reason: '{}'",
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ Result.Reason);
+ }
+ else
{
Result.ContainerObject = LoadCompactBinaryObject(IoBuffer(IoBuffer::Clone, Response.text.data(), Response.text.size()));
if (!Result.ContainerObject)
{
- Result.Reason = fmt::format("The response for {}/{}/{} is not formatted as a compact binary object"sv,
- m_ProjectStoreUrl,
- m_Project,
- m_Oplog);
- Result.ErrorCode = gsl::narrow<int32_t>(HttpResponseCode::InternalServerError);
- Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
- return Result;
+ Result.Reason = fmt::format("The response for {}/{}/{} is not formatted as a compact binary object"sv,
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog);
+ Result.ErrorCode = gsl::narrow<int32_t>(HttpResponseCode::InternalServerError);
}
}
Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
@@ -259,6 +297,15 @@ public:
{
Result.Bytes = IoBufferBuilder::MakeCloneFromMemory(Response.text.data(), Response.text.size());
}
+ if (!Result.ErrorCode)
+ {
+ Result.Reason = fmt::format("Failed fetching oplog attachment from {}/{}/{}/{}. Reason: '{}'",
+ m_ProjectStoreUrl,
+ m_Project,
+ m_Oplog,
+ RawHash,
+ Result.Reason);
+ }
Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.500;
return Result;
}