Skip to content

Commit 1badd93

Browse files
authored
BREAKING CHANGE(server): disable legacy backends include MySQL/PG/c*(.etc) (#2746)
* disable Cassandra、MySQL、Postgre、scyllaDB、palo backend
1 parent e2c08f1 commit 1badd93

23 files changed

Lines changed: 54 additions & 844 deletions

File tree

.github/outdated/.travis.yml

Lines changed: 0 additions & 124 deletions
This file was deleted.

.github/outdated/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
build:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-22.04
1010
env:
1111
TAG_NAME: ${{ github.ref_name }}
1212
steps:

.github/workflows/server-ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
build-server:
1313
# TODO: we need test & replace it to ubuntu-24.04 or ubuntu-latest
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515
env:
1616
USE_STAGE: 'false' # Whether to include the stage repository.
1717
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
BACKEND: [ memory, rocksdb, hbase, cassandra, mysql, postgresql, scylladb ]
30+
BACKEND: [ memory, rocksdb, hbase ]
3131
JAVA_VERSION: [ '11' ]
3232

3333
steps:
@@ -38,7 +38,7 @@ jobs:
3838

3939
# TODO: Remove this step after install-backend.sh updated
4040
- name: Install Java8 for backend
41-
uses: actions/setup-java@v3
41+
uses: actions/setup-java@v4
4242
with:
4343
java-version: '8'
4444
distribution: 'zulu'
@@ -48,13 +48,13 @@ jobs:
4848
$TRAVIS_DIR/install-backend.sh $BACKEND && jps -l
4949
5050
- name: Install Java ${{ matrix.JAVA_VERSION }}
51-
uses: actions/setup-java@v3
51+
uses: actions/setup-java@v4
5252
with:
5353
java-version: ${{ matrix.JAVA_VERSION }}
5454
distribution: 'zulu'
5555

5656
- name: Cache Maven packages
57-
uses: actions/cache@v3
57+
uses: actions/cache@v4
5858
with:
5959
path: ~/.m2
6060
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@@ -95,6 +95,7 @@ jobs:
9595
$TRAVIS_DIR/run-tinkerpop-test.sh $BACKEND tinkerpop
9696
9797
- name: Upload coverage to Codecov
98+
# TODO: update to v5 later
9899
uses: codecov/codecov-action@v3
99100
with:
100101
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm
2626
- Compliant to [Apache TinkerPop 3](https://tinkerpop.apache.org/), supports [Gremlin](https://tinkerpop.apache.org/gremlin.html) & [Cypher](https://en.wikipedia.org/wiki/Cypher) language
2727
- Schema Metadata Management, including VertexLabel, EdgeLabel, PropertyKey and IndexLabel
2828
- Multi-type Indexes, supporting exact query, range query and complex conditions combination query
29-
- Plug-in Backend Store Driver Framework, support `RocksDB`/`HStore`, `HBase`, `Cassandra/ScyllaDB`, and `MySQL/Postgre` now and easy to add another backend store driver if needed
29+
- Plug-in Backend Store Framework, mainly support `RocksDB`/`HStore` + `HBase` for now and you could choose other backends in the [legacy version](https://hugegraph.apache.org/docs/download/download/)`1.5.0` (like `MySQL/PG`/`Cassandra` ...)
3030
- Integration with `Flink/Spark/HDFS`, and friendly to connect other big data platforms
31+
- Complete graph ecosystem (including both in/out-memory `Graph Computing` + `Graph Visualization & Tools` + `Graph Learning & AI`, see [here](#3-build-from-source))
3132

3233

3334
## Quick Start

hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ edge.cache_type=l2
3939
backend=hstore
4040
serializer=binary
4141

42+
# graph name
4243
store=hugegraph
4344

4445
# pd config
@@ -50,48 +51,16 @@ task.schedule_period=10
5051
task.retry=0
5152
task.wait_timeout=10
5253

53-
# raft config
54-
raft.mode=false
55-
raft.path=./raft-log
56-
raft.safe_read=true
57-
raft.use_replicator_pipeline=true
58-
raft.election_timeout=10000
59-
raft.snapshot_interval=3600
60-
raft.backend_threads=48
61-
raft.read_index_threads=8
62-
raft.snapshot_threads=4
63-
raft.snapshot_parallel_compress=false
64-
raft.snapshot_compress_threads=4
65-
raft.snapshot_decompress_threads=4
66-
raft.read_strategy=ReadOnlyLeaseBased
67-
raft.queue_size=16384
68-
raft.queue_publish_timeout=60
69-
raft.apply_batch=1
70-
raft.rpc_threads=80
71-
raft.rpc_connect_timeout=5000
72-
raft.rpc_timeout=60
73-
raft.install_snapshot_rpc_timeout=36000
74-
7554
# search config
7655
search.text_analyzer=jieba
7756
search.text_analyzer_mode=INDEX
7857

79-
# rocksdb backend config
58+
### RocksDB backend config
8059
#rocksdb.data_path=/path/to/disk
8160
#rocksdb.wal_path=/path/to/disk
8261

8362

84-
# cassandra backend config
85-
cassandra.host=localhost
86-
cassandra.port=9042
87-
cassandra.username=
88-
cassandra.password=
89-
#cassandra.connect_timeout=5
90-
#cassandra.read_timeout=20
91-
#cassandra.keyspace.strategy=SimpleStrategy
92-
#cassandra.keyspace.replication=3
93-
94-
# hbase backend config
63+
### HBase backend config
9564
#hbase.hosts=localhost
9665
#hbase.port=2181
9766
#hbase.znode_parent=/hbase
@@ -102,25 +71,3 @@ cassandra.password=
10271
#hbase.enable_partition=true
10372
#hbase.vertex_partitions=10
10473
#hbase.edge_partitions=30
105-
106-
# mysql backend config
107-
#jdbc.driver=com.mysql.jdbc.Driver
108-
#jdbc.url=jdbc:mysql://127.0.0.1:3306
109-
#jdbc.username=root
110-
#jdbc.password=
111-
#jdbc.reconnect_max_times=3
112-
#jdbc.reconnect_interval=3
113-
#jdbc.ssl_mode=false
114-
115-
# postgresql & cockroachdb backend config
116-
#jdbc.driver=org.postgresql.Driver
117-
#jdbc.url=jdbc:postgresql://localhost:5432/
118-
#jdbc.username=postgres
119-
#jdbc.password=
120-
#jdbc.postgresql.connect_database=template1
121-
122-
# palo backend config
123-
#palo.host=127.0.0.1
124-
#palo.poll_interval=10
125-
#palo.temp_dir=./palo-data
126-
#palo.file_limit_size=32

hugegraph-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ HugeGraph Server consists of two layers of functionality: the graph engine layer
88
- Backend Interface: Implements the storage of graph data to the backend.
99

1010
- Storage Layer:
11-
- Storage Backend: Supports multiple built-in storage backends (RocksDB/MySQL/HBase/...) and allows users to extend custom backends without modifying the existing source code.
11+
- Storage Backend: Supports multiple built-in storage backends (RocksDB/Memory/HStore/HBase/...) and allows users to extend custom backends without modifying the existing source code.

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.hugegraph.backend.store;
1919

20+
import java.util.List;
2021
import java.util.Map;
2122
import java.util.concurrent.ConcurrentHashMap;
2223

@@ -26,14 +27,24 @@
2627
import org.apache.hugegraph.backend.store.raft.RaftBackendStoreProvider;
2728
import org.apache.hugegraph.config.CoreOptions;
2829
import org.apache.hugegraph.config.HugeConfig;
30+
import org.apache.hugegraph.util.E;
2931
import org.apache.hugegraph.util.Log;
3032
import org.slf4j.Logger;
3133

34+
/**
35+
* BREAKING CHANGE:
36+
* since 1.7.0, only "hstore, rocksdb, hbase, memory" are supported for backend.
37+
* if you want to use cassandra, mysql, postgresql, cockroachdb or palo as backend,
38+
* please find a version before 1.7.0 of apache hugegraph for your application.
39+
*/
3240
public class BackendProviderFactory {
3341

3442
private static final Logger LOG = Log.logger(BackendProviderFactory.class);
3543

36-
private static Map<String, Class<? extends BackendStoreProvider>> providers;
44+
private static final Map<String, Class<? extends BackendStoreProvider>> providers;
45+
46+
private static final List<String> ALLOWED_BACKENDS = List.of("memory", "rocksdb", "hbase",
47+
"hstore");
3748

3849
static {
3950
providers = new ConcurrentHashMap<>();
@@ -47,8 +58,7 @@ public static BackendStoreProvider open(HugeGraphParams params) {
4758

4859
BackendStoreProvider provider = newProvider(config);
4960
if (raftMode) {
50-
LOG.info("Opening backend store '{}' in raft mode for graph '{}'",
51-
backend, graph);
61+
LOG.info("Opening backend store '{}' in raft mode for graph '{}'", backend, graph);
5262
provider = new RaftBackendStoreProvider(params, provider);
5363
}
5464
provider.open(graph);
@@ -57,8 +67,10 @@ public static BackendStoreProvider open(HugeGraphParams params) {
5767

5868
private static BackendStoreProvider newProvider(HugeConfig config) {
5969
String backend = config.get(CoreOptions.BACKEND).toLowerCase();
60-
String graph = config.get(CoreOptions.STORE);
70+
E.checkState(ALLOWED_BACKENDS.contains(backend.toLowerCase()),
71+
"backend is illegal: %s", backend);
6172

73+
String graph = config.get(CoreOptions.STORE);
6274
if (InMemoryDBStoreProvider.matchType(backend)) {
6375
return InMemoryDBStoreProvider.instance(graph);
6476
}
@@ -68,24 +80,23 @@ private static BackendStoreProvider newProvider(HugeConfig config) {
6880
"Not exists BackendStoreProvider: %s", backend);
6981

7082
assert BackendStoreProvider.class.isAssignableFrom(clazz);
71-
BackendStoreProvider instance = null;
83+
BackendStoreProvider instance;
7284
try {
73-
instance = clazz.newInstance();
85+
instance = clazz.getDeclaredConstructor().newInstance();
7486
} catch (Exception e) {
7587
throw new BackendException(e);
7688
}
7789

7890
BackendException.check(backend.equals(instance.type()),
7991
"BackendStoreProvider with type '%s' " +
80-
"can't be opened by key '%s'",
81-
instance.type(), backend);
92+
"can't be opened by key '%s'", instance.type(), backend);
8293
return instance;
8394
}
8495

8596
@SuppressWarnings({"rawtypes", "unchecked"})
8697
public static void register(String name, String classPath) {
8798
ClassLoader classLoader = BackendProviderFactory.class.getClassLoader();
88-
Class<?> clazz = null;
99+
Class<?> clazz;
89100
try {
90101
clazz = classLoader.loadClass(classPath);
91102
} catch (Exception e) {

hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import org.apache.hugegraph.dist.RegisterUtil
2121
// register all the backend to avoid changes if needs to support other backend
2222
RegisterUtil.registerPlugins()
2323
RegisterUtil.registerRocksDB()
24-
RegisterUtil.registerCassandra()
25-
RegisterUtil.registerScyllaDB()
2624
RegisterUtil.registerHBase()
27-
RegisterUtil.registerMysql()
28-
RegisterUtil.registerPalo()
29-
RegisterUtil.registerPostgresql()
3025

3126
graph = HugeFactory.open('./conf/graphs/hugegraph.properties')

0 commit comments

Comments
 (0)