Skip to content

Commit

Permalink
Fix:info replication slow (#1898)
Browse files Browse the repository at this point in the history
* Update rsync_client.cc
  • Loading branch information
chejinge authored Aug 10, 2023
1 parent 5fd92fd commit 1f219c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/rsync_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class WaitObject {
pstd::Status s = Status::Timeout("rsync timeout", "timeout");
{
std::unique_lock<std::mutex> lock(mu_);
auto cv_s = cond_.wait_for(lock, std::chrono::seconds(3), [this] {
auto cv_s = cond_.wait_for(lock, std::chrono::seconds(1), [this] {
return resp_ != nullptr;
});
if (!cv_s) {
Expand Down
5 changes: 4 additions & 1 deletion src/rsync_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RsyncClient::RsyncClient(const std::string& dir, const std::string& db_name, con
: snapshot_uuid_(""), dir_(dir), db_name_(db_name), slot_id_(slot_id),
state_(IDLE), max_retries_(10), master_ip_(""), master_port_(0) {
wo_mgr_.reset(new WaitObjectManager());
client_thread_ = std::make_unique<RsyncClientThread>(10 * 1000, 60 * 1000, wo_mgr_.get());
client_thread_ = std::make_unique<RsyncClientThread>(3000, 60, wo_mgr_.get());
work_threads_.resize(kMaxRsyncParallelNum);
throttle_.reset(new Throttle(kThrottleBytesPerSecond, kThrottleCheckCycle));
finished_work_cnt_.store(0);
Expand Down Expand Up @@ -157,6 +157,9 @@ Status RsyncClient::CopyRemoteFile(const std::string& filename, int index) {
};

while (retries < max_retries_) {
if (state_.load() != RUNNING) {
break;
}
size_t copy_file_begin_time = pstd::NowMicros();
size_t count = throttle_->ThrottledByThroughput(kBytesPerRequest);
if (count == 0) {
Expand Down

0 comments on commit 1f219c1

Please sign in to comment.