Skip to content

Commit

Permalink
drop space not exist (#5169)
Browse files Browse the repository at this point in the history
* drop space not exist

* fix test

Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
Co-authored-by: kyle.cao <kyle.cao@vesoft.com>
  • Loading branch information
3 people committed Dec 30, 2022
1 parent 2cbbbed commit d0a81b0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ Status MetaClient::handleResponse(const RESP& resp) {
return Status::Error("Snapshot failure!");
case nebula::cpp2::ErrorCode::E_SNAPSHOT_RUNNING_JOBS:
return Status::Error("Snapshot failed encounter running jobs!");
case nebula::cpp2::ErrorCode::E_SNAPSHOT_NOT_FOUND:
return Status::Error("Snapshot not found!");
case nebula::cpp2::ErrorCode::E_BLOCK_WRITE_FAILURE:
return Status::Error("Block write failure!");
case nebula::cpp2::ErrorCode::E_REBUILD_INDEX_FAILED:
Expand Down
1 change: 1 addition & 0 deletions src/common/graph/Response.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
/* Admin Failure */ \
X(E_SNAPSHOT_FAILURE, -2040) \
X(E_SNAPSHOT_RUNNING_JOBS, -2056) \
X(E_SNAPSHOT_NOT_FOUND, -2057) \
X(E_BLOCK_WRITE_FAILURE, -2041) \
X(E_REBUILD_INDEX_FAILURE, -2042) \
X(E_INDEX_WITH_TTL, -2043) \
Expand Down
4 changes: 1 addition & 3 deletions src/common/thrift/ThriftClientManager-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ std::shared_ptr<ClientType> ThriftClientManager<ClientType>::client(const HostAd
}
});
auto clientChannel = apache::thrift::RocketClientChannel::newChannel(std::move(socket));
if (timeout >= 0) {
clientChannel->setTimeout(timeout);
}
clientChannel->setTimeout(timeout);
if (compatibility) {
clientChannel->setProtocolId(apache::thrift::protocol::T_BINARY_PROTOCOL);
// clientChannel->setClientType(THRIFT_UNFRAMED_DEPRECATED);
Expand Down
1 change: 1 addition & 0 deletions src/interface/common.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ enum ErrorCode {
// Admin Failure
E_SNAPSHOT_FAILURE = -2040, // Failed to generate a snapshot
E_SNAPSHOT_RUNNING_JOBS = -2056, // Failed to generate a snapshot because encounter running jobs
E_SNAPSHOT_NOT_FOUND = -2057, // Snapshot not found when try to drop it
E_BLOCK_WRITE_FAILURE = -2041, // Failed to write block data
E_REBUILD_INDEX_FAILURE = -2042,
E_INDEX_WITH_TTL = -2043,
Expand Down
1 change: 1 addition & 0 deletions src/meta/processors/admin/DropSnapshotProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void DropSnapshotProcessor::process(const cpp2::DropSnapshotReq& req) {
auto retCode = nebula::error(ret);
if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) {
LOG(INFO) << "Snapshot " << snapshot << " does not exist or already dropped.";
handleErrorCode(nebula::cpp2::ErrorCode::E_SNAPSHOT_NOT_FOUND);
onFinished();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/SnapshotProcessorsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ TEST_F(SnapshotProcessorsTest, DropNotExist) {
auto f = processor->getFuture();
processor->process(req);
auto resp = std::move(f).get();
ASSERT_EQ(resp.code(), nebula::cpp2::ErrorCode::SUCCEEDED);
ASSERT_EQ(resp.code(), nebula::cpp2::ErrorCode::E_SNAPSHOT_NOT_FOUND);

ASSERT_EQ(getAllSnapshots().size(), 1);
}
Expand Down

0 comments on commit d0a81b0

Please sign in to comment.