Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3377448
D3650.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3650.diff
View Options
diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
@@ -3,6 +3,7 @@
#include "Constants.h"
#include "ServerReadReactorBase.h"
#include "ServiceBlobClient.h"
+#include "Tools.h"
#include "../_generated/backup.grpc.pb.h"
#include "../_generated/backup.pb.h"
@@ -42,9 +43,11 @@
std::string value;
std::mutex reactorStateMutex;
std::condition_variable blobDoneCV;
+ std::mutex blobDoneCVMutex;
std::shared_ptr<reactor::BlobPutClientReactor> putReactor;
ServiceBlobClient blobClient;
+
void storeInDatabase();
std::string generateHolder();
std::string generateLogID();
@@ -60,6 +63,7 @@
std::unique_ptr<grpc::Status>
readRequest(backup::SendLogRequest request) override;
void doneCallback() override;
+ void terminateCallback() override;
};
void SendLogReactor::storeInDatabase() {
@@ -159,6 +163,20 @@
throw std::runtime_error("send log - invalid state");
}
+void SendLogReactor::terminateCallback() {
+ const std::lock_guard<std::mutex> lock(this->reactorStateMutex);
+
+ if (this->persistenceMethod == PersistenceMethod::DB ||
+ this->putReactor == nullptr) {
+ return;
+ }
+ this->putReactor->scheduleSendingDataChunk(std::make_unique<std::string>(""));
+ std::unique_lock<std::mutex> lock2(this->blobDoneCVMutex);
+ this->blobDoneCV.wait(lock2);
+ // store in db only when we successfully upload chunks
+ this->storeInDatabase();
+}
+
void SendLogReactor::doneCallback() {
// we make sure that the blob client's state is flushed to the main memory
// as there may be multiple threads from the pool taking over here
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 5:44 AM (22 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592958
Default Alt Text
D3650.diff (1 KB)
Attached To
Mode
D3650: [services] Backup - Send log - add terminate callback
Attached
Detach File
Event Timeline
Log In to Comment