Skip to content

Commit

Permalink
add raft-server test
Browse files Browse the repository at this point in the history
Change-Id: I44e0e3c3cb44b806bd87b2216a339673f26d3166
  • Loading branch information
javeme committed Jan 4, 2022
1 parent 842b315 commit 6e2c2b5
Show file tree
Hide file tree
Showing 17 changed files with 515 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ jobs:
$TRAVIS_DIR/run-api-test.sh $BACKEND
$TRAVIS_DIR/run-unit-test.sh $BACKEND
- name: Run Raft test
if: ${{ env.BACKEND == 'rocksdb' }}
run: |
$TRAVIS_DIR/run-api-test-for-raft.sh $BACKEND
- name: Run TinkerPop test
if: ${{ env.RELEASE_BRANCH == 'true' }}
run: |
Expand Down
5 changes: 3 additions & 2 deletions hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ GC_OPTION=""
USER_OPTION=""
SERVER_STARTUP_TIMEOUT_S=30

while getopts "g:m:s:j:v" arg; do
while getopts "g:m:s:j:t:v" arg; do
case ${arg} in
g) GC_OPTION="$OPTARG" ;;
m) OPEN_MONITOR="$OPTARG" ;;
s) OPEN_SECURITY_CHECK="$OPTARG" ;;
j) USER_OPTION="$OPTARG" ;;
t) SERVER_STARTUP_TIMEOUT_S="$OPTARG" ;;
v) VERBOSE="verbose" ;;
?) echo "USAGE: $0 [-g g1] [-m true|false] [-s true|false] [-j xxx] [-v]" && exit 1 ;;
?) echo "USAGE: $0 [-g g1] [-m true|false] [-s true|false] [-j java_options] [-t timeout] [-v]" && exit 1 ;;
esac
done

Expand Down
2 changes: 1 addition & 1 deletion hugegraph-dist/src/assembly/static/bin/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function wait_for_startup() {
now_s=`date '+%s'`
done

echo "The operation timed out when attempting to connect to $server_url" >&2
echo "The operation timed out(${timeout_s}s) when attempting to connect to $server_url" >&2
return 1
}

Expand Down
3 changes: 2 additions & 1 deletion hugegraph-dist/src/assembly/travis/build-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -ev

BACKEND=$1
JACOCO_PORT=$2

OPTION_CLASS_FILES_BACKEND="--classfiles hugegraph-$BACKEND/target/classes/com/baidu/hugegraph"
if [ "$BACKEND" == "memory" ]; then
Expand All @@ -11,7 +12,7 @@ if [ "$BACKEND" == "memory" ]; then
fi

cd hugegraph-test
mvn jacoco:dump@pull-test-data -Dapp.host=localhost -Dapp.port=36320 -Dskip.dump=false
mvn jacoco:dump@pull-test-data -Dapp.host=localhost -Dapp.port=$JACOCO_PORT -Dskip.dump=false
cd ../
java -jar $TRAVIS_DIR/jacococli.jar report hugegraph-test/target/jacoco-it.exec \
--classfiles hugegraph-dist/target/classes/com/baidu/hugegraph \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
#gremlin.graph=com.baidu.hugegraph.HugeFactory

store=hugegraph

backend=rocksdb
serializer=binary

rocksdb.data_path=rocksdb-data-raft1
rocksdb.wal_path=rocksdb-data-raft1

raft.mode=true
raft.safe_read=false
raft.use_snapshot=false
raft.endpoint=127.0.0.1:8281
raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
raft.path=rocksdb-raftlog1
raft.use_replicator_pipeline=true
raft.election_timeout=10000
raft.snapshot_interval=3600
raft.backend_threads=48
raft.read_index_threads=8
raft.read_strategy=ReadOnlyLeaseBased
raft.queue_size=16384
raft.queue_publish_timeout=60
raft.apply_batch=1
raft.rpc_threads=80
raft.rpc_connect_timeout=5000
raft.rpc_timeout=60000
105 changes: 105 additions & 0 deletions hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
#host: 127.0.0.1
port: 8181

# timeout in ms of gremlin query
scriptEvaluationTimeout: 30000

channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
# don't set graph at here, this happens after support for dynamically adding graph
graphs: {
}
scriptEngines: {
gremlin-groovy: {
plugins: {
com.baidu.hugegraph.plugin.HugeGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
classImports: [
java.lang.Math,
com.baidu.hugegraph.backend.id.IdGenerator,
com.baidu.hugegraph.type.define.Directions,
com.baidu.hugegraph.type.define.NodeRole,
com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser,
com.baidu.hugegraph.traversal.algorithm.CountTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
com.baidu.hugegraph.traversal.algorithm.HugeTraverser,
com.baidu.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
com.baidu.hugegraph.traversal.algorithm.KneighborTraverser,
com.baidu.hugegraph.traversal.algorithm.KoutTraverser,
com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.NeighborRankTraverser,
com.baidu.hugegraph.traversal.algorithm.PathsTraverser,
com.baidu.hugegraph.traversal.algorithm.PersonalRankTraverser,
com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser,
com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser,
com.baidu.hugegraph.traversal.algorithm.TemplatePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
com.baidu.hugegraph.traversal.optimize.Text,
com.baidu.hugegraph.traversal.optimize.TraversalUtil,
com.baidu.hugegraph.util.DateUtil
],
methodImports: [java.lang.Math#*]
},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
files: [scripts/empty-sample.groovy]
}
}
}
}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
metrics: {
consoleReporter: {enabled: false, interval: 180000},
csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
jmxReporter: {enabled: false},
slf4jReporter: {enabled: false, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}
}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false
}
authentication: {
authenticator: com.baidu.hugegraph.auth.StandardAuthenticator,
#authenticationHandler: org.apache.tinkerpop.gremlin.server.handler.SaslAndHttpBasicAuthenticationHandler,
authenticationHandler: com.baidu.hugegraph.auth.WsAndHttpBasicAuthHandler,
config: {tokens: conf/rest-server.properties}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
restserver.url=http://127.0.0.1:8080
gremlinserver.url=http://127.0.0.1:8181
graphs=conf/graphs
auth.authenticator=com.baidu.hugegraph.auth.StandardAuthenticator

rpc.server_host=127.0.0.1
rpc.server_port=8091
rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093

server.id=server1
server.role=master
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
#gremlin.graph=com.baidu.hugegraph.HugeFactory

store=hugegraph

backend=rocksdb
serializer=binary

rocksdb.data_path=rocksdb-data-raft2
rocksdb.wal_path=rocksdb-data-raft2

raft.mode=true
raft.safe_read=false
raft.use_snapshot=false
raft.endpoint=127.0.0.1:8282
raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
raft.path=rocksdb-raftlog2
raft.use_replicator_pipeline=true
raft.election_timeout=10000
raft.snapshot_interval=3600
raft.backend_threads=48
raft.read_index_threads=8
raft.read_strategy=ReadOnlyLeaseBased
raft.queue_size=16384
raft.queue_publish_timeout=60
raft.apply_batch=1
raft.rpc_threads=80
raft.rpc_connect_timeout=5000
raft.rpc_timeout=60000
105 changes: 105 additions & 0 deletions hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# host and port of gremlin server
#host: 127.0.0.1
port: 8182

# timeout in ms of gremlin query
scriptEvaluationTimeout: 30000

channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
# don't set graph at here, this happens after support for dynamically adding graph
graphs: {
}
scriptEngines: {
gremlin-groovy: {
plugins: {
com.baidu.hugegraph.plugin.HugeGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
classImports: [
java.lang.Math,
com.baidu.hugegraph.backend.id.IdGenerator,
com.baidu.hugegraph.type.define.Directions,
com.baidu.hugegraph.type.define.NodeRole,
com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser,
com.baidu.hugegraph.traversal.algorithm.CountTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
com.baidu.hugegraph.traversal.algorithm.HugeTraverser,
com.baidu.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
com.baidu.hugegraph.traversal.algorithm.KneighborTraverser,
com.baidu.hugegraph.traversal.algorithm.KoutTraverser,
com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.NeighborRankTraverser,
com.baidu.hugegraph.traversal.algorithm.PathsTraverser,
com.baidu.hugegraph.traversal.algorithm.PersonalRankTraverser,
com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser,
com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser,
com.baidu.hugegraph.traversal.algorithm.TemplatePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
com.baidu.hugegraph.traversal.optimize.Text,
com.baidu.hugegraph.traversal.optimize.TraversalUtil,
com.baidu.hugegraph.util.DateUtil
],
methodImports: [java.lang.Math#*]
},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
files: [scripts/empty-sample.groovy]
}
}
}
}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
metrics: {
consoleReporter: {enabled: false, interval: 180000},
csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
jmxReporter: {enabled: false},
slf4jReporter: {enabled: false, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}
}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false
}
authentication: {
authenticator: com.baidu.hugegraph.auth.StandardAuthenticator,
#authenticationHandler: org.apache.tinkerpop.gremlin.server.handler.SaslAndHttpBasicAuthenticationHandler,
authenticationHandler: com.baidu.hugegraph.auth.WsAndHttpBasicAuthHandler,
config: {tokens: conf/rest-server.properties}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
restserver.url=http://127.0.0.1:8082
gremlinserver.url=http://127.0.0.1:8182
graphs=conf/graphs
auth.authenticator=com.baidu.hugegraph.auth.StandardAuthenticator

rpc.server_host=127.0.0.1
rpc.server_port=8092
rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093

server.id=server2
server.role=worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
#gremlin.graph=com.baidu.hugegraph.HugeFactory

store=hugegraph

backend=rocksdb
serializer=binary

rocksdb.data_path=rocksdb-data-raft3
rocksdb.wal_path=rocksdb-data-raft3

raft.mode=true
raft.safe_read=false
raft.use_snapshot=false
raft.endpoint=127.0.0.1:8283
raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
raft.path=rocksdb-raftlog3
raft.use_replicator_pipeline=true
raft.election_timeout=10000
raft.snapshot_interval=3600
raft.backend_threads=48
raft.read_index_threads=8
raft.read_strategy=ReadOnlyLeaseBased
raft.queue_size=16384
raft.queue_publish_timeout=60
raft.apply_batch=1
raft.rpc_threads=80
raft.rpc_connect_timeout=5000
raft.rpc_timeout=60000
Loading

0 comments on commit 6e2c2b5

Please sign in to comment.