Skip to content

Commit bc9c1e7

Browse files
authored
chore(pd-store): minor improvement (#2443)
1 parent d4a20a1 commit bc9c1e7

File tree

10 files changed

+39
-316
lines changed

10 files changed

+39
-316
lines changed

hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDPulseTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.hugegraph.pd.grpc.pulse.PartitionHeartbeatRequest;
2525
import org.apache.hugegraph.pd.pulse.PulseServerNotice;
2626
import org.junit.BeforeClass;
27+
import org.junit.Test;
2728

2829
public class PDPulseTest {
2930
private static PDClient pdClient;
@@ -40,7 +41,7 @@ public static void beforeClass() throws Exception {
4041
pdClient.getLeader();
4142
}
4243

43-
// @Test
44+
@Test
4445
public void listen() {
4546

4647
PDPulse pulse = new PDPulseImpl(pdClient.getLeaderIp());
@@ -106,4 +107,4 @@ public void onCompleted() {
106107
HgPDTestUtil.println(this.listenerName + " is completed");
107108
}
108109
}
109-
}
110+
}

hugegraph-pd/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<include>*.tar.gz</include>
136136
<include>.flattened-pom.xml</include>
137137
<!-- WARN: delete dist dir may influence dev? -->
138-
<!-- <include>dist/**</include>-->
138+
<include>dist/**</include>
139139
</includes>
140140
<followSymlinks>false</followSymlinks>
141141
</fileset>

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java

+4-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hugegraph;
1919

2020
import java.util.Collection;
21-
import java.util.Collections;
2221
import java.util.Iterator;
2322
import java.util.List;
2423
import java.util.Set;
@@ -179,8 +178,6 @@ public class StandardHugeGraph implements HugeGraph {
179178

180179
private final RamTable ramtable;
181180

182-
private final MetaManager metaManager = MetaManager.instance();
183-
184181
private final String schedulerType;
185182

186183
public StandardHugeGraph(HugeConfig config) {
@@ -230,7 +227,10 @@ public StandardHugeGraph(HugeConfig config) {
230227
}
231228

232229
if (isHstore()) {
233-
initMetaManager();
230+
// TODO: parameterize the remaining configurations
231+
MetaManager.instance().connect("hg", MetaManager.MetaDriverType.PD,
232+
"ca", "ca", "ca",
233+
config.get(CoreOptions.PD_PEERS));
234234
}
235235

236236
try {
@@ -470,12 +470,6 @@ private boolean isHstore() {
470470
return this.storeProvider.isHstore();
471471
}
472472

473-
private void initMetaManager() {
474-
this.metaManager.connect("hg", MetaManager.MetaDriverType.PD,
475-
"ca", "ca", "ca",
476-
Collections.singletonList("127.0.0.1:8686"));
477-
}
478-
479473
private ISchemaTransaction openSchemaTransaction() throws HugeException {
480474
this.checkGraphNotClosed();
481475
try {

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java

+7
Original file line numberDiff line numberDiff line change
@@ -674,4 +674,11 @@ public static synchronized CoreOptions instance() {
674674
CollectionType::valueOf,
675675
"EC"
676676
);
677+
678+
public static final ConfigOption<String> PD_PEERS = new ConfigOption<>(
679+
"pd.peers",
680+
"The addresses of pd nodes, separated with commas.",
681+
disallowEmpty(),
682+
"127.0.0.1:8686"
683+
);
677684
}

hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties

+11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ serializer=binary
2424

2525
store=hugegraph
2626

27+
# pd config
28+
pd.peers=127.0.0.1:8686
29+
30+
# task config
31+
task.scheduler_type=local
32+
task.schedule_period=10
33+
task.retry=0
34+
task.wait_timeout=10
35+
36+
# raft config
2737
raft.mode=false
2838
raft.path=./raft-log
2939
raft.safe_read=true
@@ -45,6 +55,7 @@ raft.rpc_connect_timeout=5000
4555
raft.rpc_timeout=60
4656
raft.install_snapshot_rpc_timeout=36000
4757

58+
# search config
4859
search.text_analyzer=jieba
4960
search.text_analyzer_mode=INDEX
5061

hugegraph-server/hugegraph-hstore/src/main/java/org/apache/hugegraph/backend/store/hstore/HstoreNodePartitionerImpl.java

-279
This file was deleted.

0 commit comments

Comments
 (0)