Skip to content

Commit 5b52893

Browse files
committed
fix test case
1 parent 40156e4 commit 5b52893

32 files changed

+540
-333
lines changed

src/graph/executor/admin/AddHostsExecutor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Copyright (c) 2021 vesoft inc. All rights reserved.
22
*
3-
* This source code is licensed under Apache 2.0 License,
4-
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
3+
* This source code is licensed under Apache 2.0 License.
54
*/
65

76
#include "graph/executor/admin/AddHostsExecutor.h"

src/graph/executor/admin/AddHostsExecutor.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Copyright (c) 2021 vesoft inc. All rights reserved.
22
*
3-
* This source code is licensed under Apache 2.0 License,
4-
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
3+
* This source code is licensed under Apache 2.0 License.
54
*/
65

76
#ifndef GRAPH_EXECUTOR_ADMIN_ADD_HOST_EXECUTOR_H_

src/graph/executor/admin/DropHostsExecutor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Copyright (c) 2021 vesoft inc. All rights reserved.
22
*
3-
* This source code is licensed under Apache 2.0 License,
4-
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
3+
* This source code is licensed under Apache 2.0 License.
54
*/
65

76
#include "graph/executor/admin/DropHostsExecutor.h"

src/graph/executor/admin/DropHostsExecutor.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Copyright (c) 2021 vesoft inc. All rights reserved.
22
*
3-
* This source code is licensed under Apache 2.0 License,
4-
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
3+
* This source code is licensed under Apache 2.0 License.
54
*/
65

76
#ifndef GRAPH_EXECUTOR_ADMIN_DROP_HOST_EXECUTOR_H_

src/meta/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ nebula_add_library(
8686
processors/zone/DropZoneProcessor.cpp
8787
processors/zone/RenameZoneProcessor.cpp
8888
processors/zone/GetZoneProcessor.cpp
89+
processors/zone/MergeZoneProcessor.cpp
90+
processors/zone/SplitZoneProcessor.cpp
8991
processors/zone/ListZonesProcessor.cpp
9092
processors/listener/ListenerProcessor.cpp
9193
processors/session/SessionManagerProcessor.cpp

src/meta/MetaServiceHandler.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
#include "meta/processors/zone/DropZoneProcessor.h"
6868
#include "meta/processors/zone/GetZoneProcessor.h"
6969
#include "meta/processors/zone/ListZonesProcessor.h"
70+
#include "meta/processors/zone/MergeZoneProcessor.h"
7071
#include "meta/processors/zone/RenameZoneProcessor.h"
72+
#include "meta/processors/zone/SplitZoneProcessor.h"
7173

7274
#define RETURN_FUTURE(processor) \
7375
auto f = processor->getFuture(); \
@@ -445,6 +447,16 @@ folly::Future<cpp2::GetZoneResp> MetaServiceHandler::future_getZone(const cpp2::
445447
RETURN_FUTURE(processor);
446448
}
447449

450+
folly::Future<cpp2::ExecResp> MetaServiceHandler::future_mergeZone(const cpp2::MergeZoneReq& req) {
451+
auto* processor = MergeZoneProcessor::instance(kvstore_);
452+
RETURN_FUTURE(processor);
453+
}
454+
455+
folly::Future<cpp2::ExecResp> MetaServiceHandler::future_splitZone(const cpp2::SplitZoneReq& req) {
456+
auto* processor = SplitZoneProcessor::instance(kvstore_);
457+
RETURN_FUTURE(processor);
458+
}
459+
448460
folly::Future<cpp2::ListZonesResp> MetaServiceHandler::future_listZones(
449461
const cpp2::ListZonesReq& req) {
450462
auto* processor = ListZonesProcessor::instance(kvstore_);

src/meta/MetaServiceHandler.h

+5
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf {
186186

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

189+
folly::Future<cpp2::ExecResp> future_mergeZone(const cpp2::MergeZoneReq& req) override;
190+
191+
folly::Future<cpp2::ExecResp> future_splitZone(const cpp2::SplitZoneReq& req) override;
192+
189193
folly::Future<cpp2::ListZonesResp> future_listZones(const cpp2::ListZonesReq& req) override;
190194

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

211215
folly::Future<cpp2::GetMetaDirInfoResp> future_getMetaDirInfo(
212216
const cpp2::GetMetaDirInfoReq& req) override;
217+
213218
folly::Future<cpp2::CreateSessionResp> future_createSession(
214219
const cpp2::CreateSessionReq& req) override;
215220

src/meta/processors/parts/CreateSpaceAsProcessor.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ void CreateSpaceAsProcessor::process(const cpp2::CreateSpaceAsReq &req) {
4747
}
4848

4949
std::vector<kvstore::KV> data;
50-
5150
auto newSpaceData =
5251
makeNewSpaceData(nebula::value(oldSpaceId), nebula::value(newSpaceId), newSpaceName);
5352
if (nebula::ok(newSpaceData)) {
@@ -123,9 +122,10 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
123122
return nebula::error(partPrefix);
124123
}
125124
auto iter = nebula::value(partPrefix).get();
126-
for (; iter->valid(); iter->next()) {
125+
while (iter->valid()) {
127126
auto partId = MetaKeyUtils::parsePartKeyPartId(iter->key());
128127
data.emplace_back(MetaKeyUtils::partKey(newSpaceId, partId), iter->val());
128+
iter->next();
129129
}
130130
return data;
131131
}
@@ -145,7 +145,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::vector<kvstore::KV>> CreateSpaceAsProcesso
145145

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

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

177178
std::vector<kvstore::KV> data;
178179
auto iter = nebula::value(edgePrefix).get();
179-
for (; iter->valid(); iter->next()) {
180+
while (iter->valid()) {
180181
auto val = iter->val();
181182

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

208210
std::vector<kvstore::KV> data;
209211
auto iter = nebula::value(indexPrefix).get();
210-
for (; iter->valid(); iter->next()) {
212+
while (iter->valid()) {
211213
auto val = iter->val();
212214

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

221223
data.emplace_back(MetaKeyUtils::indexKey(newSpaceId, indexId), MetaKeyUtils::indexVal(idxItem));
224+
iter->next();
222225
}
223226
return data;
224227
}

0 commit comments

Comments
 (0)