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

Minor enhancement about error message #5064

Merged
merged 3 commits into from
Dec 16, 2022
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
6 changes: 3 additions & 3 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ Status MetaClient::handleResponse(const RESP& resp) {
case nebula::cpp2::ErrorCode::E_FAIL_TO_CONNECT:
return Status::Error("Fail to connect!");
case nebula::cpp2::ErrorCode::E_RPC_FAILURE:
return Status::Error("Rpc failure!");
return Status::Error("Rpc failure, probably timeout!");
case nebula::cpp2::ErrorCode::E_LEADER_CHANGED:
return Status::LeaderChanged("Leader changed!");
case nebula::cpp2::ErrorCode::E_NO_HOSTS:
Expand Down Expand Up @@ -868,8 +868,6 @@ Status MetaClient::handleResponse(const RESP& resp) {
return Status::Error("The balancer is running!");
case nebula::cpp2::ErrorCode::E_CONFIG_IMMUTABLE:
return Status::Error("Config immutable!");
case nebula::cpp2::ErrorCode::E_CONFLICT:
return Status::Error("Conflict!");
case nebula::cpp2::ErrorCode::E_INVALID_PARM:
return Status::Error("Invalid param!");
case nebula::cpp2::ErrorCode::E_WRONGCLUSTER:
Expand Down Expand Up @@ -965,6 +963,8 @@ Status MetaClient::handleResponse(const RESP& resp) {
return Status::Error("Related index exists, please drop index first");
case nebula::cpp2::ErrorCode::E_RELATED_SPACE_EXISTS:
return Status::Error("There are still space on the host");
case nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS:
return Status::Error("Related fulltext index exists, please drop it first");
default:
return Status::Error("Unknown error!");
}
Expand Down
2 changes: 1 addition & 1 deletion src/clients/storage/StorageClientBase-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ folly::Future<StatusOr<Response>> StorageClientBase<ClientType, ClientManagerTyp
invalidLeader(spaceId, partsId);
LOG(ERROR) << "Request to " << host << " failed: " << ex->what();
}
return Status::Error("RPC failure in StorageClient: %s", ex->what());
return Status::Error("RPC failure in StorageClient, probably timeout: %s", ex->what());
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/graph/executor/StorageAccessExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class StorageAccessExecutor : public Executor {

Status handleErrorCode(nebula::cpp2::ErrorCode code, PartitionID partId) const {
switch (code) {
case nebula::cpp2::ErrorCode::E_RPC_FAILURE:
return Status::Error("Storage Error: RPC failure, probably timeout.");
case nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND:
return Status::Error("Storage Error: Vertex or edge not found.");
case nebula::cpp2::ErrorCode::E_DATA_TYPE_MISMATCH: {
Expand Down
1 change: 1 addition & 0 deletions src/interface/common.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ enum ErrorCode {
E_SCHEMA_NAME_EXISTS = -2013, // Schema name already exists
E_RELATED_INDEX_EXISTS = -2014, // There are still indexes related to tag or edge, cannot drop it
E_RELATED_SPACE_EXISTS = -2015, // There are still some space on the host, cannot drop it
E_RELATED_FULLTEXT_INDEX_EXISTS = -2016, // There are still fulltext index on tag/edge

E_STORE_FAILURE = -2021, // Failed to store data
E_STORE_SEGMENT_ILLEGAL = -2022, // Illegal storage segment
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/BaseProcessor-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ nebula::cpp2::ErrorCode BaseProcessor<RESP>::indexCheck(
if (it != indexCols.end()) {
LOG(INFO) << "Index conflict, index :" << index.get_index_name()
<< ", column : " << tCol.name;
return nebula::cpp2::ErrorCode::E_CONFLICT;
return nebula::cpp2::ErrorCode::E_RELATED_INDEX_EXISTS;
}
}
}
Expand All @@ -474,7 +474,7 @@ nebula::cpp2::ErrorCode BaseProcessor<RESP>::ftIndexCheck(
std::find_if(cols.begin(), cols.end(), [&](const auto& c) { return c == iCol.name; });
if (it != cols.end()) {
LOG(INFO) << "fulltext index conflict";
return nebula::cpp2::ErrorCode::E_CONFLICT;
return nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class BaseProcessor {
* @tparam RESP
* @param items
* @param alterItems
* @return ErrorCode::E_CONFLICT if contains
* @return ErrorCode::E_RELATED_INDEX_EXISTS if contains
*/
nebula::cpp2::ErrorCode indexCheck(const std::vector<cpp2::IndexItem>& items,
const std::vector<cpp2::AlterSchemaItem>& alterItems);
Expand All @@ -350,7 +350,7 @@ class BaseProcessor {
* @tparam RESP
* @param cols
* @param alterItems
* @return nebula::cpp2::ErrorCode
* @return ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS if contains
*/
nebula::cpp2::ErrorCode ftIndexCheck(const std::vector<std::string>& cols,
const std::vector<cpp2::AlterSchemaItem>& alterItems);
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/index/CreateEdgeIndexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ void CreateEdgeIndexProcessor::process(const cpp2::CreateEdgeIndexReq& req) {
}
if (fields.size() != columnSet.size()) {
LOG(INFO) << "Conflict field in the edge index.";
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM);
onFinished();
return;
}

// A maximum of 16 columns are allowed in the index
if (columnSet.size() > maxIndexLimit) {
LOG(INFO) << "The number of index columns exceeds maximum limit " << maxIndexLimit;
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM);
onFinished();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/index/CreateTagIndexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ void CreateTagIndexProcessor::process(const cpp2::CreateTagIndexReq& req) {
}
if (fields.size() != columnSet.size()) {
LOG(INFO) << "Conflict field in the tag index.";
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM);
onFinished();
return;
}

// A maximum of 16 columns are allowed in the index.
if (columnSet.size() > maxIndexLimit) {
LOG(INFO) << "The number of index columns exceeds maximum limit " << maxIndexLimit;
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM);
onFinished();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/meta/processors/schema/CreateTagProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void CreateTagProcessor::process(const cpp2::CreateTagReq& req) {
LOG(INFO) << "Failed to create tag `" << tagName
<< "': some edge with the same name already exists.";
resp_.id_ref() = to(nebula::value(conflictRet), EntryType::TAG);
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
handleErrorCode(nebula::cpp2::ErrorCode::E_SCHEMA_NAME_EXISTS);
onFinished();
return;
} else {
Expand Down
24 changes: 12 additions & 12 deletions src/meta/test/IndexProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ TEST(IndexProcessorTest, TagIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_INVALID_PARM, resp.get_code());
}
{
cpp2::CreateTagIndexReq req;
Expand Down Expand Up @@ -665,7 +665,7 @@ TEST(IndexProcessorTest, EdgeIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_INVALID_PARM, resp.get_code());
}
{
cpp2::CreateEdgeIndexReq req;
Expand Down Expand Up @@ -834,7 +834,7 @@ TEST(IndexProcessorTest, EdgeIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_INVALID_PARM, resp.get_code());
}
{
cpp2::CreateEdgeIndexReq req;
Expand All @@ -846,7 +846,7 @@ TEST(IndexProcessorTest, EdgeIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_INVALID_PARM, resp.get_code());
}
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ TEST(IndexProcessorTest, IndexCheckAlterEdgeTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_INDEX_EXISTS, resp.get_code());
}
// Verify ErrorCode of drop
{
Expand All @@ -1024,7 +1024,7 @@ TEST(IndexProcessorTest, IndexCheckAlterEdgeTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_INDEX_EXISTS, resp.get_code());
}
}

Expand Down Expand Up @@ -1128,7 +1128,7 @@ TEST(IndexProcessorTest, IndexCheckAlterTagTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_INDEX_EXISTS, resp.get_code());
}
{
cpp2::AlterTagReq req;
Expand All @@ -1149,7 +1149,7 @@ TEST(IndexProcessorTest, IndexCheckAlterTagTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_INDEX_EXISTS, resp.get_code());
}
}

Expand Down Expand Up @@ -1997,7 +1997,7 @@ TEST(IndexProcessorTest, AlterWithFTIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS, resp.get_code());
}
{
cpp2::AlterTagReq req;
Expand All @@ -2018,7 +2018,7 @@ TEST(IndexProcessorTest, AlterWithFTIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS, resp.get_code());
}
{
cpp2::AlterTagReq req;
Expand Down Expand Up @@ -2060,7 +2060,7 @@ TEST(IndexProcessorTest, AlterWithFTIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS, resp.get_code());
}
{
cpp2::AlterEdgeReq req;
Expand All @@ -2081,7 +2081,7 @@ TEST(IndexProcessorTest, AlterWithFTIndexTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_RELATED_FULLTEXT_INDEX_EXISTS, resp.get_code());
}
{
cpp2::AlterEdgeReq req;
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/ProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ TEST(ProcessorTest, CreateEdgeTest) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code());
ASSERT_EQ(nebula::cpp2::ErrorCode::E_SCHEMA_NAME_EXISTS, resp.get_code());
}

// Set schema ttl property
Expand Down
24 changes: 12 additions & 12 deletions src/tools/db-dump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ nebula_add_executable(
curl
)

install(
TARGETS
db_dump
PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
DESTINATION
bin
COMPONENT
tool
)
#install(
# TARGETS
# db_dump
# PERMISSIONS
# OWNER_EXECUTE OWNER_WRITE OWNER_READ
# GROUP_EXECUTE GROUP_READ
# WORLD_EXECUTE WORLD_READ
# DESTINATION
# bin
# COMPONENT
# tool
#)