Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
panda-sheep committed Sep 21, 2022
1 parent 86d7eae commit 11379f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/meta/processors/job/JobDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ class JobDescription {
cpp2::JobDesc toJobDesc();

bool operator==(const JobDescription& that) const {
return space_ == that.space_ && type_ == that.type_ && paras_ == that.paras_;
bool res = (space_ == that.space_) && (type_ == that.type_);
return (type_ == cpp2::JobType::ZONE_BALANCE || type_ == cpp2::JobType::DATA_BALANCE)
? res
: res && (paras_ == that.paras_);
}

bool operator!=(const JobDescription& that) const {
Expand Down
10 changes: 9 additions & 1 deletion src/meta/processors/job/JobManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,14 @@ nebula::cpp2::ErrorCode JobManager::jobFinished(

auto optJobDesc = nebula::value(optJobDescRet);

if (!optJobDesc.setStatus(jobStatus)) {
bool force = false;
if (optJobDesc.getStatus() == cpp2::JobStatus::FAILED && jobStatus == cpp2::JobStatus::STOPPED &&
(optJobDesc.getJobType() == cpp2::JobType::ZONE_BALANCE ||
optJobDesc.getJobType() == cpp2::JobType::DATA_BALANCE)) {
force = true;
}

if (!optJobDesc.setStatus(jobStatus, force)) {
// job already been set as finished, failed or stopped
return nebula::cpp2::ErrorCode::E_JOB_NOT_STOPPABLE;
}
Expand Down Expand Up @@ -891,6 +898,7 @@ ErrorOr<nebula::cpp2::ErrorCode, uint32_t> JobManager::recoverJob(
if ((jobType == cpp2::JobType::DATA_BALANCE || jobType == cpp2::JobType::ZONE_BALANCE) &&
it->second.getStatus() == cpp2::JobStatus::FINISHED) {
lastBalanceJobFinished = it->first;
break;
}
}
for (auto it = jobsMaybeRecover.begin(); it != jobsMaybeRecover.end();) {
Expand Down

0 comments on commit 11379f5

Please sign in to comment.