Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3355357
D3738.id11697.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D3738.id11697.diff
View Options
diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h b/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h
--- a/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h
@@ -40,8 +40,7 @@
std::unique_ptr<grpc::Status>
BlobGetClientReactor::readResponse(blob::GetResponse &response) {
if (!this->dataChunks->write(std::move(*response.mutable_datachunk()))) {
- throw std::runtime_error(
- "error reading compaction data from the blob service");
+ throw std::runtime_error("error reading data from the blob service");
}
return nullptr;
}
diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h
@@ -63,12 +63,10 @@
throw std::runtime_error(
"get reactor cannot be initialized when backup item is missing");
}
- if (this->getReactor == nullptr) {
- this->getReactor = std::make_shared<reactor::BlobGetClientReactor>(
- holder, this->dataChunks);
- this->getReactor->request.set_holder(holder);
- this->blobClient.get(this->getReactor);
- }
+ this->getReactor.reset(
+ new reactor::BlobGetClientReactor(holder, this->dataChunks));
+ this->getReactor->request.set_holder(holder);
+ this->blobClient.get(this->getReactor);
}
void PullBackupReactor::initialize() {
@@ -99,7 +97,9 @@
// as there may be multiple threads from the pool taking over here
const std::lock_guard<std::mutex> lock(this->reactorStateMutex);
if (this->state == State::COMPACTION) {
- this->initializeGetReactor(this->backupItem->getCompactionHolder());
+ if (this->getReactor == nullptr) {
+ this->initializeGetReactor(this->backupItem->getCompactionHolder());
+ }
std::string dataChunk;
this->dataChunks->blockingRead(dataChunk);
if (!dataChunk.empty()) {
@@ -110,7 +110,9 @@
throw std::runtime_error(
"dangling data discovered after reading compaction");
}
- this->getReactor = nullptr;
+ if (!this->getReactor->getStatus().ok()) {
+ throw std::runtime_error(this->getReactor->getStatus().error_message());
+ }
this->state = State::LOGS;
}
if (this->state == State::LOGS) {
@@ -119,6 +121,9 @@
return std::make_unique<grpc::Status>(grpc::Status::OK);
}
if (this->currentLogIndex == this->logs.size()) {
+ if (!this->dataChunks->isEmpty()) {
+ throw std::runtime_error("dangling data discovered after reading logs");
+ }
return std::make_unique<grpc::Status>(grpc::Status::OK);
}
if (this->currentLogIndex > this->logs.size()) {
@@ -137,15 +142,26 @@
}
std::string dataChunk;
this->dataChunks->blockingRead(dataChunk);
+ if (!this->getReactor->getStatus().ok()) {
+ throw std::runtime_error(this->getReactor->getStatus().error_message());
+ }
if (dataChunk.empty()) {
++this->currentLogIndex;
this->currentLog = nullptr;
- } else {
- response->set_logchunk(dataChunk);
+ return nullptr;
}
- return nullptr;
}
- throw std::runtime_error("unhandled state");
+ std::string dataChunk;
+ this->dataChunks->blockingRead(dataChunk);
+ if (dataChunk.empty()) {
+ ++this->currentLogIndex;
+ this->currentLog = nullptr;
+ } else {
+ response->set_logchunk(dataChunk);
+ }
+ return nullptr;
+}
+throw std::runtime_error("unhandled state");
}
void PullBackupReactor::terminateCallback() {
diff --git a/services/blob/src/Reactors/server/GetReactor.h b/services/blob/src/Reactors/server/GetReactor.h
--- a/services/blob/src/Reactors/server/GetReactor.h
+++ b/services/blob/src/Reactors/server/GetReactor.h
@@ -38,7 +38,7 @@
std::min(this->chunkSize, this->fileSize - this->offset);
std::string range = "bytes=" + std::to_string(this->offset) + "-" +
- std::to_string(this->offset + nextSize);
+ std::to_string(this->offset + nextSize - 1);
this->getRequest.SetRange(range);
Aws::S3::Model::GetObjectOutcome getOutcome =
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 2:24 PM (20 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576284
Default Alt Text
D3738.id11697.diff (4 KB)
Attached To
Mode
D3738: [services] Backup/Blob - Pull backup logic fixes
Attached
Detach File
Event Timeline
Log In to Comment