Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c5a915e
chore: move hugegraph-hstore
VGalaxies Aug 17, 2023
5ada159
chore: simple adapt
VGalaxies Aug 17, 2023
d3e7ca9
chore: register hstore
VGalaxies Aug 18, 2023
afd2c5c
build: intro grpc dep
VGalaxies Aug 18, 2023
e4c894c
chore: migrate org.apache.hugegraph.meta
VGalaxies Aug 21, 2023
626bce2
chore: migrate org.apache.hugegraph.space
VGalaxies Aug 21, 2023
1780251
chore: adapt meta schema
VGalaxies Aug 21, 2023
f613bfe
chore: migrate SchemaTransactionV2
VGalaxies Aug 21, 2023
d91e50a
chore: adapt SchemaTransactionV2
VGalaxies Aug 21, 2023
cdc0f3a
refact: intro ISchemaTransaction for adaptation
VGalaxies Aug 22, 2023
8d0f053
fix: init meta server
VGalaxies Aug 23, 2023
5a2af29
fix: avoid typecast from UnmodifiableRandomAccessList
VGalaxies Aug 24, 2023
bd75b68
refact: query task and server info by graph tx
VGalaxies Aug 28, 2023
bd10b4b
fix: register task and server table for rocksdb BE
VGalaxies Aug 28, 2023
293486f
chore: add example for hstore BE scanning tables
VGalaxies Aug 28, 2023
46b8120
fix: register task and server table for other BEs
VGalaxies Aug 29, 2023
a40e808
build: remove system dependency to hugegraph-core in hg-store-core
heiyan-2020 Sep 2, 2023
169f945
Merge branch 'pd-store' into sys-tx
VGalaxies Sep 10, 2023
3125222
chore: remove author comments
VGalaxies Sep 10, 2023
dc2c9ad
chore: remove AbstractDistributedLock class and lock method
VGalaxies Sep 10, 2023
087f0bf
chore: replace HashMap with ImmutableMap
VGalaxies Sep 10, 2023
9d11f9d
chore: code review
VGalaxies Sep 10, 2023
d818aef
chore: load driver version in graph store for hstore
VGalaxies Sep 10, 2023
1a7f6cb
fix: index serialization and deserialization logic
VGalaxies Sep 11, 2023
c38b67c
fix: convertTaskOrServerToVertex for other BEs
VGalaxies Sep 11, 2023
e33a510
chore: init meta server in ctor of StandardHugeGraph
VGalaxies Sep 14, 2023
e10eea7
chore: add comments for lock module
VGalaxies Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@

/**
* PD客户端实现类
*
* @author yanjinbing
*/
@Slf4j
public class PDClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ public String toJSON(Exception exception) {
return builder;
}

/**
* @param object
* @return
* @author tianxiaohui
*/
public String toJSON(Object object) {
ObjectMapper mapper = new ObjectMapper();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ protected Collection<CassandraTable> tables() {

@Override
protected final CassandraTable table(HugeType type) {
return this.table(type.string());
return this.table(convertTaskOrServerToVertex(type).string());
}

protected final CassandraTable table(String name) {
Expand Down
26 changes: 26 additions & 0 deletions hugegraph-server/hugegraph-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,32 @@
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.apache.hugegraph</groupId>
<artifactId>hg-pd-client</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.apache.hugegraph</groupId>
<artifactId>hg-store-common</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.5.9</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.hugegraph.backend.store.BackendStore;
import org.apache.hugegraph.backend.store.ram.RamTable;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.job.EphemeralJob;
import org.apache.hugegraph.task.ServerInfoManager;
Expand All @@ -46,7 +47,7 @@ public interface HugeGraphParams {

GraphReadMode readMode();

SchemaTransaction schemaTransaction();
ISchemaTransaction schemaTransaction();

GraphTransaction systemTransaction();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hugegraph;

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
Expand All @@ -37,6 +38,7 @@
import org.apache.hugegraph.backend.cache.CacheNotifier.SchemaCacheNotifier;
import org.apache.hugegraph.backend.cache.CachedGraphTransaction;
import org.apache.hugegraph.backend.cache.CachedSchemaTransaction;
import org.apache.hugegraph.backend.cache.CachedSchemaTransactionV2;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.id.SnowflakeIdGenerator;
Expand All @@ -51,9 +53,8 @@
import org.apache.hugegraph.backend.store.raft.RaftBackendStoreProvider;
import org.apache.hugegraph.backend.store.raft.RaftGroupManager;
import org.apache.hugegraph.backend.store.ram.RamTable;
import org.apache.hugegraph.task.EphemeralJobQueue;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.config.CoreOptions;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.TypedOption;
Expand All @@ -69,6 +70,7 @@
import org.apache.hugegraph.masterelection.RoleElectionStateMachine;
import org.apache.hugegraph.masterelection.StandardClusterRoleStore;
import org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine;
import org.apache.hugegraph.meta.MetaManager;
import org.apache.hugegraph.perf.PerfUtil.Watched;
import org.apache.hugegraph.rpc.RpcServiceConfig4Client;
import org.apache.hugegraph.rpc.RpcServiceConfig4Server;
Expand All @@ -84,6 +86,7 @@
import org.apache.hugegraph.structure.HugeFeatures;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.structure.HugeVertexProperty;
import org.apache.hugegraph.task.EphemeralJobQueue;
import org.apache.hugegraph.task.ServerInfoManager;
import org.apache.hugegraph.task.TaskManager;
import org.apache.hugegraph.task.TaskScheduler;
Expand Down Expand Up @@ -176,6 +179,8 @@ public class StandardHugeGraph implements HugeGraph {

private final RamTable ramtable;

private final MetaManager metaManager = MetaManager.instance();

public StandardHugeGraph(HugeConfig config) {
this.params = new StandardHugeGraphParams();
this.configuration = config;
Expand Down Expand Up @@ -221,6 +226,10 @@ public StandardHugeGraph(HugeConfig config) {
throw new HugeException(message, e);
}

if (isHstore()) {
initMetaManager();
}

try {
this.tx = new TinkerPopTransaction(this);
boolean supportsPersistence = this.backendStoreFeatures().supportsPersistence();
Expand Down Expand Up @@ -453,9 +462,24 @@ private void clearVertexCache() {
}
}

private SchemaTransaction openSchemaTransaction() throws HugeException {
private boolean isHstore() {
return this.storeProvider.isHstore();
}

private void initMetaManager() {
this.metaManager.connect("hg", MetaManager.MetaDriverType.PD,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个链接是不是每个新的链接都要调用一次?是否只执行一次就可以呢?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑在 StandardHugeGraph 构造函数中初始化 meta manager

"ca", "ca", "ca",
Collections.singletonList("127.0.0.1:8686"));
}

private ISchemaTransaction openSchemaTransaction() throws HugeException {
this.checkGraphNotClosed();
try {
if (isHstore()) {
return new CachedSchemaTransactionV2(
MetaManager.instance().metaDriver(),
MetaManager.instance().cluster(), this.params);
}
return new CachedSchemaTransaction(this.params, loadSchemaStore());
} catch (BackendException e) {
String message = "Failed to open schema transaction";
Expand Down Expand Up @@ -500,11 +524,14 @@ private BackendStore loadGraphStore() {
}

private BackendStore loadSystemStore() {
if (isHstore()) {
return this.storeProvider.loadGraphStore(this.configuration);
}
return this.storeProvider.loadSystemStore(this.configuration);
}

@Watched
private SchemaTransaction schemaTransaction() {
private ISchemaTransaction schemaTransaction() {
this.checkGraphNotClosed();
/*
* NOTE: each schema operation will be auto committed,
Expand Down Expand Up @@ -1192,7 +1219,7 @@ public GraphReadMode readMode() {
}

@Override
public SchemaTransaction schemaTransaction() {
public ISchemaTransaction schemaTransaction() {
return StandardHugeGraph.this.schemaTransaction();
}

Expand Down Expand Up @@ -1443,7 +1470,7 @@ private void setClosed() {
}
}

private SchemaTransaction schemaTransaction() {
private ISchemaTransaction schemaTransaction() {
return this.getOrNewTransaction().schemaTx;
}

Expand All @@ -1464,7 +1491,7 @@ private Txs getOrNewTransaction() {

Txs txs = this.transactions.get();
if (txs == null) {
SchemaTransaction schemaTransaction = null;
ISchemaTransaction schemaTransaction = null;
SysTransaction sysTransaction = null;
GraphTransaction graphTransaction = null;
try {
Expand Down Expand Up @@ -1507,12 +1534,12 @@ private void destroyTransaction() {

private static final class Txs {

private final SchemaTransaction schemaTx;
private final ISchemaTransaction schemaTx;
private final SysTransaction systemTx;
private final GraphTransaction graphTx;
private long openedTime;

public Txs(SchemaTransaction schemaTx, SysTransaction systemTx,
public Txs(ISchemaTransaction schemaTx, SysTransaction systemTx,
GraphTransaction graphTx) {
assert schemaTx != null && systemTx != null && graphTx != null;
this.schemaTx = schemaTx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,9 @@ private String[] initProperties() {
return super.initProperties(props);
}
}

public static HugeAccess fromMap(Map<String, Object> map) {
HugeAccess access = new HugeAccess(null, null, null);
return fromMap(map, access);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@

public class HugeBelong extends Relationship {

public static final String UG = "ug";
public static final String UR = "ur";
public static final String GR = "gr";
public static final String ALL = "*";
private static final long serialVersionUID = -7242751631755533423L;

private final Id user;
private final Id group;
private String link;
private String description;

public HugeBelong(Id user, Id group) {
Expand Down Expand Up @@ -75,6 +80,10 @@ public Id target() {
return this.group;
}

public String link() {
return this.link;
}

public String description() {
return this.description;
}
Expand Down Expand Up @@ -196,4 +205,9 @@ private String[] initProperties() {
return super.initProperties(props);
}
}

public static HugeBelong fromMap(Map<String, Object> map) {
HugeBelong belong = new HugeBelong(null, null);
return fromMap(map, belong);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class HugeGroup extends Entity {
private static final long serialVersionUID = 2330399818352242686L;

private String name;
private String nickname;
private String description;

public HugeGroup(String name) {
Expand Down Expand Up @@ -68,6 +69,14 @@ public String name() {
return this.name;
}

public String nickname() {
return this.nickname;
}

public void nickname(String nickname) {
this.nickname = nickname;
}

public String description() {
return this.description;
}
Expand Down Expand Up @@ -195,4 +204,9 @@ protected String[] initProperties() {
return super.initProperties(props);
}
}

public static HugeGroup fromMap(Map<String, Object> map) {
HugeGroup group = new HugeGroup("");
return fromMap(map, group);
}
}
Loading