first add version 3.8.0

This commit is contained in:
fanshuai 2025-03-31 11:51:17 +08:00
parent 122b44c84c
commit 5c7e38a21a
2280 changed files with 428629 additions and 1 deletions

175
.clang-format Normal file
View File

@ -0,0 +1,175 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
#
# This is the output of clang-format-10.0.0 --style=google --dump-config,
# except for changes mentioned below.
# We have locked the version of clang-format in order to avoid inconsistencies
# in the format caused by developers using different clang-format versions.
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...

141
.clang-tidy Normal file
View File

@ -0,0 +1,141 @@
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-misc-unused-parameters,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-bool-pointer-implicit-conversion,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-infinite-loop,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-not-null-terminated-result,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-reserved-identifier,
bugprone-signed-char-misuse,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
google-build-explicit-make-pair,
google-build-namespaces,
google-build-using-namespace,
google-default-arguments,
google-explicit-constructor,
google-global-names-in-headers,
google-objc-avoid-nsobject-new,
google-objc-function-naming,
google-objc-global-variable-declaration,
google-readability-avoid-underscore-in-googletest-name,
google-readability-casting,
google-runtime-int,
google-runtime-operator,
google-upgrade-googletest-case,
modernize-avoid-bind,
-modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
-modernize-use-nodiscard,
modernize-use-nullptr,
modernize-use-override,
-modernize-use-trailing-return-type,
modernize-use-transparent-functors,
modernize-use-using,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-constructor-init,
performance-no-automatic-move,
performance-trivially-destructible,
performance-type-promotion-in-math-fn,
performance-unnecessary-copy-initialization,
'
HeaderFilterRegex: '/(?!third-party)|(?!interface)/'
AnalyzeTemporaryDtors: false
FormatStyle: 'file'
WarningsAsErrors: '*'
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantPrefix
value: k

38
.dockerignore Normal file
View File

@ -0,0 +1,38 @@
*.md
docs/
*.swp
*.so
*.DS_Store
# build
pkg-build/
build/
_build/
_build.log
_install/
install/
install_manifest.txt
cmake-build-*
# ccls
.ccls
.ccls-cache
compile_commands.json
.ccache
src/common/base/Base.h.gch
gen-*
CPackConfig.cmake
CPackSourceConfig.cmake
CMakeCache.txt
Makefile
cmake_install.cmake
CTestTestfile.cmake
CMakeFiles/
Testing/
target/
cluster.id
pids/

6
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,6 @@
#Require an approved review in PRs including files with a designated code owner.
/conf/ @vesoft-inc/tech-committee-reviewers
/src/kvstore/raftex/ @critical27
/cmake/ @vesoft-inc/tech-committee-reviewers
*.thrift @vesoft-inc/tech-committee-reviewers
*.yy @dutor @codesigner

39
.github/ISSUE_TEMPLATE/bug-report.md vendored Normal file
View File

@ -0,0 +1,39 @@
---
name: Bug Report
about: I want to report a bug.
title: ''
labels: type/bug
assignees: ''
---
**Please check the FAQ documentation before raising an issue**
<!-- Please check the [FAQ](https://docs.nebula-graph.com.cn/master/20.appendix/0.FAQ/) documentation and old issues before raising an issue in case someone has asked the same question that you are asking. -->
**Describe the bug (__required__)**
<!-- A clear and concise description of what the bug is. -->
**Your Environments (__required__)**
* OS: `uname -a`
* Compiler: `g++ --version` or `clang++ --version`
* CPU: `lscpu`
* Commit id (e.g. `a3ffc7d8`)
**How To Reproduce(__required__)**
Steps to reproduce the behavior:
1. Step 1
2. Step 2
3. Step 3
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Additional context**
<!-- Provide logs and configs, or any other context to trace the problem. -->

16
.github/ISSUE_TEMPLATE/enhancement.md vendored Normal file
View File

@ -0,0 +1,16 @@
---
name: Enhancement
about: Suggest an enhancement to make the code neat or more efficient.
title: ''
labels: type/enhancement
assignees: ''
---
**Introduction**
<!-- concise introduction to problem, motivation, and overview of proposed solution -->
**Contents**
<!-- Please describe the enhancement what you want in this section -->
**Related work**
<!-- In this section you can add other related tasks to help assigner to complete the task more easily -->

View File

@ -0,0 +1,20 @@
---
name: Feature Request
about: Suggest a feature for this project.
title: ''
labels: type/feature req
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->

18
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@ -0,0 +1,18 @@
---
name: Question
about: I want to ask a question.
labels: question
---
**General Question**
<!--
Before asking a question, make sure you have:
- Searched existing questions [forum-EN](https://discuss.nebula-graph.io/) or [forum-CH](https://discuss.nebula-graph.com.cn/).
- Googled your question.
- Searched open and closed [GitHub issues](https://github.com/vesoft-inc/nebula/issues?q=is%3Aissue).
- Read the [documentation-EN](https://docs.nebula-graph.io/) or [documentation-CH](https://docs.nebula-graph.com.cn/).
-->

30
.github/Security.md vendored Normal file
View File

@ -0,0 +1,30 @@
# Vulnerability Assessment Reporting: Beginner's Guide
NebulaGraph is dedicated to offering stable and secure data services. We recognize the importance of community contributions to our security posture and invite you to report any vulnerabilities you may discover.
Should you identify a potential security vulnerability within NebulaGraph or encounter a security incident, we urge you to get in touch with our team.
For efficient communication, please send your findings to (security@vesoft.com) with the following details:
* Vulnerability name (*): Provide a clear, concise title. Include a CVE identifier if available.
* Description of the security issue (*): Elaborate on the security concern.
* Impacted Components (*): Specify affected modules and their version numbers.
* Reproduction Steps (*): Detail the process to verify the vulnerability.
* Suggested Remediation: Offer potential solutions if possible.
* Contact information (*):
* Name
* Email
* Organization
* Consent for Identity Disclosure
> Fields marked with an asterisk `(*)` are mandatory.
## Response Protocol
The NebulaGraph security team pledges to acknowledge receipt of your report via email within one working day.
Post-resolution, we will promptly notify you and extend our gratitude for your invaluable assistance in enhancing NebulaGraph's security.
Disclosure of the vulnerability will be withheld until an official patch is released. We appreciate your discretion and cooperation.
We thank you for your attention to these guidelines and look forward to your participation in securing NebulaGraph.

View File

@ -0,0 +1,25 @@
# Extract tag name
Extract tag information from release branch
## Outputs
### `tag`
tag name
### `tagnum`
tag number
## Example usage
```yaml
- uses: ./.github/actions/tagname-action
id: tag
- name: Other step
run: |
echo ${{ steps.tag.outputs.tag }}
echo ${{ steps.tag.outputs.tagnum }}
```

View File

@ -0,0 +1,24 @@
name: "Extract tag information"
description: "Extract tag information"
outputs:
tag:
description: "tag name"
value: ${{ steps.tag.outputs.tag }}
tagnum:
description: "tag number"
value: ${{ steps.tag.outputs.tagnum }}
majorver:
description: "major version"
value: ${{ steps.tag.outputs.majorver }}
runs:
using: "composite"
steps:
- id: tag
run: |
tag=$(echo ${{ github.ref }} | rev | cut -d/ -f1 | rev)
tagnum=$(echo $tag | sed "s/^v//")
majorver=$(echo $tag | cut -d "." -f 1)
echo "tag=$tag" >> $GITHUB_OUTPUT
echo "tagnum=$tagnum" >> $GITHUB_OUTPUT
echo "majorver=$majorver" >> $GITHUB_OUTPUT
shell: bash

View File

@ -0,0 +1,22 @@
# Upload file to release assets
Upload file to release assets
## Inputs
### `tag`
**Required** tag name of release branch. Default `${{ github.ref }}`.
### `asset-path`
**Required** file path to be uploaded. Default `''`.
## Example usage
```yaml
uses: ./.github/actions/upload-assets-action
with:
asset-path: build/cpack_output
tag: ${{ steps.tag.outputs.tag }}
```

View File

@ -0,0 +1,40 @@
name: 'Upload release assets'
description: 'Upload file to release assets'
inputs:
tag:
description: 'git tag'
required: true
default: ${{ github.ref }}
asset-path:
description: 'file path to be uploaded'
required: true
default: ''
runs:
using: "composite"
steps:
- run: |
GH_RELEASE="https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ inputs.tag }}"
upload_url=$(curl -s --request GET --url $GH_RELEASE | grep -oP '(?<="upload_url": ")[^"]*' | cut -d'{' -f1)
j=0
if [ -d ${{ inputs.asset-path }} ]; then
for filename in `ls ${{ inputs.asset-path }}`;
do
folder_list[j]=${{ inputs.asset-path }}/$filename
j=`expr $j + 1`
done
else
folder_list[0]=${{ inputs.asset-path }}
fi
echo "Uploading asset... "
for filepath in ${folder_list[@]};
do
filename=$(basename "${filepath}")
content_type=$(file -b --mime-type ${filepath})
curl --silent \
--request POST \
--url "$upload_url?name=$filename" \
--header "authorization: Bearer ${{ github.token }}" \
--header "content-type: $content_type" \
--data-binary @"${filepath}"
done
shell: bash

View File

@ -0,0 +1,42 @@
# Upload file to oss
Upload file to oss
## Inputs
### `key-id`
**Required** access key ID of oss. Default `''`.
### `key-secret`
**Required** access key secret of oss. Default `''`.
### `endpoint`
**Required** endpoint of oss. Default `''`.
### `bucket`
**Required** bucket of oss. Default `''`.
### `asset-path`
**Required** file path to be uploaded. Default `''`.
### `target-path`
**Required** path where the oss object is stored. Default `''`.
## Example usage
```yaml
uses: ./.github/actions/upload-to-oss-action
with:
key-id: ${{ secrets.OSS_ID }}
key-secret: ${{ secrets.OSS_SECRET }}
endpoint: ${{ secrets.OSS_ENDPOINT }}
bucket: nebula-graph
asset-path: build/cpack_output
target-path: package/v2-nightly/${{ steps.vars.outputs.subdir }}
```

View File

@ -0,0 +1,50 @@
name: 'Upload to oss'
description: 'Upload files to oss'
inputs:
key-id:
description: 'access key ID'
required: true
default: ''
key-secret:
description: 'access key secret'
required: true
default: ''
endpoint:
description: 'endpooint'
required: true
default: ''
bucket:
description: 'bucket'
required: true
default: ''
asset-path:
description: 'file path to be uploaded'
required: true
default: ''
target-path:
description: 'file path stored on the OSS'
required: true
default: ''
runs:
using: "composite"
steps:
- run: |
j=0
if [ -d ${{ inputs.asset-path }} ]; then
for filename in `ls ${{ inputs.asset-path }}`;
do
folder_list[j]=${{ inputs.asset-path }}/$filename
j=`expr $j + 1`
done
else
folder_list[0]=${{ inputs.asset-path }}
fi
echo "Uploading to oss... "
for filepath in ${folder_list[@]};
do
ossutil64 -e ${{ inputs.endpoint}} \
-i ${{ inputs.key-id }} \
-k ${{ inputs.key-secret }} \
-f cp $filepath oss://${{ inputs.bucket }}/${{ inputs.target-path }}/$(basename ${filepath})
done
shell: bash

42
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,42 @@
<!--
Thanks for your contribution!
In order to review PR more efficiently, please add information according to the template.
-->
## What type of PR is this?
- [ ] bug
- [ ] feature
- [ ] enhancement
## What problem(s) does this PR solve?
#### Issue(s) number:
#### Description:
## How do you solve it?
## Special notes for your reviewer, ex. impact of this fix, design document, etc:
## Checklist:
Tests:
- [ ] Unit test(positive and negative cases)
- [ ] Function test
- [ ] Performance test
- [ ] N/A
Affects:
- [ ] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatibility (If it breaks the compatibility, please describe it and add the label.
- [ ] If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory
## Release notes:
Please confirm whether to be reflected in release notes and how to describe:
> ex. Fixed the bug .....

38
.github/workflows/auto_cherry_pick.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Auto Cherry Pick
on:
workflow_dispatch:
inputs:
pr_label:
description: "Cherry pick label such as 'cherry-pick-v3.2'"
required: true
defaults:
run:
shell: bash
jobs:
auto-cherry-pick:
#if: ${{ startsWith(github.event.pull_request.labels.*.name, 'cherry-pick-') && github.event.pull_request.merged == true }}
runs-on: [self-hosted, nebula-fast]
container:
image: reg.vesoft-inc.com/dashboard/dashboard-dev:centos7
credentials:
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
steps:
- name: keep workspace empty
run: |
rm -rf *
- name: git config set
env:
GH_BOT_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global url."https://${GH_BOT_PAT}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
export GOPRIVATE="github.com/vesoft-inc"
- name: auto cherry pick
uses: xigongdaEricyang/cherry-pick-robot@with-python
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
pr_label: ${{ github.event.inputs.pr_label }}
#pr_num: ${{ github.event.pull_request.number }}
auto_merge: true

22
.github/workflows/check_label.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Auto label
on:
issues:
types:
- reopened
- opened
- labeled
- unlabeled
- closed
env:
GH_PAT: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ toJSON(github.event)}}
EVENT_NAME: ${{ github.event_name}}
jobs:
sync:
name: auto label
runs-on: ubuntu-latest
steps:
- uses: HarrisChu/auto_label@v1

69
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,69 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
schedule:
- cron: '20 21 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language:
- 'cpp'
- 'python'
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

401
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,401 @@
name: nightly
on:
schedule:
- cron: "0 18 * * *"
concurrency:
group: nightly
cancel-in-progress: true
defaults:
run:
shell: bash
env:
OSS_DIR: minio/nightly-build/nebula-graph
jobs:
package:
name: build package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1604
- ubuntu1804
- ubuntu2004
# - centos6
- centos7
- centos8
container:
image: vesoft/nebula-dev:${{ matrix.os }}
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "^1.16.7"
- name: package
run: ./package/package.sh -t Release -r ON -p OFF -s FALSE -k OFF
- name: output some vars
id: vars
env:
SHA_EXT: sha256sum.txt
run: |
find pkg-build/cpack_output -type f \( -iname \*.deb -o -iname \*.rpm -o -iname \*.tar.gz \) -exec bash -c "sha256sum {} > {}.sha256sum.txt" \;
subdir=$(date -u +%Y.%m.%d)
echo "subdir=$subdir" >> $GITHUB_OUTPUT
# - uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.os }}-nightly
# path: pkg-build/cpack_output
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir to MinIO
run: mc cp -r pkg-build/cpack_output/ ${{ env.OSS_DIR }}/${{ steps.vars.outputs.subdir }}/
docker:
name: build docker image
needs: package
runs-on: [self-hosted, nebula]
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
vesoft/nebula-graphd:nightly
target: graphd
cache-to: type=local,dest=/tmp/buildx-cache,mode=max
push: true
- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
vesoft/nebula-storaged:nightly
target: storaged
cache-from: type=local,src=/tmp/buildx-cache
push: true
- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
vesoft/nebula-metad:nightly
target: metad
cache-from: type=local,src=/tmp/buildx-cache
push: true
- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
vesoft/nebula-tools:nightly
target: tools
cache-from: type=local,src=/tmp/buildx-cache
push: true
- name: delete the cache
run: |
rm -rf /tmp/buildx-cache
coverage:
name: coverage
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- centos7
compiler:
- gcc-9.3
container:
image: vesoft/nebula-dev:${{ matrix.os }}
env:
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
CCACHE_MAXSIZE: 8G
volumes:
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
options: --cap-add=SYS_PTRACE
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- name: Prepare environment
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
run: |
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTING=on \
-DENABLE_COVERAGE=on \
-GNinja \
-B build
- name: Make
run: |
ccache -z
ninja -j $(($(nproc)/2+1))
ccache -s
working-directory: build/
- name: CTest
env:
ASAN_OPTIONS: fast_unwind_on_malloc=1
run: ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure
working-directory: build/
timeout-minutes: 20
- name: Setup cluster
run: |
make CONTAINERIZED=true ENABLE_SSL=true CA_SIGNED=true up
working-directory: tests/
timeout-minutes: 2
- name: Pytest
run: |
make RM_DIR=false DEBUG=false J=8 test
working-directory: tests/
timeout-minutes: 15
- name: TCK
run: |
make RM_DIR=false DEBUG=false J=8 tck
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: coverage
run: |
~/.local/bin/fastcov -d build -l -o fastcov.info -p --exclude /usr/include /usr/lib /opt/vesoft build/ tests/ /test /mock .lex .yy
- uses: codecov/codecov-action@v3
with:
files: fastcov.info
fail_ci_if_error: false
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs/
test:
name: Tck test
needs: package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1804
- ubuntu2004
- centos7
- centos8
extra_config:
- "ENABLE_SSL=true CA_SIGNED=true QUERY_CONCURRENTLY=false"
- "ENABLE_SSL=false CA_SIGNED=false QUERY_CONCURRENTLY=true"
container:
image: vesoft/nebula-dev:${{ matrix.os }}
services:
elasticsearch:
image: elasticsearch:7.17.7
ports:
- 9200:9200
- 9300:9300
env:
discovery.type: single-node
options: >-
--health-cmd "curl elasticsearch:9200"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- name: output some vars
id: vars
env:
SHA_EXT: sha256sum.txt
run: |
subdir=$(date -u +%Y.%m.%d)
echo "subdir=$subdir" >> $GITHUB_OUTPUT
- id: oss_package
run: |
case ${{ matrix.os }} in
ubuntu1804)
echo "p=nebula-graph-${{ steps.vars.outputs.subdir }}-nightly.ubuntu1804.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
ubuntu2004)
echo "p=nebula-graph-${{ steps.vars.outputs.subdir }}-nightly.ubuntu2004.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
centos7)
echo "p=nebula-graph-${{ steps.vars.outputs.subdir }}-nightly.el7.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
centos8)
echo "p=nebula-graph-${{ steps.vars.outputs.subdir }}-nightly.el8.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
esac
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
id: cmake
run: |
echo "j=8" >> $GITHUB_OUTPUT
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir to MinIO
run: |
mc cp ${{ env.OSS_DIR }}/${{ steps.vars.outputs.subdir }}/${{ steps.oss_package.outputs.p }} build/
tar zxvf build/${{ steps.oss_package.outputs.p }} -C build
d=`echo ${{ steps.oss_package.outputs.p }} | sed 's/.tar.gz//'`
mv build/${d}/* build/.
- name: Setup cluster
run: |
make CONTAINERIZED=true ${{ matrix.extra_config }} up
working-directory: tests/
timeout-minutes: 2
- name: Pytest
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} test
working-directory: tests/
timeout-minutes: 15
- name: TCK
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} tck
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs*/
standalone:
name: standalone-build-tck
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- centos7
compiler:
- gcc-9.3
env:
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
CCACHE_MAXSIZE: 8G
container:
image: vesoft/nebula-dev:${{ matrix.os }}
volumes:
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
options: --cap-add=SYS_PTRACE
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
id: cmake
run: |
case ${{ matrix.compiler }} in
gcc-*)
case ${{ matrix.os }} in
centos7)
# build with Release type
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=on \
-DENABLE_STANDALONE_VERSION=on \
-GNinja \
-B build
echo "::set-output name=j::8"
;;
esac
;;
esac
- name: Make
run: |
ccache -z
ninja -j $(nproc)
ccache -s
working-directory: build/
- name: CTest
env:
ASAN_OPTIONS: fast_unwind_on_malloc=1
run: |
ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure -LE segment_id_test
ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure -L segment_id_test
working-directory: build/
timeout-minutes: 20
- name: Setup Cluster
run: |
make standalone-up
working-directory: tests/
timeout-minutes: 4
- name: TCK
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} standalone-tck
working-directory: tests/
timeout-minutes: 60
- name: LDBC
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} ldbc
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: Upload logs
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs/

239
.github/workflows/pull_request.yml vendored Normal file
View File

@ -0,0 +1,239 @@
name: pull_request
on:
pull_request:
types: [synchronize, reopened, labeled]
branches:
- master
- 'release-**'
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
lint:
name: lint
if: ${{ contains(github.event.pull_request.labels.*.name, 'ready-for-testing') && github.event.pull_request.merged != true }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
- uses: actions/checkout@v3
with:
clean: false
- name: Check License Header
uses: apache/skywalking-eyes/header@main
- name: Ensure clang-format-10 is available
run: |
command -v clang-format-10 > /dev/null || (sudo apt update && sudo apt install -y clang-format-10)
- name: Cpplint
run: |
ln -snf $PWD/.linters/cpp/hooks/pre-commit.sh $PWD/.linters/cpp/pre-commit.sh
.linters/cpp/pre-commit.sh $(git --no-pager diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }} HEAD)
- name: Format check
run: |
git diff -U0 --no-color ${{ github.event.pull_request.base.sha }} HEAD | /usr/share/clang/clang-format-10/clang-format-diff.py -p1 | tee /tmp/.clang-format-diff
[ -s /tmp/.clang-format-diff ] && exit 1 || true
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Prepare Gherkin exec environ
run: make init-all -C tests
- name: Check Gherkin feature format
run: make check-and-diff -C tests
build:
name: build
needs: lint
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- centos7
- ubuntu2004
compiler:
- gcc-9.3
- clang-10
exclude:
- os: centos7
compiler: clang-10
env:
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
CCACHE_MAXSIZE: 8G
container:
image: vesoft/nebula-dev:${{ matrix.os }}
volumes:
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
options: --cap-add=SYS_PTRACE
services:
elasticsearch:
image: elasticsearch:7.17.7
ports:
- 9200:9200
- 9300:9300
env:
discovery.type: single-node
options: >-
--health-cmd "curl elasticsearch:9200"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
id: cmake
run: |
case ${{ matrix.compiler }} in
gcc-*)
case ${{ matrix.os }} in
centos7)
# build with Release type
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
-DNEBULA_USE_LINKER=mold \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=on \
-GNinja \
-B build
;;
ubuntu2004)
# build with Debug type
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
-DNEBULA_USE_LINKER=mold \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTING=on \
-DENABLE_COVERAGE=on \
-GNinja \
-B build
;;
esac
;;
clang-*)
# build with Sanitizer
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_CLANG_DIR/bin/clang++ \
-DCMAKE_C_COMPILER=$TOOLSET_CLANG_DIR/bin/clang \
-DNEBULA_USE_LINKER=mold \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_MEMORY_TRACKER=off \
-DENABLE_ASAN=on \
-DENABLE_TESTING=on \
-GNinja \
-B build
;;
esac
- name: Make
run: |
case ${{ matrix.compiler }} in
gcc-*)
case ${{ matrix.os }} in
centos7)
# build with Release type
ccache -z
ninja -j $(nproc)
ccache -s
;;
ubuntu2004)
# build with Debug type
ccache -z
ninja -j $(nproc)
ccache -s
;;
esac
;;
clang-*)
# build with Sanitizer
ccache -z
ninja -j $(nproc)
ccache -s
;;
esac
working-directory: build/
- name: CTest
env:
ASAN_OPTIONS: fast_unwind_on_malloc=1
run: |
ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure -LE segment_id_test
ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure -L segment_id_test
working-directory: build/
timeout-minutes: 20
- name: Setup cluster
run: |
case ${{ matrix.compiler }} in
gcc-*)
case ${{ matrix.os }} in
centos7)
# normal cluster
make CONTAINERIZED=true ENABLE_FT_INDEX=true ES_ADDRESS='"elasticsearch":9200' up
;;
ubuntu2004)
# ssl cluster
make CONTAINERIZED=true ENABLE_FT_INDEX=true ES_ADDRESS='"elasticsearch":9200' ENABLE_SSL=true CA_SIGNED=true up
;;
esac
;;
clang-*)
# graph ssl only cluster
make CONTAINERIZED=true ENABLE_FT_INDEX=true ES_ADDRESS='"elasticsearch":9200' ENABLE_SSL=false ENABLE_GRAPH_SSL=true up
;;
esac
working-directory: tests/
timeout-minutes: 4
- name: Pytest
run: |
make RM_DIR=false DEBUG=false J=8 test
working-directory: tests/
timeout-minutes: 15
- name: TCK
run: |
make RM_DIR=false DEBUG=false ENABLE_FT_INDEX=true ES_ADDRESS='"elasticsearch":9200' J=8 tck
working-directory: tests/
timeout-minutes: 60
- name: LDBC
run: |
make RM_DIR=false DEBUG=false J=8 ldbc
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: coverage
if: ${{ matrix.compiler == 'gcc-9.3' && matrix.os == 'ubuntu2004' }}
run: |
~/.local/bin/fastcov -d build -l -o fastcov.info -p --exclude /usr/include /usr/lib /opt/vesoft build/ tests/ /test /mock .lex .yy
- uses: codecov/codecov-action@v3
if: ${{ matrix.compiler == 'gcc-9.3' && matrix.os == 'ubuntu2004' }}
with:
files: fastcov.info
fail_ci_if_error: false
- name: Sanitizer
if: ${{ always() }}
run: |
exit $(grep -P "SUMMARY: AddressSanitizer: \d+ byte\(s\) leaked in \d+ allocation\(s\)\." build/server_*/logs/*stderr.log | wc -l)
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs/

259
.github/workflows/rc.yml vendored Normal file
View File

@ -0,0 +1,259 @@
name: rc
on:
workflow_dispatch:
inputs:
version:
description: "version such as '3.1.0'"
required: true
concurrency:
group: rc
cancel-in-progress: true
defaults:
run:
shell: bash
env:
OSS_DIR: minio/rc-build/nebula-graph
jobs:
package:
name: build package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- centos7
- centos8
container:
image: vesoft/nebula-dev:${{ matrix.os }}
env:
BUILD_DIR: ./pkg-build
CPACK_DIR: ./pkg-build/cpack_output
SYMS_DIR: ./pkg-build/symbols
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 'stable'
cache-dependency-path: nebula-console/go.sum
- id: tag
run: echo tagnum=${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
- name: package
run: ./package/package.sh -v ${{ steps.tag.outputs.tagnum }}
- name: output some vars
run: |
tar zcf ${{ env.CPACK_DIR }}/nebula-graph-${{ steps.tag.outputs.tagnum }}.tar.gz --exclude=${{ env.BUILD_DIR }} ./*
find ${{ env.CPACK_DIR }} -type f \( -iname \*.deb -o -iname \*.rpm -o -iname \*.tar.gz \) -exec bash -c "sha256sum {} > {}.sha256sum.txt" \;
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir to MinIO
run: |
mc cp -r ${{ env.CPACK_DIR }}/ ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/
mc cp -r ${{ env.SYMS_DIR }}/ ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/symbols/
docker_build:
needs: package
name: docker-build
runs-on: [self-hosted, nebula]
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- id: tagname
run: |
echo tag="v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo tagnum="${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo majorver="v$(echo ${{ github.event.inputs.version }} | cut -f1 -d'.')" >> $GITHUB_OUTPUT
- id: docker
run: |
graphdTag=""
storagedTag=""
metadTag=""
toolsTag=""
majorver=$(git tag -l --sort=v:refname | tail -n1 | cut -f1 -d".")
if [[ $majorver == ${{ steps.tagname.outputs.majorver }} ]]; then
graphdTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:latest"
storagedTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:latest"
metadTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:latest"
toolsTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:latest"
fi
echo "graphdTag=$graphdTag" >> $GITHUB_OUTPUT
echo "storagedTag=$storagedTag" >> $GITHUB_OUTPUT
echo "metadTag=$metadTag" >> $GITHUB_OUTPUT
echo "toolsTag=$toolsTag" >> $GITHUB_OUTPUT
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ${{ secrets.HARBOR_REGISTRY }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: docker-graph
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.graphdTag }}
target: graphd
cache-to: type=local,dest=/tmp/buildx-cache,mode=max
push: true
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-storage
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.storagedTag }}
target: storaged
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-meta
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.metadTag }}
target: metad
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-tool
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.toolsTag }}
target: tools
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: delete the cache
run: |
rm -rf /tmp/buildx-cache
test:
name: test
needs: package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1804
- ubuntu2004
- centos7
- centos8
extra_config:
- "ENABLE_SSL=true CA_SIGNED=true QUERY_CONCURRENTLY=false"
- "ENABLE_SSL=false CA_SIGNED=false QUERY_CONCURRENTLY=true"
container:
image: vesoft/nebula-dev:${{ matrix.os }}
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- id: tag
run: echo tagnum=${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
- id: oss_package
run: |
case ${{ matrix.os }} in
ubuntu1804)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.ubuntu1804.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
ubuntu2004)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.ubuntu2004.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
centos7)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.el7.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
centos8)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.el8.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
esac
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
id: cmake
run: |
echo "j=8" >> $GITHUB_OUTPUT
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir from MinIO
run: |
mc cp ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/${{ steps.oss_package.outputs.p }} build/
tar zxvf build/${{ steps.oss_package.outputs.p }} -C build
d=`echo ${{ steps.oss_package.outputs.p }} | sed 's/.tar.gz//'`
mv build/${d}/* build/.
- name: Setup cluster
run: |
make CONTAINERIZED=true ${{ matrix.extra_config }} up
working-directory: tests/
timeout-minutes: 2
- name: Pytest
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} test
working-directory: tests/
timeout-minutes: 15
- name: TCK
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} tck
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs*/

77
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: release
on:
release:
types:
- published
concurrency:
group: release
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
package:
name: package
runs-on: [self-hosted, medium]
container:
image: vesoft/nebula-dev:centos7
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/tagname-action
id: tag
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy rc to release on MinIO
run: |
files=$(mc ls minio/rc-build/nebula-graph/${{ steps.tag.outputs.tagnum }}/ | awk '{print $6}' | grep -v '/$')
for file in $files; do
mc cp minio/rc-build/nebula-graph/${{ steps.tag.outputs.tagnum }}/$file \
minio/release-build/nebula-graph/${{ steps.tag.outputs.tagnum }}/
done
mc cp -r minio/rc-build/nebula-graph/${{ steps.tag.outputs.tagnum }}/symbols/ \
minio/release-build/nebula-graph/${{ steps.tag.outputs.tagnum }}/symbols/
docker_build:
name: docker-build
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
service:
- graphd
- metad
- storaged
- tools
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- uses: ./.github/actions/tagname-action
id: tagname
- id: docker
run: |
majorver=$(git tag -l --sort=v:refname | tail -n1 | cut -f1 -d".")
tag=""
if [[ $majorver == ${{ steps.tagname.outputs.majorver }} ]]; then
tag="latest"
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Sync docker images
env:
FROM_IMAGE: docker://${{ secrets.HARBOR_REGISTRY }}/rc/nebula-${{ matrix.service }}
TO_IMAGE: docker://docker.io/vesoft/nebula-${{ matrix.service }}
CMD: docker run --rm -i quay.io/containers/skopeo:latest copy -a --src-creds ${{ secrets.HARBOR_USERNAME }}:${{ secrets.HARBOR_PASSWORD }} --dest-creds ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}
run: |
${{ env.CMD }} ${{ env.FROM_IMAGE }}:${{ steps.tagname.outputs.tag }} ${{ env.TO_IMAGE }}:${{ steps.tagname.outputs.tag }}
${{ env.CMD }} ${{ env.FROM_IMAGE }}:${{ steps.tagname.outputs.tag }} ${{ env.TO_IMAGE }}:${{ steps.tagname.outputs.majorver }}
if [[ ! -z "${{ steps.docker.outputs.tag }}" ]]; then
${{ env.CMD }} ${{ env.FROM_IMAGE }}:${{ steps.tagname.outputs.tag }} ${{ env.TO_IMAGE }}:${{ steps.docker.outputs.tag }}
fi

71
.gitignore vendored Normal file
View File

@ -0,0 +1,71 @@
*.swp
*.so
*.DS_Store
# build
pkg-build
build
_build
_build.log
_install
install
bin/
install_manifest.txt
src/version/Version.cpp
# ccls
.ccls
.ccls-cache
compile_commands.json
# clangd cache
.clangd/
gen-*
# cmake
CPackConfig.cmake
CPackSourceConfig.cmake
CMakeCache.txt
Makefile
cmake_install.cmake
CTestTestfile.cmake
CMakeFiles/
Testing/
target/
cluster.id
pids/
modules/
# tests
!tests/Makefile
tests/secrets
reformat-gherkin
nebula-python
# IDE
.idea/
.project
.settings/
.classpath
cmake-build*/
.vscode/
.cache/
core.*
workspace.*
.metals/
.cproject
.ycm_extra_conf.py
#py
*.egg-info
*.pot
*.py[co]
__pycache__
venv/
#lock
*.lock
#ctags
.tags
/.vs

46
.licenserc.yaml Normal file
View File

@ -0,0 +1,46 @@
#
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
header:
license:
spdx-id: Apache-2.0
copyright-owner: vesoft inc
content: |
Copyright (c) 2020 vesoft inc. All rights reserved.
This source code is licensed under Apache 2.0 License.
pattern: |
Copyright (c) \d{4} vesoft inc. All rights reserved.
This source code is licensed under Apache 2.0 License.
paths-ignore:
- '.licenserc.yaml'
- '.clang-tidy'
- '.dockerignore'
- '**/.gitignore'
- 'cmake'
- 'conf'
- 'docker'
- 'package'
- 'resources/*.csv'
- 'resources/*.json'
- 'scripts/*.service'
- 'src/**/*.thrift'
- 'src/**/*.lex'
- 'src/**/*.yy'
- 'src/**/*.dict'
- 'src/**/*.in'
- 'tests'
- '.github'
- '.linters'
- '**/*.md'
- 'third-party'
- 'LICENSE'
- 'NOTICE'
comment: on-failure

View File

@ -0,0 +1,172 @@
# signout--coding:utf-8--
# Copyright (c) 2019 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
import os
import re
import sys
PARSER_FILE_PATH = 'src/parser/parser.yy'
SCANNER_FILE_PATH = 'src/parser/scanner.lex'
reserved_key_words = [
'KW_GO',
'KW_AS',
'KW_TO',
'KW_OR',
'KW_AND',
'KW_XOR',
'KW_USE',
'KW_SET',
'KW_LIST',
'KW_MAP',
'KW_FROM',
'KW_WHERE',
'KW_MATCH',
'KW_INSERT',
'KW_YIELD',
'KW_RETURN',
'KW_DESCRIBE',
'KW_DESC',
'KW_VERTEX',
'KW_VERTICES',
'KW_EDGE',
'KW_EDGES',
'KW_UPDATE',
'KW_UPSERT',
'KW_WHEN',
'KW_DELETE',
'KW_FIND',
'KW_PATH',
'KW_LOOKUP',
'KW_ALTER',
'KW_STEPS',
'KW_OVER',
'KW_UPTO',
'KW_REVERSELY',
'KW_INDEX',
'KW_INDEXES',
'KW_REBUILD',
'KW_BOOL',
'KW_INT8',
'KW_INT16',
'KW_INT32',
'KW_INT64',
'KW_INT',
'KW_FLOAT',
'KW_DOUBLE',
'KW_STRING',
'KW_FIXED_STRING',
'KW_TIMESTAMP',
'KW_DATE',
'KW_TIME',
'KW_DATETIME',
'KW_VID_SIZE',
'KW_TAG',
'KW_TAGS',
'KW_UNION',
'KW_INTERSECT',
'KW_MINUS',
'KW_NO',
'KW_OVERWRITE',
'KW_SHOW',
'KW_ADD',
'KW_CREATE',
'KW_DROP',
'KW_REMOVE',
'KW_IF',
'KW_NOT',
'KW_EXISTS',
'KW_WITH',
'KW_CHANGE',
'KW_GRANT',
'KW_REVOKE',
'KW_ON',
'KW_BY',
'KW_IN',
'KW_NOT_IN',
'KW_DOWNLOAD',
'KW_GET',
'KW_OF',
'KW_ORDER',
'KW_INGEST',
'KW_COMPACT',
'KW_FLUSH',
'KW_SUBMIT',
'KW_ASC',
'KW_ASCENDING',
'KW_DESCENDING',
'KW_DISTINCT',
'KW_FETCH',
'KW_PROP',
'KW_BALANCE',
'KW_STOP',
'KW_GROUP',
'KW_IS',
'KW_NULL',
'KW_FORCE',
'KW_RECOVER',
'KW_EXPLAIN',
'KW_UNWIND',
'KW_CASE',
'KW_HOSTS',
'KW_ZONE',
'KW_ZONES',
'KW_RENAME',
'KW_IGNORE_EXISTED_INDEX',
'KW_GEOGRAPHY',
'KW_DURATION',
'KW_ACROSS',
'KW_JOIN',
'KW_LEFT',
'KW_RIGHT',
'KW_INNER',
'KW_OUTER',
'KW_SEMI',
'KW_ANTI',
]
def get_unreserved_keyword(file_path):
parser_file = open(file_path)
flag = 0
unreserved_key_words = []
for line in parser_file.readlines():
if line.strip() == 'unreserved_keyword':
flag = 1
continue
if flag == 1:
if line.strip() == ';':
break
unreserved_key_words.append(
re.sub('\\s+[:|]\\s+(\\w+)\\s+.*', '\\1', line).strip())
continue
parser_file.close()
return unreserved_key_words
if __name__ == '__main__':
cmd = 'git diff --diff-filter=ACMRTUXB HEAD -p ' + \
SCANNER_FILE_PATH + '|grep "^+"|grep -v "^+++"|grep "KW_"'
content = os.popen(cmd)
keywords = []
for line in content.readlines():
keyword = re.sub('.*(KW_\\w+)\s*;.*', '\\1', line.strip())
keywords.append(keyword)
if len(keywords) == 0:
exit(0)
unreserved_key_words = get_unreserved_keyword(PARSER_FILE_PATH)
new_key_words = [
word for word in keywords if word not in reserved_key_words]
if len(new_key_words) == 0:
exit(0)
result = [word for word in new_key_words if word not in unreserved_key_words]
if len(result) == 0:
exit(0)
print('Keywords \"{}\" in src/parser/scanner.lex are not in the unreserved keyword list.'.format(result))
print('Please add them to the unreserved keyword in the src/parser/parser.yy.')
exit(1)

6605
.linters/cpp/cpplint.py vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,89 @@
#!/bin/bash
# Copyright (c) 2018 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
CPPLINT=`dirname $0`/../../.linters/cpp/cpplint.py
CHECKKEYWORD=`dirname $0`/../../.linters/cpp/checkKeyword.py
echo "Performing checkout keyword..."
python3 $CHECKKEYWORD
if [ $? -ne 0 ]; then
echo "Checkout keyword failed"
exit 1
fi
if [ $# -eq 0 ];then
# Since cpplint.py could only apply on our working tree,
# so we forbid committing with unstaged changes present.
# Otherwise, lints can be bypassed via changing without commit.
if ! git diff-files --exit-code --quiet
then
echo "You have unstaged changes, please stage or stash them first."
exit 1
fi
CHECK_FILES=$(git diff --name-only --diff-filter=ACMRTUXB HEAD | egrep '.*\.cpp$|.*\.h$' | grep -v 'com_vesoft_client_NativeClient.h' | grep -v 'com_vesoft_nebula_NebulaCodec.h')
else
CHECK_FILES=$(find $@ -not \( -path src/CMakeFiles -prune \) \
-not \( -path src/interface/gen-cpp2 -prune \) \
-name "*.[h]" -o -name "*.cpp" \
| grep -v 'GraphScanner.*' | grep -v 'GraphParser.*' \
| grep -v 'com_vesoft_client_NativeClient.h' \
| grep -v 'com_vesoft_nebula_NebulaCodec.h')
fi
# No changes on interested files
if [[ -z $CHECK_FILES ]]; then
echo "There's no source files to perform C++ linters..."
exit 0
fi
echo "Performing C++ linters..."
CPPLINT_EXTENS=cpp,h
CPPLINT_FILTER=-whitespace/indent,-build/include_what_you_use,-readability/todo,-build/include,-build/header_guard,-runtime/references,-build/c++11
python3 $CPPLINT --quiet --extensions=$CPPLINT_EXTENS \
--filter=$CPPLINT_FILTER --linelength=100 $CHECK_FILES 2>&1
result=$?
if [ ! $result -eq 0 ]; then
echo "cpplint code style check failed, please fix and recommit."
exit 1
fi
echo "Performing C++ code format check..."
CLANG_FALLBACK=/opt/vesoft/toolset/clang/10.0.0/
if [ -z "$CLANG_HOME" ] && [ -d "$CLANG_FALLBACK" ]; then
CLANG_HOME=$CLANG_FALLBACK
fi
CLANG_FORMAT=$(command -v clang-format-10)
if [ -z "$CLANG_FORMAT" ]; then
CLANG_FORMAT=$CLANG_HOME/bin/clang-format
fi
CLANG_FORMAT_DIFF=$(command -v clang-format-diff-10)
if [ -z "$CLANG_FORMAT_DIFF" ]; then
CLANG_FORMAT_DIFF=$CLANG_HOME/share/clang/clang-format-diff.py
fi
if [ -z "$CLANG_FORMAT" ] || [ -z "$CLANG_FORMAT_DIFF" ]; then
if [ ! -d "$CLANG_HOME" ]; then
echo "The $CLANG_HOME directory was not found."
fi
if [ -z "$CLANG_FORMAT" ]; then
echo "Could not find clang-format"
fi
if [ -z "$CLANG_FORMAT_DIFF" ]; then
echo "Could not find clang-format-diff"
fi
echo "source changes cannot be automatically formatted."
exit 0
fi
git diff -U0 --no-color --staged | "$CLANG_FORMAT_DIFF" -i -p1 -binary "$CLANG_FORMAT"
git add $CHECK_FILES

View File

@ -0,0 +1,236 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="2"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="4"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
</module>
<module name="MethodParamPad"/>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="CommentsIndentation"/>
</module>
</module>

121
CMakeLists.txt Normal file
View File

@ -0,0 +1,121 @@
# Copyright (c) 2018 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
# The build can be controlled by defining following variables on the
# <cmake> command line
#
# CMAKE_C_COMPILER -- Specify the compiler for C language
# CMAKE_CXX_COMPILER -- Specify the compiler for C++ language
#
# NEBULA_THIRDPARTY_ROOT -- Specify the root directory for third-party
# NEBULA_OTHER_ROOT -- Specify the root directory for user build
# -- Split with ":", exp: DIR:DIR
#
# ENABLE_JEMALLOC -- Link jemalloc into all executables
# ENABLE_NATIVE -- Build native client
# ENABLE_TESTING -- Build unit test
# ENABLE_PACK_ONE -- Package to one or multi packages
# CMake version check
cmake_minimum_required(VERSION 3.9.0)
# Set the project name
project("Nebula Graph" C CXX)
option(ENABLE_PACK_ONE "Whether to package into one" ON)
option(ENABLE_VERBOSE_BISON "Enable Bison to report state" OFF)
option(ENABLE_CONSOLE_COMPILATION "Enable nebula-console compilation" OFF)
option(ENABLE_PACKAGE_TAR "Enable package artifacts to tar." OFF)
option(ENABLE_CREATE_GIT_HOOKS "Enable create git hooks." ON)
option(ENABLE_INCLUDE_WHAT_YOU_USE "Enable include-what-you-use find nouse include files" OFF)
add_definitions(-DNEBULA_HOME=${CMAKE_SOURCE_DIR})
if(ENABLE_STANDALONE_VERSION)
add_definitions(-DBUILD_STANDALONE)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/nebula)
include(PlatformCheck)
include(NebulaCMakeMacros)
include(GeneralCMakeOptions)
include(GeneralCMakeConfig)
include(GeneralCompilerConfig)
include(LinkerConfig)
include(CompilerLauncher)
include(ThirdPartyConfig)
include(SanitizerConfig)
include(GitHooksConfig)
include(GitInfoConfig)
include(NebulaCustomTargets)
include(IncludeWhatYouUse)
include(TimeTrace)
add_custom_target(
clang-format
COMMAND "find" "src/" "-type" "f" "\\(" "-iname" "\\*.h" "-o" "-iname" "\\*.cpp" "\\)" "|" "xargs" "clang-format" "-i"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
if (ENABLE_NATIVE)
message(STATUS "ENABLE_NATIVE is ${ENABLE_NATIVE}")
add_compile_options(-fPIC)
endif()
if(ENABLE_MEMORY_TRACKER)
if(ENABLE_JEMALLOC)
if(NOT ENABLE_ASAN)
add_definitions(-DENABLE_MEMORY_TRACKER)
message(STATUS "MemoryTracker is ENABLED")
else()
message(FATAL_ERROR "MemoryTracker need -DENABLE_ASAN=off")
endif()
else()
message(FATAL_ERROR "MemoryTracker need -DENABLE_JEMALLOC=on")
endif()
else()
message(WARNING "MemoryTracker is DISABLED")
endif()
include_directories(AFTER ${CMAKE_SOURCE_DIR}/src)
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src)
# For simplicity, we make all ordinary libraries depend on the compile-time generated files,
# including the precompiled header, a.k.a Base.h.gch, and thrift headers.
macro(nebula_add_library name type)
add_library(${name} ${type} ${ARGN})
if (PCHSupport_FOUND)
add_dependencies(
${name}
base_obj_gch
)
endif()
add_dependencies(
${name}
common_thrift_generator
graph_thrift_generator
storage_thrift_generator
meta_thrift_generator
raftex_thrift_generator
# hbase_thrift_generator
parser_target
wkt_parser_target
datetime_parser_target
)
endmacro()
nebula_add_subdirectory(src)
nebula_add_subdirectory(conf)
nebula_add_subdirectory(resources)
nebula_add_subdirectory(scripts)
include(CPackage)
package(
${ENABLE_PACK_ONE}
"nebula-graph"
"https://github.com/vesoft-inc/nebula/releases"
${CMAKE_SOURCE_DIR}/package
)

1
CONTRIBUTING.md Normal file
View File

@ -0,0 +1 @@
See [How to contribute](https://github.com/vesoft-inc/nebula-community/blob/master/Contributors/how-to-contribute.md) for details about how to contribute to **NebulaGraph**.

10
Coding_Style_Guide.md Normal file
View File

@ -0,0 +1,10 @@
# Contributor Covenant Coding Style Guide
Currently we use clang-format to format the code. We recommend you to configure the clang-format according to the IDE / editor you use. The following link is how to configure vim / emacs / vscode to use clang-format.
- Vim
https://github.com/rhysd/vim-clang-format
- Emacs
https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/clang-format.el
- VS Code
https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting

201
LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

122
README-CN.md Normal file
View File

@ -0,0 +1,122 @@
<p align="center">
<img src="https://docs-cdn.nebula-graph.com.cn/figures/nebularepo-logo-new-cn.png"/>
<br>中文 | <a href="README.md">English</a>
<br>世界上唯一能够容纳千亿个顶点和万亿条边,并提供毫秒级查询延时的图数据库解决方案<br>
</p>
<p align="center">
<a href="https://user-images.githubusercontent.com/38887077/67449282-4362b300-f64c-11e9-878f-7efc373e5e55.jpg">
<img src="https://img.shields.io/badge/WeChat-%E5%BE%AE%E4%BF%A1-brightgreen" alt="WeiXin">
</a>
<a href="https://weibo.com/p/1006067122684542/home?from=page_100606&mod=TAB#place">
<img src="https://img.shields.io/badge/Weibo-%E5%BE%AE%E5%8D%9A-red" alt="Sina Weibo">
</a>
<a href="https://github.com/vesoft-inc/nebula/stargazers">
<img src="https://img.shields.io/github/stars/vesoft-inc/nebula" alt="GitHub stars" />
</a>
<a href="https://github.com/vesoft-inc/nebula/network/members">
<img src="https://img.shields.io/github/forks/vesoft-inc/nebula" alt="GitHub forks" />
</a>
</p>
# NebulaGraph 是什么?
**NebulaGraph** 是一款开源的图数据库,擅长处理千亿个顶点和万亿条边的超大规模数据集。
NebulaGraph 社区已成长为一个荟聚了众多用户、融合了各类图技术场景实践知识的活跃开源社区。你可以在其中与大家共同交流 NebulaGraph [周边生态项目](https://docs.nebula-graph.com.cn/master/20.appendix/6.eco-tool-version/)的应用心得,或者社交媒体、实时推荐、网络安全、金融风控、知识图谱、人工智能等[大规模生产场景](https://nebula-graph.com.cn/cases)的实践经验。
**NebulaGraph** 特点如下:
* 全对称分布式架构
* 存储与计算分离
* 水平可扩展性
* RAFT 协议下的数据强一致
* 支持 openCypher
* 用户鉴权
* 支持多种类型的图计算算法
**NebulaGraph** 内核架构图如下:
![image](https://docs-cdn.nebula-graph.com.cn/figures/nebula-graph-architecture_3.png)
点击 [NebulaGraph 官网](https://www.nebula-graph.com.cn/) 了解更多信息。
<!-- ## 发布通告 deprecated
**NebulaGraph** 的 GitHub 仓库经历过拆分和合并的过程。
- 从 v2.6.0 开始,**NebulaGraph** 内核代码集中在 [nebula](https://github.com/vesoft-inc/nebula) 仓库下。
- 从 v2.0.0 到 v2.5.x 的代码分布在 [nebula-graph](https://github.com/vesoft-inc/nebula-graph)、[nebula-storage](https://github.com/vesoft-inc/nebula-storage)、[nebula-common](https://github.com/vesoft-inc/nebula-common) 这几个仓库中,这几个仓库将被归档。
请访问 [NebulaGraph 文档](https://docs.nebula-graph.com.cn/)了解、获取 **NebulaGraph** 的最新的正式版本。
<!--
NebulaGraph 1.x 后续不再进行功能的更新,请升级到 2.0+ 版本。<br />
NebulaGraph内核 1.x 与 2.x 数据格式、通信协议、客户端等均双向不兼容,可参照[升级指导](https://docs.nebula-graph.com.cn/2.5.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-250/)进行升级。
如需使用稳定版本,请参见[NebulaGraph 1.0](https://github.com/vesoft-inc/nebula)。
## 产品路线图
**NebulaGraph** 产品规划路线图请参见 [roadmap](https://github.com/vesoft-inc/nebula/wiki/Nebula-Graph-Roadmap-2020)。
-->
## 快速使用
您可以在[云上](https://docs.nebula-graph.com.cn/3.3.0/2.quick-start/1.quick-start-overview/#_2)或[本地](https://docs.nebula-graph.com.cn/3.3.0/2.quick-start/1.quick-start-overview/#_6)快速体验 **NebulaGraph**
<!--
在开始使用 **NebulaGraph** 之前,必须通过[编译源码](https://docs.nebula-graph.com.cn/manual-CN/3.build-develop-and-administration/1.build/1.build-source-code/)或者 [docker compose](https://docs.nebula-graph.com.cn/manual-CN/3.build-develop-and-administration/1.build/2.build-by-docker/) 方式安装 **NebulaGraph**。您也可以观看[视频](https://space.bilibili.com/472621355)学习如何安装 **NebulaGraph**
-->
## 安装方式
您可以通过[下载](https://www.nebula-graph.com.cn/download)安装包或者[源码编译](https://docs.nebula-graph.com.cn/3.3.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code/)安装 **NebulaGraph**
## 获取帮助
在使用 **NebulaGraph** 过程中遇到任何问题,都可以通过下面的方式寻求帮助:
* [FAQ](https://docs.nebula-graph.com.cn/3.3.0/20.appendix/0.FAQ/)
* [访问论坛](https://discuss.nebula-graph.com.cn/)
* [查看文档](https://docs.nebula-graph.com.cn/)
## 如何贡献
**NebulaGraph** 是一个完全开源的项目,欢迎开源爱好者通过以下方式参与到 **NebulaGraph** 社区:
* 在 GitHub 上提 [Issue](https://github.com/vesoft-inc/nebula/issues)。
* 贡献代码,详情请参见[如何贡献](https://docs.nebula-graph.com.cn/master/15.contribution/how-to-contribute/)。
## 许可证
**NebulaGraph** 使用 [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) 许可证,您可以免费下载,修改以及部署源代码。<br />
您还可以将 **NebulaGraph** 作为后端服务部署以支持您的 SaaS 部署。
## 联系方式
* 访问[官网](http://nebula-graph.com.cn/)
* [![WeiXin](https://img.shields.io/badge/WeChat-%E5%BE%AE%E4%BF%A1-brightgreen)](https://user-images.githubusercontent.com/38887077/67449282-4362b300-f64c-11e9-878f-7efc373e5e55.jpg)
* [![Sina Weibo](https://img.shields.io/badge/Weibo-%E5%BE%AE%E5%8D%9A-red)](https://weibo.com/p/1006067122684542/home?from=page_100606&mod=TAB#place)
* Email: info@vesoft.com
## 加入 NebulaGraph 社区
| 加入 NebulaGraph 社区 | 加入方式 |
| ----------------------- | ------------------------------------------------------------ |
| 微信群 | [![WeChat Group](https://img.shields.io/badge/微信群-000000?style=for-the-badge&logo=wechat)](https://wj.qq.com/s2/8321168/8e2f/) |
| 提问 | [![Discourse](https://img.shields.io/badge/中文论坛-4285F4?style=for-the-badge&logo=discourse&logoColor=white)](https://discuss.nebula-graph.com.cn/) [![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-nebula--graph-orange?style=for-the-badge&logo=stack-overflow&logoColor=white)](https://stackoverflow.com/questions/tagged/nebula-graph) [![Discussions](https://img.shields.io/badge/GitHub_Discussion-000000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/vesoft-inc/nebula/discussions) |
| 聊天 | [![Chat History](https://img.shields.io/badge/Community%20Chat-000000?style=for-the-badge&logo=discord&logoColor=white)](https://community-chat.nebula-graph.io/) [![Slack](https://img.shields.io/badge/Slack-9F2B68?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/nebulagraph/shared_invite/zt-7ybejuqa-NCZBroh~PCh66d9kOQj45g) |
| NebulaGraph Meetup 活动 | [![Tencent_Meeting](https://img.shields.io/badge/腾讯会议-2D8CFF?style=for-the-badge&logo=googlemeet&logoColor=white)](https://meeting.tencent.com/dm/F8NX1aRZ8PQv) [![Google Calendar](https://img.shields.io/badge/Calander-4285F4?style=for-the-badge&logo=google&logoColor=white)](https://calendar.google.com/calendar/u/0?cid=Z29mbGttamM3ZTVlZ2hpazI2cmNlNXVnZThAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ) [![Zoom](https://img.shields.io/badge/Zoom-2D8CFF?style=for-the-badge&logo=zoom&logoColor=white)](https://us02web.zoom.us/meeting/register/tZ0rcuypqDMvGdLuIm4VprTlx96wrEf062SH) [![Meetup](https://img.shields.io/badge/Meetup-FF0000?style=for-the-badge&logo=meetup&logoColor=white)](https://www.meetup.com/nebulagraph/events/) [![Meeting Archive](https://img.shields.io/badge/Meeting_Archive-808080?style=for-the-badge&logo=readthedocs&logoColor=white)](https://github.com/vesoft-inc/nebula-community/wiki) |
<br />
#### 如果你喜欢这个项目,或者对你有用,请[点击](https://github.com/vesoft-inc/nebula)右上角 ⭐️ Star 收藏吧~

135
README.md
View File

@ -1,2 +1,135 @@
# knowlegegraph
<p align="center">
<img src="https://docs-cdn.nebula-graph.com.cn/figures/nebularepo-logo-new.png"/>
<br> English | <a href="README-CN.md">中文</a>
<br>A distributed, scalable, lightning-fast graph database<br>
</p>
<p align="center">
<a href="https://stackoverflow.com/questions/tagged/nebula-graph">
<img src="https://img.shields.io/badge/Stack%20Overflow-nebula--graph-orange" alt="Stack Overflow" />
</a>
<a href="https://app.codecov.io/gh/vesoft-inc/nebula">
<img src="https://codecov.io/github/vesoft-inc/nebula/coverage.svg?branch=master" alt="code coverage"/>
</a>
<a href="https://github.com/vesoft-inc/nebula/actions?workflow=nightly">
<img src="https://github.com/vesoft-inc/nebula/workflows/nightly/badge.svg" alt="nightly build"/>
</a>
<a href="https://github.com/vesoft-inc/nebula/stargazers">
<img src="https://img.shields.io/github/stars/vesoft-inc/nebula" alt="GitHub stars" />
</a>
<a href="https://github.com/vesoft-inc/nebula/network/members">
<img src="https://img.shields.io/github/forks/vesoft-inc/nebula" alt="GitHub forks" />
</a>
<a href="https://todos.tickgit.com/browse?repo=github.com/vesoft-inc/nebula">
<img src="https://img.shields.io/endpoint?url=https://todos.tickgit.com/badge?repo=github.com/vesoft-inc/nebula" alt="GitHub TODOs" />
</a>
<br>
</p>
# NebulaGraph
## Introduction
**NebulaGraph** is a popular open-source graph database that can handle large volumes of data with milliseconds of latency, scale up quickly, and have the ability to perform fast graph analytics. NebulaGraph has been widely used for social media, recommendation systems, knowledge graphs, security, capital flows, AI, etc. See [our users](https://nebula-graph.io/cases).
The following lists some of **NebulaGraph** features:
* Symmetrically distributed
* Storage and computing separation
* Horizontal scalability
* Strong data consistency by RAFT protocol
* OpenCypher-compatible query language
* Role-based access control for higher-level security
* Different types of graph analytics algorithms
The following figure shows the architecture of the **NebulaGraph** core.
![NebulaGraph Architecture](https://docs-cdn.nebula-graph.com.cn/figures/nebula-graph-architecture_3.png)
Learn more on [NebulaGraph website](https://nebula-graph.io/).
<!--
## Notice of Release
NebulaGraph used to be split into three repositories: [Nebula-Graph](https://github.com/vesoft-inc/nebula-graph), [Nebula-Storage,](https://github.com/vesoft-inc/nebula-storage) and [Nebula-Common](https://github.com/vesoft-inc/nebula-common) for versions between v2.0.0 and v2.5.x, which will be archived.
The one and only codebase of NebulaGraph is now [github.com/vesoft-inc/nebula](https://github.com/vesoft-inc/nebula), as it's back to mono-repo since v2.6.0.
Please check the latest release via the documentation: https://docs.nebula-graph.io/.
NebulaGraph 1.x is not actively maintained. Please move to NebulaGraph 2.x. <br/>
The data format, rpc protocols, clients, etc. are not compatible between NebulaGraph v1.x and v2.x, but we do offer [upgrade guide](https://docs.nebula-graph.io/2.5.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-250/).
To use the stable release, see [NebulaGraph 1.0](https://github.com/vesoft-inc/nebula).
## Roadmap
See our [Roadmap](https://github.com/vesoft-inc/nebula/wiki/Nebula-Graph-Roadmap-2020) for what's coming soon in **NebulaGraph**.
-->
## Quick start
Read the [getting started](https://docs.nebula-graph.io/3.6.0/2.quick-start/1.quick-start-workflow/) docs for a quick start.
## Using NebulaGraph
NebulaGraph is a distributed graph database with multiple components. You can [download](https://www.nebula-graph.io/download) or try in following ways:
- [Build from source](https://docs.nebula-graph.io/3.3.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code/)
- In the cloud: [AWS](https://docs.nebula-graph.io/3.1.3/nebula-cloud/nebula-cloud-on-aws/1.aws-overview/) and [Azure](https://docs.nebula-graph.io/3.1.3/nebula-cloud/nebula-cloud-on-azure/azure-self-managed/1.azure-overview/)
## Getting help
In case you encounter any problems playing around **NebulaGraph**, please reach out for help:
* [FAQ](https://docs.nebula-graph.io/3.6.0/20.appendix/0.FAQ/)
* [Discussions](https://github.com/vesoft-inc/nebula/discussions)
* [Documentation](https://docs.nebula-graph.io/)
## DevTools
NebulaGraph comes with a set of tools to help you manage and monitor your graph database. See [Ecosystem](https://docs.nebula-graph.io/3.6.0/20.appendix/6.eco-tool-version/).
## Contributing
Contributions are warmly welcomed and greatly appreciated. And here are a few ways you can contribute:
* Start by some [issues](https://github.com/vesoft-inc/nebula/issues)
* Submit Pull Requests to us. See [how-to-contribute](https://docs.nebula-graph.io/master/15.contribution/how-to-contribute/).
## Landscape
<p align="left">
<img src="https://landscape.cncf.io/images/cncf-landscape-horizontal-color.svg" width="150">
<br />
[NebulaGraph](https://landscape.cncf.io/?item=app-definition-and-development--database--nebulagraph) enriches the [CNCF Database Landscape](https://landscape.cncf.io/?group=projects-and-products&view-mode=card#app-definition-and-development--database).
</p>
## Licensing
**NebulaGraph** is under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license, so you can freely download, modify, and deploy the source code to meet your needs. <br/>
You can also freely deploy **NebulaGraph** as a back-end service to support your SaaS deployment.
## Contact
* [Community Chat](https://community-chat.nebula-graph.io/)
* [Slack Channel](https://join.slack.com/t/nebulagraph/shared_invite/zt-7ybejuqa-NCZBroh~PCh66d9kOQj45g)
* [Stack Overflow](https://stackoverflow.com/questions/tagged/nebula-graph)
* X(Twitter): [@NebulaGraph](https://twitter.com/NebulaGraph)
* [LinkedIn Page](https://www.linkedin.com/company/nebula-graph/)
* Email: info@vesoft.com
## Community
| Join NebulaGraph Community | Where to Find us |
| ----------------------------------- | ------------------------------------------------------------ |
| Asking Questions | [![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-nebula--graph-orange?style=for-the-badge&logo=stack-overflow&logoColor=white)](https://stackoverflow.com/questions/tagged/nebula-graph) [![Discussions](https://img.shields.io/badge/GitHub_Discussion-000000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/vesoft-inc/nebula/discussions) |
| Chat with Community Members | [![Chat History](https://img.shields.io/badge/Community%20Chat-000000?style=for-the-badge&logo=discord&logoColor=white)](https://community-chat.nebula-graph.io/) [![Slack](https://img.shields.io/badge/Slack-9F2B68?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/nebulagraph/shared_invite/zt-7ybejuqa-NCZBroh~PCh66d9kOQj45g) |
| NebulaGraph Meetup | [![Google Calendar](https://img.shields.io/badge/Calander-4285F4?style=for-the-badge&logo=google&logoColor=white)](https://calendar.google.com/calendar/u/0?cid=Z29mbGttamM3ZTVlZ2hpazI2cmNlNXVnZThAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ) [![Zoom](https://img.shields.io/badge/Zoom-2D8CFF?style=for-the-badge&logo=zoom&logoColor=white)](https://us02web.zoom.us/meeting/register/tZ0rcuypqDMvGdLuIm4VprTlx96wrEf062SH) [![Meetup](https://img.shields.io/badge/Meetup-FF0000?style=for-the-badge&logo=meetup&logoColor=white)](https://www.meetup.com/nebulagraph/events/) [![Meeting Archive](https://img.shields.io/badge/Meeting_Archive-808080?style=for-the-badge&logo=readthedocs&logoColor=white)](https://github.com/vesoft-inc/nebula-community/wiki) |
| Chat, Asking, or Meeting in Chinese | [![WeChat Group](https://img.shields.io/badge/WeChat_Group-000000?style=for-the-badge&logo=wechat)](https://wj.qq.com/s2/8321168/8e2f/) [![Tencent_Meeting](https://img.shields.io/badge/腾讯会议-2D8CFF?style=for-the-badge&logo=googlemeet&logoColor=white)](https://meeting.tencent.com/dm/F8NX1aRZ8PQv) [![Discourse](https://img.shields.io/badge/中文论坛-4285F4?style=for-the-badge&logo=discourse&logoColor=white)](https://discuss.nebula-graph.com.cn/) |
<br />
#### If you find NebulaGraph interesting, please ⭐️ [Star](https://github.com/vesoft-inc/nebula) it at the top of the GitHub page.

172
cmake/CPackage.cmake Normal file
View File

@ -0,0 +1,172 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
#
# Used to package into deb or RPM files
macro(package to_one name home_page scripts_dir)
set(CPACK_PACKAGE_DESCRIPTION ${name})
set(CPACK_PACKAGE_CONTACT ${name})
set(CPACK_PACKAGE_VERSION ${NEBULA_BUILD_VERSION})
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
set(CPACK_PACKAGE_NAME ${name})
# set(CPACK_SET_DESTDIR TRUE)
set(CPACK_PACKAGE_RELOCATABLE ON)
set(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
if (EXISTS "/etc/redhat-release")
if(ENABLE_PACKAGE_TAR)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "RPM")
endif()
file (STRINGS "/etc/redhat-release" SYSTEM_NAME)
if (${SYSTEM_NAME} MATCHES "CentOS")
set(HOST_SYSTEM_NAME "el")
execute_process(
COMMAND echo ${SYSTEM_NAME}
COMMAND tr -dc "0-9."
COMMAND cut -d "." -f1
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(CONCAT HOST_SYSTEM_VER ${HOST_SYSTEM_NAME} ${HOST_SYSTEM_VER})
elseif (${SYSTEM_NAME} MATCHES "Fedora")
set(HOST_SYSTEM_NAME "fc")
execute_process(
COMMAND echo ${SYSTEM_NAME}
COMMAND cut -d " " -f3
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(CONCAT HOST_SYSTEM_VER ${HOST_SYSTEM_NAME} ${HOST_SYSTEM_VER})
else()
set(HOST_SYSTEM_VER "Unknown")
endif()
elseif (EXISTS "/etc/lsb-release")
if(ENABLE_PACKAGE_TAR)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "DEB")
endif()
file (STRINGS "/etc/lsb-release" SYSTEM_NAME)
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND cut -d ";" -f 1
COMMAND cut -d "=" -f 2
OUTPUT_VARIABLE HOST_SYSTEM_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND cut -d ";" -f 2
COMMAND cut -d "=" -f 2
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "." "" HOST_SYSTEM_VER ${HOST_SYSTEM_VER})
if (${HOST_SYSTEM_NAME} MATCHES "Ubuntu")
string(CONCAT HOST_SYSTEM_VER "ubuntu" ${HOST_SYSTEM_VER})
# the ubuntu need to modify the architecture name
if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(CMAKE_HOST_SYSTEM_PROCESSOR "amd64")
endif()
# Adapt the Kylin system
elseif (${HOST_SYSTEM_NAME} MATCHES "Kylin" AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64")
string(CONCAT HOST_SYSTEM_VER ${HOST_SYSTEM_NAME} ${HOST_SYSTEM_VER})
set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64")
endif()
elseif (EXISTS "/etc/issue")
file (STRINGS "/etc/issue" SYSTEM_NAME)
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND sed -n "1p"
COMMAND cut -d " " -f 1
OUTPUT_VARIABLE HOST_SYSTEM_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND sed -n "1p"
COMMAND cut -d " " -f 3
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (${HOST_SYSTEM_NAME} MATCHES "Debian")
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND sed -n "1p"
COMMAND cut -d " " -f 3
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(ENABLE_PACKAGE_TAR)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "DEB")
endif()
# Adapt the NeoKylin system
elseif (${HOST_SYSTEM_NAME} MATCHES "NeoKylin" AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "mips64")
execute_process(
COMMAND echo "${SYSTEM_NAME}"
COMMAND sed -n "1p"
COMMAND cut -d " " -f 4
OUTPUT_VARIABLE HOST_SYSTEM_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_HOST_SYSTEM_PROCESSOR "mips64el")
if(ENABLE_PACKAGE_TAR)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "RPM")
endif()
endif()
string(CONCAT HOST_SYSTEM_VER ${HOST_SYSTEM_NAME} ${HOST_SYSTEM_VER})
set(CMAKE_HOST_SYSTEM_PROCESSOR "mips64el")
else()
set(HOST_SYSTEM_VER "Unknown")
endif()
print_config(NEBULA_BUILD_VERSION)
print_config(HOST_SYSTEM_NAME)
print_config(HOST_SYSTEM_VER)
print_config(CPACK_GENERATOR)
print_config(CMAKE_HOST_SYSTEM_PROCESSOR)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${HOST_SYSTEM_VER}.${CMAKE_HOST_SYSTEM_PROCESSOR})
if (${to_one})
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
else ()
set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
endif()
set(CPACK_DEB_COMPONENT_INSTALL YES)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR})
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${home_page})
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${scripts_dir}/postinst)
set(CPACK_RPM_SPEC_MORE_DEFINE "%define debug_package %{nil}
%define __os_install_post %{nil}")
set(CPACK_RPM_COMPONENT_INSTALL YES)
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR})
set(CPACK_RPM_PACKAGE_URL ${home_page})
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${scripts_dir}/rpm_postinst)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/local)
set(CPACK_RPM_PACKAGE_RELOCATABLE ON)
include(CPack)
cpack_add_component(common GROUP common)
cpack_add_component(graph GROUP graph DEPENDS common)
cpack_add_component(storage GROUP storage DEPENDS common)
cpack_add_component(meta GROUP meta DEPENDS common)
cpack_add_component(tool GROUP tool)
cpack_add_component(nebula-console GROUP nebula-console)
cpack_add_component_group(common)
cpack_add_component_group(graph)
cpack_add_component_group(storage)
cpack_add_component_group(meta)
cpack_add_component_group(tool)
cpack_add_component_group(nebula-console)
endmacro()

18
cmake/ClangTidy.cmake Normal file
View File

@ -0,0 +1,18 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
#
if (ENABLE_CLANG_TIDY)
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
message(FATAL_ERROR "clang-tidy requires CMake version at least 3.6.")
endif()
find_program (CLANG_TIDY_PATH NAMES "clang-tidy")
if (CLANG_TIDY_PATH)
message(STATUS "Using clang-tidy: ${CLANG_TIDY_PATH}.")
set (CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_PATH} --config=)
else ()
message(STATUS "clang-tidy is not found.")
endif ()
endif ()

75
cmake/FetchModule.cmake Normal file
View File

@ -0,0 +1,75 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
#
find_package(Git)
macro(nebula_fetch_module)
cmake_parse_arguments(
module # <prefix>
"" # <options>
"URL;TAG;UPDATE;NAME;CHECKOUT" # <one_value_args>
"" # <multi_value_args>
${ARGN}
)
set(module_dir ${CMAKE_SOURCE_DIR}/modules/${module_NAME})
if(NOT EXISTS ${module_dir}/.git)
message(STATUS "Cloning from ${module_URL}:${module_TAG}")
execute_process(
COMMAND
${GIT_EXECUTABLE} clone
--single-branch
--branch ${module_TAG}
${module_URL} ${module_dir}
RESULT_VARIABLE fetch_status
ERROR_VARIABLE ERROR_MESSAGE
)
if(NOT ${fetch_status} EQUAL 0)
message(FATAL_ERROR "Cloning failed")
endif()
else()
if (${module_CHECKOUT})
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${module_dir}
OUTPUT_VARIABLE branch_name
)
string(REPLACE "\n" "" branch_name "${branch_name}")
if(NOT ${branch_name} STREQUAL ${module_TAG})
message(STATUS "The branch of ${module_NAME} is ${branch_name}, need to change to ${module_TAG}")
execute_process(
COMMAND ${GIT_EXECUTABLE} remote set-branches origin --add ${module_TAG}
WORKING_DIRECTORY ${module_dir}
)
execute_process(
COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch
WORKING_DIRECTORY ${module_dir}
)
execute_process(
COMMAND ${GIT_EXECUTABLE} fetch
WORKING_DIRECTORY ${module_dir}
)
execute_process(
COMMAND ${GIT_EXECUTABLE} checkout ${module_TAG}
WORKING_DIRECTORY ${module_dir}
RESULT_VARIABLE checkout_status
ERROR_VARIABLE error_msg
)
if(NOT ${checkout_status} EQUAL 0)
message(FATAL_ERROR "Checkout to branch ${module_TAG} failed: ${error_msg}, error_code: ${checkout_status}")
endif()
endif()
endif()
if(${module_UPDATE})
message(STATUS "Updating from ${module_URL}")
execute_process(
COMMAND ${GIT_EXECUTABLE} pull
WORKING_DIRECTORY ${module_dir}
RESULT_VARIABLE fetch_status
)
if(NOT ${fetch_status} EQUAL 0)
message(FATAL_ERROR "Updating failed")
endif()
endif()
endif()
endmacro()

33
cmake/FindBreakpad.cmake Normal file
View File

@ -0,0 +1,33 @@
# - Try to find Breakpad includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Breakpad)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Breakpad_FOUND System has breakpad, include and lib dirs found
# Breakpad_INCLUDE_DIR The breakpad includes directories.
# Breakpad_LIBRARY The breakpad library.
find_path(Breakpad_INCLUDE_DIR NAMES breakpad)
find_library(Breakpad_LIBRARY NAMES libbreakpad_client.a)
message(STATUS "BREAKPAD: ${Breakpad_INCLUDE_DIR}")
if(Breakpad_INCLUDE_DIR AND Breakpad_LIBRARY)
set(Breakpad_FOUND TRUE)
mark_as_advanced(
Breakpad_INCLUDE_DIR
Breakpad_LIBRARY
)
endif()
if(NOT Breakpad_FOUND)
message(FATAL_ERROR "Breakpad doesn't exist")
endif()

34
cmake/FindBzip2.cmake Normal file
View File

@ -0,0 +1,34 @@
# - Try to find Bzip2 includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Bzip2)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Bzip2_FOUND System has bzip2, include and lib dirs found.
# Bzip2_INCLUDE_DIR The bzip2 includes directories.
# Bzip2_LIBRARY The bzip2 library.
# Bzip2_BIN The bzip2 binary.
find_path(Bzip2_INCLUDE_DIR NAMES bzlib.h)
find_library(Bzip2_LIBRARY NAMES libbz2.a)
find_program(Bzip2_BIN NAMES bzip2)
if(Bzip2_INCLUDE_DIR AND Bzip2_LIBRARY AND Bzip2_BIN)
set(Bzip2_FOUND TRUE)
mark_as_advanced(
Bzip2_INCLUDE_DIR
Bzip2_LIBRARY
Bzip2_BIN
)
endif()
if(NOT Bzip2_FOUND)
message(FATAL_ERROR "Bzip2 doesn't exist")
endif()

View File

@ -0,0 +1,30 @@
# - Try to find libdouble-conversion includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(DoubleConversion)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# DoubleConversion_FOUND System has double-conversion, include and lib dirs found
# DoubleConversion_INCLUDE_DIR The double-conversion includes directories.
# DoubleConversion_LIBRARY The double-conversion library.
find_path(DoubleConversion_INCLUDE_DIR NAMES double-conversion/double-conversion.h)
find_library(DoubleConversion_LIBRARY NAMES libdouble-conversion.a)
if(DoubleConversion_INCLUDE_DIR AND DoubleConversion_LIBRARY)
set(DoubleConversion_FOUND TRUE)
mark_as_advanced(
DoubleConversion_INCLUDE_DIR
DoubleConversion_LIBRARY
)
endif()
if(NOT DoubleConversion_FOUND)
message(FATAL_ERROR "Double-conversion doesn't exist")
endif()

27
cmake/FindFatal.cmake Normal file
View File

@ -0,0 +1,27 @@
# - Try to find Fatal includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Fatal)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Fatal_FOUND System has readline, include and lib dirs found
# Fatal_INCLUDE_DIR The readline includes directories.
find_path(Fatal_INCLUDE_DIR NAMES fatal)
if(Fatal_INCLUDE_DIR)
set(Fatal_FOUND TRUE)
mark_as_advanced(
Fatal_INCLUDE_DIR
)
endif()
if(NOT Fatal_FOUND)
message(FATAL_ERROR "Fatal doesn't exist")
endif()

33
cmake/FindFbthrift.cmake Normal file
View File

@ -0,0 +1,33 @@
# - Try to find Fbthrift includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Fbthrift)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Fbthrift_FOUND System has fbthrift, thrift1 and include and lib dirs found.
# Fbthrift_INCLUDE_DIR The fbthrift includes directories.
# Fbthrift_LIBRARY The fbthrift library.
# Fbthrift_BIN The fbthrift binary.
find_path(Fbthrift_INCLUDE_DIR NAMES thrift)
find_library(Fbthrift_LIBRARY NAMES libthriftcpp2.a)
find_program(Fbthrift_BIN NAMES thrift1)
if(Fbthrift_INCLUDE_DIR AND Fbthrift_LIBRARY AND Fbthrift_BIN)
set(Fbthrift_FOUND TRUE)
mark_as_advanced(
Fbthrift_INCLUDE_DIR
Fbthrift_LIBRARY
Fbthrift_BIN
)
endif()
if(NOT Fbthrift_FOUND)
message(FATAL_ERROR "Fbthrift doesn't exist")
endif()

30
cmake/FindFizz.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Fizz includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Fizz)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Fizz_FOUND System has fizz, include and lib dirs found
# Fizz_INCLUDE_DIR The fizz includes directories.
# Fizz_LIBRARY The fizz library.
find_path(Fizz_INCLUDE_DIR NAMES fizz)
find_library(Fizz_LIBRARY NAMES libfizz.a)
if(Fizz_INCLUDE_DIR AND Fizz_LIBRARY)
set(Fizz_FOUND TRUE)
mark_as_advanced(
Fizz_INCLUDE_DIR
Fizz_LIBRARY
)
endif()
if(NOT Fizz_FOUND)
message(FATAL_ERROR "Fizz doesn't exist")
endif()

30
cmake/FindFolly.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Folly includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Folly)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Folly_FOUND System has folly, include and lib dirs found
# Folly_INCLUDE_DIR The folly includes directories.
# Folly_LIBRARY The folly library.
find_path(Folly_INCLUDE_DIR NAMES folly)
find_library(Folly_LIBRARY NAMES libfolly.a libfollybenchmark.a)
if(Folly_INCLUDE_DIR AND Folly_LIBRARY)
set(Folly_FOUND TRUE)
mark_as_advanced(
Folly_INCLUDE_DIR
Folly_LIBRARY
)
endif()
if(NOT Folly_FOUND)
message(FATAL_ERROR "Folly doesn't exist")
endif()

30
cmake/FindGflags.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Gflags includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Gflags)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Gflags_FOUND System has Gflags, include and lib dirs found
# Gflags_INCLUDE_DIR The Gflags includes directories.
# Gflags_LIBRARY The Gflags library.
find_path(Gflags_INCLUDE_DIR NAMES gflags)
find_library(Gflags_LIBRARY NAMES libgflags.a)
if(Gflags_INCLUDE_DIR AND Gflags_LIBRARY)
set(Gflags_FOUND TRUE)
mark_as_advanced(
Gflags_INCLUDE_DIR
Gflags_LIBRARY
)
endif()
if(NOT Gflags_FOUND)
message(FATAL_ERROR "Gflags doesn't exist")
endif()

30
cmake/FindGlog.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Glog includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Glog)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Glog_FOUND System has Glog, include and lib dirs found
# Glog_INCLUDE_DIR The Glog includes directories.
# Glog_LIBRARY The Glog library.
find_path(Glog_INCLUDE_DIR NAMES glog)
find_library(Glog_LIBRARY NAMES libglog.a)
if(Glog_INCLUDE_DIR AND Glog_LIBRARY)
set(Glog_FOUND TRUE)
mark_as_advanced(
Glog_INCLUDE_DIR
Glog_LIBRARY
)
endif()
if(NOT Glog_FOUND)
message(FATAL_ERROR "Glog doesn't exist")
endif()

View File

@ -0,0 +1,30 @@
# - Try to find Googletest includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Googletest)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Googletest_FOUND System has Googletest, include and lib dirs found
# Googletest_INCLUDE_DIR The Googletest includes directories.
# Googletest_LIBRARY The Googletest library.
find_path(Googletest_INCLUDE_DIR NAMES gmock gtest)
find_library(Googletest_LIBRARY NAMES libgmock.a libgmock_main.a libgtest.a libgtest_main.a)
if(Googletest_INCLUDE_DIR AND Googletest_LIBRARY)
set(Googletest_FOUND TRUE)
mark_as_advanced(
Googletest_INCLUDE_DIR
Googletest_LIBRARY
)
endif()
if(NOT Googletest_FOUND)
message(FATAL_ERROR "Googletest doesn't exist")
endif()

29
cmake/FindJemalloc.cmake Normal file
View File

@ -0,0 +1,29 @@
# - Try to find Jemalloc includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Jemalloc)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Jemalloc_FOUND System has Jemalloc, include and lib dirs found
# Jemalloc_INCLUDE_DIR The Jemalloc includes directories.
# Jemalloc_LIBRARY The Jemalloc library.
find_path(Jemalloc_INCLUDE_DIR NAMES jemalloc)
find_library(Jemalloc_LIBRARY NAMES libjemalloc.a)
if(Jemalloc_INCLUDE_DIR AND Jemalloc_LIBRARY)
set(Jemalloc_FOUND TRUE)
mark_as_advanced(
Jemalloc_INCLUDE_DIR
Jemalloc_LIBRARY
)
endif()
if(NOT Jemalloc_FOUND)
message(FATAL_ERROR "Jemalloc doesn't exist")
endif()

30
cmake/FindLibevent.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Libevent includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Libevent)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Libevent_FOUND System has Libevent, include and lib dirs found
# Libevent_INCLUDE_DIR The Libevent includes directories.
# Libevent_LIBRARY The Libevent library.
find_path(Libevent_INCLUDE_DIR NAMES event.h)
find_library(Libevent_LIBRARY NAMES libevent.a)
if(Libevent_INCLUDE_DIR AND Libevent_LIBRARY)
set(Libevent_FOUND TRUE)
mark_as_advanced(
Libevent_INCLUDE_DIR
Libevent_LIBRARY
)
endif()
if(NOT Libevent_FOUND)
message(FATAL_ERROR "Libevent doesn't exist")
endif()

24
cmake/FindLibunwind.cmake Normal file
View File

@ -0,0 +1,24 @@
# FindLibunwind
# -------------
#
# Find Libunwind
#
# Find LibUnwind library
#
# ::
#
# LIBUNWIND_LIBRARY_DIR - Can be provided to advise the search
#
# Libunwind_FOUND - True if libunwind is found.
# LIBUNWIND_LIBRARIES - libunwind libraries to link against.
find_library(LIBUNWIND_LIBRARY NAMES unwind libunwind.so.8 PATHS ${LIBUNWIND_LIBRARY_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libunwind REQUIRED_VARS LIBUNWIND_LIBRARY)
if (Libunwind_FOUND)
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY})
endif ()
mark_as_advanced( LIBUNWIND_LIBRARY )

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
#
find_program (MOLD NAMES "mold")
if (NOT MOLD)
message(FATAL_ERROR "Could not find the mold linker")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1.0)
get_filename_component(MOLD_PATH ${MOLD} DIRECTORY)
nebula_add_exe_linker_flag(-B${MOLD_PATH}/../libexec/mold)
nebula_add_shared_linker_flag(-B${MOLD_PATH}/../libexec/mold)
else()
nebula_add_exe_linker_flag(-fuse-ld=mold)
nebula_add_shared_linker_flag(-fuse-ld=mold)
endif()

View File

@ -0,0 +1,95 @@
# This code is based on
# http://rosegarden.svn.sourceforge.net/viewvc/rosegarden/trunk/rosegarden/cmake_admin/FindPCHSupport.cmake?revision=7699&view=markup
#
# - Try to find precompiled headers support for GCC 3.4 and 4.x
# Once done this will define:
#
# Variable:
# PCHSupport_FOUND
#
# Macro:
# ADD_PRECOMPILED_HEADER
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
EXEC_PROGRAM(
${CMAKE_CXX_COMPILER}
ARGS --version
OUTPUT_VARIABLE _compiler_output)
STRING(REGEX REPLACE ".* ([0-9]\\.[0-9]\\.[0-9]) .*" "\\1"
gcc_compiler_version ${_compiler_output})
IF(gcc_compiler_version MATCHES "[4-9]\\.[0-9]\\.[0-9]")
SET(PCHSupport_FOUND TRUE)
MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version})
ELSE()
IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
SET(PCHSupport_FOUND TRUE)
MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version})
ENDIF()
ENDIF()
ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
SET(PCHSupport_FOUND TRUE)
ENDIF()
MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
GET_FILENAME_COMPONENT(_name ${_input} NAME)
SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
SET(_output "${CMAKE_CURRENT_SOURCE_DIR}/${_name}.gch")
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
SET(_compiler_FLAGS ${${_flags_var_name}})
GET_DIRECTORY_PROPERTY(_directory_compile_options COMPILE_OPTIONS)
LIST(APPEND _compiler_FLAGS ${_directory_compile_options})
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
SET(_system_INCLUDE_DIRS "/usr/include" "/usr/local/include")
FOREACH(item ${_directory_flags})
# Exclude standard paths
LIST(FIND _system_INCLUDE_DIRS ${item} _index)
IF(NOT ${_index} EQUAL -1)
continue()
ENDIF()
IF(item MATCHES "^${PROJECT_SOURCE_DIR}.*")
# Directories in this project
IF(item MATCHES "^${PROJECT_SOURCE_DIR}/.*third-party.*")
# third-party
LIST(APPEND _compiler_FLAGS "-isystem ${item}")
ELSE()
# Our own directories
LIST(APPEND _compiler_FLAGS "-I ${item}")
ENDIF()
ELSE()
# All of others
LIST(APPEND _compiler_FLAGS "-isystem ${item}")
ENDIF()
ENDFOREACH(item)
GET_DIRECTORY_PROPERTY(_directory_flags COMPILE_DEFINITIONS)
FOREACH(item ${_directory_flags})
IF(NOT ${item} MATCHES "^GIT_INFO_SHA")
LIST(APPEND _compiler_FLAGS "-D${item}")
ENDIF()
ENDFOREACH(item)
SEPARATE_ARGUMENTS(_compiler_FLAGS)
MESSAGE("Precompile header file " ${_source} " into " ${_output})
IF(CMAKE_CXX_EXTENSIONS OR NOT DEFINED CMAKE_CXX_EXTENSIONS)
SET(_cxx_standard "gnu++${CMAKE_CXX_STANDARD}")
ELSE()
SET(_cxx_standard "c++${CMAKE_CXX_STANDARD}")
ENDIF()
ADD_CUSTOM_COMMAND(
OUTPUT ${_output}
COMMAND ${CMAKE_CXX_COMPILER}
${_compiler_FLAGS}
-x c++-header
-std=${_cxx_standard}
-o ${_output} ${_source}
MAIN_DEPENDENCY ${_source}
DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
ENDMACRO(ADD_PRECOMPILED_HEADER)

31
cmake/FindProxygen.cmake Normal file
View File

@ -0,0 +1,31 @@
# - Try to find Proxygen includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Proxygen)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Proxygen_FOUND System has Proxygen, include and lib dirs found
# Proxygen_INCLUDE_DIR The Proxygen includes directories.
# Proxygen_LIBRARY The Proxygen library.
find_path(Proxygen_INCLUDE_DIR NAMES proxygen)
find_library(Proxygen_LIBRARY NAMES libproxygen.a)
if(Proxygen_INCLUDE_DIR AND Proxygen_LIBRARY)
set(Proxygen_FOUND TRUE)
mark_as_advanced(
Proxygen_INCLUDE_DIR
Proxygen_LIBRARY
)
endif(Proxygen_INCLUDE_DIR AND Proxygen_LIBRARY)
if(NOT Proxygen_FOUND)
message(FATAL_ERROR "Proxygen doesn't exist")
endif()

30
cmake/FindRocksdb.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Rocksdb includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Rocksdb)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Rocksdb_FOUND System has Rocksdb, include and lib dirs found
# Rocksdb_INCLUDE_DIR The Rocksdb includes directories.
# Rocksdb_LIBRARY The Rocksdb library.
find_path(Rocksdb_INCLUDE_DIR NAMES rocksdb)
find_library(Rocksdb_LIBRARY NAMES librocksdb.a)
if(Rocksdb_INCLUDE_DIR AND Rocksdb_LIBRARY)
set(Rocksdb_FOUND TRUE)
mark_as_advanced(
Rocksdb_INCLUDE_DIR
Rocksdb_LIBRARY
)
endif()
if(NOT Rocksdb_FOUND)
message(FATAL_ERROR "Rocksdb doesn't exist")
endif()

30
cmake/FindSnappy.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Snappy includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Snappy)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Snappy_FOUND System has Snappy, include and lib dirs found
# Snappy_INCLUDE_DIR The Snappy includes directories.
# Snappy_LIBRARY The Snappy library.
find_path(Snappy_INCLUDE_DIR NAMES snappy.h)
find_library(Snappy_LIBRARY NAMES libsnappy.a)
if(Snappy_INCLUDE_DIR AND Snappy_LIBRARY)
set(Snappy_FOUND TRUE)
mark_as_advanced(
Snappy_INCLUDE_DIR
Snappy_LIBRARY
)
endif()
if(NOT Snappy_FOUND)
message(FATAL_ERROR "Snappy doesn't exist")
endif()

30
cmake/FindSodium.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Sodium includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Sodium)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Sodium_FOUND System has Sodium, include and lib dirs found
# Sodium_INCLUDE_DIR The Sodium includes directories.
# Sodium_LIBRARY The Sodium library.
find_path(Sodium_INCLUDE_DIR NAMES sodium)
find_library(Sodium_LIBRARY NAMES libsodium.a)
if(Sodium_INCLUDE_DIR AND Sodium_LIBRARY)
set(Sodium_FOUND TRUE)
mark_as_advanced(
Sodium_INCLUDE_DIR
Sodium_LIBRARY
)
endif()
if(NOT Sodium_FOUND)
message(FATAL_ERROR "Sodium doesn't exist")
endif()

30
cmake/FindWangle.cmake Normal file
View File

@ -0,0 +1,30 @@
# - Try to find Wangle includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Wangle)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Wangle_FOUND System has Wangle, include and lib dirs found
# Wangle_INCLUDE_DIR The Wangle includes directories.
# Wangle_LIBRARY The Wangle library.
find_path(Wangle_INCLUDE_DIR NAMES wangle)
find_library(Wangle_LIBRARY NAMES libwangle.a)
if(Wangle_INCLUDE_DIR AND Wangle_LIBRARY)
set(Wangle_FOUND TRUE)
mark_as_advanced(
Wangle_INCLUDE_DIR
Wangle_LIBRARY
)
endif()
if(NOT Wangle_FOUND)
message(FATAL_ERROR "Wangle doesn't exist")
endif()

32
cmake/FindZstd.cmake Normal file
View File

@ -0,0 +1,32 @@
# - Try to find Zstd includes dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Zstd)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Variables defined by this module:
#
# Zstd_FOUND System has Zstd, include and lib dirs found
# Zstd_INCLUDE_DIR The Zstd includes directories.
# Zstd_LIBRARY The Zstd library.
# Zstd_BIN The Zstd binary.
find_path(Zstd_INCLUDE_DIR NAMES zstd.h)
find_library(Zstd_LIBRARY NAMES libzstd.a)
if(Zstd_INCLUDE_DIR AND Zstd_LIBRARY)
set(Zstd_FOUND TRUE)
mark_as_advanced(
Zstd_INCLUDE_DIR
Zstd_LIBRARY
)
endif()
if(NOT Zstd_FOUND)
message(FATAL_ERROR "Zstd doesn't exist")
endif()

138
cmake/ThriftGenerate.cmake Normal file
View File

@ -0,0 +1,138 @@
#
# Requirements:
# Please provide the following two variables before using these macros:
# ${THRIFT1} - path/to/bin/thrift1
# ${THRIFT_TEMPLATES} - path/to/include/thrift/templates
# ${THRIFTCPP2} - path/to/lib/thriftcpp2
#
#
# bypass_source_check
# This tells cmake to ignore if it doesn't see the following sources in
# the library that will be installed. Thrift files are generated at compile
# time so they do not exist at source check time
#
# Params:
# @sources - The list of files to ignore in source check
#
macro(bypass_source_check sources)
set_source_files_properties(
${sources}
PROPERTIES GENERATED TRUE
)
endmacro()
#
# thrift_generate
# This is used to codegen thrift files using the thrift compiler
# Params:
# @file_name - The name of tge thrift file
# @services - A list of services that are declared in the thrift file
# @output_path - The directory where the thrift file lives
#
# Output:
# file-cpp2-target - A custom target to add a dependency
# ${file-cpp2-HEADERS} - The generated Header Files.
# ${file-cpp2-SOURCES} - The generated Source Files.
#
# Notes:
# If any of the fields is empty, it is still required to provide an empty string
#
# When using file_cpp2-SOURCES it should always call:
# bypass_source_check(${file_cpp2-SOURCES})
# This will prevent cmake from complaining about missing source files
#
macro(thrift_generate file_name services file_path output_path include_prefix)
set("${file_name}-cpp2-HEADERS"
${output_path}/gen-cpp2/${file_name}_constants.h
${output_path}/gen-cpp2/${file_name}_data.h
${output_path}/gen-cpp2/${file_name}_types.h
${output_path}/gen-cpp2/${file_name}_types_custom_protocol.h
${output_path}/gen-cpp2/${file_name}_types.tcc
)
set("${file_name}-cpp2-SOURCES"
${output_path}/gen-cpp2/${file_name}_constants.cpp
${output_path}/gen-cpp2/${file_name}_data.cpp
${output_path}/gen-cpp2/${file_name}_metadata.cpp
${output_path}/gen-cpp2/${file_name}_types.cpp
)
foreach(service ${services})
set("${file_name}-cpp2-HEADERS"
${${file_name}-cpp2-HEADERS}
${output_path}/gen-cpp2/${service}.h
${output_path}/gen-cpp2/${service}.tcc
${output_path}/gen-cpp2/${service}AsyncClient.h
${output_path}/gen-cpp2/${service}_custom_protocol.h
)
set("${file_name}-cpp2-SOURCES"
${${file_name}-cpp2-SOURCES}
${output_path}/gen-cpp2/${service}.cpp
${output_path}/gen-cpp2/${service}AsyncClient.cpp
${output_path}/gen-cpp2/${service}_processmap_binary.cpp
${output_path}/gen-cpp2/${service}_processmap_compact.cpp
)
endforeach()
add_custom_command(
OUTPUT ${${file_name}-cpp2-HEADERS} ${${file_name}-cpp2-SOURCES}
COMMAND ${THRIFT1}
--strict "--allow-neg-enum-vals"
--gen "mstch_cpp2:include_prefix=${include_prefix},stack_arguments"
--gen "py"
--gen "js:node:"
--gen "csharp"
--gen "java:hashcode"
--gen "go:thrift_import=github.com/facebook/fbthrift/thrift/lib/go/thrift,package_prefix=github.com/vesoft-inc/nebula-go/v3/,use_context"
-o "." "${file_path}/${file_name}.thrift"
COMMAND
mkdir -p "./gen-rust/${file_name}"
&& ${THRIFT1}
--strict "--allow-neg-enum-vals"
--gen "mstch_rust"
-o "gen-rust/${file_name}"
"${file_path}/${file_name}.thrift"
&& ( mv ./gen-rust/${file_name}/gen-rust/lib.rs ./gen-rust/${file_name} )
&& ( rm -r ./gen-rust/${file_name}/gen-rust/ )
DEPENDS "${file_path}/${file_name}.thrift"
COMMENT "Generating thrift files for ${file_name}"
)
bypass_source_check(${${file_name}-cpp2-SOURCES})
add_custom_target(
${file_name}_thrift_generator
DEPENDS ${${file_name}-cpp2-HEADERS} ${${file_name}-cpp2-SOURCES}
)
add_library(
"${file_name}_thrift_obj"
OBJECT
${${file_name}-cpp2-SOURCES}
)
add_dependencies(${file_name}_thrift_obj ${file_name}_thrift_generator)
set_target_properties(
"${file_name}_thrift_obj"
PROPERTIES CXX_CLANG_TIDY ""
)
target_compile_options(${file_name}_thrift_obj PRIVATE "-Wno-pedantic")
target_compile_options(${file_name}_thrift_obj PRIVATE "-Wno-extra")
if(NOT "${file_name}" STREQUAL "common")
add_dependencies(
${file_name}_thrift_obj
common_thrift_generator
)
endif()
if("${file_name}" STREQUAL "storage")
add_dependencies(
${file_name}_thrift_obj
meta_thrift_generator
)
endif()
endmacro()

View File

@ -0,0 +1,8 @@
# Is abi 11
if (${DISABLE_CXX11_ABI})
message(STATUS "Set D_GLIBCXX_USE_CXX11_ABI to 0")
add_compile_options(-D_GLIBCXX_USE_CXX11_ABI=0)
else()
message(STATUS "Set D_GLIBCXX_USE_CXX11_ABI to 1")
add_compile_options(-D_GLIBCXX_USE_CXX11_ABI=1)
endif()

View File

@ -0,0 +1,29 @@
option(ENABLE_COMPILER_LAUNCHER "Using compiler launcher if available" ON)
if(NOT (ENABLE_COMPILER_LAUNCHER AND ENABLE_CCACHE))
return()
endif()
set(COMPILER_LAUNCHER_OPTION
"ccache"
CACHE STRING "Compiler cache to be used")
set(COMPILER_LAUNCHER_OPTION_VALUES "ccache" "sccache" "distcc")
set_property(CACHE COMPILER_LAUNCHER_OPTION PROPERTY STRINGS ${COMPILER_LAUNCHER_OPTION_VALUES})
list(
FIND
COMPILER_LAUNCHER_OPTION_VALUES
${COMPILER_LAUNCHER_OPTION}
COMPILER_LAUNCHER_OPTION_INDEX)
if(${COMPILER_LAUNCHER_OPTION_INDEX} EQUAL -1)
message(
STATUS
"Using custom compiler launcher system: '${COMPILER_LAUNCHER_OPTION}', explicitly supported entries are ${COMPILER_LAUNCHER_OPTION_VALUES}")
endif()
find_program(COMPILER_LAUNCHER_BINARY ${COMPILER_LAUNCHER_OPTION})
if(COMPILER_LAUNCHER_BINARY)
message(STATUS "${COMPILER_LAUNCHER_OPTION} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${COMPILER_LAUNCHER_BINARY})
else()
message(WARNING "${COMPILER_LAUNCHER_OPTION} is enabled but was not found. Not using it")
endif()

View File

@ -0,0 +1,25 @@
# By default, all dynamic and static libraries will be placed at ${CMAKE_BINARY_DIR}/lib,
# while all executables at ${CMAKE_BINARY_DIR}/bin.
# But for the sake of cleanliness, all executables ending with `_test' will be placed
# at ${CMAKE_BINARY_DIR}/bin/test, while those ending with `_bm' at ${CMAKE_BINARY_DIR}/bin/bench.
# Please see `nebula_add_executable' for this rule.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
if(ENABLE_TESTING)
enable_testing()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
print_config(CMAKE_BUILD_TYPE)
if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
set(CMAKE_INSTALL_PREFIX "/usr/local/nebula")
endif()
print_config(CMAKE_INSTALL_PREFIX)
set(CMAKE_SKIP_RPATH TRUE)

View File

@ -0,0 +1,31 @@
############ Nebula defined options immutable during configure stage #############
message(">>>> Options of ${PROJECT_NAME} <<<<")
option(ENABLE_TESTING "Build unit tests" ON)
option(ENABLE_CCACHE "Use ccache to speed up compiling" ON)
option(ENABLE_WERROR "Regard warnings as errors" ON)
option(ENABLE_JEMALLOC "Use jemalloc as memory allocator" ON)
option(ENABLE_ASAN "Build with AddressSanitizer" OFF)
option(ENABLE_UBSAN "Build with UndefinedBehaviourSanitizer" OFF)
option(ENABLE_TSAN "Build with ThreadSanitizer" OFF)
option(ENABLE_STATIC_ASAN "Statically link against libasan" OFF)
option(ENABLE_STATIC_UBSAN "Statically link against libubsan" OFF)
option(ENABLE_FUZZY_TESTING "Enable Fuzzy tests" OFF)
option(ENABLE_FRAME_POINTER "Build with frame pointer" OFF)
option(ENABLE_STRICT_ALIASING "Build with -fstrict-aliasing" OFF)
option(ENABLE_COVERAGE "Build with coverage report" OFF)
option(ENABLE_PIC "Build with -fPIC" OFF)
option(ENABLE_COMPRESSED_DEBUG_INFO "Compress debug info to reduce binary size" ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy if present" OFF)
option(ENABLE_GDB_SCRIPT_SECTION "Add .debug_gdb_scripts section" OFF)
option(DISABLE_CXX11_ABI "Whether to disable cxx11 abi" OFF)
option(ENABLE_BREAKPAD "Whether to enable breakpad" OFF)
option(ENABLE_STANDALONE_VERSION "Enable standalone version build" OFF)
option(ENABLE_MEMORY_TRACKER "Enable memory tracker" ON)
get_cmake_property(variable_list VARIABLES)
foreach(_varname ${variable_list})
string(REGEX MATCH "^ENABLE" matched ${_varname})
if(matched)
print_option(${_varname})
endif()
endforeach()

View File

@ -0,0 +1,93 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
print_config(CMAKE_CXX_STANDARD)
print_config(CMAKE_CXX_COMPILER)
print_config(CMAKE_CXX_COMPILER_ID)
if (!CMAKE_CXX_COMPILER)
message(FATAL_ERROR "No C++ compiler found")
endif()
include(CheckCXXCompilerFlag)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wpedantic)
add_compile_options(-Wunused-parameter)
add_compile_options(-Wshadow)
add_compile_options(-Wnon-virtual-dtor)
add_compile_options(-Woverloaded-virtual)
add_compile_options(-Wignored-qualifiers)
# For s2
add_definitions(-DS2_USE_GLOG)
add_definitions(-DS2_USE_GFLAGS)
# For breakpad
add_definitions(-D__STDC_FORMAT_MACROS)
include_directories(AFTER ${CMAKE_SOURCE_DIR}/src)
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src)
if(ENABLE_WERROR)
add_compile_options(-Werror)
add_compile_options(-Wno-attributes)
endif()
if(NOT ENABLE_STRICT_ALIASING)
add_compile_options(-fno-strict-aliasing)
else()
add_compile_options(-fstrict-aliasing)
endif()
if(ENABLE_FRAME_POINTER)
add_compile_options(-fno-omit-frame-pointer)
else()
add_compile_options(-fomit-frame-pointer)
endif()
if(ENABLE_PIC)
add_compile_options(-fPIC)
endif()
if(ENABLE_TESTING AND ENABLE_COVERAGE)
add_compile_options(--coverage)
add_compile_options(-g)
add_compile_options(-O0)
nebula_add_exe_linker_flag(-coverage)
nebula_add_exe_linker_flag(-lgcov)
endif()
# TODO(doodle) Add option suggest-override for gnu
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Here we need to specify the path of libstdc++ used by Clang
if(NOT ${NEBULA_CLANG_USE_GCC_TOOLCHAIN} STREQUAL "")
print_config(NEBULA_CLANG_USE_GCC_TOOLCHAIN)
execute_process(
COMMAND ${NEBULA_CLANG_USE_GCC_TOOLCHAIN}/bin/gcc -dumpmachine
OUTPUT_VARIABLE gcc_target_triplet
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_compile_options("--gcc-toolchain=${NEBULA_CLANG_USE_GCC_TOOLCHAIN}")
nebula_add_exe_linker_flag(--gcc-toolchain=${NEBULA_CLANG_USE_GCC_TOOLCHAIN})
nebula_add_shared_linker_flag(--gcc-toolchain=${NEBULA_CLANG_USE_GCC_TOOLCHAIN})
if(NOT "${gcc_target_triplet}" STREQUAL "")
add_compile_options(--target=${gcc_target_triplet})
nebula_add_exe_linker_flag(--target=${gcc_target_triplet})
nebula_add_shared_linker_flag(--target=${gcc_target_triplet})
endif()
endif()
#add_compile_options(-Wno-mismatched-tags)
add_compile_options(-Wno-self-assign-overloaded)
add_compile_options(-Wno-self-move)
add_compile_options(-Wno-format-pedantic)
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)
set(libatomic_link_flags "-Wl,-Bstatic -latomic -Wl,-Bdynamic")
set(CMAKE_REQUIRED_FLAGS "${libatomic_link_flags}")
check_cxx_compiler_flag("${libatomic_link_flags}" has_static_libatomic)
if(NOT has_static_libatomic)
set(libatomic_link_flags "-latomic")
endif()
endif()

View File

@ -0,0 +1,19 @@
if(ENABLE_CREATE_GIT_HOOKS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
# Create the pre-commit hook every time we run cmake
message(STATUS "Create the pre-commit hook")
set(PRE_COMMIT_HOOK ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
execute_process(
COMMAND
"rm" "-f" ${PRE_COMMIT_HOOK}
)
execute_process(
COMMAND
"ln" "-s" ${CMAKE_CURRENT_SOURCE_DIR}/.linters/cpp/hooks/pre-commit.sh ${PRE_COMMIT_HOOK}
RESULT_VARIABLE retcode
)
if(${retcode} EQUAL 0)
MESSAGE(STATUS "Creating pre-commit hook done")
else()
MESSAGE(FATAL_ERROR "Creating pre-commit hook failed: ${retcode}")
endif()
endif()

View File

@ -0,0 +1,12 @@
find_package(Git)
if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_INFO_SHA
)
endif()
if (GIT_INFO_SHA)
string(REGEX REPLACE "[^0-9a-f]+" "" GIT_INFO_SHA "${GIT_INFO_SHA}")
endif()

View File

@ -0,0 +1,10 @@
if(ENABLE_INCLUDE_WHAT_YOU_USE)
find_program(INCLUDE_WHAT_YOU_USE include-what-you-use)
if(INCLUDE_WHAT_YOU_USE)
message("use include-what-you-use")
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use;-Xiwyu;--transitive_includes_only")
else()
message(STATUS "iwyu requested but executable not found")
endif()
endif()

View File

@ -0,0 +1,28 @@
set(third_party_install_prefix ${CMAKE_BINARY_DIR}/third-party/install)
message(STATUS "Downloading prebuilt third party automatically...")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if(NOT ${NEBULA_CLANG_USED_GCC_TOOLCHAIN} STREQUAL "")
set(cxx_cmd ${NEBULA_CLANG_USED_GCC_TOOLCHAIN}/bin/g++)
else()
set(cxx_cmd ${CMAKE_CXX_COMPILER})
endif()
else()
set(cxx_cmd ${CMAKE_CXX_COMPILER})
endif()
if(${DISABLE_CXX11_ABI})
set(cxx_cmd "${cxx_cmd} -D_GLIBCXX_USE_CXX11_ABI=0")
else()
set(cxx_cmd "${cxx_cmd} -D_GLIBCXX_USE_CXX11_ABI=1")
endif()
message(STATUS "cxx_cmd: ${cxx_cmd}")
execute_process(
COMMAND
env CXX=${cxx_cmd} version=${NEBULA_THIRDPARTY_VERSION} ${CMAKE_SOURCE_DIR}/third-party/install-third-party.sh --prefix=${third_party_install_prefix}
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}
)
if(EXISTS ${third_party_install_prefix})
set(NEBULA_THIRDPARTY_ROOT ${third_party_install_prefix})
endif()
unset(third_party_install_prefix)

View File

@ -0,0 +1,61 @@
set(NEBULA_USE_LINKER
"bfd"
CACHE STRING "Linker to be used")
set(USER_LINKER_OPTION_VALUES "lld" "gold" "bfd" "mold")
set_property(CACHE NEBULA_USE_LINKER PROPERTY STRINGS ${USER_LINKER_OPTION_VALUES})
list(
FIND
USER_LINKER_OPTION_VALUES
${NEBULA_USE_LINKER}
USER_LINKER_OPTION_INDEX)
if(${USER_LINKER_OPTION_INDEX} EQUAL -1)
message(
STATUS
"Using custom linker: '${NEBULA_USE_LINKER}', explicitly supported entries are ${USER_LINKER_OPTION_VALUES}")
endif()
print_config(NEBULA_USE_LINKER)
if (${NEBULA_USE_LINKER} STREQUAL "mold")
include(FindMoldLinker)
else()
nebula_add_exe_linker_flag(-fuse-ld=${NEBULA_USE_LINKER})
nebula_add_shared_linker_flag(-fuse-ld=${NEBULA_USE_LINKER})
endif()
nebula_add_exe_linker_flag(-static-libstdc++)
nebula_add_exe_linker_flag(-static-libgcc)
nebula_add_exe_linker_flag(-no-pie)
nebula_add_exe_linker_flag(-rdynamic)
if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-D_FORTIFY_SOURCE=2)
else()
# The mips need to add it when build Debug to lift the usual restrictions on the size of the global offset table.
if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "mips64")
add_compile_options(-mxgot)
endif()
if (NOT ${NEBULA_USE_LINKER} STREQUAL "gold" AND NOT ENABLE_GDB_SCRIPT_SECTION)
# `gold' linker is buggy for `--gc-sections', disabled for it
# `gc-sections' will discard the `.debug_gdb_scripts' section if enabled
add_compile_options(-ffunction-sections)
add_compile_options(-fdata-sections)
nebula_add_exe_linker_flag(-Wl,--gc-sections)
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
# The mips not supported
if (NOT ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "mips64")
if(ENABLE_COMPRESSED_DEBUG_INFO)
nebula_add_exe_linker_flag(-Wl,--compress-debug-sections=zlib)
else()
nebula_remove_exe_linker_flag(-Wl,--compress-debug-sections=zlib)
endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-fno-limit-debug-info)
endif()
endif()

View File

@ -0,0 +1,17 @@
set(BISON_EXECUTE_ENV "")
execute_process(
COMMAND ${BISON_EXECUTABLE} --print-datadir
OUTPUT_VARIABLE bison_encoded_data_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT EXISTS ${bison_encoded_data_dir})
get_filename_component(bison_prefix ${BISON_EXECUTABLE} DIRECTORY)
get_filename_component(bison_prefix ${bison_prefix} DIRECTORY)
if(EXISTS ${bison_prefix}/share/bison)
set(BISON_EXECUTE_ENV "BISON_PKGDATADIR=${bison_prefix}/share/bison")
endif()
endif()
if(NOT ${BISON_EXECUTE_ENV} STREQUAL "")
set(BISON_EXECUTABLE ${CMAKE_COMMAND} -E env ${BISON_EXECUTE_ENV} ${BISON_EXECUTABLE})
endif()

View File

@ -0,0 +1,166 @@
macro(nebula_add_executable)
cmake_parse_arguments(
nebula_exec # prefix
"" # <options>
"NAME" # <one_value_args>
"SOURCES;OBJECTS;LIBRARIES" # <multi_value_args>
${ARGN}
)
add_executable(
${nebula_exec_NAME}
${nebula_exec_SOURCES}
${nebula_exec_OBJECTS}
)
nebula_link_libraries(
${nebula_exec_NAME}
${nebula_exec_LIBRARIES}
)
if(${nebula_exec_NAME} MATCHES "_test$")
set_target_properties(
${nebula_exec_NAME}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test
)
elseif(${nebula_exec_NAME} MATCHES "_bm$")
set_target_properties(
${nebula_exec_NAME}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/bench
)
endif()
if(TARGET common_project)
add_dependencies(
${nebula_exec_NAME}
common_project
)
endif()
endmacro()
macro(nebula_add_test)
cmake_parse_arguments(
nebula_test # prefix
"DISABLED;FUZZER" # <options>
"NAME" # <one_value_args>
"SOURCES;OBJECTS;LIBRARIES" # <multi_value_args>
${ARGN}
)
nebula_add_executable(
NAME ${nebula_test_NAME}
SOURCES ${nebula_test_SOURCES}
OBJECTS ${nebula_test_OBJECTS}
LIBRARIES ${nebula_test_LIBRARIES}
)
if (${nebula_test_FUZZER})
#Currently only Clang supports fuzz test
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_target_properties(${nebula_test_NAME} PROPERTIES COMPILE_FLAGS "-g -fsanitize=fuzzer")
set_target_properties(${nebula_test_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
endif()
elseif (NOT ${nebula_test_DISABLED})
string(REGEX REPLACE "${CMAKE_SOURCE_DIR}/src/(.*)/test" "\\1" test_group ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME ${nebula_test_NAME} COMMAND ${nebula_test_NAME})
set_tests_properties(${nebula_test_NAME} PROPERTIES LABELS ${test_group})
# e.g. cmake -DNEBULA_ASAN_PRELOAD=/path/to/libasan.so
# or, cmake -DNEBULA_ASAN_PRELOAD=`/path/to/gcc --print-file-name=libasan.so`
if (NEBULA_ASAN_PRELOAD)
set_property(
TEST ${nebula_test_NAME}
PROPERTY ENVIRONMENT LD_PRELOAD=${NEBULA_ASAN_PRELOAD}
)
endif()
endif()
endmacro()
# A wrapper for target_link_libraries()
macro(nebula_link_libraries target)
target_link_libraries(
${target}
${ARGN}
folly
fmt
glog
gflags
boost_context
boost_system
boost_regex
boost_filesystem
boost_program_options
event
double-conversion
s2
${OPENSSL_SSL_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY}
${COMPRESSION_LIBRARIES}
${JEMALLOC_LIB}
${LIBUNWIND_LIBRARIES}
resolv
dl
${GETTIME_LIB}
${libatomic_link_flags}
-pthread
z
${COVERAGES}
${Breakpad_LIBRARY}
)
endmacro(nebula_link_libraries)
function(nebula_add_subdirectory dir_name)
if ((NOT ENABLE_TESTING) AND (${dir_name} MATCHES test))
add_subdirectory(${dir_name} EXCLUDE_FROM_ALL)
return()
endif()
add_subdirectory(${dir_name})
endfunction()
macro(nebula_add_exe_linker_flag flag)
string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${flag}" position)
if(${position} EQUAL -1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
endif()
endmacro()
macro(nebula_remove_exe_linker_flag flag)
string(REPLACE "${flag}" "" output "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${output}")
endmacro()
macro(nebula_add_shared_linker_flag flag)
string(FIND "${CMAKE_SHARED_LINKER_FLAGS}" "${flag}" position)
if(${position} EQUAL -1)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}")
endif()
endmacro()
macro(nebula_remove_shared_linker_flag flag)
string(REPLACE "${flag}" "" output "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${output}")
endmacro()
function(nebula_string_rpad output width fill_char value)
string(LENGTH ${value} length)
math(EXPR delta "${width} - ${length}")
set(pads "")
if(${delta} GREATER 0)
math(EXPR delta "${delta} - 1")
foreach(loop_var RANGE ${delta})
set(pads "${pads}${fill_char}")
endforeach()
endif()
set(${output} "${value}${pads}" PARENT_SCOPE)
endfunction()
macro(print_option name)
get_property(helpstring CACHE ${name} PROPERTY HELPSTRING)
nebula_string_rpad(padded 32 " " "${name}")
string(FIND "${helpstring}" "No help" position)
if(helpstring AND ${position} EQUAL -1)
message(STATUS "${padded}: ${${name}} (${helpstring})")
else()
message(STATUS "${padded}: ${${name}}")
endif()
endmacro()
macro(print_config name)
print_option(${name})
endmacro()

View File

@ -0,0 +1,30 @@
set(NEBULA_CLEAN_ALL_DEPS clean-interface clean-bin)
add_custom_target(
clean-bin
COMMAND "rm" "-fr" "bin/*"
)
add_custom_target(
clean-build
COMMAND ${CMAKE_MAKE_PROGRAM} clean
COMMAND "find" "." "-name" "Testing" "|" "xargs" "rm" "-fr"
DEPENDS ${NEBULA_CLEAN_ALL_DEPS}
)
add_custom_target(
clean-all
COMMAND ${CMAKE_MAKE_PROGRAM} clean
COMMAND "find" "." "-name" "Testing" "|" "xargs" "rm" "-fr"
DEPENDS ${NEBULA_CLEAN_ALL_DEPS}
)
add_custom_target(
distclean
COMMAND "find" "." "-name" "CMakeFiles" "|" "xargs" "rm" "-fr"
COMMAND "find" "." "-name" "CMakeCache.txt" "|" "xargs" "rm" "-f"
COMMAND "find" "." "-name" "cmake_install.cmake" "|" "xargs" "rm" "-f"
COMMAND "find" "." "-name" "CTestTestfile.cmake" "|" "xargs" "rm" "-f"
COMMAND "find" "." "-name" "Makefile" "|" "xargs" "rm" "-f"
DEPENDS clean-all
)

View File

@ -0,0 +1,3 @@
if(${CMAKE_SYSTEM_NAME} MATCHES "(Darwin|FreeBSD|Windows)")
MESSAGE(FATAL_ERROR "Only Linux is supported")
endif ()

View File

@ -0,0 +1,63 @@
if(ENABLE_ASAN OR ENABLE_UBSAN)
add_definitions(-DBUILT_WITH_SANITIZER)
endif()
if(ENABLE_ASAN)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=address")
check_cxx_compiler_flag("-fsanitize=address" ENABLE_ASAN_OK)
if (NOT ENABLE_ASAN_OK)
MESSAGE(FATAL_ERROR "The compiler does not support address sanitizer")
endif()
if(ENABLE_STATIC_ASAN AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-static-libasan)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
endif()
add_compile_options(-fsanitize=address)
add_compile_options(-g)
add_compile_options(-fno-omit-frame-pointer)
add_definitions(-DENABLE_ASAN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif()
if(ENABLE_TSAN)
if (ENABLE_ASAN)
MESSAGE(FATAL_ERROR "ENABLE_TSAN cannot be combined with ENABLE_ASAN")
endif()
set(CMAKE_REQUIRED_FLAGS "-fsanitize=thread")
check_cxx_compiler_flag("-fsanitize=thread" ENABLE_TSAN_OK)
if (NOT ENABLE_TSAN_OK)
MESSAGE(FATAL_ERROR "The compiler does not support thread sanitizer")
endif()
set(ENV{TSAN_OPTIONS} "report_atomic_races=0")
add_compile_options(-fsanitize=thread)
add_compile_options(-g)
add_compile_options(-fno-omit-frame-pointer)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
endif()
if(ENABLE_UBSAN)
check_cxx_compiler_flag("-fsanitize=undefined -fno-sanitize=alignment" ENABLE_UBSAN_OK)
if (NOT ENABLE_UBSAN_OK)
MESSAGE(FATAL_ERROR "The compiler does not support Undefined Behavior Sanitizer")
endif()
if(ENABLE_STATIC_UBSAN AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-static-libubsan)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libubsan")
endif()
add_compile_options(-fsanitize=undefined -fno-sanitize=alignment)
add_compile_options(-fno-sanitize-recover=all) # Exit on failure
# TODO(dutor) Remove the following line when RTTI-enabled RocksDB is ready
add_compile_options(-fno-sanitize=vptr)
if(NOT ENABLE_ASAN)
add_compile_options(-g)
add_compile_options(-fno-omit-frame-pointer)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
endif()
if(ENABLE_FUZZ_TEST)
check_cxx_compiler_flag("-fsanitize=fuzzer" ENABLE_FUZZ_OK)
if (NOT ENABLE_FUZZ_OK)
MESSAGE(FATAL_ERROR "The compiler does not support fuzz testing")
endif()
endif()

View File

@ -0,0 +1,172 @@
message(">>>> Configuring third party for '${PROJECT_NAME}' <<<<")
# The precedence to decide NEBULA_THIRDPARTY_ROOT is:
# 1. The path defined with CMake argument, i.e -DNEBULA_THIRDPARTY_ROOT=path
# 2. ${CMAKE_BINARY_DIR}/third-party/install, if exists
# 3. The path specified with environment variable NEBULA_THIRDPARTY_ROOT=path
# 4. /opt/vesoft/third-party, if exists
# 5. At last, one copy will be downloaded and installed to ${CMAKE_BINARY_DIR}/third-party/install
set(NEBULA_THIRDPARTY_VERSION "3.3")
if(${DISABLE_CXX11_ABI})
SET(NEBULA_THIRDPARTY_ROOT ${CMAKE_BINARY_DIR}/third-party-98/install)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/third-party-98/install)
message(STATUS "Install abi 98 third-party")
include(InstallThirdParty)
endif()
else()
if("${NEBULA_THIRDPARTY_ROOT}" STREQUAL "")
if(EXISTS ${CMAKE_BINARY_DIR}/third-party/install)
SET(NEBULA_THIRDPARTY_ROOT ${CMAKE_BINARY_DIR}/third-party/install)
elseif(NOT $ENV{NEBULA_THIRDPARTY_ROOT} STREQUAL "")
SET(NEBULA_THIRDPARTY_ROOT $ENV{NEBULA_THIRDPARTY_ROOT})
elseif(EXISTS /opt/vesoft/third-party/${NEBULA_THIRDPARTY_VERSION})
SET(NEBULA_THIRDPARTY_ROOT "/opt/vesoft/third-party/${NEBULA_THIRDPARTY_VERSION}")
else()
include(InstallThirdParty)
endif()
endif()
endif()
if(NOT ${NEBULA_THIRDPARTY_ROOT} STREQUAL "")
print_config(NEBULA_THIRDPARTY_ROOT)
file(READ ${NEBULA_THIRDPARTY_ROOT}/version-info third_party_build_info)
message(STATUS "Build info of nebula third party:\n${third_party_build_info}")
list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/include)
list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/lib)
list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/lib64)
list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/bin)
include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/include)
link_directories(
${NEBULA_THIRDPARTY_ROOT}/lib
${NEBULA_THIRDPARTY_ROOT}/lib64
)
endif()
if(NOT ${NEBULA_OTHER_ROOT} STREQUAL "")
string(REPLACE ":" ";" DIR_LIST ${NEBULA_OTHER_ROOT})
list(LENGTH DIR_LIST len)
foreach(DIR IN LISTS DIR_LIST )
list(INSERT CMAKE_INCLUDE_PATH 0 ${DIR}/include)
list(INSERT CMAKE_LIBRARY_PATH 0 ${DIR}/lib)
list(INSERT CMAKE_PROGRAM_PATH 0 ${DIR}/bin)
include_directories(SYSTEM ${DIR}/include)
link_directories(${DIR}/lib)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${DIR}/lib")
endforeach()
endif()
print_config(CMAKE_INCLUDE_PATH)
print_config(CMAKE_LIBRARY_PATH)
print_config(CMAKE_PROGRAM_PATH)
execute_process(
COMMAND ldd --version
COMMAND head -1
COMMAND cut -d ")" -f 2
COMMAND cut -d " " -f 2
OUTPUT_VARIABLE GLIBC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
print_config(GLIBC_VERSION)
if (GLIBC_VERSION VERSION_LESS "2.17")
set(GETTIME_LIB rt)
else()
set(GETTIME_LIB)
endif()
# Breakpad
if (ENABLE_BREAKPAD)
if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
MESSAGE(FATAL_ERROR "Breakpad need debug info.")
endif()
endif()
if (NOT ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(ENABLE_BREAKPAD OFF)
endif()
if (ENABLE_BREAKPAD)
add_compile_options(-DENABLE_BREAKPAD=1)
endif()
message("")
find_package(Bzip2 REQUIRED)
find_package(DoubleConversion REQUIRED)
find_package(Fatal REQUIRED)
find_package(Fbthrift REQUIRED)
find_package(Folly REQUIRED)
find_package(Gflags REQUIRED)
find_package(Glog REQUIRED)
find_package(Googletest REQUIRED)
if(ENABLE_JEMALLOC)
find_package(Jemalloc REQUIRED)
add_definitions(-DENABLE_JEMALLOC)
endif()
find_package(Libevent REQUIRED)
find_package(Proxygen REQUIRED)
find_package(Rocksdb REQUIRED)
find_package(Snappy REQUIRED)
find_package(Wangle REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Zstd REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED)
find_package(Libunwind REQUIRED)
find_package(BISON 3.0.5 REQUIRED)
include(MakeBisonRelocatable)
find_package(FLEX REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(Fizz REQUIRED)
find_package(Sodium REQUIRED)
if (ENABLE_BREAKPAD)
find_package(Breakpad REQUIRED)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib64")
# All thrift libraries
set(THRIFT_LIBRARIES
thriftcpp2
async
thriftprotocol
transport
concurrency
thriftfrozen2
thrift-core
rpcmetadata
thriftmetadata
wangle
fizz
sodium
)
set(PROXYGEN_LIBRARIES
proxygenhttpserver
proxygen
wangle
fizz
sodium
)
set(ROCKSDB_LIBRARIES ${Rocksdb_LIBRARY})
# All compression libraries
set(COMPRESSION_LIBRARIES bz2 snappy zstd z lz4)
if (LIBLZMA_FOUND)
include_directories(SYSTEM ${LIBLZMA_INCLUDE_DIRS})
list(APPEND COMPRESSION_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
if (NOT ENABLE_JEMALLOC OR ENABLE_ASAN OR ENABLE_UBSAN)
set(JEMALLOC_LIB )
else()
set(JEMALLOC_LIB jemalloc)
endif()
if (Breakpad_FOUND)
include_directories(AFTER SYSTEM ${Breakpad_INCLUDE_DIR}/breakpad)
endif()
message(">>>> Configuring third party for '${PROJECT_NAME}' done <<<<")

View File

@ -0,0 +1,6 @@
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
add_compile_options(-ftime-trace)
endif()
endif()

13
codecov.yml Normal file
View File

@ -0,0 +1,13 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
# For more configuration details:
# https://docs.codecov.io/docs/codecov-yaml
# validate the configuration:
# curl -X POST --data-binary @codecov.yml https://codecov.io/validate
codecov:
allow_pseudo_compare: True
allow_coverage_offsets: True

68
conf/CMakeLists.txt Normal file
View File

@ -0,0 +1,68 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
# These configuration files are for reference to generate your own customized ones.
# Thus, they are installed as read-only, even for the owner.
if(NOT ENABLE_STANDALONE_VERSION)
install(
FILES
nebula-graphd.conf.default
nebula-graphd.conf.production
PERMISSIONS
OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION
etc
COMPONENT
graph
)
install(
FILES
nebula-metad.conf.default
nebula-metad.conf.production
PERMISSIONS
OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION
etc
COMPONENT
meta
)
install(
FILES
nebula-storaged.conf.default
nebula-storaged.conf.production
nebula-storaged-listener.conf.production
PERMISSIONS
OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION
etc
COMPONENT
storage
)
else()
install(
FILES
nebula-standalone.conf.default
PERMISSIONS
OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION
etc
COMPONENT
graph
)
endif()

View File

@ -0,0 +1,134 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-graphd.pid
# Whether to enable optimizer
--enable_optimizer=true
# The default charset when a space is created
--default_charset=utf8
# The default collate when a space is created
--default_collate=utf8_bin
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=graphd-stdout.log
--stderr_log_file=graphd-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# wether logging files' name contain time stamp.
--timestamp_in_logfile_name=true
########## query ##########
# Whether to treat partial success as an error.
# This flag is only used for Read-only access, and Modify access always treats partial success as an error.
--accept_partial_success=false
# Maximum sentence length, unit byte
--max_allowed_query_size=4194304
########## networking ##########
# Comma separated Meta Server Addresses
--meta_server_addrs=127.0.0.1:9559
# Local IP used to identify the nebula-graphd process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=127.0.0.1
# Network device to listen on
--listen_netdev=any
# Port to listen on
--port=9669
# To turn on SO_REUSEPORT or not
--reuse_port=false
# Backlog of the listen socket, adjust this together with net.core.somaxconn
--listen_backlog=1024
# The number of seconds Nebula service waits before closing the idle connections
--client_idle_timeout_secs=28800
# The number of seconds before idle sessions expire
# The range should be in [1, 604800]
--session_idle_timeout_secs=28800
# The number of threads to accept incoming connections
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# storage client timeout
--storage_client_timeout_ms=60000
# slow query threshold in us
--slow_query_threshold_us=200000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
--ws_meta_http_port=19559
########## authentication ##########
# Enable authorization
--enable_authorize=false
# User login authentication type, password for nebula authentication, ldap for ldap authentication, cloud for cloud authentication
--auth_type=password
########## memory ##########
# System memory high watermark ratio, cancel the memory checking when the ratio greater than 1.0
--system_memory_high_watermark_ratio=0.8
########## metrics ##########
--enable_space_level_metrics=false
########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false
# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true
# enable udf, written in c++ only for now
--enable_udf=true
# set the directory where the .so files of udf are stored, when enable_udf is true
--udf_path=/home/nebula/dev/nebula/udf/
########## session ##########
# Maximum number of sessions that can be created per IP and per user
--max_sessions_per_ip_per_user=300
########## memory tracker ##########
# trackable memory ratio (trackable_memory / (total_memory - untracked_reserved_memory) )
--memory_tracker_limit_ratio=0.8
# untracked reserved memory in Mib
--memory_tracker_untracked_reserved_memory_mb=50
# enable log memory tracker stats periodically
--memory_tracker_detail_log=false
# log memory tacker stats interval in milliseconds
--memory_tracker_detail_log_interval_ms=60000
# enable memory background purge (if jemalloc is used)
--memory_purge_enabled=true
# memory background purge interval in seconds
--memory_purge_interval_seconds=10
########## performance optimization ##########
# The max job size in multi job mode
--max_job_size=1
# The min batch size for handling dataset in multi job mode, only enabled when max_job_size is greater than 1
--min_batch_size=8192
# if true, return directly without go through RPC
--optimize_appendvertices=false
# number of paths constructed by each thread
--path_batch_size=10000

View File

@ -0,0 +1,127 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-graphd.pid
# Whether to enable optimizer
--enable_optimizer=true
# Heartbeat interval of communication between meta client and graphd service
--heartbeat_interval_secs=10
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=graphd-stdout.log
--stderr_log_file=graphd-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# wether logging files' name contain timestamp
--timestamp_in_logfile_name=true
########## query ##########
# Whether to treat partial success as an error.
# This flag is only used for Read-only access, and Modify access always treats partial success as an error.
--accept_partial_success=false
# Maximum sentence length, unit byte
--max_allowed_query_size=4194304
########## networking ##########
# Comma separated Meta Server Addresses
--meta_server_addrs=127.0.0.1:9559
# Local IP used to identify the nebula-graphd process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=127.0.0.1
# Network device to listen on
--listen_netdev=any
# Port to listen on
--port=9669
# To turn on SO_REUSEPORT or not
--reuse_port=false
# Backlog of the listen socket, adjust this together with net.core.somaxconn
--listen_backlog=1024
# The number of seconds Nebula service waits before closing the idle connections
--client_idle_timeout_secs=28800
# The number of seconds before idle sessions expire
# The range should be in [1, 604800]
--session_idle_timeout_secs=28800
# The number of threads to accept incoming connections
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# storage client timeout
--storage_client_timeout_ms=60000
# slow query threshold in us
--slow_query_threshold_us=200000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
--ws_meta_http_port=19559
########## authentication ##########
# Enable authorization
--enable_authorize=false
# User login authentication type, password for nebula authentication, ldap for ldap authentication, cloud for cloud authentication
--auth_type=password
########## memory ##########
# System memory high watermark ratio, cancel the memory checking when the ratio greater than 1.0
--system_memory_high_watermark_ratio=0.8
########## metrics ##########
--enable_space_level_metrics=false
########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false
# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true
########## session ##########
# Maximum number of sessions that can be created per IP and per user
--max_sessions_per_ip_per_user=300
########## memory tracker ##########
# trackable memory ratio (trackable_memory / (total_memory - untracked_reserved_memory) )
--memory_tracker_limit_ratio=0.8
# untracked reserved memory in Mib
--memory_tracker_untracked_reserved_memory_mb=50
# enable log memory tracker stats periodically
--memory_tracker_detail_log=false
# log memory tacker stats interval in milliseconds
--memory_tracker_detail_log_interval_ms=60000
# enable memory background purge (if jemalloc is used)
--memory_purge_enabled=true
# memory background purge interval in seconds
--memory_purge_interval_seconds=10
########## performance optimization ##########
# The max job size in multi job mode
--max_job_size=1
# The min batch size for handling dataset in multi job mode, only enabled when max_job_size is greater than 1
--min_batch_size=8192
# if true, return directly without go through RPC
--optimize_appendvertices=false
# number of paths constructed by each thread
--path_batch_size=10000

View File

@ -0,0 +1,53 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-metad.pid
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=metad-stdout.log
--stderr_log_file=metad-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# wether logging files' name contain time stamp, If Using logrotate to rotate logging files, than should set it to true.
--timestamp_in_logfile_name=true
########## networking ##########
# Comma separated Meta Server addresses
--meta_server_addrs=127.0.0.1:9559
# Local IP used to identify the nebula-metad process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=127.0.0.1
# Meta daemon listening port
--port=9559
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19559
# Port to listen on Storage with HTTP protocol, it corresponds to ws_http_port in storage's configuration file
--ws_storage_http_port=19779
########## storage ##########
# Root data path, here should be only single path for metad
--data_path=data/meta
########## Misc #########
# The default number of parts when a space is created
--default_parts_num=100
# The default replica factor when a space is created
--default_replica_factor=1
--heartbeat_interval_secs=10
--agent_heartbeat_interval_secs=60

View File

@ -0,0 +1,56 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-metad.pid
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=metad-stdout.log
--stderr_log_file=metad-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# wether logging files' name contain time stamp.
--timestamp_in_logfile_name=true
########## networking ##########
# Comma separated Meta Server addresses
--meta_server_addrs=192.168.2.1:9559
# Local IP used to identify the nebula-metad process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=192.168.2.1
# Meta daemon listening port
--port=9559
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19559
# Port to listen on Storage with HTTP protocol, it corresponds to ws_http_port in storage's configuration file
--ws_storage_http_port=19779
########## storage ##########
# Root data path, here should be only single path for metad
--data_path=data/meta
########## Misc #########
# The default number of parts when a space is created
--default_parts_num=100
# The default replica factor when a space is created
--default_replica_factor=1
--heartbeat_interval_secs=10
--agent_heartbeat_interval_secs=60
############## rocksdb Options ##############
--rocksdb_wal_sync=true

View File

@ -0,0 +1,163 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-standalone.pid
# Whether to enable optimizer
--enable_optimizer=true
# The default charset when a space is created
--default_charset=utf8
# The defaule collate when a space is created
--default_collate=utf8_bin
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=standalone-stdout.log
--stderr_log_file=standalone-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
########## query ##########
# Whether to treat partial success as an error.
# This flag is only used for Read-only access, and Modify access always treats partial success as an error.
--accept_partial_success=false
# Maximum sentence length, unit byte
--max_allowed_query_size=4194304
########## networking ##########
# Comma separated Meta Server Addresses
--meta_server_addrs=127.0.0.1:9559
# Local IP used to identify the nebula-graphd process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=127.0.0.1
# Network device to listen on
--listen_netdev=any
# Port to listen on
--port=9669
--meta_port=9559
--storage_port=9779
# To turn on SO_REUSEPORT or not
--reuse_port=false
# Backlog of the listen socket, adjust this together with net.core.somaxconn
--listen_backlog=1024
# The number of seconds Nebula service waits before closing the idle connections
--client_idle_timeout_secs=28800
# The number of seconds before idle sessions expire
# The range should be in [1, 604800]
--session_idle_timeout_secs=28800
# The number of threads to accept incoming connections
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# storage client timeout
--storage_client_timeout_ms=60000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
--ws_meta_http_port=19559
# HTTP service port
--ws_storage_http_port=19779
# heartbeat with meta service
--heartbeat_interval_secs=10
########## authentication ##########
# Enable authorization
--enable_authorize=false
# User login authentication type, password for nebula authentication, ldap for ldap authentication, cloud for cloud authentication
--auth_type=password
########## memory ##########
# System memory high watermark ratio
--system_memory_high_watermark_ratio=0.8
########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false
# if use balance data feature, only work if enable_experimental_feature is true
--enable_data_balance=true
######### Raft #########
# Raft election timeout
--raft_heartbeat_interval_secs=30
# RPC timeout for raft client (ms)
--raft_rpc_timeout_ms=500
## recycle Raft WAL
--wal_ttl=14400
########## Disk ##########
# Root data path. Split by comma. e.g. --data_path=/disk1/path1/,/disk2/path2/
# One path per Rocksdb instance.
--data_path=data/storage
# Minimum reserved bytes of each data path
--minimum_reserved_bytes=268435456
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable.
# The unit is MB.
--rocksdb_block_cache=4
# The type of storage engine, `rocksdb', `memory', etc.
--engine_type=rocksdb
# Compression algorithm, options: no,snappy,lz4,lz4hc,zlib,bzip2,zstd
# For the sake of binary compatibility, the default value is snappy.
# Recommend to use:
# * lz4 to gain more CPU performance, with the same compression ratio with snappy
# * zstd to occupy less disk space
# * lz4hc for the read-heavy write-light scenario
--rocksdb_compression=lz4
# Set different compressions for different levels
# For example, if --rocksdb_compression is snappy,
# "no:no:lz4:lz4::zstd" is identical to "no:no:lz4:lz4:snappy:zstd:snappy"
# In order to disable compression for level 0/1, set it to "no:no"
--rocksdb_compression_per_level=
# Whether or not to enable rocksdb's statistics, disabled by default
--enable_rocksdb_statistics=false
# Statslevel used by rocksdb to collection statistics, optional values are
# * kExceptHistogramOrTimers, disable timer stats, and skip histogram stats
# * kExceptTimers, Skip timer stats
# * kExceptDetailedTimers, Collect all stats except time inside mutex lock AND time spent on compression.
# * kExceptTimeForMutex, Collect all stats except the counters requiring to get time inside the mutex lock.
# * kAll, Collect all stats
--rocksdb_stats_level=kExceptHistogramOrTimers
# Whether or not to enable rocksdb's prefix bloom filter, enabled by default.
--enable_rocksdb_prefix_filtering=true
# Whether or not to enable rocksdb's whole key bloom filter, disabled by default.
--enable_rocksdb_whole_key_filtering=false
############## rocksdb Options ##############
# rocksdb DBOptions in json, each name and value of option is a string, given as "option_name":"option_value" separated by comma
--rocksdb_db_options={}
# rocksdb ColumnFamilyOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_column_family_options={"write_buffer_size":"67108864","max_write_buffer_number":"4","max_bytes_for_level_base":"268435456"}
# rocksdb BlockBasedTableOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_block_based_table_options={"block_size":"8192"}
############## meta Options ##############
--meta_data_path=data/meta
--default_replica_factor=1
--default_parts_num=100

View File

@ -0,0 +1,58 @@
########## nebula-storaged-listener ###########
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-storaged-listener.pid
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs_storaged_listener
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=storaged-listener-stdout.log
--stderr_log_file=storaged-listener-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# Wether logging files' name contain timestamp.
--timestamp_in_logfile_name=true
########## networking ##########
# Meta server address
--meta_server_addrs=127.0.0.1:9559
# Local ip
--local_ip=127.0.0.1
# Storage daemon listening port
--port=9789
# HTTP service ip
--ws_ip=127.0.0.1
# HTTP service port
--ws_http_port=19789
# heartbeat with meta service
--heartbeat_interval_secs=10
########## storage ##########
# Listener wal directory. only one path is allowed.
--listener_path=data/listener
# This parameter can be ignored for compatibility. let's fill A default value of "data"
--data_path=data
# The type of part manager, [memory | meta]
--part_man_type=memory
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable.
# The unit is MB.
--rocksdb_block_cache=4
# The type of storage engine, `rocksdb', `memory', etc.
--engine_type=rocksdb
# The type of part, `simple', `consensus'...
--part_type=simple

View File

@ -0,0 +1,58 @@
########## nebula-storaged-listener ###########
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-storaged-listener.pid
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs_storaged_listener
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=storaged-listener-stdout.log
--stderr_log_file=storaged-listener-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# Wether logging files' name contain timestamp.
--timestamp_in_logfile_name=true
########## networking ##########
# Meta server address
--meta_server_addrs=192.168.2.1:9559
# Local ip
--local_ip=192.168.2.4
# Storage daemon listening port
--port=9789
# HTTP service ip
--ws_ip=192.168.2.4
# HTTP service port
--ws_http_port=19789
# heartbeat with meta service
--heartbeat_interval_secs=10
########## storage ##########
# Listener wal directory. only one path is allowed.
--listener_path=data/listener
# This parameter can be ignored for compatibility. let's fill A default value of "data"
--data_path=data
# The type of part manager, [memory | meta]
--part_man_type=memory
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable.
# The unit is MB.
--rocksdb_block_cache=4
# The type of storage engine, `rocksdb', `memory', etc.
--engine_type=rocksdb
# The type of part, `simple', `consensus'...
--part_type=simple

View File

@ -0,0 +1,143 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-storaged.pid
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=storaged-stdout.log
--stderr_log_file=storaged-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# Wether logging files' name contain time stamp.
--timestamp_in_logfile_name=true
########## networking ##########
# Comma separated Meta server addresses
--meta_server_addrs=127.0.0.1:9559
# Local IP used to identify the nebula-storaged process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=127.0.0.1
# Storage daemon listening port
--port=9779
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19779
# heartbeat with meta service
--heartbeat_interval_secs=10
######### Raft #########
# Raft election timeout
--raft_heartbeat_interval_secs=30
# RPC timeout for raft client (ms)
--raft_rpc_timeout_ms=500
## recycle Raft WAL
--wal_ttl=14400
########## Disk ##########
# Root data path. Split by comma. e.g. --data_path=/disk1/path1/,/disk2/path2/
# One path per Rocksdb instance.
--data_path=data/storage
# Minimum reserved bytes of each data path
--minimum_reserved_bytes=268435456
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable.
# The unit is MB.
--rocksdb_block_cache=4
# The type of storage engine, `rocksdb', `memory', etc.
--engine_type=rocksdb
# Compression algorithm, options: no,snappy,lz4,lz4hc,zlib,bzip2,zstd
# For the sake of binary compatibility, the default value is snappy.
# Recommend to use:
# * lz4 to gain more CPU performance, with the same compression ratio with snappy
# * zstd to occupy less disk space
# * lz4hc for the read-heavy write-light scenario
--rocksdb_compression=lz4
# Set different compressions for different levels
# For example, if --rocksdb_compression is snappy,
# "no:no:lz4:lz4::zstd" is identical to "no:no:lz4:lz4:snappy:zstd:snappy"
# In order to disable compression for level 0/1, set it to "no:no"
--rocksdb_compression_per_level=
# Whether or not to enable rocksdb's statistics, disabled by default
--enable_rocksdb_statistics=false
# Statslevel used by rocksdb to collection statistics, optional values are
# * kExceptHistogramOrTimers, disable timer stats, and skip histogram stats
# * kExceptTimers, Skip timer stats
# * kExceptDetailedTimers, Collect all stats except time inside mutex lock AND time spent on compression.
# * kExceptTimeForMutex, Collect all stats except the counters requiring to get time inside the mutex lock.
# * kAll, Collect all stats
--rocksdb_stats_level=kExceptHistogramOrTimers
# Whether or not to enable rocksdb's prefix bloom filter, enabled by default.
--enable_rocksdb_prefix_filtering=true
# Whether or not to enable rocksdb's whole key bloom filter, disabled by default.
--enable_rocksdb_whole_key_filtering=false
############## rocksdb Options ##############
# rocksdb DBOptions in json, each name and value of option is a string, given as "option_name":"option_value" separated by comma
--rocksdb_db_options={}
# rocksdb ColumnFamilyOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_column_family_options={"write_buffer_size":"67108864","max_write_buffer_number":"4","max_bytes_for_level_base":"268435456"}
# rocksdb BlockBasedTableOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_block_based_table_options={"block_size":"8192"}
############### misc ####################
# Whether turn on query in multiple thread
--query_concurrently=true
# Whether remove outdated space data
--auto_remove_invalid_space=true
# Network IO threads number
--num_io_threads=16
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# Worker threads number to handle request
--num_worker_threads=32
# Maximum subtasks to run admin jobs concurrently
--max_concurrent_subtasks=10
# The rate limit in bytes when leader synchronizes snapshot data
--snapshot_part_rate_limit=10485760
# The amount of data sent in each batch when leader synchronizes snapshot data
--snapshot_batch_size=1048576
# The rate limit in bytes when leader synchronizes rebuilding index
--rebuild_index_part_rate_limit=4194304
# The amount of data sent in each batch when leader synchronizes rebuilding index
--rebuild_index_batch_size=1048576
########## memory tracker ##########
# trackable memory ratio (trackable_memory / (total_memory - untracked_reserved_memory) )
--memory_tracker_limit_ratio=0.8
# untracked reserved memory in Mib
--memory_tracker_untracked_reserved_memory_mb=50
# enable log memory tracker stats periodically
--memory_tracker_detail_log=false
# log memory tacker stats interval in milliseconds
--memory_tracker_detail_log_interval_ms=60000
# enable memory background purge (if jemalloc is used)
--memory_purge_enabled=true
# memory background purge interval in seconds
--memory_purge_interval_seconds=10

View File

@ -0,0 +1,144 @@
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids/nebula-storaged-listener.pid
# Whether to use the configuration obtained from the configuration file
--local_config=true
########## logging ##########
# The directory to host logging files
--log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=storaged-listener-stdout.log
--stderr_log_file=storaged-listener-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# Wether logging files' name contain timestamp.
--timestamp_in_logfile_name=true
########## networking ##########
# Comma separated Meta server addresses
--meta_server_addrs=192.168.2.1:45500
# Local IP used to identify the nebula-storaged process.
# Change it to an address other than loopback if the service is distributed or
# will be accessed remotely.
--local_ip=192.168.2.3
# Storage daemon listening port
--port=9779
# HTTP service ip
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19779
# heartbeat with meta service
--heartbeat_interval_secs=10
######### Raft #########
# Raft election timeout
--raft_heartbeat_interval_secs=30
# RPC timeout for raft client (ms)
--raft_rpc_timeout_ms=500
## recycle Raft WAL
--wal_ttl=14400
########## Disk ##########
# Root data path. split by comma. e.g. --data_path=/disk1/path1/,/disk2/path2/
# One path per Rocksdb instance.
--data_path=data/storage
# Minimum reserved bytes of each data path
--minimum_reserved_bytes=268435456
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable. (MB)
# recommend: 1/3 of all memory
--rocksdb_block_cache=4096
# Disable page cache to better control memory used by rocksdb.
# Caution: Make sure to allocate enough block cache if disabling page cache!
--disable_page_cache=false
# Compression algorithm, options: no,snappy,lz4,lz4hc,zlib,bzip2,zstd
# For the sake of binary compatibility, the default value is snappy.
# Recommend to use:
# * lz4 to gain more CPU performance, with the same compression ratio with snappy
# * zstd to occupy less disk space
# * lz4hc for the read-heavy write-light scenario
--rocksdb_compression=lz4
# Set different compressions for different levels
# For example, if --rocksdb_compression is snappy,
# "no:no:lz4:lz4::zstd" is identical to "no:no:lz4:lz4:snappy:zstd:snappy"
# In order to disable compression for level 0/1, set it to "no:no"
--rocksdb_compression_per_level=
############## rocksdb Options ##############
# rocksdb DBOptions in json, each name and value of option is a string, given as "option_name":"option_value" separated by comma
--rocksdb_db_options={"max_subcompactions":"4","max_background_jobs":"4","skip_checking_sst_file_sizes_on_db_open":"true"}
# rocksdb ColumnFamilyOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_column_family_options={"disable_auto_compactions":"false","write_buffer_size":"67108864","max_write_buffer_number":"4","max_bytes_for_level_base":"268435456"}
# rocksdb BlockBasedTableOptions in json, each name and value of option is string, given as "option_name":"option_value" separated by comma
--rocksdb_block_based_table_options={"block_size":"8192"}
# Whether or not to enable rocksdb's statistics, disabled by default
--enable_rocksdb_statistics=false
# Statslevel used by rocksdb to collection statistics, optional values are
# * kExceptHistogramOrTimers, disable timer stats, and skip histogram stats
# * kExceptTimers, Skip timer stats
# * kExceptDetailedTimers, Collect all stats except time inside mutex lock AND time spent on compression.
# * kExceptTimeForMutex, Collect all stats except the counters requiring to get time inside the mutex lock.
# * kAll, Collect all stats
--rocksdb_stats_level=kExceptHistogramOrTimers
# Whether or not to enable rocksdb's prefix bloom filter, enabled by default.
--enable_rocksdb_prefix_filtering=true
# Whether or not to enable rocksdb's whole key bloom filter, disabled by default.
--enable_rocksdb_whole_key_filtering=false
############### misc ####################
# Whether turn on query in multiple thread
--query_concurrently=true
# Whether remove outdated space data
--auto_remove_invalid_space=true
# Network IO threads number
--num_io_threads=16
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# Worker threads number to handle request
--num_worker_threads=32
# Maximum subtasks to run admin jobs concurrently
--max_concurrent_subtasks=10
# The rate limit in bytes when leader synchronizes snapshot data
--snapshot_part_rate_limit=10485760
# The amount of data sent in each batch when leader synchronizes snapshot data
--snapshot_batch_size=1048576
# The rate limit in bytes when leader synchronizes rebuilding index
--rebuild_index_part_rate_limit=4194304
# The amount of data sent in each batch when leader synchronizes rebuilding index
--rebuild_index_batch_size=1048576
########## memory tracker ##########
# trackable memory ratio (trackable_memory / (total_memory - untracked_reserved_memory) )
--memory_tracker_limit_ratio=0.8
# untracked reserved memory in Mib
--memory_tracker_untracked_reserved_memory_mb=50
# enable log memory tracker stats periodically
--memory_tracker_detail_log=false
# log memory tacker stats interval in milliseconds
--memory_tracker_detail_log_interval_ms=60000
# enable memory background purge (if jemalloc is used)
--memory_purge_enabled=true
# memory background purge interval in seconds
--memory_purge_interval_seconds=10

8
conf/tuned/README.md Normal file
View File

@ -0,0 +1,8 @@
# Summary
These are tuned profile to configure the system to optimize for the NebulaGraph service.
Follow below steps to utilize:
* Install the tuned service if absent, and enable it with `systemctl`.
* Copy the __nebula__ directory into `/etc/tuned`.
* Execute `tuned-adm profile nebula` to activate the profile.

View File

@ -0,0 +1,32 @@
[main]
summary=Optimize for NebulaGraph DBMS
include=latency-performance
[vm]
transparent_hugepages=never
[sysctl]
kernel.core_pattern=core
kernel.core_uses_pid=1
kernel.numa_balancing=0
vm.swappiness=0
vm.oom_dump_tasks=1
# min_free_kbytes is suggested to set to approximately 2% of the total memory.
# 1GB at least and 5GB at most.
vm.min_free_kbytes=5242880
vm.max_map_count=131060
vm.dirty_background_ratio = 3
vm.dirty_ratio = 20
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
net.core.busy_read=50
net.core.busy_poll=50
net.core.somaxconn=4096
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=10240
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_slow_start_after_idle=0

66
docker/Dockerfile Normal file
View File

@ -0,0 +1,66 @@
FROM vesoft/nebula-dev:centos7 as builder
ENV BUILD_IN_DOCKER TRUE
ARG VERSION=
COPY . /home/nebula/BUILD
RUN cd /home/nebula/BUILD/package \
&& ./package.sh -v "${VERSION}"
FROM centos:7 as graphd
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-graph.rpm /usr/local/nebula/nebula-graphd.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9669 19669 19670
ENTRYPOINT ["/usr/local/nebula/bin/nebula-graphd", "--flagfile=/usr/local/nebula/etc/nebula-graphd.conf", "--daemonize=false", "--containerized=true"]
FROM centos:7 as metad
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-meta.rpm /usr/local/nebula/nebula-metad.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9559 9560 19559 19560
ENTRYPOINT ["/usr/local/nebula/bin/nebula-metad", "--flagfile=/usr/local/nebula/etc/nebula-metad.conf", "--daemonize=false", "--containerized=true"]
FROM centos:7 as storaged
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-storage.rpm /usr/local/nebula/nebula-storaged.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9777 9778 9779 9780 19779 19780
ENTRYPOINT ["/usr/local/nebula/bin/nebula-storaged", "--flagfile=/usr/local/nebula/etc/nebula-storaged.conf", "--daemonize=false", "--containerized=true"]
FROM centos:7 as tools
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-tool.rpm /usr/local/nebula/nebula-tool.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& rm -rf *.rpm
# default entrypoint
ENTRYPOINT ["/usr/local/nebula/bin/db_dump"]

24
docker/Dockerfile.graphd Normal file
View File

@ -0,0 +1,24 @@
FROM vesoft/nebula-dev:centos7 as builder
ENV BUILD_IN_DOCKER TRUE
ARG VERSION=
COPY . /home/nebula/BUILD
RUN cd /home/nebula/BUILD/package \
&& ./package.sh -v "${VERSION}"
FROM centos:7
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-graph.rpm /usr/local/nebula/nebula-graphd.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9669 19669 19670
ENTRYPOINT ["/usr/local/nebula/bin/nebula-graphd", "--flagfile=/usr/local/nebula/etc/nebula-graphd.conf", "--daemonize=false", "--containerized=true"]

24
docker/Dockerfile.metad Normal file
View File

@ -0,0 +1,24 @@
FROM vesoft/nebula-dev:centos7 as builder
ENV BUILD_IN_DOCKER TRUE
ARG VERSION=
COPY . /home/nebula/BUILD
RUN cd /home/nebula/BUILD/package \
&& ./package.sh -v "${VERSION}"
FROM centos:7
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-meta.rpm /usr/local/nebula/nebula-metad.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9559 9560 19559 19560
ENTRYPOINT ["/usr/local/nebula/bin/nebula-metad", "--flagfile=/usr/local/nebula/etc/nebula-metad.conf", "--daemonize=false", "--containerized=true"]

View File

@ -0,0 +1,24 @@
FROM vesoft/nebula-dev:centos7 as builder
ENV BUILD_IN_DOCKER TRUE
ARG VERSION=
COPY . /home/nebula/BUILD
RUN cd /home/nebula/BUILD/package \
&& ./package.sh -v "${VERSION}"
FROM centos:7
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-storage.rpm /usr/local/nebula/nebula-storaged.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm
EXPOSE 9777 9778 9779 9780 19779 19780
ENTRYPOINT ["/usr/local/nebula/bin/nebula-storaged", "--flagfile=/usr/local/nebula/etc/nebula-storaged.conf", "--daemonize=false", "--containerized=true"]

21
docker/Dockerfile.tools Normal file
View File

@ -0,0 +1,21 @@
FROM vesoft/nebula-dev:centos7 as builder
ENV BUILD_IN_DOCKER TRUE
ARG VERSION=
COPY . /home/nebula/BUILD
RUN cd /home/nebula/BUILD/package \
&& ./package.sh -v "${VERSION}"
FROM centos:7
COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-tool.rpm /usr/local/nebula/nebula-tool.rpm
WORKDIR /usr/local/nebula
RUN rpm -ivh *.rpm \
&& rm -rf *.rpm
# default entrypoint
ENTRYPOINT ["/usr/local/nebula/bin/db_dump"]

8
docker/README.md Normal file
View File

@ -0,0 +1,8 @@
# Docker Files for NebulaGraph Services
Following docker images will be ready in production.
- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile.graphd`
- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile.metad`
- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile.storaged`
- [vesoft/nebula-tools](https://hub.docker.com/r/vesoft/nebula-tools): nebula tools built with `Dockerfile.tools`, including db_dump, meta_dump and db_upgrader

View File

@ -0,0 +1,64 @@
---
name: Request for Comments
about: Detail an idea for this project
---
<!-- Different from feature request, RFC require you explain the more detail in nebula. -->
<!-- The section `Drawbacks`, `Prior art`, `Unresolved questions` and `Future possibilities`
could be blank if it should be.
-->
# Summary
The overview explanation of the feature.
# Motivation
Why are we doing this? What use cases does it support? What is the expected outcome?
# Usage explanation
Explain usage of the proposal as if it was already introduced in the project. That generally means:
- Introducing new named concepts, syntax or configuration.
- Explaining the feature largely in terms of examples. If applicable, provide sample usage, output or error messages.
- Explaining the compatibility in several levels like query language, RPC structure and storage format etc.
# Design explanation
This is the technical section of the RFC. Explain the design in sufficient detail that:
- Detail how the feature will be implemented.
- From syntax, AST, planning, executing and even deep into storage etc.
# Rationale and alternatives
- Explain the ultimate purpose of the proposal. Why is this design the best in the space of possible designs?
- What other designs have been considered and what is the rationale for not choosing them?
# Drawbacks
Why should we *not* accept this? List the negative affection or shortage if exists.
# Prior art
Discuss prior art, both the good and the bad, in relation to this proposal.
A few examples of what this can include are:
- For practical proposals: Does this feature exist in other database and what experience have their community had?
- Papers: Are there any published papers or great posts that discuss this? If you have some relevant papers to refer to, this can serve as a more detailed theoretical background.
The proposal won't be accepted for they are in other projects, but this will show us more productive meaning.
# Unresolved questions
- What parts of the design do you expect to resolve through the RFC process before this gets accepted?
- What parts of the design do you expect *can't* to resolve eventually in this RFC?
- What related issues do you consider out of scope for this RFC but could be addressed in the future independently of the solution that comes out of this RFC?
# Future possibilities
List the expected extensions of this proposal in future, and why better not include in current stage.
But all content in this section has no effort to determine whether we accept this proposal, in fact, it's just additional notes or even brainstorming.

268
package/package.sh Normal file
View File

@ -0,0 +1,268 @@
#!/usr/bin/env bash
#
# Package nebula as deb/rpm package
#
# introduce the args
# -v: The version of package, the version should be match tag name, default value is null
# -n: Package to one or multi-packages, `ON` means one package, `OFF` means multi packages, default value is `ON`
# -s: Whether to strip the package, default value is `FALSE`
# -d: Whether to enable sanitizer, default OFF
# -t: Build type, default Release
# -j: Number of threads, default $(nproc)
# -r: Whether to enable compressed debug info, default ON
# -p: Whether to dump the symbols from binary by dump_syms
# -c: Whether to enable console building, default ON
# -k: Whether to enable breakpad, default OFF
#
# usage: ./package.sh -v <version> -n <ON/OFF> -s <TRUE/FALSE> -c <ON/OFF>
#
set -e
usage="Usage: ${0} -v <version> -n <ON/OFF> -s <TRUE/FALSE> -g <ON/OFF> -j <jobs> -t <BUILD TYPE>"
project_dir="$(cd "$(dirname "$0")" && pwd)/.."
build_dir=${project_dir}/pkg-build
install_prefix=/usr/local/nebula
BUILD_IN_DOCKER=${BUILD_IN_DOCKER:-FALSE}
# default variables when building release.
function _default_release_variables {
version=""
package_one="ON"
strip_enable="TRUE"
enablesanitizer="OFF"
static_sanitizer="OFF"
build_type="RelWithDebInfo"
build_console="OFF"
jobs=$(nproc)
enable_compressed_debug_info="OFF"
dump_symbols="ON"
dump_syms_tool_dir=
system_name=
enable_breakpad="ON"
}
# change default variables. e.g. build release in docker
function _extra_release_variables {
if [[ $BUILD_IN_DOCKER == TRUE ]]; then
package_one="OFF"
enable_compressed_debug_info="ON"
dump_symbols="OFF"
fi
}
_default_release_variables
_extra_release_variables
while getopts v:n:s:d:t:r:p:j:c:k: opt;
do
case $opt in
v)
version=$OPTARG
;;
n)
package_one=$OPTARG
;;
s)
strip_enable=$OPTARG
;;
d)
enablesanitizer="ON"
if [ "$OPTARG" == "static" ]; then
static_sanitizer="ON"
fi
build_type="RelWithDebInfo"
;;
t)
build_type=$OPTARG
;;
c)
build_console=$OPTARG
;;
j)
jobs=$OPTARG
;;
r)
enable_compressed_debug_info=$OPTARG
;;
p)
dump_symbols=$OPTARG
;;
k)
enable_breakpad=$OPTARG
;;
?)
echo "Invalid option, use default arguments"
;;
esac
done
# version is null, get from tag name
[[ -z $version ]] && version=$(git describe --exact-match --abbrev=0 --tags | sed 's/^v//')
# version is null, use UTC date as version
[[ -z $version ]] && version=$(date -u +%Y.%m.%d)-nightly
if [[ -z $version ]]; then
echo "version is null, exit"
echo ${usage}
exit 1
fi
if [[ $strip_enable != TRUE ]] && [[ $strip_enable != FALSE ]]; then
echo "strip enable is wrong, exit"
echo ${usage}
exit 1
fi
cat << EOF
Configuration for this shell:
version: $version
strip_enable: $strip_enable
enablesanitizer: $enablesanitizer
static_sanitizer: $static_sanitizer
build_type: $build_type
build_console: $build_console
branch: $branch
enable_compressed_debug_info: $enable_compressed_debug_info
dump_symbols: $dump_symbols
EOF
function _build_graph {
pushd ${build_dir}
cmake -DCMAKE_BUILD_TYPE=${build_type} \
-DNEBULA_BUILD_VERSION=${version} \
-DENABLE_ASAN=${san} \
-DENABLE_UBSAN=${san} \
-DENABLE_STATIC_ASAN=${ssan} \
-DENABLE_STATIC_UBSAN=${ssan} \
-DCMAKE_INSTALL_PREFIX=${install_prefix} \
-DENABLE_TESTING=OFF \
-DENABLE_CONSOLE_COMPILATION=${build_console} \
-DENABLE_PACK_ONE=${package_one} \
-DENABLE_COMPRESSED_DEBUG_INFO=${enable_compressed_debug_info} \
-DENABLE_PACKAGE_TAR=${package_tar} \
-DENABLE_BREAKPAD=${enable_breakpad} \
${project_dir}
if ! ( make -j ${jobs} ); then
echo ">>> build NebulaGraph failed <<<"
exit 1
fi
popd
echo ">>> build NebulaGraph successfully <<<"
}
# args: <version>
function build {
version=$1
san=$2
ssan=$3
build_type=$4
package_tar=$5
install_prefix=$6
mkdir -p ${build_dir}
_build_graph
}
# args: <strip_enable>
function package {
pushd ${build_dir}
strip_enable=$1
args=""
[[ $strip_enable == TRUE ]] && args="-D CPACK_STRIP_FILES=TRUE -D CPACK_RPM_SPEC_MORE_DEFINE="
if ! ( cpack --verbose $args ); then
echo ">>> package NebulaGraph failed <<<"
exit 1
else
# rename package file
outputDir=$build_dir/cpack_output
mkdir -p ${outputDir}
for pkg_name in $(ls ./*nebula*-${version}*); do
mv ${pkg_name} ${outputDir}/
echo "####### target package file is ${outputDir}/${pkg_name}"
done
fi
popd
}
function _find_dump_syms_tool {
if [[ -x ${build_dir}/third-party/install/bin/dump_syms ]]; then
dump_syms_tool_dir=${build_dir}/third-party/install/bin
elif [[ -x /opt/vesoft/third-party/3.3/bin/dump_syms ]]; then
dump_syms_tool_dir=/opt/vesoft/third-party/3.3/bin
else
echo ">>> Failed to find the dump_syms tool <<<"
exit 1
fi
}
# This is only for releasing the disk resources.
function _strip_unnecessary_binaries {
for bin in $(ls -1 -F ${build_dir}/bin/ | grep -v [/$] | sed -e '/nebula-metad/d;/nebula-graphd/d;/nebula-storaged/d'); do
if ! (strip ${build_dir}/bin/${bin}); then
echo ">>> strip ${bin} failed: $?. <<<"
exit 1
fi
done
}
function dump_syms {
_strip_unnecessary_binaries
_find_dump_syms_tool
dump_syms=${dump_syms_tool_dir}/dump_syms
syms_dir=${build_dir}/symbols/
rm -rf ${syms_dir} && mkdir -p ${syms_dir}
pack=`ls ${build_dir}/cpack_output/`
tmp=${pack#nebula-graph}
ver=${tmp%.*}
hash objcopy &> /dev/null || {
echo "'objcopy' is not installed"
exit 1
}
for bin in nebula-graphd nebula-storaged nebula-metad; do
# Create separate debuginfo for GDB
objcopy --only-keep-debug ${build_dir}/bin/${bin} ${syms_dir}/${bin}${ver}.debug
# Create separate debuginfo for breakpad
if ! (${dump_syms} ${build_dir}/bin/${bin} > ${syms_dir}/${bin}${ver}.sym); then
echo ">>> dump ${bin} symbols failed: $?. <<<"
exit 1
fi
done
}
function add_commit {
hash git &> /dev/null
if [ $? -eq 0 ];then
if [ -d ".git" ];then
git rev-parse --short HEAD > ${build_dir}/cpack_output/commit.txt
fi
fi
}
# The main
build $version $enablesanitizer $static_sanitizer $build_type "OFF" "/usr/local/nebula"
package $strip_enable
if [[ "$dump_symbols" == "ON" ]]; then
echo ">>> start dump symbols <<<"
dump_syms
fi
# tar package
build $version $enablesanitizer $static_sanitizer $build_type "ON" "/"
package $strip_enable
# add commit information
add_commit

12
package/postinst Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
install_dir=/usr/local/nebula
daemons=(metad graphd storaged)
for daemon in ${daemons[@]}
do
if [[ ! -f ${install_dir}/etc/nebula-${daemon}.conf ]] && [[ -f ${install_dir}/etc/nebula-${daemon}.conf.default ]]; then
cp ${install_dir}/etc/nebula-${daemon}.conf.default ${install_dir}/etc/nebula-${daemon}.conf
chmod 644 ${install_dir}/etc/nebula-${daemon}.conf
fi
done

11
package/rpm_postinst Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
daemons=(metad graphd storaged)
for daemon in ${daemons[@]}
do
if [[ ! -f $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf ]] && [[ -f $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf.default ]]; then
cp $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf.default $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf
chmod 644 $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf
fi
done

Some files were not shown because too many files have changed in this diff Show More