Skip to content

Commit

Permalink
fix: slotmigrate return not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
brother-jin committed Jun 17, 2024
1 parent 3a0a5bf commit d3a0430
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pika_migrate_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,11 @@ int PikaMigrateThread::ReqMigrateOne(const std::string& key, const std::shared_p
LOG(INFO) << "PikaMigrateThread::ReqMigrateOne StartThread";
is_migrating_ = true;
usleep(100);
NotifyRequestMigrate();
}
} else {
}
// check the key is migrating
if (is_migrating_) {
std::pair<const char, std::string> kpair = std::make_pair(key_type, key);
if (IsMigrating(kpair)) {
LOG(INFO) << "PikaMigrateThread::ReqMigrateOne key: " << key << " is migrating ! ";
Expand Down Expand Up @@ -937,7 +939,9 @@ void *PikaMigrateThread::ThreadMain() {
{
std::unique_lock lw(workers_mutex_);
while (!should_exit_ && is_task_success_ && send_num_ != response_num_) {
workers_cond_.wait(lw);
if (workers_cond_.wait_for(lw, std::chrono::minutes(5)) == std::cv_status::timeout) {
break;
}
}
}
LOG(INFO) << "PikaMigrateThread::ThreadMain send_num:" << send_num_ << " response_num:" << response_num_;
Expand Down

0 comments on commit d3a0430

Please sign in to comment.