Skip to content

Commit b361395

Browse files
committed
feat(server): address pmc review comments
1 parent 480748c commit b361395

9 files changed

Lines changed: 59 additions & 21 deletions

File tree

.serena/memories/architecture_and_modules.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
### 1. Client Layer
66
- Gremlin/Cypher queries, REST APIs, Swagger UI
77

8-
### 2. Server Layer (hugegraph-server, 13 submodules)
8+
### 2. Server Layer (hugegraph-server, 8 submodules)
99
- **REST API** (hugegraph-api): GraphAPI, SchemaAPI, GremlinAPI, CypherAPI, AuthAPI, GraphSpaceAPI (distributed only), ManagerAPI (distributed only)
1010
- **Graph Engine** (hugegraph-core): Schema (with TTL update), traversal, task scheduling, GraphSpace multi-tenancy
1111
- **Backend Interface**: Pluggable via `BackendStore`
1212

1313
### 3. Storage Layer
1414
- RocksDB (default/embedded), HStore (distributed/production)
15-
- Legacy (≤1.5.0, deprecated, excluded from context): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo
15+
- HBase (deprecated; planned for removal in 2.0)
1616

1717
## Module Structure (7 top-level modules)
1818

19-
### hugegraph-server (13 submodules)
20-
`hugegraph-core`, `hugegraph-api` (includes `opencypher/`, `space/`), `hugegraph-dist`, `hugegraph-test`, `hugegraph-example`, plus backends: `hugegraph-rocksdb`, `hugegraph-hstore`, `hugegraph-hbase`, `hugegraph-mysql`, `hugegraph-postgresql`, `hugegraph-cassandra`, `hugegraph-scylladb`, `hugegraph-palo`
19+
### hugegraph-server (8 submodules)
20+
`hugegraph-core`, `hugegraph-api` (includes `opencypher/`, `space/`), `hugegraph-dist`, `hugegraph-test`, `hugegraph-example`, plus backends: `hugegraph-rocksdb`, `hugegraph-hstore`, `hugegraph-hbase`
2121

2222
### hugegraph-pd (8 submodules)
2323
Placement Driver: `hg-pd-core`, `hg-pd-service`, `hg-pd-client`, `hg-pd-common`, `hg-pd-grpc`, `hg-pd-cli`, `hg-pd-dist`, `hg-pd-test`

.serena/memories/implementation_patterns_and_guidelines.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
- Backends implement `BackendStore` interface from `hugegraph-core`
55
- Each backend = separate Maven module under `hugegraph-server/`
66
- Configured via `hugegraph.properties``backend` property
7-
- **Active backends (focus here)**: RocksDB (default/embedded), HStore (distributed)
8-
- **Legacy backends** (deprecated, excluded from Serena context): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo
7+
- **Supported backends**: RocksDB (default/embedded), HStore (distributed), HBase (deprecated; planned for removal in 2.0)
98

109
## GraphSpace Multi-Tenancy
1110
- Core: `hugegraph-core/.../space/` (GraphSpace, SchemaTemplate, Service, register/)

.serena/memories/project_overview.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ Apache HugeGraph is a fast-speed, highly-scalable graph database supporting 10+
1919
- **Graph Framework**: Apache TinkerPop 3.5.1
2020
- **RPC**: gRPC + Protocol Buffers
2121
- **API Docs**: Swagger (io.swagger.core.v3)
22-
- **Storage**: RocksDB (default/embedded), HStore (distributed/production)
23-
- **Legacy backends** (≤1.5.0): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo
22+
- **Storage**: RocksDB (default/embedded), HStore (distributed/production), HBase (deprecated; planned for removal in 2.0)
2423

2524
## Version
2625
- Current: 1.7.0 (`${revision}` property, Maven flatten plugin)

.serena/project.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ ignore_all_files_in_gitignore: true
3535
# Same syntax as gitignore, so you can use * and **.
3636
# Note: global ignored_paths from serena_config.yml are also applied additively.
3737
ignored_paths:
38-
# --- Deprecated backends (focus on RocksDB/HStore only) ---
39-
- "hugegraph-server/hugegraph-cassandra/**"
40-
- "hugegraph-server/hugegraph-scylladb/**"
41-
- "hugegraph-server/hugegraph-mysql/**"
42-
- "hugegraph-server/hugegraph-postgresql/**"
43-
- "hugegraph-server/hugegraph-palo/**"
38+
# --- HBase is deprecated and planned for removal in 2.0 ---
4439
- "hugegraph-server/hugegraph-hbase/**"
4540
# --- gRPC generated Java (235k lines, never hand-edited, regenerated by mvn compile) ---
4641
- "hugegraph-pd/hg-pd-grpc/src/main/java/**"

hugegraph-server/hugegraph-core/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@
118118
<groupId>org.apache.tinkerpop</groupId>
119119
<artifactId>gremlin-driver</artifactId>
120120
</dependency>
121+
<dependency>
122+
<groupId>junit</groupId>
123+
<artifactId>junit</artifactId>
124+
<scope>test</scope>
125+
</dependency>
121126
<dependency>
122127
<groupId>org.apache.fury</groupId>
123128
<artifactId>fury-core</artifactId>

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ public class HugeSecurityManager extends SecurityManager {
6363
"line.separator",
6464
"file.separator",
6565
// Sofa
66-
"java.specification.version",
67-
"socksProxyHost",
68-
"file.encoding"
66+
"java.specification.version"
6967
);
7068

7169
private static final Map<String, Set<String>> ASYNC_TASKS = ImmutableMap.of(
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.hugegraph.security;
19+
20+
import java.lang.reflect.Field;
21+
import java.util.Set;
22+
23+
import org.junit.Assert;
24+
import org.junit.Test;
25+
26+
public class HugeSecurityManagerTest {
27+
28+
@Test
29+
public void testWhiteSystemPropertiesExcludeRemovedBackends() throws Exception {
30+
Field field = HugeSecurityManager.class.getDeclaredField(
31+
"WHITE_SYSTEM_PROPERTIES");
32+
field.setAccessible(true);
33+
34+
@SuppressWarnings("unchecked")
35+
Set<String> properties = (Set<String>) field.get(null);
36+
Assert.assertFalse(properties.contains("socksProxyHost"));
37+
Assert.assertFalse(properties.contains("file.encoding"));
38+
Assert.assertTrue(properties.contains("java.specification.version"));
39+
}
40+
}

hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,12 @@ public void testInitBackendFailsFastForPermanentException() throws Exception {
4646
Method method = InitStore.class.getDeclaredMethod("initBackend",
4747
HugeGraph.class);
4848
method.setAccessible(true);
49-
long start = System.nanoTime();
5049
try {
5150
method.invoke(null, graph);
5251
Assert.fail("Expected initialization to fail");
5352
} catch (InvocationTargetException e) {
5453
Assert.assertSame(exception, e.getCause());
5554
}
56-
long elapsed = (System.nanoTime() - start) / 1_000_000L;
57-
Assert.assertTrue("Expected initialization to fail without retrying",
58-
elapsed < 1000L);
5955
Assert.assertEquals(1, invocations.get());
6056
}
6157
}

hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ public void testProperties() {
282282
System.getProperty("java.version");
283283
result = runGremlinJob("System.getProperty(\"java.version\")");
284284
assertError(result, "Not allowed to access system property(java.version) via Gremlin");
285+
286+
result = runGremlinJob("System.getProperty(\"socksProxyHost\")");
287+
assertError(result, "Not allowed to access system property(socksProxyHost) via Gremlin");
288+
289+
result = runGremlinJob("System.getProperty(\"file.encoding\")");
290+
assertError(result, "Not allowed to access system property(file.encoding) via Gremlin");
285291
}
286292

287293
@Test

0 commit comments

Comments
 (0)