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

add balance job type to filter when create backup #5228

Merged
merged 6 commits into from
Jan 10, 2023
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
3 changes: 3 additions & 0 deletions src/meta/processors/admin/CreateBackupProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ void CreateBackupProcessor::process(const cpp2::CreateBackupReq& req) {
// make sure there is no index job
std::unordered_set<cpp2::JobType> jobTypes{cpp2::JobType::REBUILD_TAG_INDEX,
cpp2::JobType::REBUILD_EDGE_INDEX,
cpp2::JobType::REBUILD_FULLTEXT_INDEX,
cpp2::JobType::COMPACT,
cpp2::JobType::INGEST,
cpp2::JobType::DATA_BALANCE,
cpp2::JobType::ZONE_BALANCE,
cpp2::JobType::LEADER_BALANCE};
auto result = jobMgr->checkTypeJobRunning(jobTypes);
if (!nebula::ok(result)) {
Expand All @@ -105,6 +107,7 @@ void CreateBackupProcessor::process(const cpp2::CreateBackupReq& req) {
}

folly::SharedMutex::WriteHolder holder(LockUtils::snapshotLock());
LOG(INFO) << "Start to create checkpoints in all hosts.";
// get active storage host list
auto activeHostsRet = ActiveHostsMan::getActiveHosts(kvstore_);
if (!nebula::ok(activeHostsRet)) {
Expand Down
8 changes: 7 additions & 1 deletion src/meta/processors/job/JobManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,13 @@ nebula::cpp2::ErrorCode JobManager::addJob(JobDescription jobDesc) {
if (rc == nebula::cpp2::ErrorCode::SUCCEEDED) {
enqueue(spaceId, jobId, JbOp::ADD, jobDesc.getJobType());
inFlightJobs_.emplace(std::move(jobId), std::move(jobDesc));
LOG(INFO) << folly::sformat("Add job successfully, job id={}, job type={}",
jobId,
apache::thrift::util::enumNameSafe(jobDesc.getJobType()));
} else {
LOG(INFO) << "Add Job Failed";
LOG(INFO) << folly::sformat("Add job failed, job id={}, job type={}",
jobId,
apache::thrift::util::enumNameSafe(jobDesc.getJobType()));
if (rc != nebula::cpp2::ErrorCode::E_LEADER_CHANGED) {
rc = nebula::cpp2::ErrorCode::E_ADD_JOB_FAILURE;
}
Expand Down Expand Up @@ -1002,6 +1007,7 @@ ErrorOr<nebula::cpp2::ErrorCode, bool> JobManager::checkTypeJobRunning(
auto jobDesc = nebula::value(optJobRet);
auto jType = jobDesc.getJobType();
if (jobTypes.find(jType) == jobTypes.end()) {
LOG(INFO) << "skip job type:" << apache::thrift::util::enumNameSafe(jType);
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions src/meta/test/CreateBackupProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ TEST_F(CreateBackupProcessorTest, Basic) {
TEST_F(CreateBackupProcessorTest, RunningJobs) {
std::vector<cpp2::JobType> jobTypes{cpp2::JobType::REBUILD_TAG_INDEX,
cpp2::JobType::REBUILD_EDGE_INDEX,
cpp2::JobType::REBUILD_FULLTEXT_INDEX,
cpp2::JobType::COMPACT,
cpp2::JobType::INGEST,
cpp2::JobType::DATA_BALANCE,
cpp2::JobType::ZONE_BALANCE,
cpp2::JobType::LEADER_BALANCE};
JobID jobId = 1;
for (auto jobType : jobTypes) {
Expand Down