Skip to content

Commit

Permalink
fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
darionyaphet committed Nov 30, 2021
1 parent 40156e4 commit 5b52893
Show file tree
Hide file tree
Showing 32 changed files with 540 additions and 333 deletions.
3 changes: 1 addition & 2 deletions src/graph/executor/admin/AddHostsExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
* This source code is licensed under Apache 2.0 License.
*/

#include "graph/executor/admin/AddHostsExecutor.h"
Expand Down
3 changes: 1 addition & 2 deletions src/graph/executor/admin/AddHostsExecutor.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
* This source code is licensed under Apache 2.0 License.
*/

#ifndef GRAPH_EXECUTOR_ADMIN_ADD_HOST_EXECUTOR_H_
Expand Down
3 changes: 1 addition & 2 deletions src/graph/executor/admin/DropHostsExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
* This source code is licensed under Apache 2.0 License.
*/

#include "graph/executor/admin/DropHostsExecutor.h"
Expand Down
3 changes: 1 addition & 2 deletions src/graph/executor/admin/DropHostsExecutor.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
* This source code is licensed under Apache 2.0 License.
*/

#ifndef GRAPH_EXECUTOR_ADMIN_DROP_HOST_EXECUTOR_H_
Expand Down
2 changes: 2 additions & 0 deletions src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ nebula_add_library(
processors/zone/DropZoneProcessor.cpp
processors/zone/RenameZoneProcessor.cpp
processors/zone/GetZoneProcessor.cpp
processors/zone/MergeZoneProcessor.cpp
processors/zone/SplitZoneProcessor.cpp
processors/zone/ListZonesProcessor.cpp
processors/listener/ListenerProcessor.cpp
processors/session/SessionManagerProcessor.cpp
Expand Down
12 changes: 12 additions & 0 deletions src/meta/MetaServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
#include "meta/processors/zone/DropZoneProcessor.h"
#include "meta/processors/zone/GetZoneProcessor.h"
#include "meta/processors/zone/ListZonesProcessor.h"
#include "meta/processors/zone/MergeZoneProcessor.h"
#include "meta/processors/zone/RenameZoneProcessor.h"
#include "meta/processors/zone/SplitZoneProcessor.h"

#define RETURN_FUTURE(processor) \
auto f = processor->getFuture(); \
Expand Down Expand Up @@ -445,6 +447,16 @@ folly::Future<cpp2::GetZoneResp> MetaServiceHandler::future_getZone(const cpp2::
RETURN_FUTURE(processor);
}

folly::Future<cpp2::ExecResp> MetaServiceHandler::future_mergeZone(const cpp2::MergeZoneReq& req) {
auto* processor = MergeZoneProcessor::instance(kvstore_);
RETURN_FUTURE(processor);
}

folly::Future<cpp2::ExecResp> MetaServiceHandler::future_splitZone(const cpp2::SplitZoneReq& req) {
auto* processor = SplitZoneProcessor::instance(kvstore_);
RETURN_FUTURE(processor);
}

folly::Future<cpp2::ListZonesResp> MetaServiceHandler::future_listZones(
const cpp2::ListZonesReq& req) {
auto* processor = ListZonesProcessor::instance(kvstore_);
Expand Down
5 changes: 5 additions & 0 deletions src/meta/MetaServiceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf {

folly::Future<cpp2::GetZoneResp> future_getZone(const cpp2::GetZoneReq& req) override;

folly::Future<cpp2::ExecResp> future_mergeZone(const cpp2::MergeZoneReq& req) override;

folly::Future<cpp2::ExecResp> future_splitZone(const cpp2::SplitZoneReq& req) override;

folly::Future<cpp2::ListZonesResp> future_listZones(const cpp2::ListZonesReq& req) override;

folly::Future<cpp2::ExecResp> future_addHostsIntoZone(
Expand All @@ -210,6 +214,7 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf {

folly::Future<cpp2::GetMetaDirInfoResp> future_getMetaDirInfo(
const cpp2::GetMetaDirInfoReq& req) override;

folly::Future<cpp2::CreateSessionResp> future_createSession(
const cpp2::CreateSessionReq& req) override;

Expand Down
13 changes: 8 additions & 5 deletions src/meta/processors/parts/CreateSpaceAsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void CreateSpaceAsProcessor::process(const cpp2::CreateSpaceAsReq &req) {
}

std::vector<kvstore::KV> data;

auto newSpaceData =
makeNewSpaceData(nebula::value(oldSpaceId), nebula::value(newSpaceId), newSpaceName);
if (nebula::ok(newSpaceData)) {
Expand Down Expand Up @@ -123,9 +122,10 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
return nebula::error(partPrefix);
}
auto iter = nebula::value(partPrefix).get();
for (; iter->valid(); iter->next()) {
while (iter->valid()) {
auto partId = MetaKeyUtils::parsePartKeyPartId(iter->key());
data.emplace_back(MetaKeyUtils::partKey(newSpaceId, partId), iter->val());
iter->next();
}
return data;
}
Expand All @@ -145,7 +145,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso

std::vector<kvstore::KV> data;
auto iter = nebula::value(tagPrefix).get();
for (; iter->valid(); iter->next()) {
while (iter->valid()) {
auto val = iter->val();

auto tagId = MetaKeyUtils::parseTagId(iter->key());
Expand All @@ -157,6 +157,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
auto tagVer = MetaKeyUtils::parseTagVersion(iter->key());
auto key = MetaKeyUtils::schemaTagKey(newSpaceId, tagId, tagVer);
data.emplace_back(std::move(key), val.str());
iter->next();
}
return data;
}
Expand All @@ -176,7 +177,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso

std::vector<kvstore::KV> data;
auto iter = nebula::value(edgePrefix).get();
for (; iter->valid(); iter->next()) {
while (iter->valid()) {
auto val = iter->val();

auto edgeType = MetaKeyUtils::parseEdgeType(iter->key());
Expand All @@ -188,6 +189,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
auto ver = MetaKeyUtils::parseEdgeVersion(iter->key());
auto key = MetaKeyUtils::schemaEdgeKey(newSpaceId, edgeType, ver);
data.emplace_back(std::move(key), val.str());
iter->next();
}
return data;
}
Expand All @@ -207,7 +209,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso

std::vector<kvstore::KV> data;
auto iter = nebula::value(indexPrefix).get();
for (; iter->valid(); iter->next()) {
while (iter->valid()) {
auto val = iter->val();

auto indexId = MetaKeyUtils::parseIndexesKeyIndexID(iter->key());
Expand All @@ -219,6 +221,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
std::string(reinterpret_cast<const char *>(&indexId), sizeof(indexId)));

data.emplace_back(MetaKeyUtils::indexKey(newSpaceId, indexId), MetaKeyUtils::indexVal(idxItem));
iter->next();
}
return data;
}
Expand Down
Loading

0 comments on commit 5b52893

Please sign in to comment.