Skip to content

Commit

Permalink
log enhance (#5261)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
  • Loading branch information
SuperYoko and Sophie-Xie authored Jan 31, 2023
1 parent 88a93c4 commit db7606b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/meta/processors/job/JobManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ nebula::cpp2::ErrorCode JobManager::jobFinished(
JobID jobId,
cpp2::JobStatus jobStatus,
std::optional<nebula::cpp2::ErrorCode> jobErrorCode) {
LOG(INFO) << folly::sformat("{}, spaceId={}, jobId={}, result={}",
__func__,
LOG(INFO) << folly::sformat("Trying to end job, spaceId={}, jobId={}, target phase status={}",
spaceId,
jobId,
apache::thrift::util::enumNameSafe(jobStatus));
Expand Down Expand Up @@ -345,7 +344,7 @@ nebula::cpp2::ErrorCode JobManager::jobFinished(
}

if (!optJobDesc.setStatus(jobStatus, force)) {
// job already been set as finished, failed or stopped
LOG(INFO) << "Job already been set as finished, failed or stopped";
return nebula::cpp2::ErrorCode::E_JOB_ALREADY_FINISH;
}

Expand All @@ -360,6 +359,8 @@ nebula::cpp2::ErrorCode JobManager::jobFinished(
std::unique_ptr<kvstore::KVIterator> iter;
auto rc = kvStore_->prefix(kDefaultSpaceId, kDefaultPartId, jobKey, &iter);
if (rc != nebula::cpp2::ErrorCode::SUCCEEDED) {
LOG(INFO) << "Failed to end job due to fetch job info failure:"
<< apache::thrift::util::enumNameSafe(rc);
return rc;
}
for (; iter->valid(); iter->next()) {
Expand Down Expand Up @@ -966,6 +967,9 @@ nebula::cpp2::ErrorCode JobManager::save(const std::string& k, const std::string
kvStore_->asyncMultiPut(
kDefaultSpaceId, kDefaultPartId, std::move(data), [&](nebula::cpp2::ErrorCode code) {
rc = code;
if (rc != nebula::cpp2::ErrorCode::SUCCEEDED) {
LOG(INFO) << "Save job failed with errorcode: " << apache::thrift::util::enumNameSafe(rc);
}
baton.post();
});
baton.wait();
Expand Down
4 changes: 2 additions & 2 deletions src/storage/admin/AdminTaskManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void AdminTaskManager::handleUnreportedTasks() {
if (errCode == nebula::cpp2::ErrorCode::SUCCEEDED) {
pStats = &statsItem;
}
LOG(INFO) << folly::sformat("reportTaskFinish(), job={}, task={}, rc={}",
LOG(INFO) << folly::sformat("reportTaskFinish(), job={}, task={}, task_rc={}",
jobId,
taskId,
apache::thrift::util::enumNameSafe(errCode));
Expand Down Expand Up @@ -131,7 +131,7 @@ void AdminTaskManager::handleUnreportedTasks() {
continue;
}
rc = fut.value().value();
LOG(INFO) << folly::sformat("reportTaskFinish(), job={}, task={}, rc={}",
LOG(INFO) << folly::sformat("reportTaskFinish(), job={}, task={}, report_rc={}",
jId,
tId,
apache::thrift::util::enumNameSafe(rc));
Expand Down
4 changes: 3 additions & 1 deletion src/storage/admin/RebuildIndexTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bool RebuildIndexTask::check() {
return env_->kvstore_ != nullptr;
}
void RebuildIndexTask::finish(nebula::cpp2::ErrorCode rc) {
LOG(INFO) << "Finish rebuild index task in space " << *ctx_.parameters_.space_id_ref();
if (changedSpaceGuard_) {
auto space = *ctx_.parameters_.space_id_ref();
for (auto it = env_->rebuildIndexGuard_->begin(); it != env_->rebuildIndexGuard_->end(); ++it) {
Expand Down Expand Up @@ -74,7 +75,8 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<AdminSubTask>> RebuildIndexTask::ge
std::vector<AdminSubTask> tasks;
for (auto it = env_->rebuildIndexGuard_->cbegin(); it != env_->rebuildIndexGuard_->cend(); ++it) {
if (std::get<0>(it->first) == space_ && it->second != IndexState::FINISHED) {
LOG(INFO) << "This space is building index";
LOG(INFO) << "This space " << space_ << " is building index on part "
<< std::get<1>(it->first) << ", index status: " << static_cast<int32_t>(it->second);
return nebula::cpp2::ErrorCode::E_REBUILD_INDEX_FAILED;
}
}
Expand Down

0 comments on commit db7606b

Please sign in to comment.