Skip to content

Commit

Permalink
split experimental_feature flag (vesoft-inc#1429)
Browse files Browse the repository at this point in the history
<!--
Thanks for your contribution!
In order to review PR more efficiently, please add information according to the template.
-->

## What type of PR is this?
- [ ] bug
- [ ] feature
- [x] enhancement

## What problem(s) does this PR solve?
#### Issue(s) number: 

vesoft-inc#4729

#### Description:

experimental flags control toss and data balance at the same time.


## How do you solve it?

add 2 sub flag, current config only allow data balance.

```
# 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
```

## Special notes for your reviewer, ex. impact of this fix, design document, etc:



## Checklist:
Tests:
- [ ] Unit test(positive and negative cases)
- [ ] Function test
- [ ] Performance test
- [ ] N/A

Affects:
- [x] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatibility (If it breaks the compatibility, please describe it and add the label.)
- [ ] If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory


## Release notes:

Please confirm whether to be reflected in release notes and how to describe:
> add new flag to support only open toss(not suggest)/ data balance feature

Migrated from vesoft-inc#4728

Co-authored-by: Alex Xing <[email protected]>
  • Loading branch information
nebula-bots and SuperYoko authored Oct 18, 2022
1 parent abdfe0c commit e1baf18
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
# if use experimental features
--enable_experimental_feature=false

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

########## Black box ########
# Enable black box
--ng_black_box_switch=true
Expand Down
3 changes: 3 additions & 0 deletions conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
# if use experimental features
--enable_experimental_feature=false

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

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

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

######### 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
1 change: 1 addition & 0 deletions src/graph/service/GraphFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ 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");

// LDAP authentication common parameters
DEFINE_string(ldap_server,
Expand Down
1 change: 1 addition & 0 deletions src/graph/service/GraphFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DECLARE_bool(optimize_appendvertice);
DECLARE_int64(max_allowed_connections);

DECLARE_bool(enable_experimental_feature);
DECLARE_bool(enable_toss);

// LDAP authentication common parameters
DECLARE_string(ldap_server);
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 @@ -216,7 +216,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 @@ -301,7 +302,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 @@ -870,7 +871,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 e1baf18

Please sign in to comment.