Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle rsync response error in slave side #2319

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/rsync_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ class WaitObjectManager {
delete resp;
return;
}
if (resp->code() != RsyncService::kOk) {
LOG(WARNING) << "rsync response error";
wo_vec_[index]->WakeUp(resp);
return;
}

if (resp->type() == RsyncService::kRsyncFile &&
((resp->file_resp().filename() != wo_vec_[index]->Filename()) ||
(resp->file_resp().offset() != wo_vec_[index]->Offset()))) {
Expand Down
9 changes: 4 additions & 5 deletions src/rsync_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,14 @@ Status RsyncClient::CopyRemoteFile(const std::string& filename, int index) {
continue;
}

if (resp->code() != RsyncService::kOk) {
return Status::IOError("kRsyncFile request failed, master response error code");
}

size_t ret_count = resp->file_resp().count();
size_t elaspe_time_us = pstd::NowMicros() - copy_file_begin_time;
Throttle::GetInstance().ReturnUnusedThroughput(count, ret_count, elaspe_time_us);

if (resp->code() != RsyncService::kOk) {
//TODO: handle different error
continue;
}

if (resp->snapshot_uuid() != snapshot_uuid_) {
LOG(WARNING) << "receive newer dump, reset state to STOP, local_snapshot_uuid:"
<< snapshot_uuid_ << "remote snapshot uuid: " << resp->snapshot_uuid();
Expand Down
Loading