Skip to content

Commit

Permalink
split experimental_feature flag (#4728)
Browse files Browse the repository at this point in the history
* split experimental_feature flag

* eof
  • Loading branch information
SuperYoko authored and Sophie-Xie committed Oct 17, 2022
1 parent edb8fff commit 515820d
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 7 deletions.
6 changes: 6 additions & 0 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@
########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false

# if use toss feature, only work if enable_experimental_feature is true
--enable_toss=false

# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true
6 changes: 6 additions & 0 deletions conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
# if use experimental features
--enable_experimental_feature=false

# if use toss feature, only work if enable_experimental_feature is true
--enable_toss=false

# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true

########## session ##########
# Maximum number of sessions that can be created per IP and per user
--max_sessions_per_ip_per_user=300
6 changes: 6 additions & 0 deletions conf/nebula-standalone.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
# if use experimental features
--enable_experimental_feature=false

# if use toss feature, only work if enable_experimental_feature is true
--enable_toss=false

# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true

######### Raft #########
# Raft election timeout
--raft_heartbeat_interval_secs=30
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/mutate/DeleteExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ folly::Future<Status> DeleteEdgesExecutor::deleteEdges() {
auto plan = qctx()->plan();
StorageClient::CommonRequestParam param(
spaceId, qctx()->rctx()->session()->id(), plan->id(), plan->isProfileEnabled());
param.useExperimentalFeature = FLAGS_enable_experimental_feature;
param.useExperimentalFeature = FLAGS_enable_experimental_feature && FLAGS_enable_toss;
return qctx()
->getStorageClient()
->deleteEdges(param, std::move(edgeKeys))
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/mutate/InsertExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ folly::Future<Status> InsertEdgesExecutor::insertEdges() {
auto plan = qctx()->plan();
StorageClient::CommonRequestParam param(
ieNode->getSpace(), qctx()->rctx()->session()->id(), plan->id(), plan->isProfileEnabled());
param.useExperimentalFeature = FLAGS_enable_experimental_feature;
param.useExperimentalFeature = FLAGS_enable_experimental_feature && FLAGS_enable_toss;
return qctx()
->getStorageClient()
->addEdges(param,
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/mutate/UpdateExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ folly::Future<Status> UpdateEdgeExecutor::execute() {
auto plan = qctx()->plan();
StorageClient::CommonRequestParam param(
ueNode->getSpaceId(), qctx()->rctx()->session()->id(), plan->id(), plan->isProfileEnabled());
param.useExperimentalFeature = FLAGS_enable_experimental_feature;
param.useExperimentalFeature = FLAGS_enable_experimental_feature && FLAGS_enable_toss;
return qctx()
->getStorageClient()
->updateEdge(param,
Expand Down
2 changes: 2 additions & 0 deletions src/graph/service/GraphFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ DEFINE_bool(disable_octal_escape_char,
" in next version to ensure compatibility with cypher.");

DEFINE_bool(enable_experimental_feature, false, "Whether to enable experimental feature");
DEFINE_bool(enable_toss, false, "Whether to enable toss feature");
DEFINE_bool(enable_data_balance, true, "Whether to enable data balance feature");

DEFINE_int32(num_rows_to_check_memory, 1024, "number rows to check memory");
DEFINE_int32(max_sessions_per_ip_per_user,
Expand Down
2 changes: 2 additions & 0 deletions src/graph/service/GraphFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ DECLARE_bool(optimize_appendvertice);
DECLARE_int64(max_allowed_connections);

DECLARE_bool(enable_experimental_feature);
DECLARE_bool(enable_toss);
DECLARE_bool(enable_data_balance);

DECLARE_bool(enable_client_white_list);
DECLARE_string(client_white_list);
Expand Down
3 changes: 2 additions & 1 deletion src/graph/validator/AdminJobValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#include "graph/validator/AdminJobValidator.h"

#include "graph/planner/plan/Admin.h"
#include "graph/service/GraphFlags.h"

namespace nebula {
namespace graph {

Status AdminJobValidator::validateImpl() {
if (sentence_->getJobType() == meta::cpp2::JobType::DATA_BALANCE ||
sentence_->getJobType() == meta::cpp2::JobType::ZONE_BALANCE) {
if (!FLAGS_enable_experimental_feature) {
if (!(FLAGS_enable_experimental_feature && FLAGS_enable_data_balance)) {
return Status::SemanticError("Data balance not support");
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/graph/validator/MutateValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ Status InsertEdgesValidator::check() {
// Check validity of vertices data.
// Check edge key type, check properties value, fill to NewEdge structure.
Status InsertEdgesValidator::prepareEdges() {
auto size = FLAGS_enable_experimental_feature ? rows_.size() : rows_.size() * 2;
auto size =
FLAGS_enable_experimental_feature && FLAGS_enable_toss ? rows_.size() : rows_.size() * 2;
edges_.reserve(size);

size_t fieldNum = schema_->getNumFields();
Expand Down Expand Up @@ -291,7 +292,7 @@ Status InsertEdgesValidator::prepareEdges() {
edge.key_ref() = key;
edge.props_ref() = std::move(entirePropValues);
edges_.emplace_back(edge);
if (!FLAGS_enable_experimental_feature) {
if (!(FLAGS_enable_experimental_feature && FLAGS_enable_toss)) {
// inbound
key.src_ref() = dstId;
key.dst_ref() = srcId;
Expand Down Expand Up @@ -826,7 +827,7 @@ Status UpdateEdgeValidator::toPlan() {
{},
condition_,
{});
if (FLAGS_enable_experimental_feature) {
if ((FLAGS_enable_experimental_feature && FLAGS_enable_toss)) {
root_ = outNode;
tail_ = root_;
} else {
Expand Down

0 comments on commit 515820d

Please sign in to comment.