Skip to content

Commit

Permalink
fix log
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Mar 30, 2022
1 parent c8ae47b commit 20af839
Show file tree
Hide file tree
Showing 33 changed files with 125 additions and 136 deletions.
6 changes: 1 addition & 5 deletions src/graph/executor/Executor.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
// Copyright (c) 2022 vesoft inc. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

#ifndef GRAPH_EXECUTOR_EXECUTOR_H_
#define GRAPH_EXECUTOR_EXECUTOR_H_

#include <folly/futures/Future.h>

#include <boost/core/noncopyable.hpp>

#include "common/cpp/helpers.h"
#include "common/time/Duration.h"
#include "common/time/ScopedTimer.h"
#include "graph/context/ExecutionContext.h"
#include "graph/context/QueryContext.h"

namespace nebula {
namespace graph {

class PlanNode;
class QueryContext;

class Executor : private boost::noncopyable, private cpp::NonMovable {
public:
// Create executor according to plan node
Expand Down
6 changes: 3 additions & 3 deletions src/graph/executor/admin/ConfigExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ folly::Future<Status> ShowConfigsExecutor::execute() {
.thenValue([this, scNode](StatusOr<std::vector<meta::cpp2::ConfigItem>> resp) {
if (!resp.ok()) {
auto module = apache::thrift::util::enumNameSafe(scNode->getModule());
LOG(ERROR) << "Show configs `" << module << "' failed: " << resp.status();
LOG(WARNING) << "Show configs `" << module << "' failed: " << resp.status();
return Status::Error(
"Show config `%s' failed: %s", module.c_str(), resp.status().toString().c_str());
}
Expand Down Expand Up @@ -86,7 +86,7 @@ folly::Future<Status> SetConfigExecutor::execute() {
.via(runner())
.thenValue([scNode](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Set config `" << scNode->getName() << "' failed: " << resp.status();
LOG(WARNING) << "Set config `" << scNode->getName() << "' failed: " << resp.status();
return Status::Error("Set config `%s' failed: %s",
scNode->getName().c_str(),
resp.status().toString().c_str());
Expand All @@ -105,7 +105,7 @@ folly::Future<Status> GetConfigExecutor::execute() {
.via(runner())
.thenValue([this, gcNode](StatusOr<std::vector<meta::cpp2::ConfigItem>> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Get config `" << gcNode->getName() << "' failed: " << resp.status();
LOG(WARNING) << "Get config `" << gcNode->getName() << "' failed: " << resp.status();
return Status::Error("Get config `%s' failed: %s",
gcNode->getName().c_str(),
resp.status().toString().c_str());
Expand Down
3 changes: 2 additions & 1 deletion src/graph/executor/admin/DescribeUserExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ folly::Future<Status> DescribeUserExecutor::describeUser() {
v.emplace_back(nebula::Row({apache::thrift::util::enumNameSafe(item.get_role_type()),
spaceNameResult.value()}));
} else {
LOG(ERROR) << " Space name of " << item.get_space_id() << " no found";
LOG(WARNING) << " Space name of " << item.get_space_id()
<< " no found: " << spaceNameResult.status();
return Status::Error("Space not found");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/KillQueryExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ folly::Future<Status> KillQueryExecutor::execute() {
if (listResp.ok()) {
sessionsInMeta = std::move(listResp.value()).get_sessions();
} else {
LOG(ERROR) << listResp.status();
LOG(WARNING) << "List session fail: " << listResp.status();
}

auto status = verifyTheQueriesByMetaInfo(toBeVerifiedQueries, sessionsInMeta);
Expand Down
6 changes: 3 additions & 3 deletions src/graph/executor/admin/ListenerExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly::Future<Status> AddListenerExecutor::execute() {
.thenValue([this](StatusOr<bool> resp) {
SCOPED_TIMER(&execTime_);
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Add listener fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -40,7 +40,7 @@ folly::Future<Status> RemoveListenerExecutor::execute() {
.thenValue([this](StatusOr<bool> resp) {
SCOPED_TIMER(&execTime_);
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Remove listener fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -54,7 +54,7 @@ folly::Future<Status> ShowListenerExecutor::execute() {
[this](StatusOr<std::vector<meta::cpp2::ListenerInfo>> resp) {
SCOPED_TIMER(&execTime_);
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Show listener fail: " << resp.status();
return resp.status();
}

Expand Down
7 changes: 4 additions & 3 deletions src/graph/executor/admin/PartExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ folly::Future<Status> ShowPartsExecutor::execute() {
SCOPED_TIMER(&execTime_);

auto* spNode = asNode<ShowParts>(node());
const auto& spaceId = spNode->getSpaceId();
return qctx()
->getMetaClient()
->listParts(spNode->getSpaceId(), spNode->getPartIds())
->listParts(spaceId, spNode->getPartIds())
.via(runner())
.thenValue([this](StatusOr<std::vector<meta::cpp2::PartItem>> resp) {
.thenValue([this, spaceId](StatusOr<std::vector<meta::cpp2::PartItem>> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "SpaceId: " << spaceId << ", Show Parts fail: " << resp.status();
return resp.status();
}
auto partItems = std::move(resp).value();
Expand Down
3 changes: 1 addition & 2 deletions src/graph/executor/admin/SessionExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ void ShowSessionsExecutor::addSessions(const meta::cpp2::Session &session, DataS
}

folly::Future<Status> UpdateSessionExecutor::execute() {
VLOG(1) << "Update sessions to metad";
SCOPED_TIMER(&execTime_);
auto *updateNode = asNode<UpdateSession>(node());
std::vector<meta::cpp2::Session> sessions;
Expand All @@ -107,7 +106,7 @@ folly::Future<Status> UpdateSessionExecutor::execute() {
[this](auto &&resp) {
SCOPED_TIMER(&execTime_);
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Update session fail " << resp.status();
return resp.status();
}
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/ShowHostsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ folly::Future<Status> ShowHostsExecutor::showHosts() {
.via(runner())
.thenValue([=, type = shNode->getType()](auto &&resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Show host fail: " << resp.status();
return resp.status();
}
auto value = std::forward<decltype(resp)>(resp).value();
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/ShowServiceClientsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ folly::Future<Status> ShowServiceClientsExecutor::showServiceClients() {
return qctx()->getMetaClient()->listServiceClients(type).via(runner()).thenValue(
[this](auto &&resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Show service client fail: " << resp.status();
return resp.status();
}
auto values = std::move(resp).value();
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/ShowStatsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ folly::Future<Status> ShowStatsExecutor::execute() {
return qctx()->getMetaClient()->getStats(spaceId).via(runner()).thenValue(
[this, spaceId](StatusOr<meta::cpp2::StatsItem> resp) {
if (!resp.ok()) {
LOG(ERROR) << "SpaceId: " << spaceId << ", Show status failed: " << resp.status();
LOG(WARNING) << "SpaceId: " << spaceId << ", Show status failed: " << resp.status();
return resp.status();
}
auto statsItem = std::move(resp).value();
Expand Down
6 changes: 3 additions & 3 deletions src/graph/executor/admin/SnapshotExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ folly::Future<Status> CreateSnapshotExecutor::execute() {

return qctx()->getMetaClient()->createSnapshot().via(runner()).thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Create snapshot fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -31,7 +31,7 @@ folly::Future<Status> DropSnapshotExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Drop snapshot fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -44,7 +44,7 @@ folly::Future<Status> ShowSnapshotsExecutor::execute() {
return qctx()->getMetaClient()->listSnapshots().via(runner()).thenValue(
[this](StatusOr<std::vector<meta::cpp2::Snapshot>> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Show snapshot fail: " << resp.status();
return resp.status();
}

Expand Down
32 changes: 16 additions & 16 deletions src/graph/executor/admin/SpaceExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ folly::Future<Status> CreateSpaceExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Create space fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -42,7 +42,7 @@ folly::Future<Status> CreateSpaceAsExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Create space as node fail: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -53,13 +53,11 @@ folly::Future<Status> DescSpaceExecutor::execute() {
SCOPED_TIMER(&execTime_);

auto *dsNode = asNode<DescSpace>(node());
return qctx()
->getMetaClient()
->getSpace(dsNode->getSpaceName())
.via(runner())
.thenValue([this](StatusOr<meta::cpp2::SpaceItem> resp) {
const auto &spaceName = dsNode->getSpaceName();
return qctx()->getMetaClient()->getSpace(spaceName).via(runner()).thenValue(
[this, spaceName](StatusOr<meta::cpp2::SpaceItem> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Desc space: " << spaceName << " fail: " << resp.status();
return resp.status();
}
auto &spaceItem = resp.value();
Expand Down Expand Up @@ -136,7 +134,7 @@ folly::Future<Status> DropSpaceExecutor::execute() {
.via(runner())
.thenValue([this, dsNode, spaceIdRet, ftIndexes](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Drop space `" << dsNode->getSpaceName() << "' failed: " << resp.status();
LOG(WARNING) << "Drop space `" << dsNode->getSpaceName() << "' failed: " << resp.status();
return resp.status();
}
unRegisterSpaceLevelMetrics(dsNode->getSpaceName());
Expand All @@ -149,7 +147,7 @@ folly::Future<Status> DropSpaceExecutor::execute() {
if (!ftIndexes.empty()) {
auto tsRet = FTIndexUtils::getTSClients(qctx()->getMetaClient());
if (!tsRet.ok()) {
LOG(WARNING) << "Get text search clients failed";
LOG(WARNING) << "Get text search clients failed: " << tsRet.status();
return Status::OK();
}
for (const auto &ftindex : ftIndexes) {
Expand Down Expand Up @@ -197,7 +195,8 @@ folly::Future<Status> ClearSpaceExecutor::execute() {
.via(runner())
.thenValue([this, csNode, spaceIdRet, ftIndexes = std::move(ftIndexes)](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Clear space `" << csNode->getSpaceName() << "' failed: " << resp.status();
LOG(WARNING) << "Clear space `" << csNode->getSpaceName()
<< "' failed: " << resp.status();
return resp.status();
}
if (!ftIndexes.empty()) {
Expand All @@ -223,7 +222,7 @@ folly::Future<Status> ShowSpacesExecutor::execute() {
return qctx()->getMetaClient()->listSpaces().via(runner()).thenValue(
[this](StatusOr<std::vector<meta::SpaceIdName>> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Show spaces failed: " << resp.status();
LOG(WARNING) << "Show spaces failed: " << resp.status();
return resp.status();
}
auto spaceItems = std::move(resp).value();
Expand Down Expand Up @@ -258,8 +257,8 @@ folly::Future<Status> ShowCreateSpaceExecutor::execute() {
.via(runner())
.thenValue([this, scsNode](StatusOr<meta::cpp2::SpaceItem> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Show create space `" << scsNode->getSpaceName()
<< "' failed: " << resp.status();
LOG(WARNING) << "Show create space `" << scsNode->getSpaceName()
<< "' failed: " << resp.status();
return resp.status();
}
auto properties = resp.value().get_properties();
Expand Down Expand Up @@ -315,14 +314,15 @@ folly::Future<Status> ShowCreateSpaceExecutor::execute() {
folly::Future<Status> AlterSpaceExecutor::execute() {
SCOPED_TIMER(&execTime_);
auto *asnode = asNode<AlterSpace>(node());
const auto &spaceName = asnode->getSpaceName();
return qctx()
->getMetaClient()
->alterSpace(asnode->getSpaceName(), asnode->getAlterSpaceOp(), asnode->getParas())
.via(runner())
.thenValue([this](StatusOr<bool> &&resp) {
.thenValue([this, spaceName](StatusOr<bool> &&resp) {
SCOPED_TIMER(&execTime_);
if (!resp.ok()) {
LOG(ERROR) << resp.status().toString();
LOG(WARNING) << "Alter space : " << spaceName << " fail: " << resp.status();
return std::move(resp).status();
}
return Status::OK();
Expand Down
6 changes: 3 additions & 3 deletions src/graph/executor/admin/SubmitJobExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ folly::Future<Status> SubmitJobExecutor::execute() {
->getMetaClient()
->submitJob(spaceId, jobOp, jobType, params)
.via(runner())
.thenValue([jobOp, this](StatusOr<meta::cpp2::AdminJobResult> &&resp) {
.thenValue([jobOp, spaceId, this](StatusOr<meta::cpp2::AdminJobResult> &&resp) {
SCOPED_TIMER(&execTime_);

if (!resp.ok()) {
LOG(ERROR) << resp.status().toString();
LOG(WARNING) << "SpaceId: " << spaceId << ", Submit job fail: " << resp.status();
return std::move(resp).status();
}
auto status = buildResult(jobOp, std::move(resp).value());
Expand Down Expand Up @@ -96,7 +96,7 @@ StatusOr<DataSet> SubmitJobExecutor::buildResult(meta::cpp2::JobOp jobOp,
}
// no default so the compiler will warning when lack
}
DLOG(FATAL) << "Unknown job operation " << static_cast<int>(jobOp);
LOG(ERROR) << "Unknown job operation " << static_cast<int>(jobOp);
return Status::Error("Unknown job job operation %d.", static_cast<int>(jobOp));
}

Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/SwitchSpaceExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ folly::Future<Status> SwitchSpaceExecutor::execute() {
return qctx()->getMetaClient()->getSpace(spaceName).via(runner()).thenValue(
[spaceName, this](StatusOr<meta::cpp2::SpaceItem> resp) {
if (!resp.ok()) {
LOG(ERROR) << resp.status();
LOG(WARNING) << "Switch space :`" << spaceName << "' fail: " << resp.status();
return resp.status();
}

Expand Down
14 changes: 7 additions & 7 deletions src/graph/executor/admin/ZoneExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ folly::Future<Status> MergeZoneExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Merge Zone Failed :" << resp.status();
LOG(WARNING) << "Merge Zone Failed :" << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -34,7 +34,7 @@ folly::Future<Status> RenameZoneExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Rename Zone Failed :" << resp.status();
LOG(WARNING) << "Rename Zone Failed :" << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -50,7 +50,7 @@ folly::Future<Status> DropZoneExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Drop Zone Failed :" << resp.status();
LOG(WARNING) << "Drop Zone Failed :" << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -66,7 +66,7 @@ folly::Future<Status> DivideZoneExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Split Zone Failed :" << resp.status();
LOG(WARNING) << "Split Zone Failed :" << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -82,7 +82,7 @@ folly::Future<Status> DescribeZoneExecutor::execute() {
.via(runner())
.thenValue([this](StatusOr<std::vector<HostAddr>> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Describe Zone Failed: " << resp.status();
LOG(WARNING) << "Describe Zone Failed: " << resp.status();
return resp.status();
}

Expand All @@ -109,7 +109,7 @@ folly::Future<Status> AddHostsIntoZoneExecutor::execute() {
.via(runner())
.thenValue([](StatusOr<bool> resp) {
if (!resp.ok()) {
LOG(ERROR) << "Add Host Into Zone Failed: " << resp.status();
LOG(WARNING) << "Add Host Into Zone Failed: " << resp.status();
return resp.status();
}
return Status::OK();
Expand All @@ -121,7 +121,7 @@ folly::Future<Status> ListZonesExecutor::execute() {
return qctx()->getMetaClient()->listZones().via(runner()).thenValue(
[this](StatusOr<std::vector<meta::cpp2::Zone>> resp) {
if (!resp.ok()) {
LOG(ERROR) << "List Zones Failed: " << resp.status();
LOG(WARNING) << "List Zones Failed: " << resp.status();
return resp.status();
}

Expand Down
Loading

0 comments on commit 20af839

Please sign in to comment.