Skip to content

Commit

Permalink
Merge branch 'master' into zone
Browse files Browse the repository at this point in the history
  • Loading branch information
liwenhui-soul committed Jan 26, 2022
2 parents 131bc05 + d650f79 commit 4cccc8d
Show file tree
Hide file tree
Showing 37 changed files with 82 additions and 1,213 deletions.
1 change: 0 additions & 1 deletion src/common/meta/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ using RemoteListeners =
std::unordered_map<GraphSpaceID,
std::unordered_map<PartitionID, std::vector<RemoteListenerInfo>>>;


} // namespace meta
} // namespace nebula

Expand Down
2 changes: 0 additions & 2 deletions src/daemons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ nebula_add_executable(
$<TARGET_OBJECTS:meta_version_man_obj>
$<TARGET_OBJECTS:meta_data_upgrade_obj>
$<TARGET_OBJECTS:meta_v2_thrift_obj>
$<TARGET_OBJECTS:meta_v1_thrift_obj>
${common_deps}
${storage_meta_deps}
LIBRARIES
Expand Down Expand Up @@ -243,7 +242,6 @@ nebula_add_executable(
$<TARGET_OBJECTS:meta_http_handler>
$<TARGET_OBJECTS:meta_version_man_obj>
$<TARGET_OBJECTS:meta_data_upgrade_obj>
$<TARGET_OBJECTS:meta_v1_thrift_obj>
${storage_meta_deps}
${common_deps}
LIBRARIES
Expand Down
9 changes: 2 additions & 7 deletions src/daemons/MetaDaemonInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,8 @@ std::unique_ptr<nebula::kvstore::KVStore> initKV(std::vector<nebula::HostAddr> p
LOG(ERROR) << "Meta version is invalid";
return nullptr;
} else if (version == nebula::meta::MetaVersion::V1) {
auto ret = nebula::meta::MetaVersionMan::updateMetaV1ToV2(engine);
if (!ret.ok()) {
LOG(ERROR) << "Update meta from V1 to V2 failed " << ret;
return nullptr;
}

nebula::meta::MetaVersionMan::setMetaVersionToKV(engine, nebula::meta::MetaVersion::V2);
LOG(ERROR) << "Can't upgrade meta from V1 to V3";
return nullptr;
} else if (version == nebula::meta::MetaVersion::V2) {
auto ret = nebula::meta::MetaVersionMan::updateMetaV2ToV3(engine);
if (!ret.ok()) {
Expand Down
1 change: 1 addition & 0 deletions src/graph/service/GraphFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ static bool ValidateSessIdleTimeout(const char* flagname, int32_t value) {
return false;
}
DEFINE_validator(session_idle_timeout_secs, &ValidateSessIdleTimeout);
DEFINE_validator(client_idle_timeout_secs, &ValidateSessIdleTimeout);
4 changes: 4 additions & 0 deletions src/graph/validator/AdminJobValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ namespace nebula {
namespace graph {

Status AdminJobValidator::validateImpl() {
if (sentence_->getCmd() == meta::cpp2::AdminCmd::DATA_BALANCE ||
sentence_->getCmd() == meta::cpp2::AdminCmd::ZONE_BALANCE) {
return Status::SemanticError("Data balance not support");
}
if (sentence_->getOp() == meta::cpp2::AdminJobOp::ADD) {
auto cmd = sentence_->getCmd();
if (requireSpace()) {
Expand Down
21 changes: 12 additions & 9 deletions src/graph/validator/AdminValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ Status CreateSpaceValidator::validateImpl() {
auto status = Status::OK();
spaceDesc_.space_name_ref() = std::move(*(sentence->spaceName()));
if (sentence->zoneNames()) {
spaceDesc_.zone_names_ref() = sentence->zoneNames()->zoneNames();
return Status::SemanticError("Create space with zone is unsupported");
}

StatusOr<std::string> retStatusOr;
std::string result;
auto *charsetInfo = qctx_->getCharsetInfo();
Expand Down Expand Up @@ -323,10 +324,6 @@ Status ShowListenerValidator::toPlan() {
}

Status AddHostsValidator::validateImpl() {
return Status::OK();
}

Status AddHostsValidator::toPlan() {
auto sentence = static_cast<AddHostsSentence *>(sentence_);
auto hosts = sentence->hosts()->hosts();
if (hosts.empty()) {
Expand All @@ -337,18 +334,19 @@ Status AddHostsValidator::toPlan() {
if (it != hosts.end()) {
return Status::SemanticError("Host have duplicated");
}
return Status::OK();
}

Status AddHostsValidator::toPlan() {
auto sentence = static_cast<AddHostsSentence *>(sentence_);
auto hosts = sentence->hosts()->hosts();
auto *addHost = AddHosts::make(qctx_, nullptr, hosts);
root_ = addHost;
tail_ = root_;
return Status::OK();
}

Status DropHostsValidator::validateImpl() {
return Status::OK();
}

Status DropHostsValidator::toPlan() {
auto sentence = static_cast<DropHostsSentence *>(sentence_);
auto hosts = sentence->hosts()->hosts();
if (hosts.empty()) {
Expand All @@ -359,7 +357,12 @@ Status DropHostsValidator::toPlan() {
if (it != hosts.end()) {
return Status::SemanticError("Host have duplicated");
}
return Status::OK();
}

Status DropHostsValidator::toPlan() {
auto sentence = static_cast<DropHostsSentence *>(sentence_);
auto hosts = sentence->hosts()->hosts();
auto *dropHost = DropHosts::make(qctx_, nullptr, hosts);
root_ = dropHost;
tail_ = root_;
Expand Down
12 changes: 6 additions & 6 deletions src/graph/validator/MaintainValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ Status ShowEdgeIndexStatusValidator::toPlan() {
}

Status MergeZoneValidator::validateImpl() {
return Status::OK();
return Status::SemanticError("Merge zone is unsupported");
}

Status MergeZoneValidator::toPlan() {
Expand All @@ -509,7 +509,7 @@ Status MergeZoneValidator::toPlan() {
}

Status RenameZoneValidator::validateImpl() {
return Status::OK();
return Status::SemanticError("Rename zone is unsupported");
}

Status RenameZoneValidator::toPlan() {
Expand All @@ -534,7 +534,7 @@ Status DropZoneValidator::toPlan() {
}

Status DivideZoneValidator::validateImpl() {
return Status::OK();
return Status::SemanticError("Divide zone is unsupported");
}

Status DivideZoneValidator::toPlan() {
Expand All @@ -558,11 +558,11 @@ Status DescribeZoneValidator::toPlan() {
return Status::OK();
}

Status ListZonesValidator::validateImpl() {
return Status::OK();
Status ShowZonesValidator::validateImpl() {
return Status::SemanticError("Show zones is unsupported");
}

Status ListZonesValidator::toPlan() {
Status ShowZonesValidator::toPlan() {
auto *doNode = ListZones::make(qctx_, nullptr);
root_ = doNode;
tail_ = root_;
Expand Down
4 changes: 2 additions & 2 deletions src/graph/validator/MaintainValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ class DescribeZoneValidator final : public Validator {
Status toPlan() override;
};

class ListZonesValidator final : public Validator {
class ShowZonesValidator final : public Validator {
public:
ListZonesValidator(Sentence* sentence, QueryContext* context) : Validator(sentence, context) {
ShowZonesValidator(Sentence* sentence, QueryContext* context) : Validator(sentence, context) {
setNoSpaceRequired();
}

Expand Down
2 changes: 1 addition & 1 deletion src/graph/validator/Validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ std::unique_ptr<Validator> Validator::makeValidator(Sentence* sentence, QueryCon
case Sentence::Kind::kDescribeZone:
return std::make_unique<DescribeZoneValidator>(sentence, context);
case Sentence::Kind::kListZones:
return std::make_unique<ListZonesValidator>(sentence, context);
return std::make_unique<ShowZonesValidator>(sentence, context);
case Sentence::Kind::kAddHostsIntoZone:
return std::make_unique<AddHostsIntoZoneValidator>(sentence, context);
case Sentence::Kind::kAddListener:
Expand Down
1 change: 1 addition & 0 deletions src/kvstore/NebulaStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ void NebulaStore::ReleaseSnapshot(GraphSpaceID spaceId, PartitionID partId, cons
if (!ok(ret)) {
LOG(INFO) << "Failed to release snapshot for GraphSpaceID " << spaceId << " PartitionID"
<< partId;
return;
}
auto part = nebula::value(ret);
return part->engine()->ReleaseSnapshot(snapshot);
Expand Down
2 changes: 0 additions & 2 deletions src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ nebula_add_library(

add_dependencies(
meta_version_man_obj
meta_v1_thrift_obj
meta_v2_thrift_obj
)

Expand All @@ -116,7 +115,6 @@ set(meta_test_deps
$<TARGET_OBJECTS:meta_service_handler>
$<TARGET_OBJECTS:meta_version_man_obj>
$<TARGET_OBJECTS:meta_v2_thrift_obj>
$<TARGET_OBJECTS:meta_v1_thrift_obj>
$<TARGET_OBJECTS:meta_data_upgrade_obj>
$<TARGET_OBJECTS:storage_admin_service_handler>
$<TARGET_OBJECTS:graph_storage_service_handler>
Expand Down
Loading

0 comments on commit 4cccc8d

Please sign in to comment.