diff --git a/.asf.yaml b/.asf.yaml
index 1be5482889..07decc6128 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -41,7 +41,6 @@ github:
- Analyze (java)
- CodeQL
- check-license
- - build (memory, 8)
- build (memory, 11)
required_pull_request_reviews:
dismiss_stale_reviews: true
diff --git a/.editorconfig b/.editorconfig
index 740928132a..fa6c64db75 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -25,3 +25,10 @@ insert_final_newline = true
[*.{java,xml,py}]
indent_style = space
indent_size = 4
+
+[*.{java,xml}]
+# Ignore the IDEA unsupported warning & it works well (indeed)
+continuation_indent_size = 8
+
+[*.md]
+max_line_length = off
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 356c8341d9..fbc6994ee3 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -19,7 +19,7 @@ published)
## Purpose of the PR
-- close #xxx
+- close #xxx
-- [ ] Nope
-- [ ] Dependencies (add/update license info)
+- [ ] Dependencies ([add/update license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses) info & [regenerate_dependencies](../hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh))
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
+- [ ] Nope
+
## Documentation Status
diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml
index e3632f5d38..5350d53fe6 100644
--- a/.github/workflows/check-dependencies.yml
+++ b/.github/workflows/check-dependencies.yml
@@ -13,7 +13,7 @@ jobs:
dependency-check:
runs-on: ubuntu-latest
env:
- USE_STAGE: 'false' # Whether to include the stage repository.
+ USE_STAGE: 'true' # Whether to include the stage repository.
SCRIPT_DEPENDENCY: hugegraph-server/hugegraph-dist/scripts/dependency
steps:
- name: Checkout source
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 538eb7f98c..9165bfda94 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -12,7 +12,7 @@ on:
jobs:
analyze:
env:
- USE_STAGE: 'false' # Whether to include the stage repository.
+ USE_STAGE: 'true' # Whether to include the stage repository.
name: Analyze
runs-on: ubuntu-latest
permissions:
diff --git a/.github/workflows/licence-checker.yml b/.github/workflows/licence-checker.yml
index 7a8e5dcca1..a466aacbdb 100644
--- a/.github/workflows/licence-checker.yml
+++ b/.github/workflows/licence-checker.yml
@@ -11,7 +11,7 @@ jobs:
check-license:
runs-on: ubuntu-latest
env:
- USE_STAGE: 'false' # Whether to include the stage repository.
+ USE_STAGE: 'true' # Whether to include the stage repository.
steps:
- uses: actions/checkout@v4
@@ -24,7 +24,7 @@ jobs:
token: ${{ github.token }}
config: .licenserc.yaml
- - name: License check(RAT)
+ - name: License Check (RAT)
run: |
mvn apache-rat:check -ntp
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
diff --git a/.github/workflows/pd-store.yml b/.github/workflows/pd-store-ci.yml
similarity index 89%
rename from .github/workflows/pd-store.yml
rename to .github/workflows/pd-store-ci.yml
index 595be35071..0339eaf8ac 100644
--- a/.github/workflows/pd-store.yml
+++ b/.github/workflows/pd-store-ci.yml
@@ -1,4 +1,4 @@
-name: "pd-store"
+name: "hugegraph-pd-store-ci"
on:
push:
@@ -8,11 +8,14 @@ on:
- 'test-*'
pull_request:
+# TODO: consider merge to one ci.yml file
jobs:
pd:
runs-on: ubuntu-latest
env:
- USE_STAGE: 'true' # Whether to include the stage repository.
+ # TODO: avoid duplicated env setup in pd & store
+ USE_STAGE: 'false' # Whether to include the stage repository.
+ # TODO: remove outdated env
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
REPORT_DIR: target/site/jacoco
@@ -31,9 +34,9 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
- fetch-depth: 2
+ fetch-depth: 5
- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
@@ -45,29 +48,26 @@ jobs:
run: |
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp
- - name: Prepare env and service
- run: |
- $TRAVIS_DIR/start-pd.sh
-
- - name: Run client test
+ - name: Run common test
run: |
- mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test -Dmaven.test.failure.ignore=true
+ mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test
- name: Run core test
run: |
- mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test -Dmaven.test.failure.ignore=true
+ mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test
- - name: Run cli-tools test
+ # The above tests do not require starting a PD instance.
+ - name: Prepare env and service
run: |
- mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-cli-tools-test -Dmaven.test.failure.ignore=true
+ $TRAVIS_DIR/start-pd.sh
- - name: Run common test
+ - name: Run client test
run: |
- mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test -Dmaven.test.failure.ignore=true
+ mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test
- - name: Run service test
+ - name: Run rest test
run: |
- mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-service-test -Dmaven.test.failure.ignore=true
+ mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-rest-test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.0.0
@@ -78,7 +78,8 @@ jobs:
# TODO: avoid duplicated env setup
runs-on: ubuntu-latest
env:
- USE_STAGE: 'true' # Whether to include the stage repository.
+ USE_STAGE: 'false' # Whether to include the stage repository.
+ # TODO: remove outdated env
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
REPORT_DIR: target/site/jacoco
@@ -97,9 +98,9 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
- fetch-depth: 2
+ fetch-depth: 5
- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/server-ci.yml
similarity index 96%
rename from .github/workflows/ci.yml
rename to .github/workflows/server-ci.yml
index bae3434171..7af6c3be0e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/server-ci.yml
@@ -1,4 +1,4 @@
-name: "hugegraph-ci"
+name: "hugegraph-server-ci"
on:
push:
@@ -10,6 +10,7 @@ on:
jobs:
build:
+ # TODO: we need test & replace it to ubuntu-24.04 or ubuntu-latest
runs-on: ubuntu-20.04
env:
USE_STAGE: 'false' # Whether to include the stage repository.
@@ -33,7 +34,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
- fetch-depth: 2
+ fetch-depth: 5
# TODO: Remove this step after install-backend.sh updated
- name: Install Java8 for backend
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 6b8e11f4be..4f8484ce69 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -29,7 +29,7 @@ jobs:
days-before-pr-stale: 30
days-before-pr-close: 180
operations-per-run: 10
- start-date: '2017-10-01T00:00:00Z'
+ start-date: '2016-10-01T00:00:00Z'
exempt-all-assignees: true
remove-stale-when-updated: true
diff --git a/.gitignore b/.gitignore
index 47bbf40170..bf4993e030 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,8 +19,9 @@ gen-java
.svn
### IntelliJ IDEA ###
-.idea
-.idea/
+.idea/*
+!.idea/vcs.xml
+!.idea/icon.png
*.iws
*.iml
*.ipr
@@ -83,3 +84,6 @@ hs_err_pid*
.mtj.tmp/
# blueJ files
*.ctxt
+
+# docker volumes ignore
+hugegraph-server/hugegraph-dist/docker/data/
diff --git a/.idea/icon.png b/.idea/icon.png
new file mode 100644
index 0000000000..33fb271cf1
Binary files /dev/null and b/.idea/icon.png differ
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000..fca1c13cc7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.licenserc.yaml b/.licenserc.yaml
index 809a6afb49..05b21db850 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -26,7 +26,9 @@ header: # `header` section is configurations for source codes license header.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
+
http://www.apache.org/licenses/LICENSE-2.0
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,20 +36,20 @@ header: # `header` section is configurations for source codes license header.
limitations under the License.
# `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`.
pattern: |
- Licensed to the Apache Software Foundation under one or more contributor
- license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright
- ownership. The Apache Software Foundation licenses this file to you under
- the Apache License, Version 2.0 \(the "License"\); you may
- not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation \(ASF\) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ \(the "License"\); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**'].
- '**'
@@ -89,14 +91,15 @@ header: # `header` section is configurations for source codes license header.
- '**/META-INF/MANIFEST.MF'
- '.repository/**'
- '**/.flattened-pom.xml'
- - '**/optimize/HugeScriptTraversal.java'
- - '**/type/Nameable.java'
- - '**/define/Cardinality.java'
- - '**/util/StringEncoding.java'
# TODO: temporarily added to the ignore list, need handle them before releases ( ↓ )
+ - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java'
+ - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java'
+ - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java'
+ - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java'
+ - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java'
+ - 'hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java'
- 'hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java'
- 'hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java'
- - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java'
- 'hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsEntry.java'
- 'hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsReader.java'
- 'hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsSmaps.java'
diff --git a/BUILDING.md b/BUILDING.md
index d99dda447c..b7342e68d6 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -1,28 +1,35 @@
-Building hugegraph
+Building HugeGraph
--------------
Required:
-* Java 8/11
-* Maven
+* Java 11
+* Maven 3.5+
+
+To build without executing tests: `mvn clean package -DskipTests`
+
+## Building in IDEA
To build without executing tests:
-```
-mvn clean
-mvn package -DskipTests
-```
+1. Click on "File" -> "Open", choose your project location.
+2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects".
+3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle".
+4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top navibar of "Maven Projects" window to skip tests.
+5. Double click "package" or "install" to build a project.
+
+Could also refer [Dev-In-IDEA](https://hugegraph.apache.org/docs/contribution-guidelines/hugegraph-server-idea-setup/) for more details.
-## Building on Eclipse IDE
-Note that this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin.
+## Building in Eclipse
+> Note: this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin.
To build without executing tests:
1. Right-click on your project -> "Run As..." -> "Run Configurations..."
2. On "Goals", populate with `install`
3. Select the options `Update Snapshots` and `Skip Tests`
-4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. On same window, go to "Environment" tab and click "New".
+4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. In the same window, go to "Environment" tab and click "New".
5. Under "Name:", add `JAVA_HOME`
6. Under "Value:", add the path where `java` is located
7. Click "OK"
@@ -32,13 +39,3 @@ To find the Java binary in your environment, run the appropriate command for you
* Linux/macOS: `which java`
* Windows: `for %i in (java.exe) do @echo. %~$PATH:i`
-## Building on IDEA
-
-To build without executing tests:
-
-1. Click on "File" -> "Open", choose your project location.
-2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects".
-3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle".
-4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top
-navibar of "Maven Projects" window to skip tests.
-5. Double click "package" or "install" to build project.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4df6dabf38..07d993cdd7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,7 +1,9 @@
# How to Contribute to HugeGraph
-Thanks for taking the time to contribute! As an open source project, HugeGraph is looking forward to be contributed from everyone,
-and we are also grateful to all the contributors.
+> Refer [website-doc](https://hugegraph.apache.org/docs/contribution-guidelines/) for the latest information.
+
+Thanks for taking the time to contribute!
+As an open source project, HugeGraph is looking forward to being contributed from everyone, and we are also grateful to all the contributors.
The following is a contribution guide for HugeGraph:
@@ -15,7 +17,7 @@ We can contribute by reporting issues, submitting code patches or any other feed
Before submitting the code, we need to do some preparation:
-1. Sign up or login to GitHub: [https://github.com](https://github.com)
+1. Sign up or login to GitHub: [https://github.com](https://github.com)
2. Fork HugeGraph repo from GitHub: [https://github.com/apache/incubator-hugegraph/fork](https://github.com/apache/incubator-hugegraph/fork)
@@ -64,26 +66,26 @@ Assume that we need to modify some files like "HugeGraph.java" and "HugeFactory.
```shell
# modify code to fix a bug
-vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
-vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
+vim hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
+vim hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
# run test locally (optional)
mvn test -Pcore-test,memory
```
-Note: In order to be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).
+Note: To be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).
##### 3.2.1 Check licenses
If we want to add new third-party dependencies to the `HugeGraph` project, we need to do the following things:
1. Find the third-party dependent repository, put the dependent `license` file into [./hugegraph-dist/release-docs/licenses/](https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-dist/release-docs/licenses) path.
-2. Declare the dependency in [./hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/LICENSE) `LICENSE` information.
-3. Find the NOTICE file in the repository and append it to [./hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file).
-4. Execute locally [./hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update) .
+2. Declare the dependency in [./hugegraph-server/hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/LICENSE) `LICENSE` information.
+3. Find the NOTICE file in the repository and append it to [./hugegraph-server/hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file).
+4. Execute locally [./hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update).
**Example**: A new third-party dependency is introduced into the project -> `ant-1.9.1.jar`
- The project source code is located at: https://github.com/apache/ant/tree/rel/1.9.1
- LICENSE file: https://github.com/apache/ant/blob/rel/1.9.1/LICENSE
- NOTICE file: https://github.com/apache/ant/blob/rel/1.9.1/NOTICE
-The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally update the known-dependencies.txt file.
+The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally, update the known-dependencies.txt file.
#### 3.3 Commit changes to git repo
@@ -91,8 +93,8 @@ After the code has been completed, we submit them to the local git repo:
```shell
# add files to local git index
-git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
-git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
+git add hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
+git add hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
# commit to local git repo
git commit
```
@@ -105,7 +107,7 @@ Fix bug: run deploy multiple times
fix #ISSUE_ID
```
-> Please remember to fill in the issue id, which was generated by GitHub after issue creation.
+> Please remember to fill in the issue id, which GitHub generated after issue creation.
#### 3.4 Push commit to GitHub fork repo
@@ -121,7 +123,7 @@ Note that since GitHub requires submitting code through `username + token` (inst
## 4. Create a Pull Request
-Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.
+Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, click the button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.
Note: please make sure the email address you used to submit the code is bound to the GitHub account. For how to bind the email address, please refer to https://github.com/settings/emails:
@@ -131,7 +133,7 @@ Note: please make sure the email address you used to submit the code is bound to
Maintainers will start the code review after all the **automatic** checks are passed:
- Check: Contributor License Agreement is signed
-- Check: Travis CI builds is passed (automatically Test and Deploy)
+- Check: Travis CI builds are passed (automatically Test and Deploy)
The commit will be accepted and merged if there is no problem after review.
@@ -171,8 +173,8 @@ And push it to GitHub fork repo again:
git push -f origin bugfix-branch:bugfix-branch
```
-GitHub will automatically update the Pull Request after we push it, just wait for code review.
+GitHub will automatically update the Pull Request after we push it, wait for code review.
-Any question please contact to us through [hugegraph@googlegroups.com](mailto:hugegraph@googlegroups.com) or [other contact information](https://hugegraph.github.io/hugegraph-doc/).
+For Any question, please contact us through [dev@hugegraph.apache.org](mailto:dev@hugegraph.apache.org) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only)
diff --git a/LICENSE b/LICENSE
index ad08080e31..c8b9d6ed04 100644
--- a/LICENSE
+++ b/LICENSE
@@ -207,12 +207,12 @@ Apache 2.0 licenses
The following components are provided under the Apache License. See project link for details.
The text of each license is the standard Apache 2.0 license.
-hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java from https://github.com/apache/tinkerpop
-hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java from https://github.com/apache/tinkerpop
-hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java from https://github.com/twitter-archive/snowflake
-hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java from https://github.com/apache/tinkerpop
-hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java from https://github.com/JanusGraph/janusgraph
-hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java from https://github.com/JanusGraph/janusgraph
-hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java from https://github.com/JanusGraph/janusgraph
-hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java from https://github.com/opencypher/cypher-for-gremlin
-hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java from https://github.com/opencypher/cypher-for-gremlin
+hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java from https://github.com/apache/tinkerpop
+hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java from https://github.com/apache/tinkerpop
+hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java from https://github.com/twitter-archive/snowflake
+hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java from https://github.com/apache/tinkerpop
+hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java from https://github.com/JanusGraph/janusgraph
+hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java from https://github.com/JanusGraph/janusgraph
+hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java from https://github.com/JanusGraph/janusgraph
+hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java from https://github.com/opencypher/cypher-for-gremlin
+hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java from https://github.com/opencypher/cypher-for-gremlin
diff --git a/README.md b/README.md
index 9ad381f1fe..cf64cd6743 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,9 @@
## What is Apache HugeGraph?
[HugeGraph](https://hugegraph.apache.org/) is a fast-speed and highly-scalable [graph database](https://en.wikipedia.org/wiki/Graph_database).
-Billions of vertices and edges can be easily stored into and queried from HugeGraph due to its excellent OLTP ability. As compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/) framework, various complicated graph queries can be accomplished through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful graph traversal language).
+Billions of vertices and edges can be easily stored into and queried from HugeGraph due to its excellent OLTP ability.
+As compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/) framework, various complicated graph queries can be
+achieved through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful graph traversal language).
## Features
@@ -34,13 +36,14 @@ Billions of vertices and edges can be easily stored into and queried from HugeGr
We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner
HugeGraph server with `RocksDB` (in backgrounds) for **test/dev**.
-You can visit [doc page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#3-deploy) or the [README](hugegraph-server/hugegraph-dist/docker/READEME.md) for more details.
+You can visit [doc page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#3-deploy) or
+the [README](hugegraph-server/hugegraph-dist/docker/README.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example))
> Note:
>
> 1. The docker image of hugegraph is a convenience release, but not **official distribution** artifacts. You can find more details from [ASF Release Distribution Policy](https://infra.apache.org/release-distribution.html#dockerhub).
>
-> 2. Recommand to use `release tag`(like `1.2.0`) for the stable version. Use `latest` tag to experience the newest functions in development.
+> 2. Recommend to use `release tag`(like `1.2.0`) for the stable version. Use `latest` tag to experience the newest functions in development.
### 2. Download Way
@@ -56,12 +59,11 @@ The project [doc page](https://hugegraph.apache.org/docs/) contains more informa
and provides detailed documentation for users. (Structure / Usage / API / Configs...)
And here are links of other **HugeGraph** component/repositories:
-1. [hugegraph-toolchain](https://github.com/apache/incubator-hugegraph-toolchain) (graph tools **[loader](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader)/[dashboard](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-hubble)/[tool](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-tools)/[client](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client)**)
-2. [hugegraph-computer](https://github.com/apache/incubator-hugegraph-computer) (integrated **graph computing** system)
-3. [hugegraph-commons](https://github.com/apache/incubator-hugegraph-commons) (**common & rpc** libs)
-4. [hugegraph-website](https://github.com/apache/incubator-hugegraph-doc) (**doc & website** code)
-
-
+1. [hugegraph-toolchain](https://github.com/apache/hugegraph-toolchain) (graph tools **[loader](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader)/[dashboard](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-hubble)/[tool](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-tools)/[client](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client)**)
+2. [hugegraph-computer](https://github.com/apache/hugegraph-computer) (integrated **graph computing** system)
+3. [hugegraph-commons](https://github.com/apache/hugegraph-commons) (**common & rpc** libs)
+4. [hugegraph-website](https://github.com/apache/hugegraph-doc) (**doc & website** code)
+5. [hugegraph-ai](https://github.com/apache/incubator-hugegraph-ai) (integrated **Graph AI/LLM/KG** system)
## License
diff --git a/docker/configs/application-pd0.yml b/docker/configs/application-pd0.yml
new file mode 100644
index 0000000000..6531cbafb2
--- /dev/null
+++ b/docker/configs/application-pd0.yml
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+spring:
+ application:
+ name: hugegraph-pd
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+license:
+ verify-path: ./conf/verify-license.json
+ license-path: ./conf/hugegraph.license
+grpc:
+ port: 8686
+ host: 127.0.0.1
+
+server:
+ port: 8620
+
+pd:
+ data-path: ./pd_data
+ patrol-interval: 1800
+ initial-store-count: 3
+ initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
+
+raft:
+ address: 127.0.0.1:8610
+ peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
+
+store:
+ max-down-time: 172800
+ monitor_data_enabled: true
+ monitor_data_interval: 1 minute
+ monitor_data_retention: 1 day
+ initial-store-count: 1
+
+partition:
+ default-shard-count: 1
+ store-max-shard-count: 12
diff --git a/docker/configs/application-pd1.yml b/docker/configs/application-pd1.yml
new file mode 100644
index 0000000000..0cf9f54297
--- /dev/null
+++ b/docker/configs/application-pd1.yml
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+spring:
+ application:
+ name: hugegraph-pd
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+license:
+ verify-path: ./conf/verify-license.json
+ license-path: ./conf/hugegraph.license
+grpc:
+ port: 8687
+ host: 127.0.0.1
+
+server:
+ port: 8621
+
+pd:
+ data-path: ./pd_data
+ patrol-interval: 1800
+ initial-store-count: 3
+ initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
+
+raft:
+ address: 127.0.0.1:8611
+ peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
+
+store:
+ max-down-time: 172800
+ monitor_data_enabled: true
+ monitor_data_interval: 1 minute
+ monitor_data_retention: 1 day
+ initial-store-count: 1
+
+partition:
+ default-shard-count: 1
+ store-max-shard-count: 12
diff --git a/docker/configs/application-pd2.yml b/docker/configs/application-pd2.yml
new file mode 100644
index 0000000000..a0d2c79ea3
--- /dev/null
+++ b/docker/configs/application-pd2.yml
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+spring:
+ application:
+ name: hugegraph-pd
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+license:
+ verify-path: ./conf/verify-license.json
+ license-path: ./conf/hugegraph.license
+grpc:
+ port: 8688
+ host: 127.0.0.1
+
+server:
+ port: 8622
+
+pd:
+ data-path: ./pd_data
+ patrol-interval: 1800
+ initial-store-count: 3
+ initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
+
+raft:
+ address: 127.0.0.1:8612
+ peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
+
+store:
+ max-down-time: 172800
+ monitor_data_enabled: true
+ monitor_data_interval: 1 minute
+ monitor_data_retention: 1 day
+ initial-store-count: 1
+
+partition:
+ default-shard-count: 1
+ store-max-shard-count: 12
diff --git a/docker/configs/application-store0.yml b/docker/configs/application-store0.yml
new file mode 100644
index 0000000000..d093f1bfbd
--- /dev/null
+++ b/docker/configs/application-store0.yml
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+pdserver:
+ address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+grpc:
+ host: 127.0.0.1
+ port: 8500
+ netty-server:
+ max-inbound-message-size: 1000MB
+raft:
+ disruptorBufferSize: 1024
+ address: 127.0.0.1:8510
+ max-log-file-size: 600000000000
+ snapshotInterval: 1800
+server:
+ port: 8520
+
+app:
+ data-path: ./storage
+
+spring:
+ application:
+ name: store-node-grpc-server
+ profiles:
+ active: default
+ include: pd
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+ level:
+ root: info
diff --git a/docker/configs/application-store1.yml b/docker/configs/application-store1.yml
new file mode 100644
index 0000000000..0aeba62cf6
--- /dev/null
+++ b/docker/configs/application-store1.yml
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+pdserver:
+ address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+grpc:
+ host: 127.0.0.1
+ port: 8501
+ netty-server:
+ max-inbound-message-size: 1000MB
+raft:
+ disruptorBufferSize: 1024
+ address: 127.0.0.1:8511
+ max-log-file-size: 600000000000
+ snapshotInterval: 1800
+server:
+ port: 8521
+
+app:
+ data-path: ./storage
+
+spring:
+ application:
+ name: store-node-grpc-server
+ profiles:
+ active: default
+ include: pd
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+ level:
+ root: info
diff --git a/docker/configs/application-store2.yml b/docker/configs/application-store2.yml
new file mode 100644
index 0000000000..e18dc62a3c
--- /dev/null
+++ b/docker/configs/application-store2.yml
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+pdserver:
+ address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+grpc:
+ host: 127.0.0.1
+ port: 8502
+ netty-server:
+ max-inbound-message-size: 1000MB
+raft:
+ disruptorBufferSize: 1024
+ address: 127.0.0.1:8512
+ max-log-file-size: 600000000000
+ snapshotInterval: 1800
+server:
+ port: 8522
+
+app:
+ data-path: ./storage
+
+spring:
+ application:
+ name: store-node-grpc-server
+ profiles:
+ active: default
+ include: pd
+
+logging:
+ config: 'file:./conf/log4j2.xml'
+ level:
+ root: info
diff --git a/docker/configs/server1-conf/graphs/hugegraph.properties b/docker/configs/server1-conf/graphs/hugegraph.properties
new file mode 100644
index 0000000000..66cbccb731
--- /dev/null
+++ b/docker/configs/server1-conf/graphs/hugegraph.properties
@@ -0,0 +1,19 @@
+# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
+gremlin.graph=org.apache.hugegraph.HugeFactory
+
+# cache config
+vertex.cache_type=l2
+edge.cache_type=l2
+
+store=hugegraph
+backend=hstore
+serializer=binary
+
+# pd config
+pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+# task config
+task.scheduler_type=local
+task.schedule_period=10
+task.retry=0
+task.wait_timeout=10
diff --git a/docker/configs/server1-conf/gremlin-driver-settings.yaml b/docker/configs/server1-conf/gremlin-driver-settings.yaml
new file mode 100644
index 0000000000..2f60ff8379
--- /dev/null
+++ b/docker/configs/server1-conf/gremlin-driver-settings.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8181
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server1-conf/gremlin-server.yaml b/docker/configs/server1-conf/gremlin-server.yaml
new file mode 100644
index 0000000000..df73386b26
--- /dev/null
+++ b/docker/configs/server1-conf/gremlin-server.yaml
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
+host: 127.0.0.1
+port: 8181
+
+# timeout in ms of gremlin query
+evaluationTimeout: 30000
+
+channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
+# don't set graph at here, this happens after support for dynamically adding graph
+graphs: {
+}
+scriptEngines: {
+ gremlin-groovy: {
+ staticImports: [
+ org.opencypher.gremlin.process.traversal.CustomPredicates.*',
+ org.opencypher.gremlin.traversal.CustomFunctions.*
+ ],
+ plugins: {
+ org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
+ classImports: [
+ java.lang.Math,
+ org.apache.hugegraph.backend.id.IdGenerator,
+ org.apache.hugegraph.type.define.Directions,
+ org.apache.hugegraph.type.define.NodeRole,
+ org.apache.hugegraph.masterelection.GlobalMasterInfo,
+ org.apache.hugegraph.util.DateUtil,
+ org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CountTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
+ org.apache.hugegraph.traversal.algorithm.HugeTraverser,
+ org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
+ org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.KoutTraverser,
+ org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.PathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
+ org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
+ org.apache.hugegraph.traversal.optimize.ConditionP,
+ org.apache.hugegraph.traversal.optimize.Text,
+ org.apache.hugegraph.traversal.optimize.TraversalUtil,
+ org.opencypher.gremlin.traversal.CustomFunctions,
+ org.opencypher.gremlin.traversal.CustomPredicate
+ ],
+ methodImports: [
+ java.lang.Math#*,
+ org.opencypher.gremlin.traversal.CustomPredicate#*,
+ org.opencypher.gremlin.traversal.CustomFunctions#*
+ ]
+ },
+ org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
+ files: [scripts/empty-sample.groovy]
+ }
+ }
+ }
+}
+serializers:
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+metrics: {
+ consoleReporter: {enabled: false, interval: 180000},
+ csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
+ jmxReporter: {enabled: false},
+ slf4jReporter: {enabled: false, interval: 180000},
+ gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
+ graphiteReporter: {enabled: false, interval: 180000}
+}
+maxInitialLineLength: 4096
+maxHeaderSize: 8192
+maxChunkSize: 8192
+maxContentLength: 65536
+maxAccumulationBufferComponents: 1024
+resultIterationBatchSize: 64
+writeBufferLowWaterMark: 32768
+writeBufferHighWaterMark: 65536
+ssl: {
+ enabled: false
+}
diff --git a/docker/configs/server1-conf/log4j2.xml b/docker/configs/server1-conf/log4j2.xml
new file mode 100644
index 0000000000..f1dd7e8395
--- /dev/null
+++ b/docker/configs/server1-conf/log4j2.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+ logs
+ hugegraph-server
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docker/configs/server1-conf/remote-objects.yaml b/docker/configs/server1-conf/remote-objects.yaml
new file mode 100644
index 0000000000..94ebc99190
--- /dev/null
+++ b/docker/configs/server1-conf/remote-objects.yaml
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8181
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ # The duplication of HugeGraphIoRegistry is meant to fix a bug in the
+ # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method.
+ ioRegistries: [
+ org.apache.hugegraph.io.HugeGraphIoRegistry,
+ org.apache.hugegraph.io.HugeGraphIoRegistry
+ ]
+ }
+}
diff --git a/docker/configs/server1-conf/remote.yaml b/docker/configs/server1-conf/remote.yaml
new file mode 100644
index 0000000000..2f60ff8379
--- /dev/null
+++ b/docker/configs/server1-conf/remote.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8181
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server1-conf/rest-server.properties b/docker/configs/server1-conf/rest-server.properties
new file mode 100644
index 0000000000..6e2257ce97
--- /dev/null
+++ b/docker/configs/server1-conf/rest-server.properties
@@ -0,0 +1,28 @@
+# bind url
+restserver.url=http://127.0.0.1:8081
+# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
+gremlinserver.url=http://127.0.0.1:8181
+
+graphs=./conf/graphs
+
+# configuration of arthas
+arthas.telnet_port=8562
+arthas.http_port=8561
+arthas.ip=127.0.0.1
+arthas.disabled_commands=jad
+
+# authentication configs
+# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
+# 'org.apache.hugegraph.auth.ConfigAuthenticator'
+#auth.authenticator=
+
+# rpc server configs for multi graph-servers or raft-servers
+rpc.server_host=127.0.0.1
+rpc.server_port=8091
+
+# lightweight load balancing (beta)
+server.id=server-1
+server.role=master
+
+# slow query log
+log.slow_query_threshold=1000
diff --git a/docker/configs/server2-conf/graphs/hugegraph.properties b/docker/configs/server2-conf/graphs/hugegraph.properties
new file mode 100644
index 0000000000..66cbccb731
--- /dev/null
+++ b/docker/configs/server2-conf/graphs/hugegraph.properties
@@ -0,0 +1,19 @@
+# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
+gremlin.graph=org.apache.hugegraph.HugeFactory
+
+# cache config
+vertex.cache_type=l2
+edge.cache_type=l2
+
+store=hugegraph
+backend=hstore
+serializer=binary
+
+# pd config
+pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+# task config
+task.scheduler_type=local
+task.schedule_period=10
+task.retry=0
+task.wait_timeout=10
diff --git a/docker/configs/server2-conf/gremlin-driver-settings.yaml b/docker/configs/server2-conf/gremlin-driver-settings.yaml
new file mode 100644
index 0000000000..55f38ab97d
--- /dev/null
+++ b/docker/configs/server2-conf/gremlin-driver-settings.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8182
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server2-conf/gremlin-server.yaml b/docker/configs/server2-conf/gremlin-server.yaml
new file mode 100644
index 0000000000..048dded559
--- /dev/null
+++ b/docker/configs/server2-conf/gremlin-server.yaml
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
+host: 127.0.0.1
+port: 8182
+
+# timeout in ms of gremlin query
+evaluationTimeout: 30000
+
+channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
+# don't set graph at here, this happens after support for dynamically adding graph
+graphs: {
+}
+scriptEngines: {
+ gremlin-groovy: {
+ staticImports: [
+ org.opencypher.gremlin.process.traversal.CustomPredicates.*',
+ org.opencypher.gremlin.traversal.CustomFunctions.*
+ ],
+ plugins: {
+ org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
+ classImports: [
+ java.lang.Math,
+ org.apache.hugegraph.backend.id.IdGenerator,
+ org.apache.hugegraph.type.define.Directions,
+ org.apache.hugegraph.type.define.NodeRole,
+ org.apache.hugegraph.masterelection.GlobalMasterInfo,
+ org.apache.hugegraph.util.DateUtil,
+ org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CountTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
+ org.apache.hugegraph.traversal.algorithm.HugeTraverser,
+ org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
+ org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.KoutTraverser,
+ org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.PathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
+ org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
+ org.apache.hugegraph.traversal.optimize.ConditionP,
+ org.apache.hugegraph.traversal.optimize.Text,
+ org.apache.hugegraph.traversal.optimize.TraversalUtil,
+ org.opencypher.gremlin.traversal.CustomFunctions,
+ org.opencypher.gremlin.traversal.CustomPredicate
+ ],
+ methodImports: [
+ java.lang.Math#*,
+ org.opencypher.gremlin.traversal.CustomPredicate#*,
+ org.opencypher.gremlin.traversal.CustomFunctions#*
+ ]
+ },
+ org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
+ files: [scripts/empty-sample.groovy]
+ }
+ }
+ }
+}
+serializers:
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+metrics: {
+ consoleReporter: {enabled: false, interval: 180000},
+ csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
+ jmxReporter: {enabled: false},
+ slf4jReporter: {enabled: false, interval: 180000},
+ gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
+ graphiteReporter: {enabled: false, interval: 180000}
+}
+maxInitialLineLength: 4096
+maxHeaderSize: 8192
+maxChunkSize: 8192
+maxContentLength: 65536
+maxAccumulationBufferComponents: 1024
+resultIterationBatchSize: 64
+writeBufferLowWaterMark: 32768
+writeBufferHighWaterMark: 65536
+ssl: {
+ enabled: false
+}
diff --git a/docker/configs/server2-conf/log4j2.xml b/docker/configs/server2-conf/log4j2.xml
new file mode 100644
index 0000000000..f1dd7e8395
--- /dev/null
+++ b/docker/configs/server2-conf/log4j2.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+ logs
+ hugegraph-server
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docker/configs/server2-conf/remote-objects.yaml b/docker/configs/server2-conf/remote-objects.yaml
new file mode 100644
index 0000000000..39679d8c30
--- /dev/null
+++ b/docker/configs/server2-conf/remote-objects.yaml
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8182
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ # The duplication of HugeGraphIoRegistry is meant to fix a bug in the
+ # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method.
+ ioRegistries: [
+ org.apache.hugegraph.io.HugeGraphIoRegistry,
+ org.apache.hugegraph.io.HugeGraphIoRegistry
+ ]
+ }
+}
diff --git a/docker/configs/server2-conf/remote.yaml b/docker/configs/server2-conf/remote.yaml
new file mode 100644
index 0000000000..55f38ab97d
--- /dev/null
+++ b/docker/configs/server2-conf/remote.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8182
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server2-conf/rest-server.properties b/docker/configs/server2-conf/rest-server.properties
new file mode 100644
index 0000000000..e55fb6b635
--- /dev/null
+++ b/docker/configs/server2-conf/rest-server.properties
@@ -0,0 +1,26 @@
+# bind url
+restserver.url=http://127.0.0.1:8082
+# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
+gremlinserver.url=http://127.0.0.1:8182
+
+graphs=./conf/graphs
+
+# configuration of arthas
+arthas.telnet_port=8572
+arthas.http_port=8571
+arthas.ip=127.0.0.1
+arthas.disabled_commands=jad
+
+# authentication configs
+# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
+# 'org.apache.hugegraph.auth.ConfigAuthenticator'
+#auth.authenticator=
+
+# rpc server configs for multi graph-servers or raft-servers
+rpc.server_host=127.0.0.1
+rpc.server_port=8092
+#rpc.server_timeout=30
+
+# lightweight load balancing (beta)
+server.id=server-2
+server.role=worker
diff --git a/docker/configs/server3-conf/graphs/hugegraph.properties b/docker/configs/server3-conf/graphs/hugegraph.properties
new file mode 100644
index 0000000000..66cbccb731
--- /dev/null
+++ b/docker/configs/server3-conf/graphs/hugegraph.properties
@@ -0,0 +1,19 @@
+# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
+gremlin.graph=org.apache.hugegraph.HugeFactory
+
+# cache config
+vertex.cache_type=l2
+edge.cache_type=l2
+
+store=hugegraph
+backend=hstore
+serializer=binary
+
+# pd config
+pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
+
+# task config
+task.scheduler_type=local
+task.schedule_period=10
+task.retry=0
+task.wait_timeout=10
diff --git a/docker/configs/server3-conf/gremlin-driver-settings.yaml b/docker/configs/server3-conf/gremlin-driver-settings.yaml
new file mode 100644
index 0000000000..00ef046699
--- /dev/null
+++ b/docker/configs/server3-conf/gremlin-driver-settings.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8183
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server3-conf/gremlin-server.yaml b/docker/configs/server3-conf/gremlin-server.yaml
new file mode 100644
index 0000000000..e153926bc9
--- /dev/null
+++ b/docker/configs/server3-conf/gremlin-server.yaml
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
+host: 127.0.0.1
+port: 8183
+
+# timeout in ms of gremlin query
+evaluationTimeout: 30000
+
+channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
+# don't set graph at here, this happens after support for dynamically adding graph
+graphs: {
+}
+scriptEngines: {
+ gremlin-groovy: {
+ staticImports: [
+ org.opencypher.gremlin.process.traversal.CustomPredicates.*',
+ org.opencypher.gremlin.traversal.CustomFunctions.*
+ ],
+ plugins: {
+ org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
+ classImports: [
+ java.lang.Math,
+ org.apache.hugegraph.backend.id.IdGenerator,
+ org.apache.hugegraph.type.define.Directions,
+ org.apache.hugegraph.type.define.NodeRole,
+ org.apache.hugegraph.masterelection.GlobalMasterInfo,
+ org.apache.hugegraph.util.DateUtil,
+ org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CountTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
+ org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
+ org.apache.hugegraph.traversal.algorithm.HugeTraverser,
+ org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
+ org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.KoutTraverser,
+ org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.PathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
+ org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
+ org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
+ org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
+ org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
+ org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
+ org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
+ org.apache.hugegraph.traversal.optimize.ConditionP,
+ org.apache.hugegraph.traversal.optimize.Text,
+ org.apache.hugegraph.traversal.optimize.TraversalUtil,
+ org.opencypher.gremlin.traversal.CustomFunctions,
+ org.opencypher.gremlin.traversal.CustomPredicate
+ ],
+ methodImports: [
+ java.lang.Math#*,
+ org.opencypher.gremlin.traversal.CustomPredicate#*,
+ org.opencypher.gremlin.traversal.CustomFunctions#*
+ ]
+ },
+ org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
+ files: [scripts/empty-sample.groovy]
+ }
+ }
+ }
+}
+serializers:
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+ - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+ }
+metrics: {
+ consoleReporter: {enabled: false, interval: 180000},
+ csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
+ jmxReporter: {enabled: false},
+ slf4jReporter: {enabled: false, interval: 180000},
+ gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
+ graphiteReporter: {enabled: false, interval: 180000}
+}
+maxInitialLineLength: 4096
+maxHeaderSize: 8192
+maxChunkSize: 8192
+maxContentLength: 65536
+maxAccumulationBufferComponents: 1024
+resultIterationBatchSize: 64
+writeBufferLowWaterMark: 32768
+writeBufferHighWaterMark: 65536
+ssl: {
+ enabled: false
+}
diff --git a/docker/configs/server3-conf/log4j2.xml b/docker/configs/server3-conf/log4j2.xml
new file mode 100644
index 0000000000..f1dd7e8395
--- /dev/null
+++ b/docker/configs/server3-conf/log4j2.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+ logs
+ hugegraph-server
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docker/configs/server3-conf/remote-objects.yaml b/docker/configs/server3-conf/remote-objects.yaml
new file mode 100644
index 0000000000..ce99fcb2f6
--- /dev/null
+++ b/docker/configs/server3-conf/remote-objects.yaml
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8183
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ # The duplication of HugeGraphIoRegistry is meant to fix a bug in the
+ # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method.
+ ioRegistries: [
+ org.apache.hugegraph.io.HugeGraphIoRegistry,
+ org.apache.hugegraph.io.HugeGraphIoRegistry
+ ]
+ }
+}
diff --git a/docker/configs/server3-conf/remote.yaml b/docker/configs/server3-conf/remote.yaml
new file mode 100644
index 0000000000..00ef046699
--- /dev/null
+++ b/docker/configs/server3-conf/remote.yaml
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+hosts: [localhost]
+port: 8183
+serializer: {
+ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
+ config: {
+ serializeResultToString: false,
+ ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
+ }
+}
diff --git a/docker/configs/server3-conf/rest-server.properties b/docker/configs/server3-conf/rest-server.properties
new file mode 100644
index 0000000000..af1d7301db
--- /dev/null
+++ b/docker/configs/server3-conf/rest-server.properties
@@ -0,0 +1,25 @@
+# bind url
+restserver.url=http://127.0.0.1:8083
+# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
+gremlinserver.url=http://127.0.0.1:8183
+
+graphs=./conf/graphs
+
+# configuration of arthas
+arthas.telnet_port=8582
+arthas.http_port=8581
+arthas.ip=127.0.0.1
+arthas.disabled_commands=jad
+
+# authentication configs
+# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
+# 'org.apache.hugegraph.auth.ConfigAuthenticator'
+#auth.authenticator=
+
+# rpc server configs for multi graph-servers or raft-servers
+rpc.server_host=127.0.0.1
+rpc.server_port=8093
+
+# lightweight load balancing (beta)
+server.id=server-3
+server.role=worker
diff --git a/docker/docker-compose-3pd-3store-3server.yml b/docker/docker-compose-3pd-3store-3server.yml
new file mode 100644
index 0000000000..f704c1c0f6
--- /dev/null
+++ b/docker/docker-compose-3pd-3store-3server.yml
@@ -0,0 +1,180 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# TODO: reuse the configs for same type containers
+# User could modify the node nums and the port by themselves
+version: "3"
+
+services:
+ pd0:
+ image: hugegraph/pd
+ container_name: pd0
+ hostname: pd0
+ network_mode: host
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8620"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-pd0.yml:/hugegraph-pd/conf/application.yml
+
+ pd1:
+ image: hugegraph/pd
+ container_name: pd1
+ hostname: pd1
+ network_mode: host
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8621"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-pd1.yml:/hugegraph-pd/conf/application.yml
+
+ pd2:
+ image: hugegraph/pd
+ container_name: pd2
+ hostname: pd2
+ network_mode: host
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8622"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-pd2.yml:/hugegraph-pd/conf/application.yml
+
+ store0:
+ image: hugegraph/store
+ container_name: store0
+ hostname: store0
+ network_mode: host
+ depends_on:
+ pd0:
+ condition: service_healthy
+ pd1:
+ condition: service_healthy
+ pd2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8520"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-store0.yml:/hugegraph-store/conf/application.yml
+
+ store1:
+ image: hugegraph/store
+ container_name: store1
+ hostname: store1
+ network_mode: host
+ depends_on:
+ pd0:
+ condition: service_healthy
+ pd1:
+ condition: service_healthy
+ pd2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8521"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-store1.yml:/hugegraph-store/conf/application.yml
+
+ store2:
+ image: hugegraph/store
+ container_name: store2
+ hostname: store2
+ network_mode: host
+ depends_on:
+ pd0:
+ condition: service_healthy
+ pd1:
+ condition: service_healthy
+ pd2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8522"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/application-store2.yml:/hugegraph-store/conf/application.yml
+
+ server1:
+ image: hugegraph/server
+ container_name: server1
+ hostname: server1
+ network_mode: host
+ depends_on:
+ store0:
+ condition: service_healthy
+ store1:
+ condition: service_healthy
+ store2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8081"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/server1-conf:/hugegraph-server/conf
+
+ server2:
+ image: hugegraph/server
+ container_name: server2
+ hostname: server2
+ network_mode: host
+ depends_on:
+ store0:
+ condition: service_healthy
+ store1:
+ condition: service_healthy
+ store2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8082"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/server2-conf:/hugegraph-server/conf
+
+ server3:
+ image: hugegraph/server
+ container_name: server3
+ hostname: server3
+ network_mode: host
+ depends_on:
+ store0:
+ condition: service_healthy
+ store1:
+ condition: service_healthy
+ store2:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8083"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ volumes:
+ - ./configs/server3-conf:/hugegraph-server/conf
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000000..0c90c1e451
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+version: "3"
+
+services:
+ pd:
+ image: hugegraph/pd
+ container_name: pd
+ hostname: pd
+ network_mode: host
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8620"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+
+ store:
+ image: hugegraph/store
+ container_name: store
+ hostname: store
+ network_mode: host
+ depends_on:
+ pd:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8520"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+
+ server:
+ image: hugegraph/server
+ container_name: server
+ hostname: server
+ network_mode: host
+ depends_on:
+ store:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080"]
+ interval: 10s
+ timeout: 5s
+ retries: 3
diff --git a/hugegraph-pd/.gitignore b/hugegraph-pd/.gitignore
index 689a7a80b3..9a447456f0 100644
--- a/hugegraph-pd/.gitignore
+++ b/hugegraph-pd/.gitignore
@@ -7,7 +7,5 @@
**/tmp/
*.log
*.iml
-/hg-pd-common/target_B000000405016P_Oct-28-114458-2021_conflict_parent/
-
dist/
.flattened-pom.xml
diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile
new file mode 100644
index 0000000000..b9cdb2209e
--- /dev/null
+++ b/hugegraph-pd/Dockerfile
@@ -0,0 +1,66 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Dockerfile for HugeGraph PD
+# 1st stage: build source code
+FROM maven:3.9.0-eclipse-temurin-11 AS build
+
+COPY . /pkg
+WORKDIR /pkg
+ARG MAVEN_ARGS
+
+RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \
+ ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/dist/*.tar.gz && rm ./hugegraph-store/dist/*.tar.gz
+
+# 2nd stage: runtime env
+# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13
+FROM openjdk:11-slim
+
+COPY --from=build /pkg/hugegraph-pd/dist/hugegraph-pd-*/ /hugegraph-pd/
+LABEL maintainer="HugeGraph Docker Maintainers "
+
+# TODO: use g1gc or zgc as default
+ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \
+ HUGEGRAPH_HOME="hugegraph-pd"
+
+#COPY . /hugegraph/hugegraph-pd
+WORKDIR /hugegraph-pd/
+
+# 1. Install environment and init HugeGraph Sever
+RUN set -x \
+ && apt-get -q update \
+ && apt-get -q install -y --no-install-recommends --no-install-suggests \
+ dumb-init \
+ procps \
+ curl \
+ lsof \
+ vim \
+ cron \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/* \
+ && service cron start \
+ && pwd && cd /hugegraph-pd/
+
+# 2. Init docker script
+COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh .
+RUN chmod 755 ./docker-entrypoint.sh
+
+EXPOSE 8620
+VOLUME /hugegraph-pd
+
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+CMD ["./docker-entrypoint.sh"]
diff --git a/hugegraph-pd/build-pre.sh b/hugegraph-pd/build-pre.sh
deleted file mode 100644
index f92d104eea..0000000000
--- a/hugegraph-pd/build-pre.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-mkdir output
-touch output/1
-export JAVA_HOME=$ORACLEJDK_1_8_0_HOME
-
-readonly VER=3.6.3
-readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local
-
-$MAVEN_3_5_3_BIN/mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set
-$MAVEN_3_5_3_BIN/mvn --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy
-$MAVEN_3_5_3_BIN/mvn versions:revert
-
-
-#------------------repo-----------------------
-readonly FILE_NAME=hugegraph-pd-3.6.3.tar.gz
-readonly REPO_URL_FILE=http://127.0.0.1:8081/artifactory/star-file
-
-localFilePath=dist/${FILE_NAME}
-targetFolder="${REPO_URL_FILE}/dist/$(date '+%Y-%m-%d')/"
-artifactoryUser="admin"
-artifactoryPassword="JFrog12345"
-
-md5Value="$(md5sum "$localFilePath")"
-md5Value="${md5Value:0:32}"
-sha1Value="$(sha1sum "$localFilePath")"
-sha1Value="${sha1Value:0:40}"
-sha256Value="$(sha256sum "$localFilePath")"
-sha256Value="${sha256Value:0:65}"
-
-#curl -X PUT -u admin:JFrog12345 -T ${localFilePath} "${REPO_URL_FILE}/dist/${data_folder}/"
-echo "INFO: Uploading $localFilePath to $targetFolder"
-curl -i -X PUT -u "$artifactoryUser:$artifactoryPassword" \
- -H "X-Checksum-Md5: $md5Value" \
- -H "X-Checksum-Sha1: $sha1Value" \
- -H "X-Checksum-Sha256: $sha256Value" \
- -T "$localFilePath" \
- "$targetFolder"
diff --git a/hugegraph-pd/build.sh b/hugegraph-pd/build.sh
deleted file mode 100644
index f77358e1cc..0000000000
--- a/hugegraph-pd/build.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-export PATH=$MAVEN_3_5_3_BIN:$ORACLEJDK_11_0_7_BIN:$PATH
-export JAVA_HOME=$ORACLEJDK_11_0_7_HOME
-export MAVEN_HOME=$MAVEN_3_5_3_HOME
-
-# TODO: remove later
-readonly REPO_URL=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots
-
-if [ ! -n "$1" ] ;then
- GOAL=package
-else
- GOAL=$1
-fi
-
-$MAVEN_3_5_3_BIN/mvn -Dmaven.test.skip=true -DaltDeploymentRepository=Baidu_Local_Snapshots::default::${REPO_URL} clean ${GOAL}
-echo "mv dist...."
-mv dist output
-ls output
-echo "mv dist done"
-echo "show output...."
-ls output
-echo "show output done"
diff --git a/hugegraph-pd/deploy-release.sh b/hugegraph-pd/deploy-release.sh
deleted file mode 100644
index 118a214d7f..0000000000
--- a/hugegraph-pd/deploy-release.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-readonly VER=3.6.3
-readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local
-#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set
-
-./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set
-./mvnw --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy
-./mvnw versions:revert
diff --git a/hugegraph-pd/deploy-snapshot.sh b/hugegraph-pd/deploy-snapshot.sh
deleted file mode 100644
index 118a214d7f..0000000000
--- a/hugegraph-pd/deploy-snapshot.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-readonly VER=3.6.3
-readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local
-#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set
-
-./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set
-./mvnw --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy
-./mvnw versions:revert
diff --git a/hugegraph-pd/hg-pd-client/pom.xml b/hugegraph-pd/hg-pd-client/pom.xml
index c2d67ff92d..a64756fe94 100644
--- a/hugegraph-pd/hg-pd-client/pom.xml
+++ b/hugegraph-pd/hg-pd-client/pom.xml
@@ -1,19 +1,19 @@
getPartitionById(String graphName, int partId) {
try {
GraphCache graph = initGraph(graphName);
Partition partition = graph.getPartition(partId);
- Shard shard = groups.get(partId).getValue();
- if (partition == null || shard == null) {
+ if (partition == null) {
+ return null;
+ }
+ KVPair group = groups.get(partId);
+ if (group == null) {
+ return null;
+ }
+ Shard shard = group.getValue();
+ if (shard == null) {
return null;
}
return new KVPair<>(partition, shard);
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java
index 4222bfbe50..713657bd59 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java
@@ -1,25 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
+import org.apache.hugegraph.pd.common.Useless;
import org.apache.hugegraph.pd.grpc.discovery.NodeInfos;
import org.apache.hugegraph.pd.grpc.discovery.Query;
+@Useless
public interface Discoverable {
NodeInfos getNodeInfos(Query query);
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java
index aa80ec606f..fe1546ae61 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
@@ -28,6 +28,7 @@
import java.util.function.Function;
import org.apache.hugegraph.pd.common.PDException;
+import org.apache.hugegraph.pd.common.Useless;
import org.apache.hugegraph.pd.grpc.discovery.DiscoveryServiceGrpc;
import org.apache.hugegraph.pd.grpc.discovery.NodeInfo;
import org.apache.hugegraph.pd.grpc.discovery.NodeInfos;
@@ -38,6 +39,7 @@
import io.grpc.ManagedChannelBuilder;
import lombok.extern.slf4j.Slf4j;
+@Useless
@Slf4j
public abstract class DiscoveryClient implements Closeable, Discoverable {
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java
index 77ec9a36b2..b6b3e98204 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
@@ -20,9 +20,11 @@
import java.util.Map;
import java.util.function.Consumer;
+import org.apache.hugegraph.pd.common.Useless;
import org.apache.hugegraph.pd.grpc.discovery.NodeInfo;
import org.apache.hugegraph.pd.grpc.discovery.RegisterType;
+@Useless
public class DiscoveryClientImpl extends DiscoveryClient {
private final String id;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/KvClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/KvClient.java
index 27975ca57c..3e5c2359ed 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/KvClient.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/KvClient.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java
index b86d6b3946..d9a2ef5fe2 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java
@@ -1,23 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
import org.apache.hugegraph.pd.common.KVPair;
+import org.apache.hugegraph.pd.common.Useless;
import org.apache.hugegraph.pd.grpc.PDGrpc;
import org.apache.hugegraph.pd.grpc.Pdpb;
@@ -27,6 +28,7 @@
import io.grpc.stub.AbstractStub;
import lombok.extern.slf4j.Slf4j;
+@Useless
@Slf4j
public class LicenseClient extends AbstractClient {
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
index 6c86f96376..fa1e595264 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDConfig.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDConfig.java
index 64558436ea..16686a265b 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDConfig.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDConfig.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java
index 025d6f7ae8..4b9bf32c4e 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java
index 2d1ccb743e..d01cd42d70 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java
index 3da255a825..1428fe762d 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java
index 73796b53fb..a35893a33a 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PartitionNotice.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PartitionNotice.java
index b6e5555e6a..f8ee9b994c 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PartitionNotice.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PartitionNotice.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.pulse;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java
index 251bab07f9..0c83f2b06e 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.pulse;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/NodeEvent.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/NodeEvent.java
index 893566b9f5..484d9a08c7 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/NodeEvent.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/NodeEvent.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java
index c4ff91b107..d663f34a3c 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java
index 76a4fdc7d9..0211cf8ec9 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java
index e14bfafdc1..e537701936 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-clitools/pom.xml b/hugegraph-pd/hg-pd-clitools/pom.xml
deleted file mode 100644
index d408b45baf..0000000000
--- a/hugegraph-pd/hg-pd-clitools/pom.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
- hugegraph-pd
- org.apache.hugegraph
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- hg-pd-clitools
-
-
- org.apache.hugegraph
- hg-pd-client
- ${revision}
-
-
- junit
- junit
- 4.13.2
- test
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- package
-
- single
-
-
-
-
-
- org.apache.hugegraph.pd.clitools.Main
-
-
-
-
- jar-with-dependencies
-
-
-
-
-
-
-
-
diff --git a/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java b/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java
deleted file mode 100644
index f1db9cc8de..0000000000
--- a/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd.clitools;
-
-import org.apache.hugegraph.pd.client.PDClient;
-import org.apache.hugegraph.pd.client.PDConfig;
-import org.apache.hugegraph.pd.common.PDException;
-import org.apache.hugegraph.pd.grpc.Metapb;
-
-public class Main {
-
- public static void main(String[] args) throws PDException {
- if (args.length < 3) {
- String error = " usage: pd-address config key[=value] \n key list: " +
- "\n\tenableBatchLoad";
- System.out.println(error);
- System.exit(0);
- }
- String pd = args[0];
- String cmd = args[1];
- String param = args[2];
- System.out.println(pd + " " + cmd + " " + param);
- System.out.println("Result: \n");
- switch (cmd) {
- case "config":
- doConfig(pd, param);
- case "change_raft":
- doChangeRaft(pd, param);
- }
- }
-
- private static void doChangeRaft(String pd, String param) throws PDException {
- PDClient pdClient = PDClient.create(PDConfig.of(pd));
- pdClient.updatePdRaft(param);
- }
-
- public static void doConfig(String pd, String param) throws PDException {
- PDClient pdClient = PDClient.create(PDConfig.of(pd));
- String[] pair = param.split("=");
- String key = pair[0].trim();
- Object value = null;
- if (pair.length > 1) {
- value = pair[1].trim();
- }
- if (value == null) {
- Metapb.PDConfig pdConfig = pdClient.getPDConfig();
- switch (key) {
- case "enableBatchLoad":
- // value = pdConfig.getEnableBatchLoad();
- break;
- case "shardCount":
- value = pdConfig.getShardCount();
- break;
- }
-
- System.out.println("Get config " + key + "=" + value);
- } else {
- Metapb.PDConfig.Builder builder = Metapb.PDConfig.newBuilder();
- switch (key) {
- case "enableBatchLoad":
- // builder.setEnableBatchLoad(Boolean.valueOf((String)value));
- case "shardCount":
- builder.setShardCount(Integer.valueOf((String) value));
- }
- pdClient.setPDConfig(builder.build());
- System.out.println("Set config " + key + "=" + value);
- }
- }
-
-}
diff --git a/hugegraph-pd/hg-pd-common/pom.xml b/hugegraph-pd/hg-pd-common/pom.xml
index 1997660099..918c8deab8 100644
--- a/hugegraph-pd/hg-pd-common/pom.xml
+++ b/hugegraph-pd/hg-pd-common/pom.xml
@@ -1,19 +1,19 @@
SEQUENCES = new ConcurrentHashMap<>();
- public static long CID_DEL_TIMEOUT = 24 * 3600 * 1000;
+ private static long CID_DEL_TIMEOUT = 24 * 3600 * 1000;
private final long clusterId;
public IdMetaStore(PDConfig pdConfig) {
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java
index ab3660034d..ee791d5e04 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataFactory.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataFactory.java
index b8e824c3c5..c70eec489d 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataFactory.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataFactory.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataKeyHelper.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataKeyHelper.java
index a8866a2217..8a421c2d60 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataKeyHelper.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataKeyHelper.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java
index 05aa938f07..bf77e41c05 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataStoreBase.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataStoreBase.java
index 297384c146..10c38a3ec6 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataStoreBase.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataStoreBase.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/PartitionMeta.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/PartitionMeta.java
index 38cce28b05..09a4eb8e20 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/PartitionMeta.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/PartitionMeta.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java
index ce850e5b90..74820ab023 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/StoreInfoMeta.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/StoreInfoMeta.java
index dfe709dfd6..45959211d8 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/StoreInfoMeta.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/StoreInfoMeta.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/TaskInfoMeta.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/TaskInfoMeta.java
index cdbc022dd3..148101de4d 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/TaskInfoMeta.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/TaskInfoMeta.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.meta;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/FutureClosureAdapter.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/FutureClosureAdapter.java
index e7b985842e..1991a78db9 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/FutureClosureAdapter.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/FutureClosureAdapter.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
@@ -45,4 +45,4 @@ public void failure(Throwable t) {
public void run(Status status) {
}
-}
\ No newline at end of file
+}
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVOperation.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVOperation.java
index 4af18f50a2..9169a248dc 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVOperation.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVOperation.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVStoreClosure.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVStoreClosure.java
index db13f0ceb1..cb5291703a 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVStoreClosure.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVStoreClosure.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
@@ -30,4 +30,4 @@ public interface KVStoreClosure extends Closure {
Object getData();
void setData(final Object data);
-}
\ No newline at end of file
+}
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftEngine.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftEngine.java
index 910240cbd7..6882585a08 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftEngine.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftEngine.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
@@ -159,6 +159,9 @@ public void shutDown() {
}
public boolean isLeader() {
+ if (Objects.isNull(this.raftNode)) {
+ return false;
+ }
return this.raftNode.isLeader(true);
}
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcClient.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcClient.java
index 1dafc43b28..2e17a65eef 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcClient.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcClient.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcProcessor.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcProcessor.java
index 984e59c60a..1286515de2 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcProcessor.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcProcessor.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateListener.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateListener.java
index 3c4de74e2c..020be6f8bb 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateListener.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateListener.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateMachine.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateMachine.java
index 6b3815d6cc..4733212022 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateMachine.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftStateMachine.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftTaskHandler.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftTaskHandler.java
index 310cf0fbae..6dfced4c98 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftTaskHandler.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftTaskHandler.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/ZipUtils.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/ZipUtils.java
index 8bb417db48..ed75b54211 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/ZipUtils.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/ZipUtils.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.raft;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/BaseKVStoreClosure.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/BaseKVStoreClosure.java
index 14c5c3a13e..84974aea27 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/BaseKVStoreClosure.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/BaseKVStoreClosure.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.store;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStore.java
index d8cf954f08..bfa2f1ded9 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStore.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStore.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.store;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStoreImpl.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStoreImpl.java
index 8ef79bbb7d..88ebd5ca28 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStoreImpl.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStoreImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.store;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/KV.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/KV.java
index fec074579d..763a8541a8 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/KV.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/KV.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.store;
diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/RaftKVStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/RaftKVStore.java
index ca86a5aacf..b9e373ce8b 100644
--- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/RaftKVStore.java
+++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/RaftKVStore.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.store;
diff --git a/hugegraph-pd/ci.yml b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
similarity index 60%
rename from hugegraph-pd/ci.yml
rename to hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
index 0eb7515ae3..fd894d5518 100644
--- a/hugegraph-pd/ci.yml
+++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -15,29 +16,7 @@
# limitations under the License.
#
-Global:
- tool: build_submitter
- languages:
- # Java Version: 1.7, 1.8, 9, 10
- - language: java
- version: 11
- envs:
- # Maven Version: 3.0.4, 3.1.1, 3.2.5, 3.3.9, 3.5.3
- - env: maven
- version: 3.5.3
-Default:
- profile: [ dev ]
-Profiles:
- - profile:
- name: dev
- tool: build_submitter
- env: DECK_CENTOS7U5_K3
- command: sh build.sh
- release: true
+# start hugegraph pd
+./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS"
- - profile:
- name: deploy
- tool: build_submitter
- env: DECK_CENTOS7U5_K3
- command: sh build.sh deploy
- release: true
+tail -f /dev/null
diff --git a/hugegraph-pd/hg-pd-dist/pom.xml b/hugegraph-pd/hg-pd-dist/pom.xml
index 3cb51b3938..719fc11c49 100644
--- a/hugegraph-pd/hg-pd-dist/pom.xml
+++ b/hugegraph-pd/hg-pd-dist/pom.xml
@@ -1,19 +1,19 @@
@@ -54,4 +54,4 @@
-
\ No newline at end of file
+
diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh
index 05b3921c71..d4264e841c 100644
--- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh
+++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh
@@ -2,19 +2,19 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
#
if [ -z "$GC_OPTION" ];then
@@ -23,12 +23,17 @@ fi
if [ -z "$USER_OPTION" ];then
USER_OPTION=""
fi
+if [ -z "$OPEN_TELEMETRY" ];then
+ OPEN_TELEMETRY="false"
+fi
-while getopts "g:j:v" arg; do
+while getopts "g:j:y:" arg; do
case ${arg} in
g) GC_OPTION="$OPTARG" ;;
j) USER_OPTION="$OPTARG" ;;
- ?) echo "USAGE: $0 [-g g1] [-j xxx] [-v]" && exit 1 ;;
+ # Telemetry is used to collect metrics, traces and logs
+ y) OPEN_TELEMETRY="$OPTARG" ;;
+ ?) echo "USAGE: $0 [-g g1] [-j xxx] [-y true|false]" && exit 1 ;;
esac
done
@@ -46,13 +51,16 @@ BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
CONF="$TOP/conf"
LIB="$TOP/lib"
+PLUGINS="$TOP/plugins"
LOGS="$TOP/logs"
OUTPUT=${LOGS}/hugegraph-pd-stdout.log
+GITHUB="https://github.com"
PID_FILE="$BIN/pid"
. "$BIN"/util.sh
-mkdir -p ${LOGS}
+ensure_path_writable "$LOGS"
+ensure_path_writable "$PLUGINS"
# The maximum and minium heap memory that service can use
MAX_MEM=$((32 * 1024))
@@ -104,6 +112,44 @@ case "$GC_OPTION" in
exit 1
esac
+if [ "${OPEN_TELEMETRY}" == "true" ]; then
+ OT_JAR="opentelemetry-javaagent.jar"
+ OT_JAR_PATH="${PLUGINS}/${OT_JAR}"
+
+ if [[ ! -e "${OT_JAR_PATH}" ]]; then
+ echo "## Downloading ${OT_JAR}..."
+ download "${PLUGINS}" \
+ "${GITHUB}/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/${OT_JAR}"
+
+ if [[ ! -e "${OT_JAR_PATH}" ]]; then
+ echo "## Error: Failed to download ${OT_JAR}." >>${OUTPUT}
+ exit 1
+ fi
+ fi
+
+ # Note: remember update it if we change the jar
+ expected_md5="e3bcbbe8ed9b6d840fa4c333b36f369f"
+ actual_md5=$(md5sum "${OT_JAR_PATH}" | awk '{print $1}')
+
+ if [[ "${expected_md5}" != "${actual_md5}" ]]; then
+ echo "## Error: MD5 checksum verification failed for ${OT_JAR_PATH}." >>${OUTPUT}
+ echo "## Tips: Remove the file and try again." >>${OUTPUT}
+ exit 1
+ fi
+
+ # Note: check carefully if multi "javeagent" params are set
+ export JAVA_TOOL_OPTIONS="-javaagent:${PLUGINS}/${OT_JAR}"
+ export OTEL_TRACES_EXPORTER=otlp
+ export OTEL_METRICS_EXPORTER=none
+ export OTEL_LOGS_EXPORTER=none
+ export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
+ # 127.0.0.1:4317 is the port of otel-collector running in Docker located in
+ # 'hugegraph-server/hugegraph-dist/docker/example/docker-compose-trace.yaml'.
+ # Make sure the otel-collector is running before starting HugeGraphPD.
+ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4317
+ export OTEL_RESOURCE_ATTRIBUTES=service.name=pd
+fi
+
#if [ "${JMX_EXPORT_PORT}" != "" ] && [ ${JMX_EXPORT_PORT} -ne 0 ] ; then
# JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${LIB}/jmx_prometheus_javaagent-0.16.1.jar=${JMX_EXPORT_PORT}:${CONF}/jmx_exporter.yml"
#fi
diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh
index 55499ee59c..cda7ba647a 100644
--- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh
+++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh
@@ -2,19 +2,19 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
#
abs_path() {
diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh
index d32871f13f..807da92fa1 100644
--- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh
+++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh
@@ -2,19 +2,19 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to You under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
#
function command_available() {
diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml
index fe6ae6a913..4e2eee329e 100644
--- a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml
+++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml
@@ -2,19 +2,19 @@
diff --git a/hugegraph-pd/hg-pd-grpc/pom.xml b/hugegraph-pd/hg-pd-grpc/pom.xml
index 538647a7a3..cef49e957d 100644
--- a/hugegraph-pd/hg-pd-grpc/pom.xml
+++ b/hugegraph-pd/hg-pd-grpc/pom.xml
@@ -1,19 +1,19 @@
{
* Invoked on completion.
*/
void onCompleted();
-}
\ No newline at end of file
+}
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java
index dca1d58d02..3ae957dd53 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java
index 78d24be5cd..9b3eb7662e 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
@@ -285,4 +285,4 @@ public GraphStatistics(Metapb.Graph graph) throws PDException {
graphName = graphName.substring(0, graphName.length() - postfixLength);
}
}
-}
\ No newline at end of file
+}
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java
index 1bb4f183a5..c47e1869d4 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java
index 6b1113a2eb..f2cf511a2b 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java
index 16f560f92b..28c9fdb98d 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java
index 5bc5cdfae0..cdd3ac0ae2 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java
index f2432b093f..11a1cdf1e6 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java
index 2aedd5f305..482eac40a0 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java
index 53249b9436..685d8fa3a0 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java
index f288ef877f..2587277745 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java
index d1419d2ddb..06b8f0f8b8 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java
index 1ab6326112..f15be9b48d 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.rest;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java
index e1f6fcef3f..f5d9a45106 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java
index 7898248d2d..99c58937b4 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java
index 2f21cfbacd..83a1e14169 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java
index a7402886ff..76ee4227b8 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java
index b7ec32abf1..4ef7401378 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java
index d4b9481e9d..ac5dfd2b61 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java
index 7683e58073..5f163e17d3 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java
index 5aa67f93bf..7cba93a33a 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java
index 78af36aaea..d7a121c8bd 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.service;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java
index 7f4b4fda4d..5e01952e55 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.upgrade;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java
index 8cd54864aa..7b261bce7c 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.upgrade;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java
index e113d95ff4..1b2e5ebe56 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.upgrade.scripts;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java
index 6370f839f9..bc302e31e3 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.upgrade.scripts;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java
index f26be26dd9..729e8c89fc 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java
index 7619254483..26e7d97420 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java
index 8b6a4a4dcb..fe84bb4b04 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java
index 75e4287178..6ecba60e1e 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java
index ad0bad5493..83c198a800 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util.grpc;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java
index c3893cc3ae..1eb995eced 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.util.grpc;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java
index 79905511f2..bf25a578b3 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java
index 0a2dbd84b5..c70016a319 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java
index 0e7c26dde5..3036c00237 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java
index 92ef98e8e6..c1a429eb87 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java
index 85f5e8b7f0..43f5bc9b7a 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java
index d9cfde8e73..3c6dd32ae6 100644
--- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java
+++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.watch;
diff --git a/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml b/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml
index a26fe62d9d..f3cd7c005c 100644
--- a/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml
+++ b/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml
@@ -2,19 +2,19 @@
diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java
index 7ef0152ef2..ab4c3b486c 100644
--- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java
+++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.live;
diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java
index 1e07684f85..1a30f5a2d3 100644
--- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java
+++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.live;
diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java
index 6e14ca7f8e..74e72e5191 100644
--- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java
+++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.live;
diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java
index b926118dfc..30fb9a200b 100644
--- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java
+++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.live;
diff --git a/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml b/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml
index d117f8328c..e51bcb30a1 100644
--- a/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml
+++ b/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml
@@ -2,19 +2,19 @@
diff --git a/hugegraph-pd/hg-pd-test/pom.xml b/hugegraph-pd/hg-pd-test/pom.xml
index 06b940a345..b8de18e2be 100644
--- a/hugegraph-pd/hg-pd-test/pom.xml
+++ b/hugegraph-pd/hg-pd-test/pom.xml
@@ -1,19 +1,19 @@
-
- org.apache.hugegraph
- hg-pd-clitools
- ${revision}
- org.apache.hugegraphhg-pd-common${revision}
-
org.apache.hugegraph
@@ -292,14 +286,14 @@
- pd-service-test
+ pd-rest-test${basedir}/src/main/java/
${basedir}/target/classes/
- **/ServerSuiteTest.java
+ **/PDRestSuiteTest.java
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/MonitorServiceTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/MonitorServiceTest.java
deleted file mode 100644
index 2b8d708df2..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/MonitorServiceTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd;
-
-import java.util.concurrent.ExecutionException;
-
-import org.apache.hugegraph.pd.common.PDException;
-import org.apache.hugegraph.pd.config.PDConfig;
-import org.apache.hugegraph.pd.grpc.Metapb;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
-// import org.junit.Test;
-
-public class MonitorServiceTest {
- static PDConfig pdConfig;
-
- @BeforeClass
- public static void init() throws ExecutionException, InterruptedException {
- pdConfig = new PDConfig() {{
- this.setClusterId(100);
- this.setPatrolInterval(1);
- }};
-
- //pdConfig.setEtcd(new PDConfig().new Etcd() {{
- // this.setAddress("http://localhost:2379");
- //
- //}});
- pdConfig.setStore(new PDConfig().new Store() {{
- this.setMaxDownTime(1);
- this.setKeepAliveTimeout(5);
- }});
-
- pdConfig.setPartition(new PDConfig().new Partition() {{
- this.setShardCount(3);
- this.setTotalCount(10);
- }});
-
- clearClusterData();
- }
-
- public static void clearClusterData() throws ExecutionException, InterruptedException {
- //Client client = Client.builder().endpoints(pdConfig.getEtcd().getAddress()).build();
- //KV kvClient = client.getKVClient();
- //
- //ByteSequence key = ByteSequence.from("HUGEGRAPH/" + pdConfig.getClusterId(), Charset
- // .forName("utf-8"));
- //CompletableFuture rsp = kvClient.delete(key, DeleteOption.newBuilder()
- // .isPrefix(true).build());
- //System.out.println("删除数量 : " + rsp.get().getDeleted());
- //kvClient.close();
- //client.close();
- }
-
- // @Test
- public void testPatrolStores() throws PDException, InterruptedException {
- StoreNodeService storeService = new StoreNodeService(pdConfig);
- PartitionService partitionService = new PartitionService(pdConfig, storeService);
- TaskScheduleService monitorService =
- new TaskScheduleService(pdConfig, storeService, partitionService);
- storeService.init(partitionService);
- partitionService.init();
- monitorService.init();
-
- int count = 6;
- Metapb.Store[] stores = new Metapb.Store[count];
- for (int i = 0; i < count; i++) {
- Metapb.Store store = Metapb.Store.newBuilder()
- .setId(0)
- .setAddress(String.valueOf(i))
- .setDeployPath("/data")
- .addLabels(Metapb.StoreLabel.newBuilder()
- .setKey("namespace")
- .setValue("default")
- .build())
- .build();
- stores[i] = storeService.register(store);
- System.out.println("新注册store, id = " + Long.toHexString(stores[i].getId()));
- }
- Metapb.Graph graph = Metapb.Graph.newBuilder()
- .setGraphName("defaultGH")
-
- .setPartitionCount(10)
- .build();
- partitionService.updateGraph(graph);
- Thread.sleep(10000);
- count = 0;
- count += storeService.getStores("").stream()
- .filter(store -> store.getState() == Metapb.StoreState.Tombstone)
- .count();
-
- Assert.assertEquals(6, count);
-
- }
-
-
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionCacheTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionCacheTest.java
deleted file mode 100644
index 0b937f4ed2..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionCacheTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.hugegraph.pd.common.KVPair;
-import org.apache.hugegraph.pd.common.PartitionCache;
-import org.apache.hugegraph.pd.grpc.Metapb;
-
-import com.google.common.collect.Range;
-import com.google.common.collect.RangeMap;
-import com.google.common.collect.TreeRangeMap;
-
-public class PartitionCacheTest {
-
- // @Test
- public void test() {
- PartitionCache cache = new PartitionCache();
- for (int i = 0; i < 10; i++) {
- KVPair partShards =
- new KVPair<>(Metapb.Partition.newBuilder()
- .setStartKey(i * 10)
- .setEndKey((i + 1) * 10)
- .build(), null);
- cache.updatePartition("aa", i, partShards.getKey());
- }
-
- for (int i = 0; i < 100; i++) {
- KVPair partShards = cache.getPartitionByCode("aa", i);
- System.out.println(" " + i + " " + partShards.getKey().getStartKey());
- }
- }
-
-
- // @Test
- public void test1() {
- Map> keyToPartIdCache = new HashMap<>();
- // graphName + PartitionID组成key
- Map> partitionCache = new HashMap<>();
-
- // 缓存全部Store,用于全库查询,需要优化
- Map> allStoresCache = new HashMap<>();
-
- keyToPartIdCache.put("a", TreeRangeMap.create());
-
- keyToPartIdCache.get("a")
- .put(Range.closedOpen(1L, 2L), 1);
-
- allStoresCache.put("a", new ArrayList<>());
- allStoresCache.get("a").add(Metapb.Store.newBuilder().setId(34).build());
-
-
- Map> keyToPartIdCache2 =
- cloneKeyToPartIdCache(keyToPartIdCache);
- System.out.println(keyToPartIdCache2.size());
- }
-
- public Map> cloneKeyToPartIdCache(
- Map> cache) {
- Map> cacheClone = new HashMap<>();
- cache.forEach((k1, v1) -> {
- cacheClone.put(k1, TreeRangeMap.create());
- v1.asMapOfRanges().forEach((k2, v2) -> {
- cacheClone.get(k1).put(k2, v2);
- });
- });
- return cacheClone;
- }
-
- public Map>
- clonePartitionCache(Map> cache) {
- Map> cacheClone = new HashMap<>();
- cacheClone.putAll(cache);
- return cacheClone;
- }
-
- public Map>
- cloneStoreCache(Map> cache) {
- Map> cacheClone = new HashMap<>();
- cacheClone.putAll(cache);
- return cacheClone;
- }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionServiceTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionServiceTest.java
deleted file mode 100644
index 5a501f6bbd..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/PartitionServiceTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.hugegraph.pd.grpc.Metapb;
-import org.junit.Test;
-
-public class PartitionServiceTest {
- @Test
- public void testPartitionHeartbeat() {
- List shardList = new ArrayList<>();
- shardList.add(Metapb.Shard.newBuilder().setStoreId(1).build());
- shardList.add(Metapb.Shard.newBuilder().setStoreId(2).build());
- shardList.add(Metapb.Shard.newBuilder().setStoreId(3).build());
- shardList = new ArrayList<>(shardList);
- Metapb.PartitionStats stats = Metapb.PartitionStats.newBuilder()
- .addAllShard(shardList).build();
- List shardList2 = new ArrayList<>(stats.getShardList());
- Collections.shuffle(shardList2);
- shardList2.forEach(shard -> {
- System.out.println(shard.getStoreId());
- });
-
-
- }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/StoreNodeServiceTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/StoreNodeServiceTest.java
deleted file mode 100644
index 2e6e06fc9c..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/StoreNodeServiceTest.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hugegraph.pd.common.PDException;
-import org.apache.hugegraph.pd.config.PDConfig;
-import org.apache.hugegraph.pd.grpc.Metapb;
-import org.apache.hugegraph.pd.grpc.pulse.ChangeShard;
-import org.apache.hugegraph.pd.grpc.pulse.CleanPartition;
-import org.apache.hugegraph.pd.grpc.pulse.DbCompaction;
-import org.apache.hugegraph.pd.grpc.pulse.MovePartition;
-import org.apache.hugegraph.pd.grpc.pulse.PartitionKeyRange;
-import org.apache.hugegraph.pd.grpc.pulse.SplitPartition;
-import org.apache.hugegraph.pd.grpc.pulse.TransferLeader;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
-public class StoreNodeServiceTest {
- static PDConfig pdConfig;
-
- @BeforeClass
- public static void init() throws Exception {
- String path = "tmp/unitTest";
- deleteDirectory(new File(path));
- pdConfig = new PDConfig() {{
- this.setClusterId(100);
- this.setInitialStoreList(
- "127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502,127.0.0.1:8503,127.0.0.1:8504," +
- "127.0.0.1:8505");
- }};
-
- pdConfig.setStore(new PDConfig().new Store() {{
- this.setMaxDownTime(3600);
- this.setKeepAliveTimeout(3600);
- }});
-
- pdConfig.setPartition(new PDConfig().new Partition() {{
- this.setShardCount(3);
- this.setMaxShardsPerStore(3);
- }});
- pdConfig.setRaft(new PDConfig().new Raft() {{
- this.setEnable(false);
- }});
- pdConfig.setDiscovery(new PDConfig().new Discovery());
- pdConfig.setDataPath(path);
- ConfigService configService = new ConfigService(pdConfig);
- pdConfig = configService.loadConfig();
- }
-
- public static byte[] intToByteArray(int i) {
- byte[] result = new byte[4];
- result[0] = (byte) ((i >> 24) & 0xFF);
- result[1] = (byte) ((i >> 16) & 0xFF);
- result[2] = (byte) ((i >> 8) & 0xFF);
- result[3] = (byte) (i & 0xFF);
- return result;
- }
-
- public static void deleteDirectory(File dir) {
- try {
- FileUtils.deleteDirectory(dir);
- } catch (IOException e) {
- System.out.printf("Failed to start ....,%s%n", e.getMessage());
- }
- }
-
- // @Test
- public void testStoreNodeService() throws PDException {
- Assert.assertEquals(pdConfig.getPartition().getTotalCount(),
- (long) pdConfig.getInitialStoreMap().size() *
- pdConfig.getPartition().getMaxShardsPerStore()
- / pdConfig.getPartition().getShardCount());
- StoreNodeService storeService = new StoreNodeService(pdConfig);
- int count = 6;
- Metapb.Store[] stores = new Metapb.Store[count];
- for (int i = 0; i < count; i++) {
- Metapb.Store store = Metapb.Store.newBuilder()
- .setId(0)
- .setAddress("127.0.0.1:850" + i)
- .setDeployPath("/data")
- .addLabels(Metapb.StoreLabel.newBuilder()
- .setKey("namespace")
- .setValue("default")
- .build())
- .build();
- stores[i] = storeService.register(store);
- System.out.println("新注册store, id = " + stores[i].getId());
- }
- Assert.assertEquals(count, storeService.getStores("").size());
-
- for (Metapb.Store store : stores) {
- Metapb.StoreStats stats = Metapb.StoreStats.newBuilder()
- .setStoreId(store.getId())
- .build();
- storeService.heartBeat(stats);
- }
-
- Assert.assertEquals(6, storeService.getActiveStores("").size());
-
- Metapb.Graph graph = Metapb.Graph.newBuilder()
- .setGraphName("defaultGH")
- .setPartitionCount(10)
- .build();
- // 分配shard
- List shards = storeService.allocShards(graph, 1);
-
-
- Assert.assertEquals(3, shards.size());
-
- Assert.assertEquals(pdConfig.getPartition().getTotalCount(),
- storeService.getShardGroups().size()); // 设置leader
- Metapb.Shard leader = Metapb.Shard.newBuilder(shards.get(0))
- .setRole(Metapb.ShardRole.Leader).build();
- shards = new ArrayList<>(shards);
- shards.set(0, leader);
- // 增加shard
- pdConfig.getPartition().setShardCount(5);
-
- Metapb.ShardGroup shardGroup = Metapb.ShardGroup.newBuilder()
- .setId(1)
- .addAllShards(shards).build();
- shards = storeService.reallocShards(shardGroup);
-
- Assert.assertEquals(5, shards.size());
- // 减少shard
- pdConfig.getPartition().setShardCount(3);
- shards = storeService.reallocShards(shardGroup);
- Assert.assertEquals(3, shards.size());
- // 包含leader,leader不能被删除
- Assert.assertTrue(shards.contains(leader));
-
- // 减少shard
- pdConfig.getPartition().setShardCount(1);
- graph = Metapb.Graph.newBuilder(graph).build();
- shards = storeService.reallocShards(shardGroup);
- Assert.assertEquals(1, shards.size());
- // 包含leader,leader不能被删除
- Assert.assertTrue(shards.contains(leader));
-
- for (Metapb.Store store : stores) {
- storeService.removeStore(store.getId());
- }
- Assert.assertEquals(0, storeService.getStores("").size());
-
-
- }
-
- // @Test
- public void testSplitPartition() throws PDException {
- StoreNodeService storeService = new StoreNodeService(pdConfig);
- PartitionService partitionService = new PartitionService(pdConfig, storeService);
-
- storeService.init(partitionService);
- partitionService.addInstructionListener(new PartitionInstructionListener() {
-
- @Override
- public void changeShard(Metapb.Partition partition, ChangeShard changeShard) throws
- PDException {
-
- }
-
- @Override
- public void transferLeader(Metapb.Partition partition,
- TransferLeader transferLeader) throws PDException {
-
- }
-
- @Override
- public void splitPartition(Metapb.Partition partition,
- SplitPartition splitPartition) throws PDException {
- splitPartition.getNewPartitionList().forEach(p -> {
- System.out.println("SplitPartition " + p.getId() + " " + p.getStartKey() + "," +
- p.getEndKey());
- });
- }
-
- @Override
- public void dbCompaction(Metapb.Partition partition, DbCompaction dbCompaction) throws
- PDException {
-
- }
-
- @Override
- public void movePartition(Metapb.Partition partition,
- MovePartition movePartition) throws PDException {
-
- }
-
- @Override
- public void cleanPartition(Metapb.Partition partition,
- CleanPartition cleanPartition) throws PDException {
-
- }
-
- @Override
- public void changePartitionKeyRange(Metapb.Partition partition,
- PartitionKeyRange partitionKeyRange) throws
- PDException {
-
- }
- });
- int count = 6;
- Metapb.Store[] stores = new Metapb.Store[count];
- for (int i = 0; i < count; i++) {
- Metapb.Store store = Metapb.Store.newBuilder()
- .setId(0)
- .setAddress("127.0.0.1:850" + i)
- .setDeployPath("/data")
- .addLabels(Metapb.StoreLabel.newBuilder()
- .setKey("namespace")
- .setValue("default")
- .build())
- .build();
- stores[i] = storeService.register(store);
- System.out.println("新注册store, id = " + Long.toHexString(stores[i].getId()));
- }
- Assert.assertEquals(count, storeService.getStores().size());
-
- Metapb.Graph graph = Metapb.Graph.newBuilder()
- .setGraphName("defaultGH")
- .build();
- Metapb.PartitionShard ptShard =
- partitionService.getPartitionByCode(graph.getGraphName(), 0);
- System.out.println(ptShard.getPartition().getId());
- {
- Metapb.Partition pt = ptShard.getPartition();
- System.out.println(pt.getId() + " " + pt.getStartKey() + "," + pt.getEndKey());
- }
-
- Assert.assertEquals(6, storeService.getShardGroups().size());
- // storeService.splitShardGroups(ptShard.getPartition().getId(), 4);
- Assert.assertEquals(9, storeService.getShardGroups().size());
- storeService.getShardGroups().forEach(shardGroup -> {
- System.out.println("shardGroup id = " + shardGroup.getId());
- });
- }
-
- // @Test
- public void testPartitionService() throws PDException, ExecutionException,
- InterruptedException {
- StoreNodeService storeService = new StoreNodeService(pdConfig);
- int count = 6;
- Metapb.Store[] stores = new Metapb.Store[count];
- for (int i = 0; i < count; i++) {
- Metapb.Store store = Metapb.Store.newBuilder()
- .setId(0)
- .setAddress(String.valueOf(i))
- .setDeployPath("/data")
- .addLabels(Metapb.StoreLabel.newBuilder()
- .setKey("namespace")
- .setValue("default")
- .build())
- .build();
- stores[i] = storeService.register(store);
- System.out.println("新注册store, id = " + Long.toHexString(stores[i].getId()));
- }
- Assert.assertEquals(count, storeService.getStores("").size());
-
-
- PartitionService partitionService = new PartitionService(pdConfig, storeService);
-
- Metapb.Graph graph = Metapb.Graph.newBuilder()
- .setGraphName("defaultGH")
-
- .setPartitionCount(10)
- .build();
- // 申请分区
- Metapb.PartitionShard[] partitions = new Metapb.PartitionShard[10];
- for (int i = 0; i < partitions.length; i++) {
- partitions[i] =
- partitionService.getPartitionShard(graph.getGraphName(), intToByteArray(i));
- Assert.assertEquals(3, storeService.getShardGroup(i).getShardsCount());
- }
- System.out.println(
- "分区数量: " + partitionService.getPartitions(graph.getGraphName()).size());
-
- int[] caseNo = {0}; //1 测试增加shard, 2 //测试store下线
-
- Metapb.Shard leader = null;
- int[] finalCaseNo = caseNo;
-
- partitionService.addInstructionListener(new PartitionInstructionListener() {
-
- @Override
- public void changeShard(Metapb.Partition partition, ChangeShard changeShard) throws
- PDException {
- switch (finalCaseNo[0]) {
- case 2:
- Assert.assertEquals(5, storeService.getShardGroup(partition.getId())
- .getShardsCount());
- break;
- case 3:
- storeService.getShardGroup(partition.getId()).getShardsList()
- .forEach(shard -> {
- Assert.assertNotEquals(shard.getStoreId(),
- stores[0].getId());
- });
- break;
- }
-
- }
-
- @Override
- public void transferLeader(Metapb.Partition partition, TransferLeader transferLeader) {
-
- }
-
- @Override
- public void splitPartition(Metapb.Partition partition, SplitPartition splitPartition) {
- }
-
- @Override
- public void dbCompaction(Metapb.Partition partition, DbCompaction dbCompaction) throws
- PDException {
-
- }
-
- @Override
- public void movePartition(Metapb.Partition partition,
- MovePartition movePartition) throws PDException {
-
- }
-
- @Override
- public void cleanPartition(Metapb.Partition partition,
- CleanPartition cleanPartition) throws PDException {
-
- }
-
- @Override
- public void changePartitionKeyRange(Metapb.Partition partition,
- PartitionKeyRange partitionKeyRange)
- throws PDException {
-
- }
- });
- Metapb.Partition partition = partitions[0].getPartition();
- leader = Metapb.Shard.newBuilder(
- storeService.getShardGroup(partition.getId()).getShardsList().get(0)).build();
- Metapb.Shard finalLeader = leader;
- partitionService.addStatusListener(new PartitionStatusListener() {
- @Override
- public void onPartitionChanged(Metapb.Partition partition,
- Metapb.Partition newPartition) {
-
- }
-
- @Override
- public void onPartitionRemoved(Metapb.Partition partition) {
-
- }
- });
- // 测试修改图
- caseNo[0] = 1;
- partitionService.updateGraph(graph);
- for (int i = 0; i < partitions.length; i++) {
- partitions[i] =
- partitionService.getPartitionShard(graph.getGraphName(), intToByteArray(i));
- Assert.assertEquals(3, storeService.getShardGroup(i).getShardsCount());
- }
-
- graph = Metapb.Graph.newBuilder(graph)
- .setGraphName("defaultGH")
-
- .setPartitionCount(10)
- .build();
- caseNo[0] = 2;
- partitionService.updateGraph(graph);
-
- // 测试store离线
- caseNo[0] = 3;
- partitionService.storeOffline(stores[0]);
-
-
- Metapb.PartitionStats stats = Metapb.PartitionStats.newBuilder()
- .addGraphName(partition.getGraphName())
- .setId(partition.getId())
- .setLeader(
- Metapb.Shard.newBuilder(leader)
- .setRole(
- Metapb.ShardRole.Leader))
- .build();
- // 测试leader飘移
- caseNo[0] = 4;
- partitionService.partitionHeartbeat(stats);
- AtomicReference shard = new AtomicReference<>();
- Metapb.PartitionShard ss =
- partitionService.getPartitionShardById(partition.getGraphName(), partition.getId());
- storeService.getShardList(partition.getId()).forEach(s -> {
- if (s.getRole() == Metapb.ShardRole.Leader) {
- Assert.assertNull(shard.get());
- shard.set(s);
- }
- });
-
- Assert.assertEquals(leader.getStoreId(), shard.get().getStoreId());
-
- }
-
- // @Test
- public void testMergeGraphParams() throws PDException {
- StoreNodeService storeService = new StoreNodeService(pdConfig);
- PartitionService partitionService = new PartitionService(pdConfig, storeService);
-
- Metapb.Graph dfGraph = Metapb.Graph.newBuilder()
-
- .setPartitionCount(
- pdConfig.getPartition().getTotalCount())
-
- .build();
-
- Metapb.Graph graph1 = Metapb.Graph.newBuilder()
- .setGraphName("test")
- .setPartitionCount(20)
-
- .build();
-
- Metapb.Graph graph2 = Metapb.Graph.newBuilder()
- .setGraphName("test")
- .setPartitionCount(7).build();
- Metapb.Graph graph3 = Metapb.Graph.newBuilder()
- .setGraphName("test")
- .build();
- Metapb.Graph graph4 = Metapb.Graph.newBuilder()
- .setGraphName("test")
- .build();
-
- Metapb.Graph graph = Metapb.Graph.newBuilder(dfGraph).mergeFrom(graph2).build();
- Assert.assertEquals(graph2.getGraphName(), graph.getGraphName());
-
- Assert.assertEquals(graph2.getPartitionCount(), graph.getPartitionCount());
-
-
- graph = Metapb.Graph.newBuilder(dfGraph).mergeFrom(graph3).build();
- Assert.assertEquals(graph3.getGraphName(), graph.getGraphName());
-
- Assert.assertEquals(dfGraph.getPartitionCount(), graph.getPartitionCount());
-
-
- graph = Metapb.Graph.newBuilder(dfGraph).mergeFrom(graph4).build();
- Assert.assertEquals(graph4.getGraphName(), graph.getGraphName());
-
- Assert.assertEquals(dfGraph.getPartitionCount(), graph.getPartitionCount());
-
- }
-
- // @Test
- public void test() {
- int[] n = new int[3];
-
-
- if (++n[2] > 1) {
- System.out.println(n[2]);
- }
- if (++n[2] > 1) {
- System.out.println(n[2]);
- }
- if (++n[2] > 1) {
- System.out.println(n[2]);
- }
- }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java
deleted file mode 100644
index 0f26b1e55d..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd;
-
-import java.io.File;
-
-public class UnitTestBase {
- public static boolean deleteDir(File dir) {
- if (dir.isDirectory()) {
- for (File file : dir.listFiles()) {
- deleteDir(file);
- }
- }
- return dir.delete();
- }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
index 87b8081339..ef3152fa11 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
@@ -24,21 +24,18 @@
@RunWith(MockitoJUnitRunner.class)
public class BaseClientTest {
- public static PDClient pdClient;
- public final String storeAddr = "localhost";
- public final String graphName = "default/hugegraph/g";
- public long storeId = 0;
+
+ protected static PDClient pdClient;
@BeforeClass
- public static void beforeClass() throws Exception {
+ public static void beforeClass() {
PDConfig config = PDConfig.of("localhost:8686");
-// PDConfig config = PDConfig.of("10.81.116.77:8986");
config.setEnableCache(true);
pdClient = PDClient.create(config);
}
@After
- public void teardown() throws Exception {
+ public void teardown() {
// pass
}
-}
\ No newline at end of file
+}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java
new file mode 100644
index 0000000000..afc3d20edc
--- /dev/null
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hugegraph.pd.client;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hugegraph.pd.common.Useless;
+
+import com.alipay.sofa.jraft.CliService;
+import com.alipay.sofa.jraft.RaftServiceFactory;
+import com.alipay.sofa.jraft.Status;
+import com.alipay.sofa.jraft.conf.Configuration;
+import com.alipay.sofa.jraft.entity.PeerId;
+import com.alipay.sofa.jraft.option.CliOptions;
+
+@Useless("used for development")
+public class ChangingLeader {
+
+ private static final CliService cliService =
+ RaftServiceFactory.createAndInitCliService(new CliOptions());
+
+ public static void main(String[] args) {
+ var conf = new Configuration();
+ conf.addPeer(PeerId.parsePeer("127.0.0.1:8610"));
+ conf.addPeer(PeerId.parsePeer("127.0.0.1:8611"));
+ conf.addPeer(PeerId.parsePeer("127.0.0.1:8612"));
+ CountDownLatch latch = new CountDownLatch(100);
+
+ Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
+ Status status = cliService.transferLeader("pd_raft", conf, PeerId.ANY_PEER);
+ System.out.println("trigger change leader status: " + status);
+ latch.countDown();
+ }, 1, 3, TimeUnit.SECONDS);
+
+ try {
+ latch.await();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java
deleted file mode 100644
index 8952cc1162..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd.client;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.hugegraph.pd.grpc.discovery.NodeInfos;
-import org.apache.hugegraph.pd.grpc.discovery.Query;
-import org.junit.Assert;
-
-public class DiscoveryClientImplTest {
-
- private static final AtomicLong label = new AtomicLong();
- String address = "localhost:80";
- int delay = 1000;
- int wait = delay * 3 + 500;
-
- // @Test
- public void registerStore() throws InterruptedException {
-
- HashMap labels = new HashMap<>();
-
- labels.put("metrics", "/actuator/prometheus");
- labels.put("target", "10.81.116.77:8520");
- labels.put("scheme", "http");
- labels.put("__relabeling", "http");
- labels.put("no_relabeling", "http");
- getClient("store", "address1", labels);
-
- labels.put("metrics", "/actuator/prometheus");
- labels.put("target", "10.81.116.78:8520");
- labels.put("scheme", "http");
- getClient("store", "address2", labels);
-
- labels.put("metrics", "/actuator/prometheus");
- labels.put("target", "10.81.116.79:8520");
- labels.put("scheme", "http");
- getClient("store", "address3", labels);
-
- labels.put("metrics", "/actuator/prometheus");
- labels.put("target", "10.81.116.78:8620");
- labels.put("scheme", "http");
- getClient("pd", "address1", labels);
-
- labels.put("metrics", "/graph/metrics");
- labels.put("target", "10.37.1.1:9200");
- labels.put("scheme", "https");
- getClient("hugegraph", "address1", labels);
- }
-
- // @Test
- public void testNodes() throws InterruptedException {
- String appName = "hugegraph";
- register(appName, address);
- }
-
- // @Test
- public void testMultiNode() throws InterruptedException {
- for (int i = 0; i < 2; i++) {
- register("app" + i, address + i);
- }
- }
-
- // @Test
- public void testParallelMultiNode() throws InterruptedException {
- CountDownLatch latch = new CountDownLatch(30);
- Vector exceptions = new Vector<>();
- for (int i = 0; i < 30; i++) {
- int finalI = i;
- new Thread(() -> {
- try {
- for (int j = 0; j < 3; j++) {
- register("app" + finalI, address + j);
- }
- } catch (Exception e) {
- exceptions.add(e);
- } finally {
- latch.countDown();
- }
- }).start();
- }
- latch.await();
- Assert.assertEquals(0, exceptions.size());
- }
-
- private void register(String appName, String address) throws InterruptedException {
-
- HashMap labels = new HashMap<>();
- String labelValue = String.valueOf(label.incrementAndGet());
- labels.put("address", labelValue);
- labels.put("address1", labelValue);
- Query query = Query.newBuilder().setAppName(
- appName).setVersion("0.13.0").putAllLabels(labels).build();
- DiscoveryClientImpl discoveryClient = getClient(appName, address, labels);
- Thread.sleep(10000);
- NodeInfos nodeInfos1 = discoveryClient.getNodeInfos(query);
- Assert.assertEquals(1, nodeInfos1.getInfoCount());
- DiscoveryClientImpl discoveryClient1 = getClient(appName, address + 0, labels);
- Thread.sleep(10000);
- Assert.assertEquals(2, discoveryClient.getNodeInfos(query).getInfoCount());
- Query query1 = Query.newBuilder().setAppName(
- appName).setVersion("0.12.0").putAllLabels(labels).build();
- Assert.assertEquals(0, discoveryClient.getNodeInfos(query1).getInfoCount());
- discoveryClient.cancelTask();
- discoveryClient1.cancelTask();
- Thread.sleep(wait);
- NodeInfos nodeInfos = discoveryClient.getNodeInfos(query);
- System.out.println(nodeInfos);
- Assert.assertEquals(0, nodeInfos.getInfoCount());
- discoveryClient.close();
- discoveryClient1.close();
- }
-
- private DiscoveryClientImpl getClient(String appName, String address, Map labels) {
- DiscoveryClientImpl discoveryClient = null;
- try {
- discoveryClient = DiscoveryClientImpl.newBuilder().setCenterAddress(
- "localhost:8687,localhost:8686,localhost:8688").setAddress(address).setAppName(
- appName).setDelay(delay).setVersion("0.13.0").setId(
- "0").setLabels(labels).build();
- discoveryClient.scheduleTask();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return discoveryClient;
- }
-}
\ No newline at end of file
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java
deleted file mode 100644
index 5e7d1ee08e..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd.client;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
-
-import org.apache.hugegraph.pd.client.DiscoveryClientImpl;
-import org.apache.hugegraph.pd.grpc.discovery.NodeInfo;
-import org.apache.hugegraph.pd.grpc.discovery.Query;
-import org.junit.Before;
-import org.junit.Test;
-
-public class DiscoveryClientTest {
-
- private DiscoveryClientImpl client;
-
- @Before
- public void setUp() {
- this.client = getClient("appName", "localhost:8654", new HashMap());
- }
-
- @Test
- public void testGetRegisterNode() {
- // Setup
- try {
- Consumer result = this.client.getRegisterConsumer();
- final NodeInfo expectedResult = NodeInfo.newBuilder()
- .setAppName("appName")
- .build();
-
- Thread.sleep(3000);
- Query query = Query.newBuilder().setAppName("appName")
- .setVersion("0.13.0").build();
-
- // Run the test
- this.client.getNodeInfos(query);
- } catch (InterruptedException e) {
- e.printStackTrace();
- } finally {
- this.client.close();
- }
-
- }
-
- private DiscoveryClientImpl getClient(String appName, String address,
- Map labels) {
- DiscoveryClientImpl discoveryClient = null;
- try {
- discoveryClient = DiscoveryClientImpl.newBuilder().setCenterAddress(
- "localhost:8686").setAddress(address).setAppName(appName)
- .setDelay(2000)
- .setVersion("0.13.0")
- .setId("0").setLabels(labels)
- .build();
- discoveryClient.scheduleTask();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return discoveryClient;
- }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
index 54cee0b812..66993f2815 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.hugegraph.pd.client;
@@ -23,8 +23,6 @@
import java.util.function.Consumer;
import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.pd.client.KvClient;
-import org.apache.hugegraph.pd.client.PDConfig;
import org.apache.hugegraph.pd.grpc.kv.KResponse;
import org.apache.hugegraph.pd.grpc.kv.ScanPrefixResponse;
import org.apache.hugegraph.pd.grpc.kv.WatchEvent;
@@ -59,7 +57,6 @@ public void testCreateStub() {
}
-
// Verify the results
}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java
deleted file mode 100644
index 390821662e..0000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.pd.client;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hugegraph.pd.grpc.Pdpb;
-import org.apache.hugegraph.pd.grpc.kv.KResponse;
-import org.apache.hugegraph.pd.grpc.kv.KvResponse;
-import org.yaml.snakeyaml.Yaml;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class LicenseClientImplTest {
-
- // @Test
- public void putLicense() {
- PDConfig pdConfig = PDConfig.of("localhost:8686,localhost:8687,localhost:8688");
- //PDConfig pdConfig = PDConfig.of("localhost:8686");
- pdConfig.setEnableCache(true);
- try (LicenseClient c = new LicenseClient(pdConfig)) {
- File file = new File("../conf/hugegraph.license");
- byte[] bytes = FileUtils.readFileToByteArray(file);
- Pdpb.PutLicenseResponse putLicenseResponse = c.putLicense(bytes);
- Pdpb.Error error = putLicenseResponse.getHeader().getError();
- log.info(error.getMessage());
- assert error.getType().equals(Pdpb.ErrorType.OK);
- } catch (Exception e) {
- log.error("put license with error: ", e);
- }
- }
-
- // @Test
- public void getKv() {
- PDConfig pdConfig = PDConfig.of("10.157.12.36:8686");
- pdConfig.setEnableCache(true);
- try (KvClient c = new KvClient(pdConfig)) {
- KResponse kResponse = c.get("S:FS");
- Pdpb.Error error = kResponse.getHeader().getError();
- log.info(error.getMessage());
- assert error.getType().equals(Pdpb.ErrorType.OK);
- Properties ymlConfig = getYmlConfig(kResponse.getValue());
- Object property = ymlConfig.get("rocksdb.write_buffer_size");
- assert property.toString().equals("32000000");
- } catch (Exception e) {
- log.error("put license with error: ", e);
- }
- }
-
- // @Test
- public void putKv() {
- PDConfig pdConfig = PDConfig.of("127.0.0.1.70:8688");
- pdConfig.setEnableCache(true);
- try (KvClient c = new KvClient(pdConfig)) {
- long l = System.currentTimeMillis();
- KvResponse kvResponse = c.put("S:Timestamp", String.valueOf(l));
- Pdpb.Error error = kvResponse.getHeader().getError();
- log.info(error.getMessage());
- assert error.getType().equals(Pdpb.ErrorType.OK);
- } catch (Exception e) {
- log.error("put license with error: ", e);
- }
- }
-
- // @Test
- public void putKvLocal() {
- PDConfig pdConfig = PDConfig.of("localhost:8686");
- pdConfig.setEnableCache(true);
- try (KvClient c = new KvClient(pdConfig)) {
- long l = System.currentTimeMillis();
- KvResponse kvResponse = c.put("S:Timestamp", String.valueOf(l));
- Pdpb.Error error = kvResponse.getHeader().getError();
- log.info(error.getMessage());
- assert error.getType().equals(Pdpb.ErrorType.OK);
- } catch (Exception e) {
- log.error("put license with error: ", e);
- }
- }
-
- private Properties getYmlConfig(String yml) {
- Yaml yaml = new Yaml();
- Iterable
+
+ org.gridkit.jvmtool
+ sjk-core
+ 0.22
+ compile
+
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
index 444549a805..b7f564e8d8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
@@ -48,22 +48,23 @@ public class API {
public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN;
public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON;
public static final String APPLICATION_JSON_WITH_CHARSET =
- APPLICATION_JSON + ";charset=" + CHARSET;
- public static final String APPLICATION_TEXT_WITH_CHARSET = MediaType.TEXT_PLAIN + ";charset=" + CHARSET;
+ APPLICATION_JSON + ";charset=" + CHARSET;
+ public static final String APPLICATION_TEXT_WITH_CHARSET =
+ MediaType.TEXT_PLAIN + ";charset=" + CHARSET;
public static final String JSON = MediaType.APPLICATION_JSON_TYPE
- .getSubtype();
+ .getSubtype();
public static final String ACTION_APPEND = "append";
public static final String ACTION_ELIMINATE = "eliminate";
public static final String ACTION_CLEAR = "clear";
protected static final Logger LOG = Log.logger(API.class);
private static final Meter SUCCEED_METER =
- MetricsUtil.registerMeter(API.class, "commit-succeed");
+ MetricsUtil.registerMeter(API.class, "commit-succeed");
private static final Meter ILLEGAL_ARG_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "illegal-arg");
+ MetricsUtil.registerMeter(API.class, "illegal-arg");
private static final Meter EXPECTED_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "expected-error");
+ MetricsUtil.registerMeter(API.class, "expected-error");
private static final Meter UNKNOWN_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "unknown-error");
+ MetricsUtil.registerMeter(API.class, "unknown-error");
public static HugeGraph graph(GraphManager manager, String graph) {
HugeGraph g = manager.graph(graph);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
index cb819057ca..7cd9a98f8a 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
@@ -29,7 +29,6 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
index 75dbad7fb0..5c07681da8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
@@ -19,37 +19,37 @@
import java.util.List;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Path;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.HugeAccess;
import org.apache.hugegraph.auth.HugePermission;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/accesses")
@Singleton
@Tag(name = "AccessAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
index 7880e434eb..da66c0cecc 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
@@ -19,7 +19,24 @@
import java.util.List;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeBelong;
+import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
@@ -32,23 +49,6 @@
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import jakarta.inject.Singleton;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeBelong;
-import org.apache.hugegraph.backend.id.Id;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/belongs")
@Singleton
@Tag(name = "BelongAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
index e70c88d316..f0ac7f6ea2 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
@@ -19,7 +19,24 @@
import java.util.List;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeGroup;
+import org.apache.hugegraph.backend.id.IdGenerator;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
@@ -32,23 +49,6 @@
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import jakarta.inject.Singleton;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeGroup;
-import org.apache.hugegraph.backend.id.IdGenerator;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/groups")
@Singleton
@Tag(name = "GroupAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java
index ba2ab3f4fe..50bf1a78de 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java
@@ -70,11 +70,9 @@ public String login(@Context GraphManager manager, @PathParam("graph") String gr
checkCreatingBody(jsonLogin);
try {
- String token = manager.authManager()
- .loginUser(jsonLogin.name, jsonLogin.password);
+ String token = manager.authManager().loginUser(jsonLogin.name, jsonLogin.password);
HugeGraph g = graph(manager, graph);
- return manager.serializer(g)
- .writeMap(ImmutableMap.of("token", token));
+ return manager.serializer(g).writeMap(ImmutableMap.of("token", token));
} catch (AuthenticationException e) {
throw new NotAuthorizedException(e.getMessage(), e);
}
@@ -86,8 +84,7 @@ public String login(@Context GraphManager manager, @PathParam("graph") String gr
@Status(Status.OK)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
- public void logout(@Context GraphManager manager,
- @PathParam("graph") String graph,
+ public void logout(@Context GraphManager manager, @PathParam("graph") String graph,
@HeaderParam(HttpHeaders.AUTHORIZATION) String auth) {
E.checkArgument(StringUtils.isNotEmpty(auth),
"Request header Authorization must not be null");
@@ -107,10 +104,8 @@ public void logout(@Context GraphManager manager,
@Status(Status.OK)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
- public String verifyToken(@Context GraphManager manager,
- @PathParam("graph") String graph,
- @HeaderParam(HttpHeaders.AUTHORIZATION)
- String token) {
+ public String verifyToken(@Context GraphManager manager, @PathParam("graph") String graph,
+ @HeaderParam(HttpHeaders.AUTHORIZATION) String token) {
E.checkArgument(StringUtils.isNotEmpty(token),
"Request header Authorization must not be null");
LOG.debug("Graph [{}] get user: {}", graph, token);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
index 1f048e9a01..c90323ef97 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
@@ -21,39 +21,39 @@
import java.util.List;
import java.util.Set;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.AuthManager;
import org.apache.hugegraph.auth.HugeProject;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/projects")
@Singleton
@Tag(name = "ProjectAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
index c13fff1517..eb52e455c1 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
@@ -20,6 +20,22 @@
import java.util.List;
import java.util.Map;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeTarget;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
@@ -34,22 +50,6 @@
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeTarget;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/targets")
@Singleton
@Tag(name = "TargetAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
index 25d812104f..ed26573f83 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
@@ -19,39 +19,39 @@
import java.util.List;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.HugeUser;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
import org.apache.hugegraph.util.StringEncoding;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/users")
@Singleton
@Tag(name = "UserAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
index c8cc3929fd..b24169aaaf 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
@@ -34,7 +34,6 @@
import com.codahale.metrics.annotation.Timed;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
index eb3a86ff65..92ae18c54d 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
@@ -17,16 +17,6 @@
package org.apache.hugegraph.api.cypher;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.tinkerpop.gremlin.driver.*;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import org.slf4j.Logger;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -35,6 +25,20 @@
import java.util.concurrent.ExecutionException;
import java.util.function.Supplier;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.ThreadSafe;
+
+import org.apache.commons.configuration2.Configuration;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
+import org.apache.tinkerpop.gremlin.driver.Tokens;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.slf4j.Logger;
+
@ThreadSafe
public final class CypherClient {
@@ -93,7 +97,7 @@ private RequestMessage createRequest(String cypherQuery) {
}
private List doQueryList(Client client, RequestMessage request)
- throws ExecutionException, InterruptedException {
+ throws ExecutionException, InterruptedException {
ResultSet results = client.submitAsync(request).get();
Iterator iter = results.iterator();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
index c85a0aff0e..cd5a769237 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
@@ -50,12 +50,14 @@ private CypherModel() {
}
public static class Status {
+
public String message = "";
public int code;
public Map attributes = Collections.EMPTY_MAP;
}
private static class Result {
+
public List data;
public Map meta = Collections.EMPTY_MAP;
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
index 7a4a9b97d7..d429db4d9b 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
@@ -26,8 +26,10 @@
import java.io.IOException;
import java.net.URI;
+import org.apache.hugegraph.auth.HugeAuthenticator;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.metrics.MetricsUtil;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;
@@ -55,6 +57,9 @@ public class AccessLogFilter implements ContainerResponseFilter {
@Context
private jakarta.inject.Provider configProvider;
+ @Context
+ private jakarta.inject.Provider managerProvider;
+
public static boolean needRecordLog(ContainerRequestContext context) {
// TODO: add test for 'path' result ('/gremlin' or 'gremlin')
String path = context.getUriInfo().getPath();
@@ -114,6 +119,13 @@ public void filter(ContainerRequestContext requestContext,
executeTime, null, method, path, uri.getQuery());
}
}
+
+ // Unset the context in "HugeAuthenticator", need distinguish Graph/Auth server lifecycle
+ GraphManager manager = managerProvider.get();
+ // TODO: transfer Authorizer if we need after.
+ if (manager.requireAuthentication()) {
+ manager.unauthorize(requestContext.getSecurityContext());
+ }
}
private boolean statusOk(int status) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
index ba69fd9c00..f1829e7020 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
@@ -41,10 +41,11 @@
import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException;
import org.glassfish.grizzly.http.server.Request;
import org.glassfish.grizzly.utils.Charsets;
+import org.gridkit.jvmtool.cmd.AntPathMatcher;
import org.slf4j.Logger;
import com.alipay.remoting.util.StringUtils;
-import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import jakarta.annotation.Priority;
import jakarta.ws.rs.BadRequestException;
@@ -70,14 +71,15 @@ public class AuthenticationFilter implements ContainerRequestFilter {
private static final Logger LOG = Log.logger(AuthenticationFilter.class);
- private static final List WHITE_API_LIST = ImmutableList.of(
- "auth/login",
+ private static final AntPathMatcher MATCHER = new AntPathMatcher();
+ private static final Set FIXED_WHITE_API_SET = ImmutableSet.of(
"versions",
"openapi.json"
);
+ /** Remove auth/login API from whitelist */
+ private static final Set FLEXIBLE_WHITE_API_SET = ImmutableSet.of();
- private static String whiteIpStatus;
-
+ private static Boolean enabledWhiteIpCheck;
private static final String STRING_WHITE_IP_LIST = "whiteiplist";
private static final String STRING_ENABLE = "enable";
@@ -92,7 +94,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext context) throws IOException {
- if (AuthenticationFilter.isWhiteAPI(context)) {
+ if (isWhiteAPI(context)) {
return;
}
User user = this.authenticate(context);
@@ -105,7 +107,7 @@ protected User authenticate(ContainerRequestContext context) {
E.checkState(manager != null, "Context GraphManager is absent");
if (!manager.requireAuthentication()) {
- // Return anonymous user with admin role if disable authentication
+ // Return anonymous user with an admin role if disable authentication
return User.ANONYMOUS;
}
@@ -119,11 +121,12 @@ protected User authenticate(ContainerRequestContext context) {
}
// Check whiteIp
- if (whiteIpStatus == null) {
- whiteIpStatus = this.configProvider.get().get(WHITE_IP_STATUS);
+ if (enabledWhiteIpCheck == null) {
+ String whiteIpStatus = this.configProvider.get().get(WHITE_IP_STATUS);
+ enabledWhiteIpCheck = Objects.equals(whiteIpStatus, STRING_ENABLE);
}
- if (Objects.equals(whiteIpStatus, STRING_ENABLE) && request != null) {
+ if (enabledWhiteIpCheck && request != null) {
peer = request.getRemoteAddr() + ":" + request.getRemotePort();
path = request.getRequestURI();
@@ -132,9 +135,8 @@ protected User authenticate(ContainerRequestContext context) {
boolean whiteIpEnabled = manager.authManager().getWhiteIpStatus();
if (!path.contains(STRING_WHITE_IP_LIST) && whiteIpEnabled &&
!whiteIpList.contains(remoteIp)) {
- throw new ForbiddenException(
- String.format("Remote ip '%s' is not permitted",
- remoteIp));
+ throw new ForbiddenException(String.format("Remote ip '%s' is not permitted",
+ remoteIp));
}
}
@@ -142,28 +144,23 @@ protected User authenticate(ContainerRequestContext context) {
// Extract authentication credentials
String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION);
if (auth == null) {
- throw new NotAuthorizedException(
- "Authentication credentials are required",
- "Missing authentication credentials");
+ throw new NotAuthorizedException("Authentication credentials are required",
+ "Missing authentication credentials");
}
if (auth.startsWith(BASIC_AUTH_PREFIX)) {
auth = auth.substring(BASIC_AUTH_PREFIX.length());
- auth = new String(DatatypeConverter.parseBase64Binary(auth),
- Charsets.ASCII_CHARSET);
+ auth = new String(DatatypeConverter.parseBase64Binary(auth), Charsets.ASCII_CHARSET);
String[] values = auth.split(":");
if (values.length != 2) {
- throw new BadRequestException(
- "Invalid syntax for username and password");
+ throw new BadRequestException("Invalid syntax for username and password");
}
final String username = values[0];
final String password = values[1];
- if (StringUtils.isEmpty(username) ||
- StringUtils.isEmpty(password)) {
- throw new BadRequestException(
- "Invalid syntax for username and password");
+ if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
+ throw new BadRequestException("Invalid syntax for username and password");
}
credentials.put(HugeAuthenticator.KEY_USERNAME, username);
@@ -172,8 +169,7 @@ protected User authenticate(ContainerRequestContext context) {
String token = auth.substring(BEARER_TOKEN_PREFIX.length());
credentials.put(HugeAuthenticator.KEY_TOKEN, token);
} else {
- throw new BadRequestException(
- "Only HTTP Basic or Bearer authentication is supported");
+ throw new BadRequestException("Only HTTP Basic or Bearer authentication is supported");
}
credentials.put(HugeAuthenticator.KEY_ADDRESS, peer);
@@ -183,8 +179,7 @@ protected User authenticate(ContainerRequestContext context) {
try {
return manager.authenticate(credentials);
} catch (AuthenticationException e) {
- throw new NotAuthorizedException("Authentication failed",
- e.getMessage());
+ throw new NotAuthorizedException("Authentication failed", e.getMessage());
}
}
@@ -248,7 +243,7 @@ private boolean matchPermission(String required) {
requiredPerm = RequiredPerm.fromPermission(required);
/*
- * Replace owner value(it may be a variable) if the permission
+ * Replace owner value (it may be a variable) if the permission
* format like: "$owner=$graph $action=vertex_write"
*/
String owner = requiredPerm.owner();
@@ -264,8 +259,7 @@ private boolean matchPermission(String required) {
if (LOG.isDebugEnabled()) {
LOG.debug("Verify permission {} {} for user '{}' with role {}",
- requiredPerm.action().string(),
- requiredPerm.resourceObject(),
+ requiredPerm.action().string(), requiredPerm.resourceObject(),
this.user.username(), this.user.role());
}
@@ -274,9 +268,8 @@ private boolean matchPermission(String required) {
if (!valid && LOG.isInfoEnabled() &&
!required.equals(HugeAuthenticator.USER_ADMIN)) {
- LOG.info("User '{}' is denied to {} {}",
- this.user.username(), requiredPerm.action().string(),
- requiredPerm.resourceObject());
+ LOG.info("User '{}' is denied to {} {}", this.user.username(),
+ requiredPerm.action().string(), requiredPerm.resourceObject());
}
return valid;
}
@@ -314,9 +307,12 @@ public boolean equals(Object obj) {
public static boolean isWhiteAPI(ContainerRequestContext context) {
String path = context.getUriInfo().getPath();
+ if (FIXED_WHITE_API_SET.contains(path)) {
+ return true;
+ }
- for (String whiteApi : WHITE_API_LIST) {
- if (path.endsWith(whiteApi)) {
+ for (String whiteApi : FLEXIBLE_WHITE_API_SET) {
+ if (MATCHER.match(whiteApi, path)) {
return true;
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
index a5cf78aa4f..f38ffd78f3 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
@@ -24,18 +24,17 @@
import java.lang.annotation.RetentionPolicy;
import java.util.zip.GZIPOutputStream;
+import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import jakarta.inject.Singleton;
import jakarta.ws.rs.NameBinding;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.ext.Provider;
import jakarta.ws.rs.ext.WriterInterceptor;
import jakarta.ws.rs.ext.WriterInterceptorContext;
-import jakarta.inject.Singleton;
-
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
-import org.apache.hugegraph.util.Log;
@Provider
@Singleton
@@ -51,7 +50,7 @@ public class CompressInterceptor implements WriterInterceptor {
@Override
public void aroundWriteTo(WriterInterceptorContext context)
- throws IOException, WebApplicationException {
+ throws IOException, WebApplicationException {
// If there is no annotation(like exception), we don't compress it
if (context.getAnnotations().length > 0) {
try {
@@ -70,14 +69,14 @@ public void aroundWriteTo(WriterInterceptorContext context)
}
private void compress(WriterInterceptorContext context)
- throws IOException {
+ throws IOException {
// Get compress info from the @Compress annotation
final Compress compression = getCompressAnnotation(context);
final String encoding = compression.value();
final int buffer = compression.buffer();
// Update header
- MultivaluedMap headers = context.getHeaders();
+ MultivaluedMap headers = context.getHeaders();
headers.remove("Content-Length");
headers.add("Content-Encoding", encoding);
@@ -104,7 +103,9 @@ private static Compress getCompressAnnotation(WriterInterceptorContext c) {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Compress {
+
String value() default GZIP;
+
int buffer() default BUFFER_SIZE;
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
index d8de560900..488dd509bd 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
@@ -37,7 +37,7 @@ public class DecompressInterceptor implements ReaderInterceptor {
@Override
public Object aroundReadFrom(ReaderInterceptorContext context)
- throws IOException {
+ throws IOException {
// NOTE: Currently we just support GZIP
String encoding = context.getHeaders().getFirst("Content-Encoding");
if (!GZIP.equalsIgnoreCase(encoding)) {
@@ -47,10 +47,10 @@ public Object aroundReadFrom(ReaderInterceptorContext context)
return context.proceed();
}
-
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Decompress {
+
String value() default GZIP;
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
index 894f38c661..ded04b3545 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
@@ -25,6 +25,18 @@
import javax.json.JsonArrayBuilder;
import javax.json.JsonObjectBuilder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.HugeException;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.exception.HugeGremlinException;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.glassfish.hk2.api.MultiException;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
@@ -41,18 +53,6 @@
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.config.ServerOptions;
-import org.glassfish.hk2.api.MultiException;
-
-import org.apache.hugegraph.HugeException;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.exception.HugeGremlinException;
-import org.apache.hugegraph.exception.NotFoundException;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
public class ExceptionFilter {
private static final int BAD_REQUEST_ERROR =
@@ -107,8 +107,8 @@ public Object trace(boolean trace) {
@Provider
public static class HugeExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(HugeException exception) {
@@ -121,8 +121,8 @@ public Response toResponse(HugeException exception) {
@Provider
public static class IllegalArgumentExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(IllegalArgumentException exception) {
@@ -135,8 +135,8 @@ public Response toResponse(IllegalArgumentException exception) {
@Provider
public static class NotFoundExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(NotFoundException exception) {
@@ -149,8 +149,8 @@ public Response toResponse(NotFoundException exception) {
@Provider
public static class NoSuchElementExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(NoSuchElementException exception) {
@@ -163,8 +163,8 @@ public Response toResponse(NoSuchElementException exception) {
@Provider
public static class WebApplicationExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(WebApplicationException exception) {
@@ -189,8 +189,8 @@ private boolean trace(int status) {
@Provider
public static class HugeGremlinExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper {
+ extends TracedExceptionMapper
+ implements ExceptionMapper {
@Override
public Response toResponse(HugeGremlinException exception) {
@@ -204,7 +204,7 @@ public Response toResponse(HugeGremlinException exception) {
@Provider
public static class AssertionErrorMapper extends TracedExceptionMapper
- implements ExceptionMapper {
+ implements ExceptionMapper {
@Override
public Response toResponse(AssertionError exception) {
@@ -217,7 +217,7 @@ public Response toResponse(AssertionError exception) {
@Provider
public static class UnknownExceptionMapper extends TracedExceptionMapper
- implements ExceptionMapper {
+ implements ExceptionMapper {
@Override
public Response toResponse(Throwable exception) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
index 42344e613f..7ee5e7c0f7 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
@@ -20,6 +20,15 @@
import java.util.List;
import java.util.Set;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.define.WorkLoad;
+import org.apache.hugegraph.util.Bytes;
+import org.apache.hugegraph.util.E;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.RateLimiter;
+
import jakarta.inject.Singleton;
import jakarta.ws.rs.ServiceUnavailableException;
import jakarta.ws.rs.container.ContainerRequestContext;
@@ -29,14 +38,6 @@
import jakarta.ws.rs.core.PathSegment;
import jakarta.ws.rs.ext.Provider;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.define.WorkLoad;
-import org.apache.hugegraph.util.Bytes;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.RateLimiter;
-
@Provider
@Singleton
@PreMatching
@@ -51,7 +52,7 @@ public class LoadDetectFilter implements ContainerRequestFilter {
// Call gc every 30+ seconds if memory is low and request frequently
private static final RateLimiter GC_RATE_LIMITER =
- RateLimiter.create(1.0 / 30);
+ RateLimiter.create(1.0 / 30);
@Context
private jakarta.inject.Provider configProvider;
@@ -71,9 +72,9 @@ public void filter(ContainerRequestContext context) {
// There will be a thread doesn't work, dedicated to statistics
if (load.incrementAndGet() >= maxWorkerThreads) {
throw new ServiceUnavailableException(String.format(
- "The server is too busy to process the request, " +
- "you can config %s to adjust it or try again later",
- ServerOptions.MAX_WORKER_THREADS.name()));
+ "The server is too busy to process the request, " +
+ "you can config %s to adjust it or try again later",
+ ServerOptions.MAX_WORKER_THREADS.name()));
}
long minFreeMemory = config.get(ServerOptions.MIN_FREE_MEMORY);
@@ -84,17 +85,17 @@ public void filter(ContainerRequestContext context) {
if (presumableFreeMem < minFreeMemory) {
gcIfNeeded();
throw new ServiceUnavailableException(String.format(
- "The server available memory %s(MB) is below than " +
- "threshold %s(MB) and can't process the request, " +
- "you can config %s to adjust it or try again later",
- presumableFreeMem, minFreeMemory,
- ServerOptions.MIN_FREE_MEMORY.name()));
+ "The server available memory %s(MB) is below than " +
+ "threshold %s(MB) and can't process the request, " +
+ "you can config %s to adjust it or try again later",
+ presumableFreeMem, minFreeMemory,
+ ServerOptions.MIN_FREE_MEMORY.name()));
}
}
public static boolean isWhiteAPI(ContainerRequestContext context) {
List segments = context.getUriInfo().getPathSegments();
- E.checkArgument(segments.size() > 0, "Invalid request uri '%s'",
+ E.checkArgument(!segments.isEmpty(), "Invalid request uri '%s'",
context.getUriInfo().getPath());
String rootPath = segments.get(0).getPath();
return WHITE_API_LIST.contains(rootPath);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
index 04f2fada5d..83a6b0d73a 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
@@ -17,6 +17,8 @@
package org.apache.hugegraph.api.filter;
+import org.apache.hugegraph.define.WorkLoad;
+
import jakarta.inject.Singleton;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerResponseContext;
@@ -24,8 +26,6 @@
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.ext.Provider;
-import org.apache.hugegraph.define.WorkLoad;
-
@Provider
@Singleton
public class LoadReleaseFilter implements ContainerResponseFilter {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
index 35dc3793de..2a2a9142ef 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
@@ -151,5 +151,6 @@ private void initClientIfNeeded() {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface RedirectMasterRole {
+
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
index 70f6cb16de..980c714d31 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
@@ -34,7 +34,7 @@ public class StatusFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext)
- throws IOException {
+ throws IOException {
if (responseContext.getStatus() == 200) {
for (Annotation i : responseContext.getEntityAnnotations()) {
if (i instanceof Status) {
@@ -48,6 +48,7 @@ public void filter(ContainerRequestContext requestContext,
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Status {
+
int OK = 200;
int CREATED = 201;
int ACCEPTED = 202;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
index c533a7d990..2ba95e5bc9 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
@@ -21,21 +21,21 @@
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.hugegraph.HugeException;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.metrics.MetricsUtil;
import org.apache.hugegraph.server.RestServer;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeException;
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.structure.HugeElement;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.slf4j.Logger;
+
import com.codahale.metrics.Meter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -49,14 +49,13 @@ public class BatchAPI extends API {
static {
MetricsUtil.registerGauge(RestServer.class, "batch-write-threads",
- () -> BATCH_WRITE_THREADS.intValue());
+ BATCH_WRITE_THREADS::intValue);
}
private final Meter batchMeter;
public BatchAPI() {
- this.batchMeter = MetricsUtil.registerMeter(this.getClass(),
- "batch-commit");
+ this.batchMeter = MetricsUtil.registerMeter(this.getClass(), "batch-commit");
}
public R commit(HugeConfig config, HugeGraph g, int size,
@@ -99,8 +98,7 @@ protected abstract static class JsonElement implements Checkable {
protected abstract Object[] properties();
}
- protected void updateExistElement(JsonElement oldElement,
- JsonElement newElement,
+ protected void updateExistElement(JsonElement oldElement, JsonElement newElement,
Map strategies) {
if (oldElement == null) {
return;
@@ -113,8 +111,8 @@ protected void updateExistElement(JsonElement oldElement,
if (oldElement.properties.get(key) != null &&
newElement.properties.get(key) != null) {
Object value = updateStrategy.checkAndUpdateProperty(
- oldElement.properties.get(key),
- newElement.properties.get(key));
+ oldElement.properties.get(key),
+ newElement.properties.get(key));
newElement.properties.put(key, value);
} else if (oldElement.properties.get(key) != null &&
newElement.properties.get(key) == null) {
@@ -124,9 +122,7 @@ protected void updateExistElement(JsonElement oldElement,
}
}
- protected void updateExistElement(HugeGraph g,
- Element oldElement,
- JsonElement newElement,
+ protected void updateExistElement(HugeGraph g, Element oldElement, JsonElement newElement,
Map strategies) {
if (oldElement == null) {
return;
@@ -139,8 +135,8 @@ protected void updateExistElement(HugeGraph g,
if (oldElement.property(key).isPresent() &&
newElement.properties.get(key) != null) {
Object value = updateStrategy.checkAndUpdateProperty(
- oldElement.property(key).value(),
- newElement.properties.get(key));
+ oldElement.property(key).value(),
+ newElement.properties.get(key));
value = g.propertyKey(key).validValueOrThrow(value);
newElement.properties.put(key, value);
} else if (oldElement.property(key).isPresent() &&
@@ -151,8 +147,7 @@ protected void updateExistElement(HugeGraph g,
}
}
- protected static void updateProperties(HugeElement element,
- JsonElement jsonElement,
+ protected static void updateProperties(HugeElement element, JsonElement jsonElement,
boolean append) {
for (Map.Entry e : jsonElement.properties.entrySet()) {
String key = e.getKey();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
index c0a8577e55..25e8cacf00 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
@@ -24,31 +24,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.function.TriFunction;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.UpdateStrategy;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
@@ -58,6 +33,9 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.ConditionQuery;
import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.schema.PropertyKey;
@@ -69,9 +47,31 @@
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.function.TriFunction;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/graph/edges")
@Singleton
@Tag(name = "EdgeAPI")
@@ -98,18 +98,15 @@ public String create(@Context GraphManager manager,
* NOTE: If the vertex id is correct but label not match with id,
* we allow to create it here
*/
- vertexLabel(g, jsonEdge.sourceLabel,
- "Invalid source vertex label '%s'");
- vertexLabel(g, jsonEdge.targetLabel,
- "Invalid target vertex label '%s'");
+ vertexLabel(g, jsonEdge.sourceLabel, "Invalid source vertex label '%s'");
+ vertexLabel(g, jsonEdge.targetLabel, "Invalid target vertex label '%s'");
}
Vertex srcVertex = getVertex(g, jsonEdge.source, jsonEdge.sourceLabel);
Vertex tgtVertex = getVertex(g, jsonEdge.target, jsonEdge.targetLabel);
Edge edge = commit(g, () -> {
- return srcVertex.addEdge(jsonEdge.label, tgtVertex,
- jsonEdge.properties());
+ return srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
});
return manager.serializer(g).writeEdge(edge);
@@ -136,7 +133,7 @@ public String create(@Context HugeConfig config,
HugeGraph g = graph(manager, graph);
TriFunction getVertex =
- checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
+ checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
return this.commit(config, g, jsonEdges.size(), () -> {
List ids = new ArrayList<>(jsonEdges.size());
@@ -146,12 +143,9 @@ public String create(@Context HugeConfig config,
* then the label is correct and not matched id,
* it will be allowed currently
*/
- Vertex srcVertex = getVertex.apply(g, jsonEdge.source,
- jsonEdge.sourceLabel);
- Vertex tgtVertex = getVertex.apply(g, jsonEdge.target,
- jsonEdge.targetLabel);
- Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex,
- jsonEdge.properties());
+ Vertex srcVertex = getVertex.apply(g, jsonEdge.source, jsonEdge.sourceLabel);
+ Vertex tgtVertex = getVertex.apply(g, jsonEdge.target, jsonEdge.targetLabel);
+ Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
ids.add((Id) edge.id());
}
return manager.serializer(g).writeIds(ids);
@@ -179,16 +173,16 @@ public String update(@Context HugeConfig config,
HugeGraph g = graph(manager, graph);
Map map = new HashMap<>(req.jsonEdges.size());
- TriFunction getVertex =
- req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
+ TriFunction getVertex = req.checkVertex ?
+ EdgeAPI::getVertex :
+ EdgeAPI::newVertex;
- return this.commit(config, g, map.size(), () -> {
+ return this.commit(config, g, 0, () -> {
// 1.Put all newEdges' properties into map (combine first)
req.jsonEdges.forEach(newEdge -> {
Id newEdgeId = getEdgeId(graph(manager, graph), newEdge);
JsonEdge oldEdge = map.get(newEdgeId);
- this.updateExistElement(oldEdge, newEdge,
- req.updateStrategies);
+ this.updateExistElement(oldEdge, newEdge, req.updateStrategies);
map.put(newEdgeId, newEdge);
});
@@ -197,19 +191,15 @@ public String update(@Context HugeConfig config,
Iterator oldEdges = g.edges(ids);
oldEdges.forEachRemaining(oldEdge -> {
JsonEdge newEdge = map.get(oldEdge.id());
- this.updateExistElement(g, oldEdge, newEdge,
- req.updateStrategies);
+ this.updateExistElement(g, oldEdge, newEdge, req.updateStrategies);
});
// 3.Add all finalEdges
List edges = new ArrayList<>(map.size());
map.values().forEach(finalEdge -> {
- Vertex srcVertex = getVertex.apply(g, finalEdge.source,
- finalEdge.sourceLabel);
- Vertex tgtVertex = getVertex.apply(g, finalEdge.target,
- finalEdge.targetLabel);
- edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex,
- finalEdge.properties()));
+ Vertex srcVertex = getVertex.apply(g, finalEdge.source, finalEdge.sourceLabel);
+ Vertex tgtVertex = getVertex.apply(g, finalEdge.target, finalEdge.targetLabel);
+ edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex, finalEdge.properties()));
});
// If return ids, the ids.size() maybe different with the origins'
@@ -253,7 +243,6 @@ public String update(@Context GraphManager manager,
}
commit(g, () -> updateProperties(edge, jsonEdge, append));
-
return manager.serializer(g).writeEdge(edge);
}
@@ -281,8 +270,7 @@ public String list(@Context GraphManager manager,
Map props = parseProperties(properties);
if (page != null) {
E.checkArgument(offset == 0,
- "Not support querying edges based on paging " +
- "and offset together");
+ "Not support querying edges based on paging and offset together");
}
Id vertex = VertexAPI.checkAndParseVertexId(vertexId);
@@ -321,8 +309,7 @@ public String list(@Context GraphManager manager,
if (page == null) {
traversal = traversal.range(offset, offset + limit);
} else {
- traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
- .limit(limit);
+ traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
}
try {
@@ -372,42 +359,38 @@ public void delete(@Context GraphManager manager,
g.removeEdge(label, id);
} catch (NotFoundException e) {
throw new IllegalArgumentException(String.format(
- "No such edge with id: '%s', %s", id, e));
+ "No such edge with id: '%s', %s", id, e));
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(String.format(
- "No such edge with id: '%s'", id));
+ "No such edge with id: '%s'", id));
}
});
}
- private static void checkBatchSize(HugeConfig config,
- List edges) {
+ private static void checkBatchSize(HugeConfig config, List edges) {
int max = config.get(ServerOptions.MAX_EDGES_PER_BATCH);
if (edges.size() > max) {
throw new IllegalArgumentException(String.format(
- "Too many edges for one time post, " +
- "the maximum number is '%s'", max));
+ "Too many edges for one time post, " +
+ "the maximum number is '%s'", max));
}
- if (edges.size() == 0) {
- throw new IllegalArgumentException(
- "The number of edges can't be 0");
+ if (edges.isEmpty()) {
+ throw new IllegalArgumentException("The number of edges can't be 0");
}
}
- private static Vertex getVertex(HugeGraph graph,
- Object id, String label) {
+ private static Vertex getVertex(HugeGraph graph, Object id, String label) {
HugeVertex vertex;
try {
vertex = (HugeVertex) graph.vertices(id).next();
} catch (NoSuchElementException e) {
- throw new IllegalArgumentException(String.format(
- "Invalid vertex id '%s'", id));
+ throw new IllegalArgumentException(String.format("Invalid vertex id '%s'", id));
}
if (label != null && !vertex.label().equals(label)) {
throw new IllegalArgumentException(String.format(
- "The label of vertex '%s' is unmatched, users expect " +
- "label '%s', actual label stored is '%s'",
- id, label, vertex.label()));
+ "The label of vertex '%s' is unmatched, users expect " +
+ "label '%s', actual label stored is '%s'",
+ id, label, vertex.label()));
}
// Clone a new vertex to support multi-thread access
return vertex.copy();
@@ -419,8 +402,7 @@ private static Vertex newVertex(HugeGraph g, Object id, String label) {
return new HugeVertex(g, idValue, vl);
}
- private static VertexLabel vertexLabel(HugeGraph graph, String label,
- String message) {
+ private static VertexLabel vertexLabel(HugeGraph graph, String label, String message) {
try {
// NOTE: don't use SchemaManager because it will throw 404
return graph.vertexLabel(label);
@@ -437,8 +419,8 @@ public static Direction parseDirection(String direction) {
return Direction.valueOf(direction);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "Direction value must be in [OUT, IN, BOTH], " +
- "but got '%s'", direction));
+ "Direction value must be in [OUT, IN, BOTH], " +
+ "but got '%s'", direction));
}
}
@@ -453,8 +435,7 @@ private Id getEdgeId(HugeGraph g, JsonEdge newEdge) {
String sortKey = pk.name();
Object sortKeyValue = newEdge.properties.get(sortKey);
E.checkArgument(sortKeyValue != null,
- "The value of sort key '%s' can't be null",
- sortKey);
+ "The value of sort key '%s' can't be null", sortKey);
sortKeyValue = pk.validValueOrThrow(sortKeyValue);
sortKeyValues.add(sortKeyValue);
});
@@ -487,14 +468,11 @@ protected static class BatchEdgeRequest {
private static void checkUpdate(BatchEdgeRequest req) {
E.checkArgumentNotNull(req, "BatchEdgeRequest can't be null");
- E.checkArgumentNotNull(req.jsonEdges,
- "Parameter 'edges' can't be null");
- E.checkArgument(req.updateStrategies != null &&
- !req.updateStrategies.isEmpty(),
+ E.checkArgumentNotNull(req.jsonEdges, "Parameter 'edges' can't be null");
+ E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
"Parameter 'update_strategies' can't be empty");
- E.checkArgument(req.createIfNotExist == true,
- "Parameter 'create_if_not_exist' " +
- "dose not support false now");
+ E.checkArgument(req.createIfNotExist,
+ "Parameter 'create_if_not_exist' dose not support false now");
}
@Override
@@ -524,15 +502,11 @@ public void checkCreate(boolean isBatch) {
E.checkArgumentNotNull(this.source, "Expect source vertex id");
E.checkArgumentNotNull(this.target, "Expect target vertex id");
if (isBatch) {
- E.checkArgumentNotNull(this.sourceLabel,
- "Expect source vertex label");
- E.checkArgumentNotNull(this.targetLabel,
- "Expect target vertex label");
+ E.checkArgumentNotNull(this.sourceLabel, "Expect source vertex label");
+ E.checkArgumentNotNull(this.targetLabel, "Expect target vertex label");
} else {
- E.checkArgument(this.sourceLabel == null &&
- this.targetLabel == null ||
- this.sourceLabel != null &&
- this.targetLabel != null,
+ E.checkArgument(this.sourceLabel == null && this.targetLabel == null ||
+ this.sourceLabel != null && this.targetLabel != null,
"The both source and target vertex label " +
"are either passed in, or not passed in");
}
@@ -541,15 +515,13 @@ public void checkCreate(boolean isBatch) {
@Override
public void checkUpdate() {
- E.checkArgumentNotNull(this.properties,
- "The properties of edge can't be null");
+ E.checkArgumentNotNull(this.properties, "The properties of edge can't be null");
for (Map.Entry entry : this.properties.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
E.checkArgumentNotNull(value, "Not allowed to set value of " +
- "property '%s' to null for edge '%s'",
- key, this.id);
+ "property '%s' to null for edge '%s'", key, this.id);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
index 98032d2ad7..e25e7888b8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
@@ -25,29 +25,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.UpdateStrategy;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
@@ -57,6 +34,9 @@
import org.apache.hugegraph.backend.id.SplicingIdGenerator;
import org.apache.hugegraph.backend.query.ConditionQuery;
import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.schema.PropertyKey;
import org.apache.hugegraph.schema.VertexLabel;
@@ -68,9 +48,29 @@
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/graph/vertices")
@Singleton
@Tag(name = "VertexAPI")
@@ -148,7 +148,7 @@ public String update(@Context HugeConfig config,
HugeGraph g = graph(manager, graph);
Map map = new HashMap<>(req.jsonVertices.size());
- return this.commit(config, g, map.size(), () -> {
+ return this.commit(config, g, 0, () -> {
/*
* 1.Put all newVertices' properties into map (combine first)
* - Consider primary-key & user-define ID mode first
@@ -156,8 +156,7 @@ public String update(@Context HugeConfig config,
req.jsonVertices.forEach(newVertex -> {
Id newVertexId = getVertexId(g, newVertex);
JsonVertex oldVertex = map.get(newVertexId);
- this.updateExistElement(oldVertex, newVertex,
- req.updateStrategies);
+ this.updateExistElement(oldVertex, newVertex, req.updateStrategies);
map.put(newVertexId, newVertex);
});
@@ -166,8 +165,7 @@ public String update(@Context HugeConfig config,
Iterator oldVertices = g.vertices(ids);
oldVertices.forEachRemaining(oldVertex -> {
JsonVertex newVertex = map.get(oldVertex.id());
- this.updateExistElement(g, oldVertex, newVertex,
- req.updateStrategies);
+ this.updateExistElement(g, oldVertex, newVertex, req.updateStrategies);
});
// 3.Add finalVertices and return them
@@ -177,8 +175,7 @@ public String update(@Context HugeConfig config,
});
// If return ids, the ids.size() maybe different with the origins'
- return manager.serializer(g)
- .writeVertices(vertices.iterator(), false);
+ return manager.serializer(g).writeVertices(vertices.iterator(), false);
});
}
@@ -238,8 +235,7 @@ public String list(@Context GraphManager manager,
Map props = parseProperties(properties);
if (page != null) {
E.checkArgument(offset == 0,
- "Not support querying vertices based on paging " +
- "and offset together");
+ "Not support querying vertices based on paging and offset together");
}
HugeGraph g = graph(manager, graph);
@@ -265,13 +261,11 @@ public String list(@Context GraphManager manager,
if (page == null) {
traversal = traversal.range(offset, offset + limit);
} else {
- traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
- .limit(limit);
+ traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
}
try {
- return manager.serializer(g).writeVertices(traversal,
- page != null);
+ return manager.serializer(g).writeVertices(traversal, page != null);
} finally {
if (g.tx().isOpen()) {
g.tx().close();
@@ -319,10 +313,10 @@ public void delete(@Context GraphManager manager,
g.removeVertex(label, id);
} catch (NotFoundException e) {
throw new IllegalArgumentException(String.format(
- "No such vertex with id: '%s', %s", id, e));
+ "No such vertex with id: '%s', %s", id, e));
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(String.format(
- "No such vertex with id: '%s'", id));
+ "No such vertex with id: '%s'", id));
}
});
}
@@ -340,22 +334,19 @@ public static Id checkAndParseVertexId(String idValue) {
return uuid ? Text.uuid((String) id) : HugeVertex.getIdValue(id);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "The vertex id must be formatted as Number/String/UUID" +
- ", but got '%s'", idValue));
+ "The vertex id must be formatted as Number/String/UUID" +
+ ", but got '%s'", idValue));
}
}
- private static void checkBatchSize(HugeConfig config,
- List vertices) {
+ private static void checkBatchSize(HugeConfig config, List vertices) {
int max = config.get(ServerOptions.MAX_VERTICES_PER_BATCH);
if (vertices.size() > max) {
throw new IllegalArgumentException(String.format(
- "Too many vertices for one time post, " +
- "the maximum number is '%s'", max));
+ "Too many vertices for one time post, the maximum number is '%s'", max));
}
- if (vertices.size() == 0) {
- throw new IllegalArgumentException(
- "The number of vertices can't be 0");
+ if (vertices.isEmpty()) {
+ throw new IllegalArgumentException("The number of vertices can't be 0");
}
}
@@ -373,8 +364,7 @@ private static Id getVertexId(HugeGraph g, JsonVertex vertex) {
String propertyKey = g.propertyKey(pkId).name();
Object propertyValue = vertex.properties.get(propertyKey);
E.checkArgument(propertyValue != null,
- "The value of primary key '%s' can't be null",
- propertyKey);
+ "The value of primary key '%s' can't be null", propertyKey);
pkValues.add(propertyValue);
}
@@ -402,8 +392,7 @@ private static void checkUpdate(BatchVertexRequest req) {
E.checkArgumentNotNull(req, "BatchVertexRequest can't be null");
E.checkArgumentNotNull(req.jsonVertices,
"Parameter 'vertices' can't be null");
- E.checkArgument(req.updateStrategies != null &&
- !req.updateStrategies.isEmpty(),
+ E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
"Parameter 'update_strategies' can't be empty");
E.checkArgument(req.createIfNotExist,
"Parameter 'create_if_not_exist' " +
@@ -428,14 +417,13 @@ public void checkCreate(boolean isBatch) {
@Override
public void checkUpdate() {
- E.checkArgumentNotNull(this.properties,
- "The properties of vertex can't be null");
+ E.checkArgumentNotNull(this.properties, "The properties of vertex can't be null");
for (Map.Entry e : this.properties.entrySet()) {
String key = e.getKey();
Object value = e.getValue();
E.checkArgumentNotNull(value, "Not allowed to set value of " +
- "property '%s' to null for vertex '%s'",
+ "property '%s' to null for vertex '%s'",
key, this.id);
}
}
@@ -462,7 +450,7 @@ public Object[] properties() {
}
if (this.id != null) {
newProps[appendIndex++] = T.id;
- // Keep value++ to avoid code trap
+ // Note: Here we keep value++ to avoid code trap
newProps[appendIndex++] = this.id;
}
return newProps;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
index 37963a371e..810dbc8b45 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
@@ -83,7 +83,7 @@ private static PoolingHttpClientConnectionManager configConnectionManager(Client
* repository seems to have a bug: https://github.com/jersey/jersey/pull/3752
*/
PoolingHttpClientConnectionManager pool =
- new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS);
+ new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS);
Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL);
Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
index 09459ca4c7..110a3ef5b8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
@@ -17,7 +17,16 @@
package org.apache.hugegraph.api.gremlin;
+import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.metrics.MetricsUtil;
+import org.apache.hugegraph.util.E;
+
+import com.codahale.metrics.Histogram;
+import com.codahale.metrics.annotation.Timed;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
@@ -29,14 +38,6 @@
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
-import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
-import org.apache.hugegraph.api.filter.RedirectFilter;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.metrics.MetricsUtil;
-import com.codahale.metrics.Histogram;
-import com.codahale.metrics.annotation.Timed;
-import jakarta.inject.Singleton;
-
@Path("gremlin")
@Singleton
@Tag(name = "GremlinAPI")
@@ -77,6 +78,7 @@ public Response get(@Context HugeConfig conf,
@Context UriInfo uriInfo) {
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
String query = uriInfo.getRequestUri().getRawQuery();
+ E.checkArgumentNotNull(query, "The request query can't be empty");
MultivaluedMap params = uriInfo.getQueryParameters();
Response response = this.client().doGetRequest(auth, params);
GREMLIN_INPUT_HISTOGRAM.update(query.length());
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
index 009f44dbd7..1f35da5f1c 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
@@ -24,6 +24,7 @@
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.exception.HugeGremlinException;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -36,8 +37,7 @@
public class GremlinQueryAPI extends API {
private static final Set FORBIDDEN_REQUEST_EXCEPTIONS =
- ImmutableSet.of("java.lang.SecurityException",
- "jakarta.ws.rs.ForbiddenException");
+ ImmutableSet.of("java.lang.SecurityException", "jakarta.ws.rs.ForbiddenException");
private static final Set BAD_REQUEST_EXCEPTIONS = ImmutableSet.of(
"java.lang.IllegalArgumentException",
"java.util.concurrent.TimeoutException",
@@ -55,6 +55,7 @@ public GremlinClient client() {
if (this.client != null) {
return this.client;
}
+
HugeConfig config = this.configProvider.get();
String url = config.get(ServerOptions.GREMLIN_SERVER_URL);
int timeout = config.get(ServerOptions.GREMLIN_SERVER_TIMEOUT) * 1000;
@@ -99,6 +100,7 @@ private static boolean matchBadRequestException(String exClass) {
if (exClass == null) {
return false;
}
+
if (BAD_REQUEST_EXCEPTIONS.contains(exClass)) {
return true;
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
index 408d27a39d..8ebf1f6d10 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
@@ -37,7 +37,6 @@
import com.google.common.collect.ImmutableMap;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.NotFoundException;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
index 5bb8274b77..e7def05065 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
@@ -190,11 +190,11 @@ public static GremlinRequest fromJson(String json) {
String gremlin = (String) map.get("gremlin");
@SuppressWarnings("unchecked")
Map bindings = (Map)
- map.get("bindings");
+ map.get("bindings");
String language = (String) map.get("language");
@SuppressWarnings("unchecked")
Map aliases = (Map)
- map.get("aliases");
+ map.get("aliases");
GremlinRequest request = new GremlinRequest();
request.gremlin(gremlin);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
index 8daf2954dd..d9b90de103 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
@@ -92,7 +92,7 @@ public Map list(@Context GraphManager manager,
// Set limit to NO_LIMIT to ignore limit when query task by ids
limit = NO_LIMIT;
List idList = ids.stream().map(IdGenerator::of)
- .collect(Collectors.toList());
+ .collect(Collectors.toList());
iter = scheduler.tasks(idList);
} else {
if (status == null) {
@@ -159,7 +159,7 @@ public Map update(@Context GraphManager manager,
if (!ACTION_CANCEL.equals(action)) {
throw new NotSupportedException(String.format(
- "Not support action '%s'", action));
+ "Not support action '%s'", action));
}
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
@@ -173,8 +173,8 @@ public Map update(@Context GraphManager manager,
assert task.completed() || task.cancelling();
throw new BadRequestException(String.format(
- "Can't cancel task '%s' which is completed or cancelling",
- id));
+ "Can't cancel task '%s' which is completed or cancelling",
+ id));
}
private static TaskStatus parseStatus(String status) {
@@ -182,8 +182,8 @@ private static TaskStatus parseStatus(String status) {
return TaskStatus.valueOf(status.toUpperCase());
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "Status value must be in %s, but got '%s'",
- Arrays.asList(TaskStatus.values()), status));
+ "Status value must be in %s, but got '%s'",
+ Arrays.asList(TaskStatus.values()), status));
}
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
index 605abef1d7..b0ca6845ad 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
@@ -72,7 +72,6 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
@@ -363,7 +362,6 @@ private Map> statistics() {
Counter successCounter = reporter.counters().get(
joinWithSlash(metricsName, METRICS_PATH_SUCCESS_COUNTER));
-
Histogram histogram = entry.getValue();
Map entryMetricsMap = new HashMap<>();
entryMetricsMap.put(MetricsKeys.MAX_RESPONSE_TIME.name(),
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
index 8bcc9311d1..f45c228baf 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
@@ -22,6 +22,23 @@
import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
+import org.apache.hugegraph.auth.HugePermission;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.type.define.GraphMode;
+import org.apache.hugegraph.type.define.GraphReadMode;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
@@ -30,8 +47,8 @@
import jakarta.ws.rs.ForbiddenException;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotSupportedException;
-import jakarta.ws.rs.PUT;
import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
@@ -39,23 +56,6 @@
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.SecurityContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
-import org.apache.hugegraph.auth.HugePermission;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.type.define.GraphMode;
-import org.apache.hugegraph.type.define.GraphReadMode;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("graphs")
@Singleton
@Tag(name = "GraphsAPI")
@@ -154,7 +154,7 @@ public File getConf(@Context GraphManager manager,
File file = config.file();
if (file == null) {
throw new NotSupportedException("Can't access the api in " +
- "a node which started with non local file config.");
+ "a node which started with non local file config.");
}
return file;
}
@@ -255,9 +255,9 @@ public Map mode(@Context GraphManager manager,
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
public Map graphReadMode(
- @Context GraphManager manager,
- @PathParam("name") String name,
- GraphReadMode readMode) {
+ @Context GraphManager manager,
+ @PathParam("name") String name,
+ GraphReadMode readMode) {
LOG.debug("Set graph-read-mode to: '{}' of graph '{}'",
readMode, name);
@@ -275,8 +275,8 @@ public Map graphReadMode(
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$name"})
public Map graphReadMode(
- @Context GraphManager manager,
- @PathParam("name") String name) {
+ @Context GraphManager manager,
+ @PathParam("name") String name) {
LOG.debug("Get graph-read-mode of graph '{}'", name);
HugeGraph g = graph(manager, name);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
index 26a7873e45..279f095569 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
@@ -24,31 +24,30 @@
import java.util.TreeMap;
import java.util.TreeSet;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Application;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.InsertionOrderUtil;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.version.CoreVersion;
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
import org.glassfish.jersey.model.Parameter.Source;
import org.glassfish.jersey.server.model.Parameter;
import org.glassfish.jersey.server.model.Resource;
import org.glassfish.jersey.server.model.ResourceMethod;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.InsertionOrderUtil;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.version.CoreVersion;
-
import com.codahale.metrics.annotation.Timed;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.MediaType;
+
@Path("/")
@Singleton
@Tag(name = "ProfileAPI")
@@ -154,8 +153,8 @@ public void put(APICategory category, APIProfile profile) {
categories = this.apis.computeIfAbsent(category.dir,
k -> new TreeMap<>());
List profiles = categories.computeIfAbsent(
- category.category,
- k -> new ArrayList<>());
+ category.category,
+ k -> new ArrayList<>());
profiles.add(profile);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
index b6a095c9ec..5f951e7ac7 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
@@ -19,6 +19,13 @@
import java.util.Map;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.version.ApiVersion;
+import org.apache.hugegraph.version.CoreVersion;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
@@ -26,12 +33,6 @@
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.version.ApiVersion;
-import org.apache.hugegraph.version.CoreVersion;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("versions")
@Singleton
@Tag(name = "VersionAPI")
@@ -43,9 +44,9 @@ public class VersionAPI extends API {
@PermitAll
public Object list() {
Map versions = ImmutableMap.of("version", "v1",
- "core", CoreVersion.VERSION.toString(),
- "gremlin", CoreVersion.GREMLIN_VERSION,
- "api", ApiVersion.VERSION.toString());
+ "core", CoreVersion.VERSION.toString(),
+ "gremlin", CoreVersion.GREMLIN_VERSION,
+ "api", ApiVersion.VERSION.toString());
return ImmutableMap.of("versions", versions);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
index f765ff46ab..e965ed21a9 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
@@ -76,7 +76,8 @@ public Map list(@Context GraphManager manager) {
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
@Operation(summary = "update white ip list")
- public Map updateWhiteIPs(@Context GraphManager manager, Map actionMap) {
+ public Map updateWhiteIPs(@Context GraphManager manager,
+ Map actionMap) {
E.checkArgument(actionMap != null,
"Missing argument: actionMap");
Set whiteIpList = manager.authManager().listWhiteIPs();
@@ -137,7 +138,8 @@ public Map updateWhiteIPs(@Context GraphManager manager, Map updateStatus(@Context GraphManager manager, @QueryParam("status") String status) {
+ public Map updateStatus(@Context GraphManager manager,
+ @QueryParam("status") String status) {
LOG.debug("Enable or disable white ip list");
E.checkArgument("true".equals(status) ||
"false".equals(status),
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
index 2c2d893b66..76f44a5248 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
@@ -21,38 +21,38 @@
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.api.filter.RedirectFilter;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.RedirectFilter;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob;
import org.apache.hugegraph.backend.store.raft.RaftGroupManager;
import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.job.JobBuilder;
import org.apache.hugegraph.util.DateUtil;
import org.apache.hugegraph.util.JsonUtil;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/raft")
@Singleton
@Tag(name = "RaftAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
index 1154d71447..82ad79e38e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
@@ -20,16 +20,6 @@
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.graph.EdgeAPI;
@@ -40,9 +30,20 @@
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
/**
* AdamicAdar is one of the prediction algorithms in graph, you can get more
* info and definition in:
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
index f2e3f0c9a5..0855c8cb62 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
@@ -25,31 +25,31 @@
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.CountTraverser;
import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/count")
@Singleton
@Tag(name = "CountAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
index 03ebb82180..8af4969ddb 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
@@ -114,7 +114,6 @@ public String post(@Context GraphManager manager,
measure.addIterCount(traverser.vertexIterCounter.get(),
traverser.edgeIterCounter.get());
-
Iterator> iterVertex;
Set vertexIds = new HashSet<>();
if (request.withPath) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
index 5237fdcdb7..f52c2b57ee 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
@@ -25,7 +25,6 @@
import org.apache.hugegraph.api.graph.VertexAPI;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.EdgeExistenceTraverser;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
index 9c1fda3be2..d5bf74ee20 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
@@ -26,29 +26,29 @@
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/neighborrank")
@Singleton
@Tag(name = "NeighborRankAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
index 8619fb1711..aefc9daaa0 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
@@ -24,16 +24,6 @@
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
@@ -43,9 +33,19 @@
import org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/personalrank")
@Singleton
@Tag(name = "PersonalRankAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
index 881138bbf9..fb4d73e5af 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
@@ -20,16 +20,6 @@
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.graph.EdgeAPI;
@@ -40,9 +30,20 @@
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
/**
* ResourceAllocation is one of the prediction algorithms in graph, you can get
* more info and definition in:
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
index 183c27d87c..d5be694893 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
@@ -23,16 +23,17 @@
import java.util.Map;
import java.util.Set;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.ConditionQuery;
+import org.apache.hugegraph.schema.SchemaLabel;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.E;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class Vertices {
@@ -47,10 +48,14 @@ public class Vertices {
public Iterator vertices(HugeGraph g) {
Map props = this.properties;
E.checkArgument(!((this.ids == null || this.ids.isEmpty()) &&
- (props == null || props.isEmpty()) &&
- this.label == null), "No source vertices provided");
+ (props == null || props.isEmpty()) &&
+ this.label == null), "No source vertices provided");
Iterator iterator;
if (this.ids != null && !this.ids.isEmpty()) {
+ E.checkArgument(this.label == null,
+ "Just provide one of ids or label of source vertices");
+ E.checkArgument(props == null || props.isEmpty(),
+ "Just provide one of ids or properties of source vertices");
List sourceIds = new ArrayList<>(this.ids.size());
for (Object id : this.ids) {
sourceIds.add(HugeVertex.getIdValue(id));
@@ -62,7 +67,7 @@ public Iterator vertices(HugeGraph g) {
} else {
ConditionQuery query = new ConditionQuery(HugeType.VERTEX);
if (this.label != null) {
- Id label = g.vertexLabel(this.label).id();
+ Id label = SchemaLabel.getVertexLabelId(g, this.label);
query.eq(HugeKeys.LABEL, label);
}
if (props != null && !props.isEmpty()) {
@@ -72,7 +77,7 @@ public Iterator vertices(HugeGraph g) {
assert !query.empty();
iterator = g.vertices(query);
E.checkArgument(iterator.hasNext(), "Not exist source vertex " +
- "with label '%s' and properties '%s'",
+ "with label '%s' and properties '%s'",
this.label, props);
}
return iterator;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
index 89272fb8f5..2ea29aaf1d 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
@@ -20,6 +20,16 @@
import java.util.Map;
import java.util.Optional;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
@@ -32,16 +42,6 @@
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("graphs/{graph}/variables")
@Singleton
@Tag(name = "VariablesAPI")
@@ -91,7 +91,7 @@ public Map get(@Context GraphManager manager,
Optional> object = g.variables().get(key);
if (!object.isPresent()) {
throw new NotFoundException(String.format(
- "Variable '%s' does not exist", key));
+ "Variable '%s' does not exist", key));
}
return ImmutableMap.of(key, object.get());
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
index 2106d54dc4..eaad573d5e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
@@ -30,6 +30,8 @@
import org.apache.hugegraph.util.E;
import org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens;
+import jakarta.ws.rs.core.SecurityContext;
+
public class ConfigAuthenticator implements HugeAuthenticator {
public static final String KEY_USERNAME = CredentialGraphTokens.PROPERTY_USERNAME;
@@ -50,8 +52,9 @@ public void setup(HugeConfig config) {
/**
* Verify if a user is legal
- * @param username the username for authentication
- * @param password the password for authentication
+ *
+ * @param username the username for authentication
+ * @param password the password for authentication
* @return String No permission if return ROLE_NONE else return a role
*/
@Override
@@ -79,6 +82,10 @@ public UserWithRole authenticate(final String username,
return new UserWithRole(IdGenerator.of(username), username, role);
}
+ @Override
+ public void unauthorize(SecurityContext context) {
+ }
+
@Override
public AuthManager authManager() {
throw new NotImplementedException("AuthManager is unsupported by ConfigAuthenticator");
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
index f753fc2ca7..7f8829974e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
@@ -115,8 +115,8 @@ public void injectTraversalSource() {
String gName = G_PREFIX + graph;
if (manager.getTraversalSource(gName) != null) {
throw new HugeException(
- "Found existing name '%s' in global bindings, " +
- "it may lead to gremlin query error.", gName);
+ "Found existing name '%s' in global bindings, " +
+ "it may lead to gremlin query error.", gName);
}
// Add a traversal source for all graphs with customed rule.
manager.putTraversalSource(gName, g);
@@ -136,7 +136,7 @@ private void injectGraph(HugeGraph graph) {
manager.putTraversalSource(G_PREFIX + name, g);
Whitebox.invoke(executor, "globalBindings",
- new Class>[]{ String.class, Object.class },
+ new Class>[]{String.class, Object.class},
"put", name, graph);
}
@@ -149,7 +149,7 @@ private void removeGraph(String name) {
manager.removeGraph(name);
manager.removeTraversalSource(G_PREFIX + name);
Whitebox.invoke(executor, "globalBindings",
- new Class>[]{ Object.class },
+ new Class>[]{Object.class},
"remove", name);
} catch (Exception e) {
throw new HugeException("Failed to remove graph '%s' from " +
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java
index e1077d9469..02911c8d98 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java
@@ -39,6 +39,8 @@
import org.apache.tinkerpop.gremlin.server.auth.Authenticator;
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
+import jakarta.ws.rs.core.SecurityContext;
+
public interface HugeAuthenticator extends Authenticator {
String KEY_USERNAME = CredentialGraphTokens.PROPERTY_USERNAME;
@@ -64,6 +66,8 @@ public interface HugeAuthenticator extends Authenticator {
UserWithRole authenticate(String username, String password, String token);
+ void unauthorize(SecurityContext context);
+
AuthManager authManager();
HugeGraph graph();
@@ -81,7 +85,7 @@ default void setup(final Map config) {
@Override
default User authenticate(final Map credentials)
- throws AuthenticationException {
+ throws AuthenticationException {
HugeGraphAuthProxy.resetContext();
@@ -103,10 +107,7 @@ default User authenticate(final Map credentials)
}
HugeGraphAuthProxy.logUser(user, credentials.get(KEY_PATH));
- /*
- * Set authentication context
- * TODO: unset context after finishing a request
- */
+ // TODO: Ensure context lifecycle in GraphServer & AuthServer(#AccessLogFilter)
HugeGraphAuthProxy.setContext(new Context(user));
return user;
@@ -118,11 +119,7 @@ default boolean requireAuthentication() {
}
default boolean verifyRole(RolePermission role) {
- if (role == ROLE_NONE || role == null) {
- return false;
- } else {
- return true;
- }
+ return role != ROLE_NONE && role != null;
}
void initAdminUser(String password) throws Exception;
@@ -334,7 +331,7 @@ private static Object matchedAction(HugePermission action,
return null;
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static RolePerm fromJson(Object role) {
RolePermission table = RolePermission.fromJson(role);
return new RolePerm((Map) table.map());
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
index 0c748445a2..3ffaefb04f 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
@@ -57,15 +57,18 @@
import org.apache.hugegraph.traversal.optimize.HugeCountStepStrategy;
import org.apache.hugegraph.traversal.optimize.HugeGraphStepStrategy;
import org.apache.hugegraph.traversal.optimize.HugeVertexStepStrategy;
+import org.apache.hugegraph.util.Log;
import org.apache.hugegraph.util.Reflection;
import org.apache.hugegraph.variables.HugeVariables;
+import org.slf4j.Logger;
import com.google.common.collect.ImmutableSet;
public final class HugeFactoryAuthProxy {
+ private static final Logger LOG = Log.logger(HugeFactoryAuthProxy.class);
public static final String GRAPH_FACTORY =
- "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy";
+ "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy";
private static final Set PROTECT_METHODS = ImmutableSet.of("instance");
@@ -90,116 +93,417 @@ public static synchronized HugeGraph open(Configuration config) {
return proxy;
}
+ // TODO: add some test to ensure the effect & partially move to HugeSecurityManager
private static void registerPrivateActions() {
+ // Sensitive classes (Be careful to add classes here due to JDK compatibility)
+ filterCriticalSystemClasses();
+
// Thread
- Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", "eetop", "single_step", "daemon", "stillborn", "target", "group", "contextClassLoader", "inheritedAccessControlContext", "threadInitNumber", "threadLocals", "inheritableThreadLocals", "stackSize", "nativeParkEventPointer", "tid", "threadSeqNumber", "threadStatus", "parkBlocker", "blocker", "blockerLock", "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", "uncaughtExceptionHandler", "defaultUncaughtExceptionHandler", "threadLocalRandomSeed", "threadLocalRandomSecondarySeed");
- Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", "dispatchUncaughtException", "clone", "isInterrupted", "registerNatives", "init", "init", "nextThreadNum", "nextThreadID", "blockedOn", "start0", "isCCLOverridden", "auditSubclass", "dumpThreads", "getThreads", "processQueue", "setPriority0", "stop0", "suspend0", "resume0", "interrupt0", "setNativeName");
- Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", "nextHashCode", "HASH_INCREMENT");
- Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", "createInheritedMap", "nextHashCode", "initialValue", "setInitialValue", "getMap", "createMap", "childValue");
- Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", "createMap", "childValue");
+ Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ",
+ "eetop", "single_step", "daemon", "stillborn", "target",
+ "group", "contextClassLoader",
+ "inheritedAccessControlContext", "threadInitNumber",
+ "threadLocals", "inheritableThreadLocals", "stackSize",
+ "nativeParkEventPointer", "tid", "threadSeqNumber",
+ "threadStatus", "parkBlocker", "blocker", "blockerLock",
+ "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION",
+ "uncaughtExceptionHandler",
+ "defaultUncaughtExceptionHandler",
+ "threadLocalRandomSeed",
+ "threadLocalRandomSecondarySeed");
+ Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit",
+ "dispatchUncaughtException", "clone", "isInterrupted",
+ "registerNatives", "init", "nextThreadNum",
+ "nextThreadID", "blockedOn", "start0", "isCCLOverridden",
+ "auditSubclass", "dumpThreads", "getThreads",
+ "processQueue", "setPriority0", "stop0", "suspend0",
+ "resume0", "interrupt0", "setNativeName");
+ Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode",
+ "nextHashCode", "HASH_INCREMENT");
+ Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400",
+ "createInheritedMap", "nextHashCode", "initialValue",
+ "setInitialValue", "getMap", "createMap", "childValue");
+ Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap",
+ "createMap", "childValue");
// HugeGraph
Reflection.registerFieldsToFilter(StandardAuthenticator.class, "graph");
- Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", "inputPassword", "graph");
+ Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser",
+ "inputPassword", "graph");
Reflection.registerFieldsToFilter(ConfigAuthenticator.class, "tokens");
Reflection.registerFieldsToFilter(HugeFactoryAuthProxy.class, "PROTECT_METHODS");
- Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", "registerClass", "registerPrivateActions", "registerPrivateActions", "c");
+ Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions",
+ "registerClass", "registerPrivateActions",
+ "registerPrivateActions", "c");
Reflection.registerFieldsToFilter(HugeAuthenticator.User.class, "role", "client");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", "taskScheduler", "authManager", "contexts", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "resetContext", "logUser", "verifyAdminPermission", "verifyStatusPermission", "verifyPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifyNamePermission", "verifyNameExistsPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyResPermission", "verifyResPermission", "verifyUserPermission", "verifyUserPermission", "verifyUserPermission", "getContextString", "access$6", "access$7", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "lambda$20", "lambda$21", "lambda$22", "lambda$23", "lambda$24", "access$8", "access$9", "access$10", "setContext", "getContext");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "currentUsername", "updateCreator");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "taskScheduler", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", "lambda$1", "lambda$2", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "hasTaskPermission");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, "this$0");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, "connection", "graph", "strategies", "bytecode");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "REST_WOEKER", "serialVersionUID", "strategies", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "translate");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", "this$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph",
+ "taskScheduler", "authManager", "contexts",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3",
+ "access$4", "access$2", "access$5", "resetContext",
+ "logUser", "verifyAdminPermission",
+ "verifyStatusPermission", "verifyPermission",
+ "verifySchemaPermission", "verifySchemaPermission",
+ "verifySchemaPermission", "verifySchemaPermission",
+ "verifyNamePermission", "verifyNameExistsPermission",
+ "verifyElemPermission", "verifyElemPermission",
+ "verifyElemPermission", "verifyElemPermission",
+ "verifyResPermission", "verifyResPermission",
+ "verifyUserPermission", "verifyUserPermission",
+ "verifyUserPermission", "getContextString", "access$6",
+ "access$7", "lambda$1", "lambda$2", "lambda$3",
+ "lambda$4", "lambda$5", "lambda$6", "lambda$7",
+ "lambda$8", "lambda$9", "lambda$10", "lambda$11",
+ "lambda$12", "lambda$13", "lambda$14", "lambda$15",
+ "lambda$16", "lambda$17", "lambda$18", "lambda$19",
+ "lambda$20", "lambda$21", "lambda$22", "lambda$23",
+ "lambda$24", "access$8", "access$9", "access$10",
+ "setContext", "getContext");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager",
+ "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class,
+ "currentUsername", "updateCreator");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class,
+ "taskScheduler", "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0",
+ "lambda$1", "lambda$2", "verifyTaskPermission",
+ "verifyTaskPermission", "verifyTaskPermission",
+ "verifyTaskPermission", "hasTaskPermission");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class,
+ "this$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class,
+ "connection", "graph", "strategies", "bytecode");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class,
+ "REST_WOEKER", "serialVersionUID", "strategies",
+ "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class,
+ "translate");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables",
+ "this$0");
Reflection.registerFieldsToFilter(HugeGraphAuthProxy.Context.class, "ADMIN", "user");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", "context");
- Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "access$18", "serializer", "loadSchemaStore", "loadSystemStore", "loadGraphStore", "closeTx", "analyzer", "serverInfoManager", "reloadRamtable", "reloadRamtable", "access$19", "access$20", "access$21");
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph");
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners");
- Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g");
- Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite");
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0");
- Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
- Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxSize", "checkTxVerticesCapacity", "checkTxEdgesCapacity", "verticesInTxUpdated", "verticesInTxRemoved", "removingEdgeOwner", "prepareDeletions", "prepareDeletions", "prepareUpdates", "prepareAdditions", "checkVertexExistIfCustomizedId", "checkAggregateProperty", "checkAggregateProperty", "checkNonnullProperty", "queryEdgesFromBackend", "commitPartOfEdgeDeletions", "optimizeQueries", "checkVertexLabel", "checkId", "queryVerticesFromBackend", "joinTxVertices", "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", "verifyVerticesConditionQuery", "verifyEdgesConditionQuery", "indexQuery", "joinTxRecords", "propertyUpdated", "parseEntry", "traverseByLabel", "reset", "queryVerticesByIds", "filterUnmatchedRecords", "skipOffsetOrStopLimit", "filterExpiredResultFromFromBackend", "queryEdgesByIds", "matchEdgeSortKeys", "rightResultFromIndexQuery");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner",
+ "context");
+ Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed",
+ "mode", "variables", "name", "params", "configuration",
+ "schemaEventHub", "graphEventHub", "indexEventHub",
+ "writeRateLimiter", "readRateLimiter", "taskManager",
+ "authManager", "features", "storeProvider", "tx",
+ "ramtable", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3",
+ "access$4", "access$2", "access$5", "access$6",
+ "access$7", "waitUntilAllTasksCompleted", "access$8",
+ "loadStoreProvider", "graphTransaction",
+ "schemaTransaction", "openSchemaTransaction",
+ "checkGraphNotClosed", "openSystemTransaction",
+ "openGraphTransaction", "systemTransaction", "access$9",
+ "access$10", "access$11", "access$12", "access$13",
+ "access$14", "access$15", "access$16", "access$17",
+ "access$18", "serializer", "loadSchemaStore",
+ "loadSystemStore", "loadGraphStore", "closeTx",
+ "analyzer", "serverInfoManager", "reloadRamtable",
+ "reloadRamtable", "access$19", "access$20", "access$21");
+ Reflection.registerFieldsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"),
+ "graph", "this$0");
+ Reflection.registerMethodsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"),
+ "access$1", "graph");
+ Reflection.registerFieldsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs",
+ "opened", "transactions", "this$0", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"),
+ "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction",
+ "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit",
+ "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen",
+ "setClosed", "getOrNewTransaction", "access$0", "resetState");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class,
+ "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners");
+ Reflection.registerMethodsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class,
+ "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite",
+ "lambda$fireOnRollback$1", "lambda$fireOnCommit$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g");
+ Reflection.registerMethodsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit",
+ "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite");
+ Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"),
+ "schemaTx", "systemTx", "graphTx", "openedTime",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"),
+ "access$2", "access$1", "access$0");
+ Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices",
+ "removedVertices", "addedEdges", "removedEdges",
+ "addedProps", "removedProps", "updatedVertices",
+ "updatedEdges", "updatedOldestProps", "locksTable",
+ "checkCustomVertexExist", "checkAdjacentVertexExist",
+ "lazyLoadAdjacentVertex", "ignoreInvalidEntry",
+ "commitPartOfAdjacentEdges", "batchSize", "pageSize",
+ "verticesCapacity", "edgesCapacity",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
+ Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1",
+ "lambda$2", "lambda$3", "lambda$4", "lambda$5",
+ "lambda$6", "lambda$7", "lambda$8", "lambda$9",
+ "lambda$10", "lambda$11", "lambda$12", "lambda$13",
+ "lambda$14", "lambda$15", "lambda$16", "lambda$17",
+ "lambda$18", "lambda$19", "access$1",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "indexTransaction", "indexTransaction", "beforeWrite",
+ "prepareCommit", "verticesInTxSize", "edgesInTxSize",
+ "checkTxVerticesCapacity", "checkTxEdgesCapacity",
+ "verticesInTxUpdated", "verticesInTxRemoved",
+ "removingEdgeOwner", "prepareDeletions",
+ "prepareDeletions", "prepareUpdates", "prepareAdditions",
+ "checkVertexExistIfCustomizedId",
+ "checkAggregateProperty", "checkAggregateProperty",
+ "checkNonnullProperty", "queryEdgesFromBackend",
+ "commitPartOfEdgeDeletions", "optimizeQueries",
+ "checkVertexLabel", "checkId",
+ "queryVerticesFromBackend", "joinTxVertices",
+ "joinTxEdges", "lockForUpdateProperty", "optimizeQuery",
+ "verifyVerticesConditionQuery",
+ "verifyEdgesConditionQuery", "indexQuery",
+ "joinTxRecords", "propertyUpdated", "parseEntry",
+ "traverseByLabel", "reset", "queryVerticesByIds",
+ "filterUnmatchedRecords", "skipOffsetOrStopLimit",
+ "filterExpiredResultFromFromBackend", "queryEdgesByIds",
+ "matchEdgeSortKeys", "rightResultFromIndexQuery");
Reflection.registerFieldsToFilter(IndexableTransaction.class, "$assertionsDisabled");
- Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", "commit2Backend", "reset");
- Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", "autoCommit", "closed", "committing", "committing2Backend", "graph", "store", "mutation", "serializer", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", "prepareCommit", "params", "mutation", "commit2Backend", "autoCommit", "beforeRead", "afterWrite", "afterRead", "commitMutation2Backend", "checkOwnerThread", "doAction", "store", "reset");
+ Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction",
+ "commit2Backend", "reset");
+ Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread",
+ "autoCommit", "closed", "committing",
+ "committing2Backend", "graph", "store", "mutation",
+ "serializer", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite",
+ "prepareCommit", "params", "mutation", "commit2Backend",
+ "autoCommit", "beforeRead", "afterWrite", "afterRead",
+ "commitMutation2Backend", "checkOwnerThread", "doAction",
+ "store", "reset");
Reflection.registerFieldsToFilter(HugeFactory.class, "LOG", "NAME_REGEX", "graphs");
Reflection.registerMethodsToFilter(HugeFactory.class, "lambda$0");
- Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", "status");
- Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys");
- Reflection.registerMethodsToFilter(HugeVertex.class, "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "checkIdLength", "onUpdateProperty", "ensureFilledProperties", "clone", "clone");
- Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", "properties", "expiredTime", "removed", "fresh", "propLoaded", "defaultValueUpdated", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality");
- Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", "newProperty", "tx", "onUpdateProperty", "ensureFilledProperties", "propLoaded", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", "getIdValue", "fresh", "updateToDefaultValueIfNone", "copyProperties");
- Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", "targetVertex", "isOutEdge", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction");
- Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "onUpdateProperty", "ensureFilledProperties", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", "clone", "clone");
+ Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata",
+ "status");
+ Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys");
+ Reflection.registerMethodsToFilter(HugeVertex.class,
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "newProperty", "newProperty", "tx",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "checkIdLength", "onUpdateProperty",
+ "ensureFilledProperties", "clone", "clone");
+ Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph",
+ "properties", "expiredTime", "removed", "fresh",
+ "propLoaded", "defaultValueUpdated",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality");
+ Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty",
+ "newProperty", "tx", "onUpdateProperty",
+ "ensureFilledProperties", "propLoaded",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality",
+ "getIdValue", "fresh", "updateToDefaultValueIfNone",
+ "copyProperties");
+ Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex",
+ "targetVertex", "isOutEdge", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction");
+ Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist",
+ "newProperty", "newProperty", "tx",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "onUpdateProperty", "ensureFilledProperties",
+ "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction",
+ "clone", "clone");
Reflection.registerFieldsToFilter(HugeProperty.class, "owner", "pkey", "value");
- Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", "params", "graph");
- Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", "queryAllVariableVertices", "queryVariableVertex", "createVariableVertex", "removeVariableVertex", "extractSingleObject", "setProperty");
+ Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY",
+ "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE",
+ "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE",
+ "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES",
+ "params", "graph");
+ Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey",
+ "queryAllVariableVertices", "queryVariableVertex",
+ "createVariableVertex", "removeVariableVertex",
+ "extractSingleObject", "setProperty");
Reflection.registerFieldsToFilter(SchemaManager.class, "transaction", "graph");
- Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "checkExists");
- Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", "cardinality", "aggregateType", "checkExist", "userdata", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", "checkAggregateType", "hasSameProperties");
+ Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2",
+ "lambda$3", "checkExists");
+ Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType",
+ "cardinality", "aggregateType", "checkExist", "userdata",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars",
+ "checkAggregateType", "hasSameProperties");
Reflection.registerFieldsToFilter(AbstractBuilder.class, "transaction", "graph");
- Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", "checkSchemaName", "validOrGenerateId", "lockCheckAndCreateSchema", "propertyKeyOrNull", "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", "edgeLabelOrNull", "indexLabelOrNull", "updateSchemaStatus");
- Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", "properties", "primaryKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
- Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkIdStrategy", "checkPrimaryKeys", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
- Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", "targetLabel", "frequency", "properties", "sortKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action");
- Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkSortKeys", "checkRelation", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
- Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", "baseValue", "indexType", "indexFields", "userdata", "checkExist", "rebuild", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType");
- Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", "checkBaseType", "checkIndexType", "checkFields4Range", "loadElement", "checkFields", "checkRepeatIndex", "checkRepeatIndex", "checkRepeatIndex", "checkPrimaryKeyIndex", "checkRepeatRangeIndex", "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", "checkRepeatShardIndex", "checkRepeatUniqueIndex", "removeSubIndex", "hasSubIndex", "allStringIndex", "oneNumericField", "hasSameProperties");
- Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", "serverInfoDbExecutor", "schedulerExecutor", "contexts", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", "closeTaskTx", "setContext", "instance", "closeSchedulerTx", "notifyNewTask", "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph");
- Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", "serverManager", "taskExecutor", "taskDbExecutor", "eventListener", "tasks", "taskTx", "NO_LIMIT", "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "tx", "listenChanges", "unlistenChanges", "submitTask", "queryTask", "queryTask", "queryTask", "call", "call", "remove", "sleep", "taskDone", "serverManager", "supportsPaging", "restore", "checkOnMasterNode", "waitUntilTaskCompleted", "scheduleTasks", "executeTasksOnWorker", "cancelTasksOnWorker");
- Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", "callable", "type", "name", "id", "parent", "dependencies", "description", "context", "create", "server", "load", "status", "progress", "update", "retries", "input", "result", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", "asArray", "checkPropertySize", "checkPropertySize", "checkDependenciesSuccess", "toOrderSet", "done", "callable", "setException", "set", "result", "status");
- Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", "ERROR_MESSAGES", "task", "graph", "lastSaveTime", "saveInterval");
- Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", "done", "task", "save", "needSaveWithEx");
+ Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph",
+ "checkSchemaName", "validOrGenerateId",
+ "lockCheckAndCreateSchema", "propertyKeyOrNull",
+ "checkSchemaIdIfRestoringMode", "vertexLabelOrNull",
+ "edgeLabelOrNull", "indexLabelOrNull",
+ "updateSchemaStatus");
+ Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy",
+ "properties", "primaryKeys", "nullableKeys", "ttl",
+ "ttlStartTime", "enableLabelIndex", "userdata",
+ "checkExist", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
+ Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "checkProperties", "checkNullableKeys",
+ "checkIdStrategy", "checkPrimaryKeys",
+ "hasSameProperties", "checkTtl", "checkUserdata",
+ "mapPkId2Name", "mapPkId2Name");
+ Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel",
+ "targetLabel", "frequency", "properties", "sortKeys",
+ "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex",
+ "userdata", "checkExist", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action");
+ Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "checkProperties", "checkNullableKeys", "checkSortKeys",
+ "checkRelation", "hasSameProperties", "checkTtl",
+ "checkUserdata", "mapPkId2Name", "mapPkId2Name");
+ Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType",
+ "baseValue", "indexType", "indexFields", "userdata",
+ "checkExist", "rebuild", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType");
+ Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType",
+ "checkBaseType", "checkIndexType", "checkFields4Range",
+ "loadElement", "checkFields", "checkRepeatIndex",
+ "checkRepeatIndex", "checkRepeatIndex",
+ "checkPrimaryKeyIndex", "checkRepeatRangeIndex",
+ "checkRepeatSearchIndex", "checkRepeatSecondaryIndex",
+ "checkRepeatShardIndex", "checkRepeatUniqueIndex",
+ "removeSubIndex", "hasSubIndex", "allStringIndex",
+ "oneNumericField", "hasSameProperties");
+ Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS",
+ "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor",
+ "serverInfoDbExecutor", "schedulerExecutor", "contexts",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext",
+ "closeTaskTx", "setContext", "instance",
+ "closeSchedulerTx", "notifyNewTask",
+ "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph");
+ Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph",
+ "serverManager", "taskExecutor", "taskDbExecutor",
+ "eventListener", "tasks", "taskTx", "NO_LIMIT",
+ "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1",
+ "lambda$2", "lambda$3", "lambda$4", "lambda$5",
+ "lambda$6", "lambda$7", "tx", "listenChanges",
+ "unlistenChanges", "submitTask", "queryTask",
+ "queryTask", "queryTask", "call", "call", "remove",
+ "sleep", "taskDone", "serverManager", "supportsPaging",
+ "restore", "checkOnMasterNode", "waitUntilTaskCompleted",
+ "scheduleTasks", "executeTasksOnWorker",
+ "cancelTasksOnWorker");
+ Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler",
+ "callable", "type", "name", "id", "parent",
+ "dependencies", "description", "context", "create",
+ "server", "load", "status", "progress", "update",
+ "retries", "input", "result", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler",
+ "asArray", "checkPropertySize", "checkPropertySize",
+ "checkDependenciesSuccess", "toOrderSet", "done",
+ "callable", "setException", "set", "result", "status");
+ Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT",
+ "ERROR_MESSAGES", "task", "graph", "lastSaveTime",
+ "saveInterval");
+ Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled",
+ "done", "task", "save", "needSaveWithEx");
Reflection.registerFieldsToFilter(TaskCallable.SysTaskCallable.class, "params");
Reflection.registerMethodsToFilter(TaskCallable.SysTaskCallable.class, "params", "params");
- Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", "eventListener", "usersCache", "users", "groups", "targets", "belong", "access", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", "unlistenChanges", "invalidCache", "initSchemaIfNeeded", "rolePermission", "rolePermission", "rolePermission", "cache");
+ Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph",
+ "eventListener", "usersCache", "users", "groups",
+ "targets", "belong", "access", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges",
+ "unlistenChanges", "invalidCache", "initSchemaIfNeeded",
+ "rolePermission", "rolePermission", "rolePermission",
+ "cache");
Reflection.registerFieldsToFilter(SchemaDefine.class, "graph", "label");
- Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", "createPropertyKey", "createPropertyKey", "existEdgeLabel", "createRangeIndex", "unhideField", "hideField", "existVertexLabel", "initProperties");
- Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryEntity", "constructVertex", "save", "query");
- Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryRelationship", "newVertex", "save");
- Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", "timer");
- Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", "instance");
- Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "INSTANCE", "lockGroupMap");
- Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "instance");
- Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", "histograms", "meters", "timers");
+ Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey",
+ "createPropertyKey", "createPropertyKey",
+ "existEdgeLabel", "createRangeIndex", "unhideField",
+ "hideField", "existVertexLabel", "initProperties");
+ Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser",
+ "NO_LIMIT", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx",
+ "commitOrRollback", "unhideLabel", "queryById",
+ "queryEntity", "constructVertex", "save", "query");
+ Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser",
+ "NO_LIMIT", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph",
+ "tx", "commitOrRollback", "unhideLabel", "queryById",
+ "queryRelationship", "newVertex", "save");
+ Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE",
+ "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches",
+ "timer");
+ Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer",
+ "instance");
+ Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class,
+ "INSTANCE", "lockGroupMap");
+ Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class,
+ "instance");
+ Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters",
+ "histograms", "meters", "timers");
Reflection.registerMethodsToFilter(ServerReporter.class, "instance", "instance");
- Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", "FACTORY_ID", "registry", "executor", "shutdownExecutorOnStop", "disabledMetricAttributes", "scheduledFuture", "filter", "durationFactor", "durationUnit", "rateFactor", "rateUnit");
- Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, "convertDuration", "convertRate", "getRateUnit", "getDurationUnit", "isShutdownExecutorOnStop", "getDisabledMetricAttributes", "calculateRateUnit", "createDefaultExecutor", "lambda$start$0", "start");
+ Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG",
+ "FACTORY_ID", "registry", "executor",
+ "shutdownExecutorOnStop", "disabledMetricAttributes",
+ "scheduledFuture", "filter", "durationFactor",
+ "durationUnit", "rateFactor", "rateUnit");
+ Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class,
+ "convertDuration", "convertRate", "getRateUnit",
+ "getDurationUnit", "isShutdownExecutorOnStop",
+ "getDisabledMetricAttributes", "calculateRateUnit",
+ "createDefaultExecutor", "lambda$start$0", "start");
Reflection.registerFieldsToFilter(JsonSerializer.class, "LBUF_SIZE", "INSTANCE");
Reflection.registerMethodsToFilter(JsonSerializer.class, "writeIterator", "instance");
- Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeVertexStepStrategy.class, "instance");
- Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeGraphStepStrategy.class, "instance");
- Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeCountStepStrategy.class, "lambda$0", "instance");
// Enable this line to generate registration statement
//genRegisterPrivateActions();
}
+ public static void filterCriticalSystemClasses() {
+ // TODO: merge them in HugeSecurityManager after 1.5.0
+ Reflection.registerMethodsToFilter(Class.class, "forName", "newInstance");
+ Reflection.registerMethodsToFilter(ClassLoader.class, "loadClass", "newInstance");
+ Reflection.registerMethodsToFilter(Method.class, "invoke", "setAccessible");
+ Reflection.registerMethodsToFilter(Field.class, "set", "setAccessible");
+ Reflection.registerMethodsToFilter(java.lang.reflect.Constructor.class, "newInstance",
+ "setAccessible");
+ Reflection.registerMethodsToFilter(Runtime.class, "exec", "getRuntime");
+ Reflection.registerMethodsToFilter(ProcessBuilder.class, "command", "start",
+ "startPipeline");
+ Reflection.registerMethodsToFilter(loadClass("java.lang.ProcessImpl"), "forkAndExec",
+ "setAccessible", "start");
+
+ optionalMethodsToFilter("sun.invoke.util.BytecodeDescriptor", "parseMethod", "parseSig");
+ optionalMethodsToFilter("sun.reflect.misc.MethodUtil", "invoke");
+ optionalMethodsToFilter("jdk.internal.reflect.MethodAccessor", "invoke");
+ optionalMethodsToFilter("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke");
+ }
+
@SuppressWarnings("unused")
private static void genRegisterPrivateActions() {
registerPrivateActions(Thread.class);
@@ -285,20 +589,18 @@ private static void registerPrivateActions(Class> clazz) {
}
}
- private static boolean registerClass(Class> clazz,
- List fields,
- List methods) {
- if (clazz.getName().startsWith("java") ||
- fields.isEmpty() && methods.isEmpty()) {
- return false;
+ private static void registerClass(Class> clazz, List fields, List methods) {
+ if (clazz.getName().startsWith("java") || fields.isEmpty() && methods.isEmpty()) {
+ return;
}
+
final String[] array = new String[fields.size()];
try {
Reflection.registerFieldsToFilter(clazz, fields.toArray(array));
Reflection.registerMethodsToFilter(clazz, methods.toArray(array));
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Filter already registered: class")) {
- return false;
+ return;
}
throw e;
}
@@ -319,8 +621,6 @@ private static boolean registerClass(Class> clazz,
System.out.println(code);
// CHECKSTYLE:ON
}
-
- return true;
}
private static Class> loadClass(String clazz) {
@@ -330,4 +630,17 @@ private static Class> loadClass(String clazz) {
throw new HugeException(e.getMessage(), e);
}
}
+
+ public static void optionalMethodsToFilter(String className, String... methodNames) {
+ Class> clazz = null;
+ try {
+ clazz = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ // TODO: we just ignore the exception, change it after we drop Java8 support
+ LOG.warn("Skip register class {} to filter", className);
+ }
+ if (clazz != null) {
+ Reflection.registerMethodsToFilter(clazz, methodNames);
+ }
+ }
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
index 389d15b1cd..63d3912793 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
@@ -149,7 +149,7 @@ public HugeGraph hugegraph() {
@Override
public C compute(Class clazz)
- throws IllegalArgumentException {
+ throws IllegalArgumentException {
this.verifyAnyPermission();
return this.hugegraph.compute(clazz);
}
@@ -166,7 +166,7 @@ public GraphTraversalSource traversal() {
return new GraphTraversalSourceProxy(this);
}
- @SuppressWarnings({ "rawtypes", "deprecation" })
+ @SuppressWarnings({"rawtypes", "deprecation"})
@Override
public I io(final Io.Builder builder) {
this.verifyAnyPermission();
@@ -834,14 +834,14 @@ private void verifyPermission(HugePermission actionPerm,
}
private V verifyUserPermission(
- HugePermission actionPerm,
- V elementFetcher) {
+ HugePermission actionPerm,
+ V elementFetcher) {
return verifyUserPermission(actionPerm, true, () -> elementFetcher);
}
private List verifyUserPermission(
- HugePermission actionPerm,
- List elems) {
+ HugePermission actionPerm,
+ List elems) {
List results = new ArrayList<>();
for (V elem : elems) {
V r = verifyUserPermission(actionPerm, false, () -> elem);
@@ -853,9 +853,9 @@ private List verifyUserPermission(
}
private V verifyUserPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier elementFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier elementFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
V elem = elementFetcher.get();
@@ -871,14 +871,14 @@ private void verifyElemPermission(HugePermission actionPerm, Element elem) {
}
private V verifyElemPermission(
- HugePermission actionPerm,
- Supplier elementFetcher) {
+ HugePermission actionPerm,
+ Supplier elementFetcher) {
return verifyElemPermission(actionPerm, true, elementFetcher);
}
private Iterator verifyElemPermission(
- HugePermission actionPerm,
- Iterator elems) {
+ HugePermission actionPerm,
+ Iterator elems) {
return new FilterIterator<>(elems, elem -> {
V r = verifyElemPermission(actionPerm, false, () -> elem);
return r != null;
@@ -886,9 +886,9 @@ private Iterator verifyElemPermission(
}
private V verifyElemPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier elementFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier elementFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
HugeElement elem = (HugeElement) elementFetcher.get();
@@ -918,8 +918,8 @@ private void verifySchemaPermission(HugePermission actionPerm,
}
private Collection verifySchemaPermission(
- HugePermission actionPerm,
- Collection schemas) {
+ HugePermission actionPerm,
+ Collection schemas) {
List results = new ArrayList<>();
for (V schema : schemas) {
V r = verifySchemaPermission(actionPerm, false, () -> schema);
@@ -931,15 +931,15 @@ private Collection verifySchemaPermission(
}
private V verifySchemaPermission(
- HugePermission actionPerm,
- Supplier schemaFetcher) {
+ HugePermission actionPerm,
+ Supplier schemaFetcher) {
return verifySchemaPermission(actionPerm, true, schemaFetcher);
}
private V verifySchemaPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier schemaFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier schemaFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
SchemaElement elem = schemaFetcher.get();
@@ -1101,21 +1101,21 @@ public boolean close() {
@Override
public HugeTask waitUntilTaskCompleted(Id id, long seconds)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
return this.taskScheduler.waitUntilTaskCompleted(id, seconds);
}
@Override
public HugeTask waitUntilTaskCompleted(Id id)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
return this.taskScheduler.waitUntilTaskCompleted(id);
}
@Override
public void waitUntilAllTasksCompleted(long seconds)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
this.taskScheduler.waitUntilAllTasksCompleted(seconds);
}
@@ -1166,8 +1166,8 @@ private HugeTask verifyTaskPermission(HugePermission actionPerm,
}
private Iterator> verifyTaskPermission(
- HugePermission actionPerm,
- Iterator> tasks) {
+ HugePermission actionPerm,
+ Iterator> tasks) {
return new FilterIterator<>(tasks, task -> {
return verifyTaskPermission(actionPerm, false, task) != null;
});
@@ -1727,7 +1727,7 @@ public TraversalStrategies addStrategies(TraversalStrategy>... strategies) {
@SuppressWarnings({"unchecked"})
@Override
public TraversalStrategies removeStrategies(
- Class extends TraversalStrategy>... strategyClasses) {
+ Class extends TraversalStrategy>... strategyClasses) {
return this.strategies.removeStrategies(strategyClasses);
}
@@ -1756,14 +1756,14 @@ private String translate(Bytecode bytecode) {
}
private final class TraversalStrategyProxy>
- implements TraversalStrategy {
+ implements TraversalStrategy {
private static final long serialVersionUID = 2071829024642435735L;
private final TraversalStrategy origin;
public TraversalStrategyProxy(TraversalStrategy> origin) {
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
TraversalStrategy strategy = (TraversalStrategy) origin;
this.origin = strategy;
}
@@ -1784,9 +1784,9 @@ public void apply(Traversal.Admin, ?> traversal) {
}
/*
- * Verify gremlin-execute permission for user gremlin(in gremlin-
- * server-exec worker) and gremlin job(in task worker).
- * But don't check permission in rest worker, because the following
+ * Verify gremlin-execute permission for user gremlin (in gremlin-server-exec worker)
+ * and gremlin job(in task worker).
+ * But don't check permission in rest worker because the following
* places need to call traversal():
* 1.vertices/edges rest api
* 2.oltp rest api (like crosspointpath/neighborrank)
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
index 4922533760..ad100875b0 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
@@ -27,6 +27,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.filter.AuthenticationFilter;
import org.apache.hugegraph.config.CoreOptions;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
@@ -39,6 +40,8 @@
import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException;
import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
+import jakarta.ws.rs.core.SecurityContext;
+
public class StandardAuthenticator implements HugeAuthenticator {
private static final String INITING_STORE = "initing_store";
@@ -110,7 +113,7 @@ private String inputPassword() {
public void setup(HugeConfig config) {
String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE);
Map graphConfs = ConfigUtil.scanGraphsDir(
- config.get(ServerOptions.GRAPHS));
+ config.get(ServerOptions.GRAPHS));
String graphPath = graphConfs.get(graphName);
E.checkArgument(graphPath != null,
"Can't find graph name '%s' in config '%s' at " +
@@ -137,7 +140,7 @@ public void setup(HugeConfig config) {
String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL);
if (StringUtils.isNotEmpty(remoteUrl)) {
RpcClientProviderWithAuth clientProvider =
- new RpcClientProviderWithAuth(config);
+ new RpcClientProviderWithAuth(config);
this.graph.switchAuthManager(clientProvider.authManager());
}
}
@@ -159,9 +162,10 @@ private void transferRoleWorkerConfig(HugeConfig graphConfig, HugeConfig config)
/**
* Verify if a user is legal
+ *
* @param username the username for authentication
* @param password the password for authentication
- * @param token the token for authentication
+ * @param token the token for authentication
* @return String No permission if return ROLE_NONE else return a role
*/
@Override
@@ -191,6 +195,11 @@ public UserWithRole authenticate(String username, String password,
userWithRole.username(), role);
}
+ @Override
+ public void unauthorize(SecurityContext context) {
+ HugeGraphAuthProxy.resetContext();
+ }
+
@Override
public AuthManager authManager() {
return this.graph().authManager();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
index 205074ae78..1b329e19f9 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
@@ -24,7 +24,7 @@
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD;
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
@@ -61,7 +61,7 @@ public WsAndHttpBasicAuthHandler(Authenticator authenticator,
@Override
public void channelRead(final ChannelHandlerContext ctx, final Object obj)
- throws Exception {
+ throws Exception {
if (obj instanceof HttpMessage && !isWebSocket((HttpMessage) obj)) {
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandler authHandler = pipeline.get(HTTP_AUTH);
@@ -86,7 +86,7 @@ public static boolean isWebSocket(final HttpMessage msg) {
@ChannelHandler.Sharable
private static class HttpBasicAuthHandler
- extends AbstractAuthenticationHandler {
+ extends AbstractAuthenticationHandler {
private final Base64.Decoder decoder = Base64.getUrlDecoder();
@@ -122,7 +122,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
return;
}
String authorization = new String(userPass,
- Charset.forName("UTF-8"));
+ StandardCharsets.UTF_8);
String[] split = authorization.split(":");
if (split.length != 2) {
sendError(ctx, msg);
@@ -134,7 +134,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
address = address.substring(1);
}
- final Map credentials = new HashMap<>();
+ final Map credentials = new HashMap<>();
credentials.put(PROPERTY_USERNAME, split[0]);
credentials.put(PROPERTY_PASSWORD, split[1]);
credentials.put(HugeAuthenticator.KEY_ADDRESS, address);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
index e18d5139a5..63da169c99 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
@@ -274,36 +274,36 @@ public static synchronized ServerOptions instance() {
);
public static final ConfigOption ARTHAS_TELNET_PORT =
- new ConfigOption<>(
- "arthas.telnet_port",
- "The telnet port provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "8562"
- );
+ new ConfigOption<>(
+ "arthas.telnet_port",
+ "The telnet port provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "8562"
+ );
public static final ConfigOption ARTHAS_HTTP_PORT =
- new ConfigOption<>(
- "arthas.http_port",
- "The HTTP port provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "8561"
- );
+ new ConfigOption<>(
+ "arthas.http_port",
+ "The HTTP port provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "8561"
+ );
public static final ConfigOption ARTHAS_IP =
- new ConfigOption<>(
- "arthas.ip",
- "The IP provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "0.0.0.0"
- );
+ new ConfigOption<>(
+ "arthas.ip",
+ "The IP provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "127.0.0.1"
+ );
public static final ConfigOption ARTHAS_DISABLED_COMMANDS =
- new ConfigOption<>(
- "arthas.disabled_commands",
- "The disabled Arthas commands due to high risk.",
- null,
- "jad"
- );
+ new ConfigOption<>(
+ "arthas.disabled_commands",
+ "The disabled Arthas commands due to high risk.",
+ null,
+ "jad"
+ );
public static final ConfigOption SLOW_QUERY_LOG_TIME_THRESHOLD =
new ConfigOption<>(
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
index 9b3c3a10ae..37939c2019 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
@@ -76,6 +76,8 @@
import com.alipay.sofa.rpc.config.ServerConfig;
+import jakarta.ws.rs.core.SecurityContext;
+
public final class GraphManager {
private static final Logger LOG = Log.logger(GraphManager.class);
@@ -158,7 +160,7 @@ public HugeGraph cloneGraph(String name, String newName, String configText) {
HugeConfig cloneConfig = cloneGraph.cloneConfig(newName);
if (StringUtils.isNotEmpty(configText)) {
PropertiesConfiguration propConfig = ConfigUtil.buildConfig(
- configText);
+ configText);
// Use the passed config to overwrite the old one
propConfig.getKeys().forEachRemaining(key -> {
cloneConfig.setProperty(key, propConfig.getProperty(key));
@@ -259,10 +261,14 @@ public boolean requireAuthentication() {
}
public HugeAuthenticator.User authenticate(Map credentials)
- throws AuthenticationException {
+ throws AuthenticationException {
return this.authenticator().authenticate(credentials);
}
+ public void unauthorize(SecurityContext context) {
+ this.authenticator().unauthorize(context);
+ }
+
public AuthManager authManager() {
return this.authenticator().authManager();
}
@@ -347,7 +353,6 @@ private HugeAuthenticator authenticator() {
return this.authenticator;
}
-
private void closeTx(final Set graphSourceNamesToCloseTxOn,
final Transaction.Status tx) {
final Set graphsToCloseTxOn = new HashSet<>();
@@ -436,20 +441,20 @@ private void checkBackendVersionOrExit(HugeConfig config) {
this.authenticator().initAdminUser(token);
} catch (Exception e) {
throw new BackendException(
- "The backend store of '%s' can't " +
- "initialize admin user", hugegraph.name());
+ "The backend store of '%s' can't " +
+ "initialize admin user", hugegraph.name());
}
}
}
BackendStoreInfo info = hugegraph.backendStoreInfo();
if (!info.exists()) {
throw new BackendException(
- "The backend store of '%s' has not been initialized",
- hugegraph.name());
+ "The backend store of '%s' has not been initialized",
+ hugegraph.name());
}
if (!info.checkVersion()) {
throw new BackendException(
- "The backend store version is inconsistent");
+ "The backend store version is inconsistent");
}
}
}
@@ -521,7 +526,7 @@ private void addMetrics(HugeConfig config) {
});
// Add metrics for caches
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Map> caches = (Map) CacheManager.instance()
.caches();
registerCacheMetrics(caches);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
index c910dc8c26..887bf7d456 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
@@ -26,6 +26,7 @@
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.NumericUtil;
+
import com.google.common.collect.Sets;
public enum UpdateStrategy {
@@ -113,7 +114,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) {
// Batch update Set should use union because of higher efficiency
APPEND {
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Object updatePropertyValue(Object oldProperty, Object newProperty) {
((Collection) oldProperty).addAll((Collection) newProperty);
return oldProperty;
@@ -127,7 +128,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) {
ELIMINATE {
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Object updatePropertyValue(Object oldProperty, Object newProperty) {
((Collection) oldProperty).removeAll((Collection) newProperty);
return oldProperty;
@@ -186,7 +187,7 @@ protected static Object compareNumber(Object oldProperty,
Number newNum = NumericUtil.convertToNumber(newProperty);
int result = NumericUtil.compareNumber(oldNum, newNum);
return strategy == BIGGER ? (result > 0 ? oldProperty : newProperty) :
- (result < 0 ? oldProperty : newProperty);
+ (result < 0 ? oldProperty : newProperty);
}
protected static Set> combineSet(Object oldProperty, Object newProperty,
@@ -198,6 +199,6 @@ protected static Set> combineSet(Object oldProperty, Object newProperty,
(Set>) newProperty :
new HashSet<>((List>) newProperty);
return strategy == UNION ? Sets.union(oldSet, newSet) :
- Sets.intersection(oldSet, newSet);
+ Sets.intersection(oldSet, newSet);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
index 5107b46113..0d42b6369e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
@@ -227,7 +227,7 @@ public void serialize(Timer timer, JsonGenerator json,
}
private static class MetricRegistrySerializer
- extends StdSerializer {
+ extends StdSerializer {
private static final long serialVersionUID = 3717001164181726933L;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
index 82f502e823..3721cb1e18 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
@@ -63,7 +63,6 @@ public class MetricsUtil {
public static final String RIGHT_NAME_STR = ",} ";
public static final String PROM_HELP_NAME = "hugegraph_info";
-
public static Gauge registerGauge(Class> clazz, String name,
Gauge gauge) {
return REGISTRY.register(MetricRegistry.name(clazz, name), gauge);
@@ -94,7 +93,7 @@ public static Timer registerTimer(Class> clazz, String name) {
}
public static String replaceDotDashInKey(String orgKey) {
- return orgKey.replace(".", "_").replace("-", "_");
+ return orgKey.replace(".", "_").replace("-", "_").replace("/", "_").replace("$", "_");
}
public static String replaceSlashInKey(String orgKey) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
index d3cd6855b7..b302ddc5d2 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
@@ -26,6 +26,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.hugegraph.util.E;
+
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
@@ -47,7 +48,7 @@ public class ServerReporter extends ScheduledReporter {
private SortedMap timers;
public static synchronized ServerReporter instance(
- MetricRegistry registry) {
+ MetricRegistry registry) {
if (instance == null) {
synchronized (ServerReporter.class) {
if (instance == null) {
@@ -97,7 +98,7 @@ public Map meters() {
return Collections.unmodifiableMap(this.meters);
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void report(SortedMap gauges,
SortedMap counters,
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
index 903ac6103d..3aeaca3445 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
@@ -27,7 +27,6 @@
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-
import org.apache.hugegraph.util.Bytes;
public class SystemMetrics {
@@ -112,7 +111,7 @@ private Map getThreadMetrics() {
private Map getClassLoadingMetrics() {
Map metrics = new LinkedHashMap<>();
ClassLoadingMXBean classLoadingMxBean = ManagementFactory
- .getClassLoadingMXBean();
+ .getClassLoadingMXBean();
metrics.put("count", classLoadingMxBean.getLoadedClassCount());
metrics.put("loaded", classLoadingMxBean.getTotalLoadedClassCount());
metrics.put("unloaded", classLoadingMxBean.getUnloadedClassCount());
@@ -122,7 +121,7 @@ private Map getClassLoadingMetrics() {
private Map getGarbageCollectionMetrics() {
Map metrics = new LinkedHashMap<>();
List gcMxBeans = ManagementFactory
- .getGarbageCollectorMXBeans();
+ .getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
String name = formatName(gcMxBean.getName());
metrics.put(name + "_count", gcMxBean.getCollectionCount());
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
index a4dfff60a4..dfad9b9594 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
@@ -16,7 +16,22 @@
package org.apache.hugegraph.opencypher;
-import io.netty.channel.ChannelHandlerContext;
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.singletonList;
+import static java.util.Optional.empty;
+import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR;
+import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
import org.apache.tinkerpop.gremlin.driver.Tokens;
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
@@ -45,20 +60,9 @@
import org.opencypher.gremlin.traversal.ReturnNormalizer;
import org.slf4j.Logger;
+import io.netty.channel.ChannelHandlerContext;
import scala.collection.Seq;
-import java.util.*;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-
-import static java.util.Collections.emptyMap;
-import static java.util.Collections.singletonList;
-import static java.util.Optional.empty;
-import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR;
-import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN;
-import static org.slf4j.LoggerFactory.getLogger;
-
/**
* Description of the modifications:
*
@@ -80,7 +84,7 @@
*
* 3) Set the logger level from info to trace
*
- *
+ *
* {@link OpProcessor} implementation for processing Cypher {@link RequestMessage}s:
*
* {
@@ -94,7 +98,7 @@
public class CypherOpProcessor extends AbstractEvalOpProcessor {
private static final String DEFAULT_TRANSLATOR_DEFINITION =
- "gremlin+cfog_server_extensions+inline_parameters";
+ "gremlin+cfog_server_extensions+inline_parameters";
private static final Logger logger = getLogger(CypherOpProcessor.class);
@@ -242,8 +246,8 @@ protected void handleIterator(Context context, Iterator traversal) {
.getExecutorService().submit(evalFuture);
if (timeout > 0) {
context.getScheduledExecutorService().schedule(
- () -> executionFuture.cancel(true)
- , timeout, TimeUnit.MILLISECONDS);
+ () -> executionFuture.cancel(true)
+ , timeout, TimeUnit.MILLISECONDS);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
index 98cf98eeef..6d7899dd19 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
@@ -28,13 +28,6 @@
package org.apache.hugegraph.opencypher;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.opencypher.gremlin.traversal.CustomFunctions;
-import org.opencypher.gremlin.traversal.CustomPredicate;
-
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
@@ -42,15 +35,24 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.opencypher.gremlin.traversal.CustomFunctions;
+import org.opencypher.gremlin.traversal.CustomPredicate;
+
public class CypherPlugin implements GremlinPlugin {
private static final ImportCustomizer IMPORTS =
- DefaultImportCustomizer.build()
- .addClassImports(CustomPredicate.class)
- .addMethodImports(getDeclaredPublicMethods(CustomPredicate.class))
- .addClassImports(CustomFunctions.class)
- .addMethodImports(getDeclaredPublicMethods(CustomFunctions.class))
- .create();
+ DefaultImportCustomizer.build()
+ .addClassImports(CustomPredicate.class)
+ .addMethodImports(
+ getDeclaredPublicMethods(CustomPredicate.class))
+ .addClassImports(CustomFunctions.class)
+ .addMethodImports(
+ getDeclaredPublicMethods(CustomFunctions.class))
+ .create();
private static List getDeclaredPublicMethods(Class> klass) {
Method[] declaredMethods = klass.getDeclaredMethods();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
index 1311e3e32d..80af0ab368 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
@@ -17,12 +17,13 @@
package org.apache.hugegraph.rpc;
-import com.alipay.sofa.rpc.common.utils.StringUtils;
import org.apache.hugegraph.auth.AuthManager;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.util.E;
+import com.alipay.sofa.rpc.common.utils.StringUtils;
+
public class RpcClientProviderWithAuth extends RpcClientProvider {
private final RpcConsumerConfig authConsumerConfig;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
index e477fce1d0..7784613f53 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
@@ -42,32 +42,32 @@
import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import jakarta.ws.rs.ApplicationPath;
@SecurityScheme(
- name = "basic",
- type = SecuritySchemeType.HTTP,
- scheme = "basic"
+ name = "basic",
+ type = SecuritySchemeType.HTTP,
+ scheme = "basic"
)
@SecurityScheme(
- name = "bearer",
- type = SecuritySchemeType.HTTP,
- scheme = "bearer"
+ name = "bearer",
+ type = SecuritySchemeType.HTTP,
+ scheme = "bearer"
)
@ApplicationPath("/")
@OpenAPIDefinition(
- info = @Info(
- title = "HugeGraph RESTful API",
- version = CoreVersion.DEFAULT_VERSION,
- description = "All management API for HugeGraph",
- contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
- ),
- security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
+ info = @Info(
+ title = "HugeGraph RESTful API",
+ version = CoreVersion.DEFAULT_VERSION,
+ description = "All management API for HugeGraph",
+ contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
+ ),
+ security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
)
public class ApplicationConfig extends ResourceConfig {
@@ -131,9 +131,9 @@ private class GraphManagerFactory extends AbstractBinder implements Factory listeners = server.getListeners();
- E.checkState(listeners.size() > 0,
+ E.checkState(!listeners.isEmpty(),
"Http Server should have some listeners, but now is none");
NetworkListener listener = listeners.iterator().next();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
index 87c3d43571..bbc06ad309 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
@@ -125,7 +125,7 @@ public final class ApiVersion {
/**
* The second parameter of Version.of() is for IDE running without JAR
- * Note: Also update the version number in hugegraph-api/pom.xml
+ * Note: Also update the version number in hugegraph-server/hugegraph-api/pom.xml
*/
public static final Version VERSION = Version.of(ApiVersion.class, "0.71");
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
index 8cb0bc78ba..2f057007f1 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
@@ -43,7 +43,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
private BackendEntry next;
public CassandraEntryIterator(ResultSet results, Query query,
- BiFunction merger) {
+ BiFunction merger) {
super(query);
this.results = results;
this.rows = results.iterator();
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
index e3e3eb51a6..400efd024c 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
@@ -108,7 +108,7 @@ protected Map getMetricsByHost(String host) {
metrics.put(MEM_UNIT, "MB");
long diskSize = UnitUtil.bytesFromReadableString(
- probe.getLoadString());
+ probe.getLoadString());
metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize));
metrics.put(DISK_USAGE + READABLE,
UnitUtil.bytesToReadableString(diskSize));
@@ -213,7 +213,7 @@ protected static void appendTimerMetrics(Map metrics,
String name = humpToLine(metric + "_" + suffix);
// Aggregation of metrics for the whole host if keyspace=null
JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric(
- keyspace, null, metric);
+ keyspace, null, metric);
Map timerMap = InsertionOrderUtil.newMap();
timerMap.put("count", value.getCount());
timerMap.put("min", value.getMin());
@@ -316,7 +316,7 @@ private Map executeAllHosts(Function func) {
}
private NodeProbe newNodeProbe(String host) throws IOException {
- LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
+ LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
return this.username.isEmpty() ?
new NodeProbe(host, this.port) :
new NodeProbe(host, this.port, this.username, this.password);
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
index 0901a0231c..fc3c499a81 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
@@ -45,6 +45,7 @@
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.JsonUtil;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
index a50cc3099c..7a9ffa2b91 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
@@ -26,6 +26,7 @@
import org.apache.hugegraph.backend.store.BackendSessionPool;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.E;
+
import com.datastax.driver.core.BatchStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Cluster.Builder;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
index 30bd148346..5f37922985 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
@@ -32,7 +32,6 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import org.apache.cassandra.schema.SchemaConstants;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.dht.ByteOrderedPartitioner;
import org.apache.cassandra.dht.IPartitioner;
@@ -41,10 +40,11 @@
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.dht.Token.TokenFactory;
-
+import org.apache.cassandra.schema.SchemaConstants;
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.Shard;
import org.apache.hugegraph.util.Bytes;
+
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
import com.datastax.driver.core.ResultSet;
@@ -82,9 +82,10 @@ public CassandraShard(CassandraSessionPool.Session session,
/**
* Get splits of a table
+ *
* @param splitPartitions: expected partitions count per split
- * @param splitSize: expected size(bytes) per split,
- * splitPartitions will be ignored if splitSize is passed
+ * @param splitSize: expected size(bytes) per split,
+ * splitPartitions will be ignored if splitSize is passed
* @return a list of Shard
*/
public List getSplits(long splitPartitions, long splitSize) {
@@ -105,7 +106,7 @@ public List getSplits(long splitPartitions, long splitSize) {
* compute bite-sized splits.
*/
futures.add(executor.submit(new SplitCallable(
- range, splitPartitions, splitSize)));
+ range, splitPartitions, splitSize)));
}
// Wait until we have all the results back
@@ -128,11 +129,12 @@ public List getSplits(long splitPartitions, long splitSize) {
/**
* Get splits of a table in specified range
* NOTE: maybe we don't need this method
- * @param start: the start of range
- * @param end: the end of range
+ *
+ * @param start: the start of range
+ * @param end: the end of range
* @param splitPartitions: expected partitions count per split
- * @param splitSize: expected size(bytes) per split,
- * splitPartitions will be ignored if splitSize is passed
+ * @param splitSize: expected size(bytes) per split,
+ * splitPartitions will be ignored if splitSize is passed
* @return a list of Shard
*/
public List getSplits(String start, String end,
@@ -146,8 +148,8 @@ public List getSplits(String start, String end,
List>> futures = new ArrayList<>();
TokenFactory tokenFactory = this.partitioner.getTokenFactory();
TokenRange tokenRange = rangeToTokenRange(new Range<>(
- tokenFactory.fromString(start),
- tokenFactory.fromString(end)));
+ tokenFactory.fromString(start),
+ tokenFactory.fromString(end)));
// Canonical ranges and nodes holding replicas
Map> masterRangeNodes = getRangeMap();
@@ -157,7 +159,7 @@ public List getSplits(String start, String end,
// For each tokenRange, pick a live owner and ask it
// to compute bite-sized splits
futures.add(executor.submit(new SplitCallable(
- r, splitPartitions, splitSize)));
+ r, splitPartitions, splitSize)));
}
}
@@ -187,8 +189,8 @@ private TokenRange rangeToTokenRange(Range range) {
TokenFactory tokenFactory = this.partitioner.getTokenFactory();
Metadata metadata = this.session.metadata();
return metadata.newTokenRange(
- metadata.newToken(tokenFactory.toString(range.left)),
- metadata.newToken(tokenFactory.toString(range.right)));
+ metadata.newToken(tokenFactory.toString(range.left)),
+ metadata.newToken(tokenFactory.toString(range.right)));
}
private Map getSubSplits(TokenRange tokenRange,
@@ -205,8 +207,8 @@ private Map getSubSplits(TokenRange tokenRange,
private Map> getRangeMap() {
Metadata metadata = this.session.metadata();
return metadata.getTokenRanges().stream().collect(Collectors.toMap(
- p -> p,
- p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
+ p -> p,
+ p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
}
private static Map describeSplits(
@@ -274,15 +276,15 @@ public SplitCallable(TokenRange tokenRange,
long splitPartitions, long splitSize) {
if (splitSize <= 0 && splitPartitions <= 0) {
throw new IllegalArgumentException(String.format(
- "The split-partitions must be > 0, but got %s",
- splitPartitions));
+ "The split-partitions must be > 0, but got %s",
+ splitPartitions));
}
if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) {
// splitSize should be at least 1M if passed
throw new IllegalArgumentException(String.format(
- "The split-size must be >= %s bytes, but got %s",
- MIN_SHARD_SIZE, splitSize));
+ "The split-size must be >= %s bytes, but got %s",
+ MIN_SHARD_SIZE, splitSize));
}
this.tokenRange = tokenRange;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
index 31038652b1..d302c65d5c 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
@@ -26,8 +26,6 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
@@ -45,6 +43,7 @@
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.KeyspaceMetadata;
@@ -169,13 +168,13 @@ public synchronized void open(HugeConfig config) {
this.sessions.session().open();
} catch (InvalidQueryException e) {
// TODO: the error message may be changed in different versions
- if (!e.getMessage().contains(String.format(
- "Keyspace '%s' does not exist", this.keyspace))) {
+ if (!e.getMessage().contains(String.format("Keyspace '%s' does not exist",
+ this.keyspace))) {
throw e;
}
if (this.isSchemaStore()) {
- LOG.info("Failed to connect keyspace: {}, " +
- "try to init keyspace later", this.keyspace);
+ LOG.info("Failed to connect keyspace: {}, try to init keyspace later",
+ this.keyspace);
}
}
} catch (Throwable e) {
@@ -211,13 +210,12 @@ public void mutate(BackendMutation mutation) {
this.checkOpened();
CassandraSessionPool.Session session = this.sessions.session();
- for (Iterator it = mutation.mutation(); it.hasNext();) {
+ for (Iterator it = mutation.mutation(); it.hasNext(); ) {
this.mutate(session, it.next());
}
}
- private void mutate(CassandraSessionPool.Session session,
- BackendAction item) {
+ private void mutate(CassandraSessionPool.Session session, BackendAction item) {
CassandraBackendEntry entry = castBackendEntry(item.entry());
// Check if the entry has no change
@@ -296,7 +294,7 @@ private void mutate(CassandraSessionPool.Session session,
break;
default:
throw new AssertionError(String.format(
- "Unsupported mutate action: %s", item.action()));
+ "Unsupported mutate action: %s", item.action()));
}
}
@@ -305,7 +303,7 @@ public Iterator query(Query query) {
this.checkOpened();
HugeType type = CassandraTable.tableType(query);
String tableName = query.olap() ? this.olapTableName(type) :
- type.string();
+ type.string();
CassandraTable table = this.table(tableName);
Iterator entries = table.query(this.session(null), query);
// Merge olap results as needed
@@ -443,11 +441,11 @@ public void commitTx() {
} catch (DriverException e) {
session.txState(TxState.COMMITT_FAIL);
LOG.error("Failed to commit statements due to:", e);
- assert session.statements().size() > 0;
+ assert !session.statements().isEmpty();
throw new BackendException(
- "Failed to commit %s statements: '%s'...", e,
- session.statements().size(),
- session.statements().iterator().next());
+ "Failed to commit %s statements: '%s'...", e,
+ session.statements().size(),
+ session.statements().iterator().next());
}
}
@@ -512,7 +510,7 @@ private static Map parseReplica(HugeConfig conf) {
switch (strategy) {
case "SimpleStrategy":
List replicas =
- conf.get(CassandraOptions.CASSANDRA_REPLICATION);
+ conf.get(CassandraOptions.CASSANDRA_REPLICATION);
E.checkArgument(replicas.size() == 1,
"Individual factor value should be provided " +
"with SimpleStrategy for Cassandra");
@@ -522,7 +520,7 @@ private static Map parseReplica(HugeConfig conf) {
case "NetworkTopologyStrategy":
// The replicas format is like 'dc1:2,dc2:1'
Map replicaMap =
- conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
+ conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
for (Map.Entry e : replicaMap.entrySet()) {
E.checkArgument(!e.getKey().isEmpty(),
"The datacenter can't be empty");
@@ -531,20 +529,20 @@ private static Map parseReplica(HugeConfig conf) {
break;
default:
throw new AssertionError(String.format(
- "Illegal replication strategy '%s', valid strategy " +
- "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
- strategy));
+ "Illegal replication strategy '%s', valid strategy " +
+ "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
+ strategy));
}
return replication;
}
private static int convertFactor(String factor) {
try {
- return Integer.valueOf(factor);
+ return Integer.parseInt(factor);
} catch (NumberFormatException e) {
throw new BackendException(
- "Expect int factor value for SimpleStrategy, " +
- "but got '%s'", factor);
+ "Expect int factor value for SimpleStrategy, " +
+ "but got '%s'", factor);
}
}
@@ -720,19 +718,19 @@ public CassandraGraphStore(BackendStoreProvider provider,
@Override
public Id nextId(HugeType type) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.nextId()");
+ "CassandraGraphStore.nextId()");
}
@Override
public void increaseCounter(HugeType type, long num) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.increaseCounter()");
+ "CassandraGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.getCounter()");
+ "CassandraGraphStore.getCounter()");
}
@Override
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
index 633c98bc8e..15ad1a7bd3 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
@@ -27,9 +27,6 @@
import java.util.function.BiFunction;
import java.util.function.Function;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.page.PageState;
@@ -51,6 +48,9 @@
import org.apache.hugegraph.util.CopyUtil;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.slf4j.Logger;
+
import com.datastax.driver.core.ColumnDefinitions.Definition;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.PagingState;
@@ -74,7 +74,7 @@
import com.google.common.collect.ImmutableMap;
public abstract class CassandraTable
- extends BackendTable {
+ extends BackendTable {
private static final Logger LOG = Log.logger(CassandraTable.class);
private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;
@@ -90,8 +90,8 @@ protected void registerMetaHandlers() {
"The args count of %s must be 1", meta);
long splitSize = (long) args[0];
CassandraShard splitter = new CassandraShard(session,
- session.keyspace(),
- this.table());
+ session.keyspace(),
+ this.table());
return splitter.getSplits(0, splitSize);
});
}
@@ -118,12 +118,12 @@ public Number queryNumber(CassandraSessionPool.Session session,
statement.setReadTimeoutMillis(timeout * 1000);
return session.query(statement);
}, (q, rs) -> {
- Row row = rs.one();
- if (row == null) {
- return IteratorUtils.of(aggregate.defaultValue());
- }
- return IteratorUtils.of(row.getLong(0));
- });
+ Row row = rs.one();
+ if (row == null) {
+ return IteratorUtils.of(aggregate.defaultValue());
+ }
+ return IteratorUtils.of(row.getLong(0));
+ });
return aggregate.reduce(results);
}
@@ -135,8 +135,7 @@ public Iterator query(CassandraSessionPool.Session session,
protected Iterator query(Query query,
Function fetcher,
- BiFunction>
- parser) {
+ BiFunction> parser) {
ExtendableIterator rs = new ExtendableIterator<>();
if (query.limit() == 0L && !query.noLimit()) {
@@ -279,8 +278,8 @@ protected List