From 1bad9dbaf7cc3bbc64751397168de4fe65a1f448 Mon Sep 17 00:00:00 2001 From: seagle Date: Sun, 17 Apr 2022 16:42:35 +0800 Subject: [PATCH 1/7] optimize checkstyle,delete ClassTypeParameterName check and ignore test and generate code --- .../hugegraph/backend/store/raft/rpc/RaftRequests.java | 2 +- .../baidu/hugegraph/unit/util/collection/IntSetTest.java | 0 pom.xml | 1 + style/checkstyle.xml | 8 ++++---- 4 files changed, 6 insertions(+), 5 deletions(-) rename hugegraph-core/src/{main => generated}/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java (99%) rename hugegraph-test/src/{main => test}/java/com/baidu/hugegraph/unit/util/collection/IntSetTest.java (100%) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java similarity index 99% rename from hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java rename to hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 6bcc9aa702..750454ac7a 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -369,7 +369,7 @@ private StoreCommandRequest( } case 16: { int rawValue = input.readEnum(); - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); + StoreAction value = StoreAction.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(2, rawValue); } else { diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/util/collection/IntSetTest.java b/hugegraph-test/src/test/java/com/baidu/hugegraph/unit/util/collection/IntSetTest.java similarity index 100% rename from hugegraph-test/src/main/java/com/baidu/hugegraph/unit/util/collection/IntSetTest.java rename to hugegraph-test/src/test/java/com/baidu/hugegraph/unit/util/collection/IntSetTest.java diff --git a/pom.xml b/pom.xml index b66f7988e3..623f6c17d0 100644 --- a/pom.xml +++ b/pom.xml @@ -357,6 +357,7 @@ true true false + **/generated/**/*,**/test/**/* false diff --git a/style/checkstyle.xml b/style/checkstyle.xml index 999f5c687a..d07aa0ea16 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -46,10 +46,10 @@ - - - - + + + + From 8a0c367abdce448f98c4651a79339db17f6e4bd5 Mon Sep 17 00:00:00 2001 From: seagle Date: Sun, 17 Apr 2022 17:25:01 +0800 Subject: [PATCH 2/7] restore the previous version --- .../baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 750454ac7a..6bcc9aa702 100644 --- a/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/generated/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -369,7 +369,7 @@ private StoreCommandRequest( } case 16: { int rawValue = input.readEnum(); - StoreAction value = StoreAction.valueOf(rawValue); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(2, rawValue); } else { From 57f66074562df927b16736b52d6b7280ecdda47b Mon Sep 17 00:00:00 2001 From: seagle Date: Mon, 18 Apr 2022 12:41:43 +0800 Subject: [PATCH 3/7] delete ClassTypeParameterName check --- style/checkstyle.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/style/checkstyle.xml b/style/checkstyle.xml index 999f5c687a..d07aa0ea16 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -46,10 +46,10 @@ - - - - + + + + From 46929960bae407972751fce653c25afb8ec426b4 Mon Sep 17 00:00:00 2001 From: seagle Date: Mon, 18 Apr 2022 21:34:18 +0800 Subject: [PATCH 4/7] fix checkstyle issue --- .../java/com/baidu/hugegraph/HugeFactory.java | 20 +- .../java/com/baidu/hugegraph/HugeGraph.java | 263 +++++++++++------- .../com/baidu/hugegraph/HugeGraphParams.java | 69 +++-- .../baidu/hugegraph/StandardHugeGraph.java | 34 +-- .../com/baidu/hugegraph/auth/AuthManager.java | 157 +++++++---- .../baidu/hugegraph/auth/EntityManager.java | 2 +- .../hugegraph/auth/RelationshipManager.java | 2 +- .../baidu/hugegraph/auth/SchemaDefine.java | 8 +- .../backend/cache/CachedGraphTransaction.java | 10 +- .../hugegraph/backend/cache/OffheapCache.java | 4 +- .../baidu/hugegraph/backend/id/EdgeId.java | 10 +- .../hugegraph/backend/id/IdGenerator.java | 18 +- .../hugegraph/backend/page/IdHolder.java | 2 +- .../hugegraph/backend/query/Condition.java | 5 +- .../backend/query/ConditionQuery.java | 4 +- .../baidu/hugegraph/backend/query/Query.java | 16 +- .../serializer/BinaryEntryIterator.java | 2 +- .../backend/serializer/BinarySerializer.java | 8 +- .../backend/serializer/GraphSerializer.java | 30 +- .../backend/serializer/SchemaSerializer.java | 20 +- .../hugegraph/backend/store/BackendEntry.java | 3 + .../backend/store/BackendSession.java | 30 +- .../hugegraph/backend/store/BackendStore.java | 79 +++--- .../backend/store/BackendStoreProvider.java | 41 ++- .../hugegraph/backend/store/BackendTable.java | 5 +- .../hugegraph/backend/store/MetaHandler.java | 4 +- .../hugegraph/backend/store/ram/RamTable.java | 5 +- .../backend/tx/GraphIndexTransaction.java | 20 +- .../backend/tx/GraphTransaction.java | 2 +- .../hugegraph/io/HugeGraphSONModule.java | 14 +- .../job/computer/LouvainComputer.java | 4 +- .../job/system/DeleteExpiredIndexJob.java | 2 +- .../plugin/HugeGraphGremlinPlugin.java | 12 +- .../schema/builder/PropertyKeyBuilder.java | 1 - .../security/HugeSecurityManager.java | 7 +- .../com/baidu/hugegraph/task/HugeTask.java | 2 +- .../baidu/hugegraph/task/TaskCallable.java | 2 +- pom.xml | 1 - 38 files changed, 528 insertions(+), 390 deletions(-) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java index 56ee22e84b..503f901e8b 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java @@ -44,7 +44,7 @@ public class HugeFactory { private static final Logger LOG = Log.logger(HugeGraph.class); - private static final Thread shutdownHook = new Thread(() -> { + private static final Thread SHUTDOWN_HOOK = new Thread(() -> { LOG.info("HugeGraph is shutting down"); HugeFactory.shutdown(30L); }, "hugegraph-shutdown"); @@ -53,14 +53,14 @@ public class HugeFactory { SerialEnum.registerInternalEnums(); HugeGraph.registerTraversalStrategies(StandardHugeGraph.class); - Runtime.getRuntime().addShutdownHook(shutdownHook); + Runtime.getRuntime().addShutdownHook(SHUTDOWN_HOOK); } private static final String NAME_REGEX = "^[A-Za-z][A-Za-z0-9_]{0,47}$"; - private static final Map graphs = new HashMap<>(); + private static final Map GRAPHS = new HashMap<>(); - private static final AtomicBoolean shutdown = new AtomicBoolean(false); + private static final AtomicBoolean SHUTDOWN = new AtomicBoolean(false); public static synchronized HugeGraph open(Configuration config) { HugeConfig conf = config instanceof HugeConfig ? @@ -82,10 +82,10 @@ public static synchronized HugeGraph open(HugeConfig config) { String name = config.get(CoreOptions.STORE); checkGraphName(name, "graph config(like hugegraph.properties)"); name = name.toLowerCase(); - HugeGraph graph = graphs.get(name); + HugeGraph graph = GRAPHS.get(name); if (graph == null || graph.closed()) { graph = new StandardHugeGraph(config); - graphs.put(name, graph); + GRAPHS.put(name, graph); } else { String backend = config.get(CoreOptions.BACKEND); E.checkState(backend.equalsIgnoreCase(graph.backend()), @@ -105,7 +105,7 @@ public static HugeGraph open(URL url) { public static void remove(HugeGraph graph) { String name = graph.option(CoreOptions.STORE); - graphs.remove(name); + GRAPHS.remove(name); } public static void checkGraphName(String name, String configFile) { @@ -143,7 +143,7 @@ public static PropertiesConfiguration getRemoteConfig(URL url) { * @param timeout seconds */ public static void shutdown(long timeout) { - if (!shutdown.compareAndSet(false, true)) { + if (!SHUTDOWN.compareAndSet(false, true)) { return; } try { @@ -154,7 +154,7 @@ public static void shutdown(long timeout) { OltpTraverser.destroy(); } catch (Throwable e) { LOG.error("Error while shutdown", e); - shutdown.compareAndSet(true, false); + SHUTDOWN.compareAndSet(true, false); throw new HugeException("Failed to shutdown", e); } @@ -162,6 +162,6 @@ public static void shutdown(long timeout) { } public static void removeShutdownHook() { - Runtime.getRuntime().removeShutdownHook(shutdownHook); + Runtime.getRuntime().removeShutdownHook(SHUTDOWN_HOOK); } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java index 69e495f56d..1e93542124 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java @@ -63,126 +63,183 @@ */ public interface HugeGraph extends Graph { - public HugeGraph hugegraph(); - - public SchemaManager schema(); - - public Id getNextId(HugeType type); - - public Id addPropertyKey(PropertyKey key); - public Id removePropertyKey(Id key); - public Id clearPropertyKey(PropertyKey propertyKey); - public Collection propertyKeys(); - public PropertyKey propertyKey(String key); - public PropertyKey propertyKey(Id key); - public boolean existsPropertyKey(String key); - - public void addVertexLabel(VertexLabel vertexLabel); - public Id removeVertexLabel(Id label); - public Collection vertexLabels(); - public VertexLabel vertexLabel(String label); - public VertexLabel vertexLabel(Id label); - public VertexLabel vertexLabelOrNone(Id id); - public boolean existsVertexLabel(String label); - public boolean existsLinkLabel(Id vertexLabel); - - public void addEdgeLabel(EdgeLabel edgeLabel); - public Id removeEdgeLabel(Id label); - public Collection edgeLabels(); - public EdgeLabel edgeLabel(String label); - public EdgeLabel edgeLabel(Id label); - public EdgeLabel edgeLabelOrNone(Id label); - public boolean existsEdgeLabel(String label); - - public void addIndexLabel(SchemaLabel schemaLabel, IndexLabel indexLabel); - public Id removeIndexLabel(Id label); - public Id rebuildIndex(SchemaElement schema); - public Collection indexLabels(); - public IndexLabel indexLabel(String label); - public IndexLabel indexLabel(Id id); - public boolean existsIndexLabel(String label); + HugeGraph hugegraph(); + + SchemaManager schema(); + + Id getNextId(HugeType type); + + Id addPropertyKey(PropertyKey key); + + Id removePropertyKey(Id key); + + Id clearPropertyKey(PropertyKey propertyKey); + + Collection propertyKeys(); + + PropertyKey propertyKey(String key); + + PropertyKey propertyKey(Id key); + + boolean existsPropertyKey(String key); + + void addVertexLabel(VertexLabel vertexLabel); + + Id removeVertexLabel(Id label); + + Collection vertexLabels(); + + VertexLabel vertexLabel(String label); + + VertexLabel vertexLabel(Id label); + + VertexLabel vertexLabelOrNone(Id id); + + boolean existsVertexLabel(String label); + + boolean existsLinkLabel(Id vertexLabel); + + void addEdgeLabel(EdgeLabel edgeLabel); + + Id removeEdgeLabel(Id label); + + Collection edgeLabels(); + + EdgeLabel edgeLabel(String label); + + EdgeLabel edgeLabel(Id label); + + EdgeLabel edgeLabelOrNone(Id label); + + boolean existsEdgeLabel(String label); + + void addIndexLabel(SchemaLabel schemaLabel, IndexLabel indexLabel); + + Id removeIndexLabel(Id label); + + Id rebuildIndex(SchemaElement schema); + + Collection indexLabels(); + + IndexLabel indexLabel(String label); + + IndexLabel indexLabel(Id id); + + boolean existsIndexLabel(String label); @Override - public Vertex addVertex(Object... keyValues); - public void removeVertex(Vertex vertex); - public void removeVertex(String label, Object id); - public void addVertexProperty(VertexProperty property); - public void removeVertexProperty(VertexProperty property); - - public Edge addEdge(Edge edge); - public void canAddEdge(Edge edge); - public void removeEdge(Edge edge); - public void removeEdge(String label, Object id); - public void addEdgeProperty(Property property); - public void removeEdgeProperty(Property property); - - public Vertex vertex(Object object); + Vertex addVertex(Object... keyValues); + + void removeVertex(Vertex vertex); + + void removeVertex(String label, Object id); + + void addVertexProperty(VertexProperty property); + + void removeVertexProperty(VertexProperty property); + + Edge addEdge(Edge edge); + + void canAddEdge(Edge edge); + + void removeEdge(Edge edge); + + void removeEdge(String label, Object id); + + void addEdgeProperty(Property property); + + void removeEdgeProperty(Property property); + + Vertex vertex(Object object); + @Override - public Iterator vertices(Object... objects); - public Iterator vertices(Query query); - public Iterator adjacentVertex(Object id); - public boolean checkAdjacentVertexExist(); + Iterator vertices(Object... objects); + + Iterator vertices(Query query); + + Iterator adjacentVertex(Object id); + + boolean checkAdjacentVertexExist(); + + Edge edge(Object object); - public Edge edge(Object object); @Override - public Iterator edges(Object... objects); - public Iterator edges(Query query); - public Iterator adjacentVertices(Iterator edges) ; - public Iterator adjacentEdges(Id vertexId); + Iterator edges(Object... objects); + + Iterator edges(Query query); + + Iterator adjacentVertices(Iterator edges); + + Iterator adjacentEdges(Id vertexId); - public Number queryNumber(Query query); + Number queryNumber(Query query); - public String name(); - public String backend(); - public String backendVersion(); - public BackendStoreSystemInfo backendStoreSystemInfo(); - public BackendFeatures backendStoreFeatures(); + String name(); - public GraphMode mode(); - public void mode(GraphMode mode); + String backend(); - public GraphReadMode readMode(); - public void readMode(GraphReadMode readMode); + String backendVersion(); - public void waitStarted(); - public void serverStarted(Id serverId, NodeRole serverRole); - public boolean started(); - public boolean closed(); + BackendStoreSystemInfo backendStoreSystemInfo(); - public T metadata(HugeType type, String meta, Object... args); + BackendFeatures backendStoreFeatures(); - public void initBackend(); - public void clearBackend(); - public void truncateBackend(); + GraphMode mode(); - public void createSnapshot(); - public void resumeSnapshot(); + void mode(GraphMode mode); - public void create(String configPath, Id server, NodeRole role); - public void drop(); + GraphReadMode readMode(); - public HugeConfig cloneConfig(String newGraph); + void readMode(GraphReadMode readMode); + + void waitStarted(); + + void serverStarted(Id serverId, NodeRole serverRole); + + boolean started(); + + boolean closed(); + + T metadata(HugeType type, String meta, Object... args); + + void initBackend(); + + void clearBackend(); + + void truncateBackend(); + + void createSnapshot(); + + void resumeSnapshot(); + + void create(String configPath, Id server, NodeRole role); + + void drop(); + + HugeConfig cloneConfig(String newGraph); @Override - public HugeFeatures features(); + HugeFeatures features(); + + AuthManager authManager(); + + void switchAuthManager(AuthManager authManager); + + TaskScheduler taskScheduler(); - public AuthManager authManager(); - public void switchAuthManager(AuthManager authManager); - public TaskScheduler taskScheduler(); - public RaftGroupManager raftGroupManager(String group); + RaftGroupManager raftGroupManager(String group); - public void proxy(HugeGraph graph); + void proxy(HugeGraph graph); - public boolean sameAs(HugeGraph graph); + boolean sameAs(HugeGraph graph); - public long now(); + long now(); - public V option(TypedOption option); + V option(TypedOption option); - public void registerRpcServices(RpcServiceConfig4Server serverConfig, - RpcServiceConfig4Client clientConfig); + void registerRpcServices(RpcServiceConfig4Server serverConfig,RpcServiceConfig4Client clientConfig); - public default List mapPkId2Name(Collection ids) { + default List mapPkId2Name(Collection ids) { List names = new ArrayList<>(ids.size()); for (Id id : ids) { SchemaElement schema = this.propertyKey(id); @@ -191,7 +248,7 @@ public default List mapPkId2Name(Collection ids) { return names; } - public default List mapVlId2Name(Collection ids) { + default List mapVlId2Name(Collection ids) { List names = new ArrayList<>(ids.size()); for (Id id : ids) { SchemaElement schema = this.vertexLabel(id); @@ -200,7 +257,7 @@ public default List mapVlId2Name(Collection ids) { return names; } - public default List mapElId2Name(Collection ids) { + default List mapElId2Name(Collection ids) { List names = new ArrayList<>(ids.size()); for (Id id : ids) { SchemaElement schema = this.edgeLabel(id); @@ -209,7 +266,7 @@ public default List mapElId2Name(Collection ids) { return names; } - public default List mapIlId2Name(Collection ids) { + default List mapIlId2Name(Collection ids) { List names = new ArrayList<>(ids.size()); for (Id id : ids) { SchemaElement schema = this.indexLabel(id); @@ -218,7 +275,7 @@ public default List mapIlId2Name(Collection ids) { return names; } - public default List mapPkName2Id(Collection pkeys) { + default List mapPkName2Id(Collection pkeys) { List ids = new ArrayList<>(pkeys.size()); for (String pkey : pkeys) { PropertyKey propertyKey = this.propertyKey(pkey); @@ -227,7 +284,7 @@ public default List mapPkName2Id(Collection pkeys) { return ids; } - public default Id[] mapElName2Id(String[] edgeLabels) { + default Id[] mapElName2Id(String[] edgeLabels) { Id[] ids = new Id[edgeLabels.length]; for (int i = 0; i < edgeLabels.length; i++) { EdgeLabel edgeLabel = this.edgeLabel(edgeLabels[i]); @@ -236,7 +293,7 @@ public default Id[] mapElName2Id(String[] edgeLabels) { return ids; } - public default Id[] mapVlName2Id(String[] vertexLabels) { + default Id[] mapVlName2Id(String[] vertexLabels) { Id[] ids = new Id[vertexLabels.length]; for (int i = 0; i < vertexLabels.length; i++) { VertexLabel vertexLabel = this.vertexLabel(vertexLabels[i]); @@ -245,7 +302,7 @@ public default Id[] mapVlName2Id(String[] vertexLabels) { return ids; } - public static void registerTraversalStrategies(Class clazz) { + static void registerTraversalStrategies(Class clazz) { TraversalStrategies strategies = null; strategies = TraversalStrategies.GlobalCache .getStrategies(Graph.class) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java index e307415635..c9853c90a0 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java @@ -38,38 +38,55 @@ */ public interface HugeGraphParams { - public HugeGraph graph(); - public String name(); - public GraphMode mode(); - public GraphReadMode readMode(); + HugeGraph graph(); - public SchemaTransaction schemaTransaction(); - public GraphTransaction systemTransaction(); - public GraphTransaction graphTransaction(); + String name(); - public GraphTransaction openTransaction(); - public void closeTx(); + GraphMode mode(); - public boolean started(); - public boolean closed(); - public boolean initialized(); - public BackendFeatures backendStoreFeatures(); + GraphReadMode readMode(); - public BackendStore loadSchemaStore(); - public BackendStore loadGraphStore(); - public BackendStore loadSystemStore(); + SchemaTransaction schemaTransaction(); - public EventHub schemaEventHub(); - public EventHub graphEventHub(); - public EventHub indexEventHub(); + GraphTransaction systemTransaction(); - public HugeConfig configuration(); + GraphTransaction graphTransaction(); - public ServerInfoManager serverManager(); + GraphTransaction openTransaction(); - public AbstractSerializer serializer(); - public Analyzer analyzer(); - public RateLimiter writeRateLimiter(); - public RateLimiter readRateLimiter(); - public RamTable ramtable(); + void closeTx(); + + boolean started(); + + boolean closed(); + + boolean initialized(); + + BackendFeatures backendStoreFeatures(); + + BackendStore loadSchemaStore(); + + BackendStore loadGraphStore(); + + BackendStore loadSystemStore(); + + EventHub schemaEventHub(); + + EventHub graphEventHub(); + + EventHub indexEventHub(); + + HugeConfig configuration(); + + ServerInfoManager serverManager(); + + AbstractSerializer serializer(); + + Analyzer analyzer(); + + RateLimiter writeRateLimiter(); + + RateLimiter readRateLimiter(); + + RamTable ramtable(); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java index 1336fd98d4..2b6d0f333d 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java @@ -112,26 +112,26 @@ public class StandardHugeGraph implements HugeGraph { public static final Class[] PROTECT_CLASSES = { - StandardHugeGraph.class, - StandardHugeGraph.StandardHugeGraphParams.class, - TinkerPopTransaction.class, - StandardHugeGraph.Txs.class, - StandardHugeGraph.SysTransaction.class + StandardHugeGraph.class, + StandardHugeGraph.StandardHugeGraphParams.class, + TinkerPopTransaction.class, + StandardHugeGraph.Txs.class, + StandardHugeGraph.SysTransaction.class }; public static final Set> ALLOWED_CONFIGS = ImmutableSet.of( - CoreOptions.TASK_WAIT_TIMEOUT, - CoreOptions.TASK_SYNC_DELETION, - CoreOptions.TASK_TTL_DELETE_BATCH, - CoreOptions.TASK_INPUT_SIZE_LIMIT, - CoreOptions.TASK_RESULT_SIZE_LIMIT, - CoreOptions.OLTP_CONCURRENT_THREADS, - CoreOptions.OLTP_CONCURRENT_DEPTH, - CoreOptions.OLTP_COLLECTION_TYPE, - CoreOptions.VERTEX_DEFAULT_LABEL, - CoreOptions.VERTEX_ENCODE_PK_NUMBER, - CoreOptions.STORE_GRAPH, - CoreOptions.STORE + CoreOptions.TASK_WAIT_TIMEOUT, + CoreOptions.TASK_SYNC_DELETION, + CoreOptions.TASK_TTL_DELETE_BATCH, + CoreOptions.TASK_INPUT_SIZE_LIMIT, + CoreOptions.TASK_RESULT_SIZE_LIMIT, + CoreOptions.OLTP_CONCURRENT_THREADS, + CoreOptions.OLTP_CONCURRENT_DEPTH, + CoreOptions.OLTP_COLLECTION_TYPE, + CoreOptions.VERTEX_DEFAULT_LABEL, + CoreOptions.VERTEX_ENCODE_PK_NUMBER, + CoreOptions.STORE_GRAPH, + CoreOptions.STORE ); private static final Logger LOG = Log.logger(HugeGraph.class); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/AuthManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/AuthManager.java index c10e11a099..7dddc8d58c 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/AuthManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/AuthManager.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Set; - import javax.security.sasl.AuthenticationException; import com.baidu.hugegraph.auth.SchemaDefine.AuthElement; @@ -29,63 +28,101 @@ public interface AuthManager { - public boolean close(); - - public Id createUser(HugeUser user); - public Id updateUser(HugeUser user); - public HugeUser deleteUser(Id id); - public HugeUser findUser(String name); - public HugeUser getUser(Id id); - public List listUsers(List ids); - public List listAllUsers(long limit); - - public Id createGroup(HugeGroup group); - public Id updateGroup(HugeGroup group); - public HugeGroup deleteGroup(Id id); - public HugeGroup getGroup(Id id); - public List listGroups(List ids); - public List listAllGroups(long limit); - - public Id createTarget(HugeTarget target); - public Id updateTarget(HugeTarget target); - public HugeTarget deleteTarget(Id id); - public HugeTarget getTarget(Id id); - public List listTargets(List ids); - public List listAllTargets(long limit); - - public Id createBelong(HugeBelong belong); - public Id updateBelong(HugeBelong belong); - public HugeBelong deleteBelong(Id id); - public HugeBelong getBelong(Id id); - public List listBelong(List ids); - public List listAllBelong(long limit); - public List listBelongByUser(Id user, long limit); - public List listBelongByGroup(Id group, long limit); - - public Id createAccess(HugeAccess access); - public Id updateAccess(HugeAccess access); - public HugeAccess deleteAccess(Id id); - public HugeAccess getAccess(Id id); - public List listAccess(List ids); - public List listAllAccess(long limit); - public List listAccessByGroup(Id group, long limit); - public List listAccessByTarget(Id target, long limit); - - public Id createProject(HugeProject project); - public HugeProject deleteProject(Id id); - public Id updateProject(HugeProject project); - public Id projectAddGraphs(Id id, Set graphs); - public Id projectRemoveGraphs(Id id, Set graphs); - public HugeProject getProject(Id id); - public List listAllProject(long limit); - - public HugeUser matchUser(String name, String password); - public RolePermission rolePermission(AuthElement element); - - public String loginUser(String username, String password) - throws AuthenticationException; - public void logoutUser(String token); - - public UserWithRole validateUser(String username, String password); - public UserWithRole validateUser(String token); + boolean close(); + + Id createUser(HugeUser user); + + Id updateUser(HugeUser user); + + HugeUser deleteUser(Id id); + + HugeUser findUser(String name); + + HugeUser getUser(Id id); + + List listUsers(List ids); + + List listAllUsers(long limit); + + Id createGroup(HugeGroup group); + + Id updateGroup(HugeGroup group); + + HugeGroup deleteGroup(Id id); + + HugeGroup getGroup(Id id); + + List listGroups(List ids); + + List listAllGroups(long limit); + + Id createTarget(HugeTarget target); + + Id updateTarget(HugeTarget target); + + HugeTarget deleteTarget(Id id); + + HugeTarget getTarget(Id id); + + List listTargets(List ids); + + List listAllTargets(long limit); + + Id createBelong(HugeBelong belong); + + Id updateBelong(HugeBelong belong); + + HugeBelong deleteBelong(Id id); + + HugeBelong getBelong(Id id); + + List listBelong(List ids); + + List listAllBelong(long limit); + + List listBelongByUser(Id user, long limit); + + List listBelongByGroup(Id group, long limit); + + Id createAccess(HugeAccess access); + + Id updateAccess(HugeAccess access); + + HugeAccess deleteAccess(Id id); + + HugeAccess getAccess(Id id); + + List listAccess(List ids); + + List listAllAccess(long limit); + + List listAccessByGroup(Id group, long limit); + + List listAccessByTarget(Id target, long limit); + + Id createProject(HugeProject project); + + HugeProject deleteProject(Id id); + + Id updateProject(HugeProject project); + + Id projectAddGraphs(Id id, Set graphs); + + Id projectRemoveGraphs(Id id, Set graphs); + + HugeProject getProject(Id id); + + List listAllProject(long limit); + + HugeUser matchUser(String name, String password); + + RolePermission rolePermission(AuthElement element); + + String loginUser(String username, String password) throws AuthenticationException; + + void logoutUser(String token); + + UserWithRole validateUser(String username, String password); + + UserWithRole validateUser(String token); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/EntityManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/EntityManager.java index c4b668e619..0ff8c0ca2c 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/EntityManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/EntityManager.java @@ -73,7 +73,7 @@ private HugeGraph graph() { } private String unhideLabel() { - return Hidden.unHide(this.label) ; + return Hidden.unHide(this.label); } public Id add(T entity) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RelationshipManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RelationshipManager.java index 1fb3232fd5..667927d026 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RelationshipManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RelationshipManager.java @@ -77,7 +77,7 @@ private HugeGraph graph() { } private String unhideLabel() { - return Hidden.unHide(this.label) ; + return Hidden.unHide(this.label); } public Id add(T relationship) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/SchemaDefine.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/SchemaDefine.java index 3ffc1d883a..dd3535021a 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/SchemaDefine.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/SchemaDefine.java @@ -116,7 +116,7 @@ protected static String unhideField(String label, String key) { return Hidden.unHide(label) + "_" + key; } - public static abstract class AuthElement implements Serializable { + public abstract static class AuthElement implements Serializable { private static final long serialVersionUID = 8746691160192814973L; @@ -241,7 +241,7 @@ protected Object[] asArray(List list) { } // NOTE: travis-ci fails if class Entity implements Nameable - public static abstract class Entity extends AuthElement + public abstract static class Entity extends AuthElement implements com.baidu.hugegraph.type.Nameable { private static final long serialVersionUID = 4113319546914811762L; @@ -270,14 +270,16 @@ public String idString() { } } - public static abstract class Relationship extends AuthElement { + public abstract static class Relationship extends AuthElement { private static final long serialVersionUID = -1406157381685832493L; public abstract String sourceLabel(); + public abstract String targetLabel(); public abstract Id source(); + public abstract Id target(); public static T fromEdge(Edge edge, diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java index eb064f14d0..fa397862f4 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java @@ -55,11 +55,11 @@ public final class CachedGraphTransaction extends GraphTransaction { - private final static int MAX_CACHE_PROPS_PER_VERTEX = 10000; - private final static int MAX_CACHE_EDGES_PER_QUERY = 100; - private final static float DEFAULT_LEVEL_RATIO = 0.001f; - private final static long AVG_VERTEX_ENTRY_SIZE = 40L; - private final static long AVG_EDGE_ENTRY_SIZE = 100L; + private static final int MAX_CACHE_PROPS_PER_VERTEX = 10000; + private static final int MAX_CACHE_EDGES_PER_QUERY = 100; + private static final float DEFAULT_LEVEL_RATIO = 0.001f; + private static final long AVG_VERTEX_ENTRY_SIZE = 40L; + private static final long AVG_EDGE_ENTRY_SIZE = 100L; private final Cache verticesCache; private final Cache edgesCache; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java index a890410e47..993809750b 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java @@ -51,7 +51,7 @@ public class OffheapCache extends AbstractCache { - private final static long VALUE_SIZE_TO_SKIP = 100 * Bytes.KB; + private static final long VALUE_SIZE_TO_SKIP = 100 * Bytes.KB; private final OHCache cache; private final HugeGraph graph; @@ -128,7 +128,7 @@ protected boolean write(Id id, Object value, long timeOffset) { long expireTime = this.expire(); boolean success; if (expireTime <= 0L) { - success = this.cache.put(id, serializedValue); + success = this.cache.put(id, serializedValue); } else { expireTime += now() + timeOffset; /* diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/EdgeId.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/EdgeId.java index 60a5aa7194..f7a98d69ed 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/EdgeId.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/EdgeId.java @@ -38,11 +38,11 @@ public class EdgeId implements Id { public static final HugeKeys[] KEYS = new HugeKeys[] { - HugeKeys.OWNER_VERTEX, - HugeKeys.DIRECTION, - HugeKeys.LABEL, - HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX + HugeKeys.OWNER_VERTEX, + HugeKeys.DIRECTION, + HugeKeys.LABEL, + HugeKeys.SORT_VALUES, + HugeKeys.OTHER_VERTEX }; private final Id ownerVertexId; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java index 1858fb4c0b..3ab42ee77e 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java @@ -36,19 +36,19 @@ public abstract class IdGenerator { public abstract Id generate(HugeVertex vertex); - public final static Id of(String id) { + public static final Id of(String id) { return new StringId(id); } - public final static Id of(UUID id) { + public static final Id of(UUID id) { return new UuidId(id); } - public final static Id of(String id, boolean uuid) { + public static final Id of(String id, boolean uuid) { return uuid ? new UuidId(id) : new StringId(id); } - public final static Id of(long id) { + public static final Id of(long id) { return new LongId(id); } @@ -65,7 +65,7 @@ public static Id of(Object id) { return new ObjectId(id); } - public final static Id of(byte[] bytes, IdType type) { + public static final Id of(byte[] bytes, IdType type) { switch (type) { case LONG: return new LongId(bytes); @@ -78,7 +78,7 @@ public final static Id of(byte[] bytes, IdType type) { } } - public final static Id ofStoredString(String id, IdType type) { + public static final Id ofStoredString(String id, IdType type) { switch (type) { case LONG: return of(LongEncoding.decodeSignedB64(id)); @@ -92,7 +92,7 @@ public final static Id ofStoredString(String id, IdType type) { } } - public final static String asStoredString(Id id) { + public static final String asStoredString(Id id) { switch (id.type()) { case LONG: return LongEncoding.encodeSignedB64(id.asLong()); @@ -105,7 +105,7 @@ public final static String asStoredString(Id id) { } } - public final static IdType idType(Id id) { + public static final IdType idType(Id id) { if (id instanceof LongId) { return IdType.LONG; } @@ -121,7 +121,7 @@ public final static IdType idType(Id id) { return IdType.UNKNOWN; } - private final static int compareType(Id id1, Id id2) { + private static final int compareType(Id id1, Id id2) { return idType(id1).ordinal() - idType(id2).ordinal(); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/IdHolder.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/IdHolder.java index fb05714361..c8660a4f71 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/IdHolder.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/IdHolder.java @@ -41,7 +41,7 @@ public abstract class IdHolder { protected boolean exhausted; public IdHolder(Query query) { - E.checkNotNull(query, "query");; + E.checkNotNull(query, "query"); this.query = query; this.exhausted = false; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java index ecf7ac87a2..6608dfefa0 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java @@ -76,8 +76,7 @@ public enum RelationType implements BiPredicate { TEXT_CONTAINS("textcontains", String.class, String.class, (v1, v2) -> { return v1 != null && ((String) v1).contains((String) v2); }), - TEXT_CONTAINS_ANY("textcontainsany", String.class, Collection.class, - (v1, v2) -> { + TEXT_CONTAINS_ANY("textcontainsany", String.class, Collection.class,(v1, v2) -> { assert v2 != null; if (v1 == null) { return false; @@ -389,7 +388,7 @@ public static Condition contains(Id key, Object value) { /** * Condition defines */ - public static abstract class BinCondition extends Condition { + public abstract static class BinCondition extends Condition { private Condition left; private Condition right; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java index a2fda90dad..a85ddade47 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java @@ -208,7 +208,7 @@ public List relations() { return relations; } - public Relation relation(Id key){ + public Relation relation(Id key) { for (Relation r : this.relations()) { if (r.key().equals(key)) { return r; @@ -804,7 +804,7 @@ public boolean validRangeIndex(HugeElement element, Condition cond) { return hasRightValue; } - private static boolean removeValue(Set values, Object value){ + private static boolean removeValue(Set values, Object value) { for (Object compareValue : values) { if (numberEquals(compareValue, value)) { values.remove(compareValue); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java index 103a27f0b7..88304c722a 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java @@ -47,16 +47,14 @@ public class Query implements Cloneable { public static final long COMMIT_BATCH = 500L; public static final long QUERY_BATCH = 100L; - public static final long NO_CAPACITY = -1L; - public static final long DEFAULT_CAPACITY = 800000L; // HugeGraph-777 + public static final long DEFAULT_CAPACITY = 800000L; - private static final ThreadLocal capacityContext = new ThreadLocal<>(); + private static final ThreadLocal CAPACITY_CONTEXT =new ThreadLocal<>(); + private static final Set EMPTY_OLAP_PKS = ImmutableSet.of(); protected static final Query NONE = new Query(HugeType.UNKNOWN); - private static final Set EMPTY_OLAP_PKS = ImmutableSet.of(); - private HugeType resultType; private Map orders; private long offset; @@ -558,17 +556,17 @@ public String toString() { } public static long defaultCapacity(long capacity) { - Long old = capacityContext.get(); - capacityContext.set(capacity); + Long old = CAPACITY_CONTEXT.get(); + CAPACITY_CONTEXT.set(capacity); return old != null ? old : DEFAULT_CAPACITY; } public static long defaultCapacity() { - Long capacity = capacityContext.get(); + Long capacity = CAPACITY_CONTEXT.get(); return capacity != null ? capacity : DEFAULT_CAPACITY; } - public final static void checkForceCapacity(long count) + public static final void checkForceCapacity(long count) throws LimitExceedException { if (count > Query.DEFAULT_CAPACITY) { throw new LimitExceedException( diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryEntryIterator.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryEntryIterator.java index c9817a36a5..c4f87516bf 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryEntryIterator.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryEntryIterator.java @@ -129,7 +129,7 @@ private void removeLastRecord() { ((BinaryBackendEntry) this.current).removeColumn(lastOne); } - public final static long sizeOfEntry(BackendEntry entry) { + public static final long sizeOfEntry(BackendEntry entry) { /* * 3 cases: * 1) one vertex per entry diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinarySerializer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinarySerializer.java index 2393f5a25f..e65911eafb 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinarySerializer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinarySerializer.java @@ -19,11 +19,15 @@ package com.baidu.hugegraph.backend.serializer; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; -import com.baidu.hugegraph.config.HugeConfig; import org.apache.commons.lang.NotImplementedException; +import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.backend.BackendException; import com.baidu.hugegraph.backend.id.EdgeId; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/GraphSerializer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/GraphSerializer.java index 35a96395cf..0d68fc3307 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/GraphSerializer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/GraphSerializer.java @@ -33,19 +33,25 @@ public interface GraphSerializer { - public BackendEntry writeVertex(HugeVertex vertex); - public BackendEntry writeOlapVertex(HugeVertex vertex); - public BackendEntry writeVertexProperty(HugeVertexProperty prop); - public HugeVertex readVertex(HugeGraph graph, BackendEntry entry); + BackendEntry writeVertex(HugeVertex vertex); - public BackendEntry writeEdge(HugeEdge edge); - public BackendEntry writeEdgeProperty(HugeEdgeProperty prop); - public HugeEdge readEdge(HugeGraph graph, BackendEntry entry); + BackendEntry writeOlapVertex(HugeVertex vertex); - public BackendEntry writeIndex(HugeIndex index); - public HugeIndex readIndex(HugeGraph graph, ConditionQuery query, - BackendEntry entry); + BackendEntry writeVertexProperty(HugeVertexProperty prop); - public BackendEntry writeId(HugeType type, Id id); - public Query writeQuery(Query query); + BackendEntry writeEdge(HugeEdge edge); + + BackendEntry writeEdgeProperty(HugeEdgeProperty prop); + + BackendEntry writeIndex(HugeIndex index); + + BackendEntry writeId(HugeType type, Id id); + + HugeVertex readVertex(HugeGraph graph, BackendEntry entry); + + HugeEdge readEdge(HugeGraph graph, BackendEntry entry); + + HugeIndex readIndex(HugeGraph graph, ConditionQuery query,BackendEntry entry); + + Query writeQuery(Query query); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/SchemaSerializer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/SchemaSerializer.java index 9e3bcc4d8a..045f065da8 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/SchemaSerializer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/SchemaSerializer.java @@ -28,15 +28,19 @@ public interface SchemaSerializer { - public BackendEntry writeVertexLabel(VertexLabel vertexLabel); - public VertexLabel readVertexLabel(HugeGraph graph, BackendEntry entry); + BackendEntry writeVertexLabel(VertexLabel vertexLabel); - public BackendEntry writeEdgeLabel(EdgeLabel edgeLabel); - public EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry entry); + VertexLabel readVertexLabel(HugeGraph graph, BackendEntry entry); - public BackendEntry writePropertyKey(PropertyKey propertyKey); - public PropertyKey readPropertyKey(HugeGraph graph, BackendEntry entry); + BackendEntry writeEdgeLabel(EdgeLabel edgeLabel); - public BackendEntry writeIndexLabel(IndexLabel indexLabel); - public IndexLabel readIndexLabel(HugeGraph graph, BackendEntry entry); + EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry entry); + + BackendEntry writePropertyKey(PropertyKey propertyKey); + + PropertyKey readPropertyKey(HugeGraph graph, BackendEntry entry); + + BackendEntry writeIndexLabel(IndexLabel indexLabel); + + IndexLabel readIndexLabel(HugeGraph graph, BackendEntry entry); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java index 2bc2bc75a2..4bcf11d6b4 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java @@ -84,12 +84,15 @@ public boolean equals(Object obj) { public long ttl(); public int columnsSize(); + public Collection columns(); public void columns(Collection columns); + public void columns(BackendColumn... columns); public void merge(BackendEntry other); + public boolean mergeable(BackendEntry other); public void clear(); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendSession.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendSession.java index a340730a40..b04b118334 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendSession.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendSession.java @@ -26,26 +26,30 @@ */ public interface BackendSession { - public void open(); - public void close(); + void open(); + void close(); - public boolean opened(); - public boolean closed(); + boolean opened(); - public Object commit(); + boolean closed(); - public void rollback(); + Object commit(); - public boolean hasChanges(); + void rollback(); - public int attach(); - public int detach(); + boolean hasChanges(); - public long created(); - public long updated(); - public void update(); + int attach(); - public default void reconnectIfNeeded() { + int detach(); + + long created(); + + long updated(); + + void update(); + + default void reconnectIfNeeded() { // pass } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java index eff4e9f02c..63f1d023ea 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java @@ -32,50 +32,57 @@ public interface BackendStore { // Store name - public String store(); + String store(); // Database name - public String database(); + String database(); // Get the parent provider - public BackendStoreProvider provider(); + BackendStoreProvider provider(); // Whether it is the storage of schema - public boolean isSchemaStore(); + boolean isSchemaStore(); // Open/close database - public void open(HugeConfig config); - public void close(); - public boolean opened(); + void open(HugeConfig config); + + void close(); + + boolean opened(); // Initialize/clear database - public void init(); - public void clear(boolean clearSpace); - public boolean initialized(); + void init(); + + void clear(boolean clearSpace); + + boolean initialized(); // Delete all data of database (keep table structure) - public void truncate(); + void truncate(); // Add/delete data - public void mutate(BackendMutation mutation); + void mutate(BackendMutation mutation); // Query data - public Iterator query(Query query); - public Number queryNumber(Query query); + Iterator query(Query query); + + Number queryNumber(Query query); // Transaction - public void beginTx(); - public void commitTx(); - public void rollbackTx(); + void beginTx(); + + void commitTx(); + + void rollbackTx(); // Get metadata by key - public R metadata(HugeType type, String meta, Object[] args); + R metadata(HugeType type, String meta, Object[] args); // Backend features - public BackendFeatures features(); + BackendFeatures features(); // Generate an id for a specific type - public default Id nextId(HugeType type) { + default Id nextId(HugeType type) { final int MAX_TIMES = 1000; // Do get-increase-get-compare operation long counter = 0L; @@ -102,7 +109,7 @@ public default Id nextId(HugeType type) { } // Set next id >= lowest for a specific type - public default void setCounterLowest(HugeType type, long lowest) { + default void setCounterLowest(HugeType type, long lowest) { long current = this.getCounter(type); if (current >= lowest) { return; @@ -111,7 +118,7 @@ public default void setCounterLowest(HugeType type, long lowest) { this.increaseCounter(type, increment); } - public default String olapTableName(HugeType type) { + default String olapTableName(HugeType type) { StringBuilder sb = new StringBuilder(7); sb.append(this.store()) .append("_") @@ -121,52 +128,52 @@ public default String olapTableName(HugeType type) { return sb.toString().toLowerCase(); } - public default String olapTableName(Id id) { + default String olapTableName(Id id) { StringBuilder sb = new StringBuilder(5 + 4); sb.append(this.store()) - .append("_") - .append(HugeType.OLAP.string()) - .append("_") - .append(id.asLong()); + .append("_") + .append(HugeType.OLAP.string()) + .append("_") + .append(id.asLong()); return sb.toString().toLowerCase(); } // Increase next id for specific type - public void increaseCounter(HugeType type, long increment); + void increaseCounter(HugeType type, long increment); // Get current counter for a specific type - public long getCounter(HugeType type); + long getCounter(HugeType type); - public default void createOlapTable(Id pkId) { + default void createOlapTable(Id pkId) { throw new UnsupportedOperationException( "BackendStore.createOlapTable()"); } - public default void checkAndRegisterOlapTable(Id pkId) { + default void checkAndRegisterOlapTable(Id pkId) { throw new UnsupportedOperationException( "BackendStore.checkAndRegisterOlapTable()"); } - public default void clearOlapTable(Id pkId) { + default void clearOlapTable(Id pkId) { throw new UnsupportedOperationException( "BackendStore.clearOlapTable()"); } - public default void removeOlapTable(Id pkId) { + default void removeOlapTable(Id pkId) { throw new UnsupportedOperationException( "BackendStore.removeOlapTable()"); } - public default Map createSnapshot(String snapshotDir) { + default Map createSnapshot(String snapshotDir) { throw new UnsupportedOperationException("createSnapshot"); } - public default void resumeSnapshot(String snapshotDir, + default void resumeSnapshot(String snapshotDir, boolean deleteSnapshot) { throw new UnsupportedOperationException("resumeSnapshot"); } - static enum TxState { + enum TxState { BEGIN, COMMITTING, COMMITT_FAIL, ROLLBACKING, ROLLBACK_FAIL, CLEAN } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreProvider.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreProvider.java index a4027e17ac..3d794d2c9d 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreProvider.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreProvider.java @@ -27,46 +27,45 @@ public interface BackendStoreProvider { // Backend store type - public String type(); + String type(); // Backend store version - public String version(); + String version(); // Graph name (that's database name) - public String graph(); + String graph(); - public BackendStore loadSystemStore(HugeConfig config, String name); + BackendStore loadSystemStore(HugeConfig config, String name); - public BackendStore loadSchemaStore(HugeConfig config, String name); + BackendStore loadSchemaStore(HugeConfig config, String name); - public BackendStore loadGraphStore(HugeConfig config, String name); + BackendStore loadGraphStore(HugeConfig config, String name); + void open(String name); - public void open(String name); + void waitStoreStarted(); - public void waitStoreStarted(); + void close(); - public void close(); + void init(); - public void init(); + void clear(); - public void clear(); + void truncate(); - public void truncate(); + void initSystemInfo(HugeGraph graph); - public void initSystemInfo(HugeGraph graph); + void createSnapshot(); - public void createSnapshot(); + void resumeSnapshot(); - public void resumeSnapshot(); + void listen(EventListener listener); - public void listen(EventListener listener); + void unlisten(EventListener listener); - public void unlisten(EventListener listener); + EventHub storeEventHub(); - public EventHub storeEventHub(); + void onCloneConfig(HugeConfig config, String newGraph); - public void onCloneConfig(HugeConfig config, String newGraph); - - public void onDeleteConfig(HugeConfig config); + void onDeleteConfig(HugeConfig config); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendTable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendTable.java index 334194741d..7126e4a632 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendTable.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendTable.java @@ -122,7 +122,7 @@ public static final String joinTableName(String prefix, String table) { /****************************** ShardSplitter ******************************/ - public static abstract class ShardSplitter { + public abstract static class ShardSplitter { // The min shard size should >= 1M to prevent too many number of shards protected static final int MIN_SHARD_SIZE = (int) Bytes.MB; @@ -220,7 +220,8 @@ public List splitEven(int count) { endKey(this.endKey), 0)); } - byte[] start, end; + byte[] start; + byte[] end; boolean startChanged = false; boolean endChanged = false; int length; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/MetaHandler.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/MetaHandler.java index f19270a450..84a66cc55f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/MetaHandler.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/MetaHandler.java @@ -19,7 +19,7 @@ package com.baidu.hugegraph.backend.store; -public interface MetaHandler { +public interface MetaHandler { - public Object handle(Session session, String meta, Object... args); + Object handle(T session, String meta, Object... args); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java index 9fd2f14764..fd2156a60c 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java @@ -542,7 +542,10 @@ private void addVertex(Id vertex) { if (this.vertices.size() > 0) { lastId = this.vertices.get(this.vertices.size() - 1); } - LOG.info("scan from hbase source {} lastId value: {} compare {} size {}", vertex, lastId, vertex.compareTo(lastId), this.vertices.size()); + + LOG.info("scan from hbase source {} lastId value: {} compare {} size {}", + vertex, lastId, vertex.compareTo(lastId), this.vertices.size()); + if (vertex.compareTo(lastId) < 0) { throw new HugeException("The ramtable feature is not " + "supported by %s backend", diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java index d497cb9e6a..46ea4a688f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java @@ -211,7 +211,7 @@ protected void updateIndex(Id ilId, HugeElement element, boolean removed) { if (property == null) { E.checkState(hasNullableProp(element, fieldId), "Non-null property '%s' is null for '%s'", - this.graph().propertyKey(fieldId) , element); + this.graph().propertyKey(fieldId), element); if (firstNullField == fieldsNum) { firstNullField = allPropValues.size(); } @@ -424,7 +424,7 @@ private IdHolderList queryByLabel(ConditionQuery query) { } ConditionQuery indexQuery; - indexQuery = new ConditionQuery(indexType , query); + indexQuery = new ConditionQuery(indexType, query); indexQuery.eq(HugeKeys.INDEX_LABEL_ID, il.id()); indexQuery.eq(HugeKeys.FIELD_VALUES, label); /* @@ -826,8 +826,8 @@ private MatchedIndex collectMatchedIndex(SchemaLabel schemaLabel, } - private ConditionQuery constructSearchQuery(ConditionQuery query, - MatchedIndex index) { + private ConditionQuery constructSearchQuery(ConditionQuery query,MatchedIndex index) { + ConditionQuery originQuery = query; Set indexFields = new HashSet<>(); // Convert has(key, text) to has(key, textContainsAny(word1, word2)) @@ -1660,7 +1660,7 @@ public Query rootQuery() { public Query asJointQuery() { @SuppressWarnings({ "unchecked", "rawtypes" }) - Collection queries = (Collection) this.values();; + Collection queries = (Collection) this.values(); return new JointQuery(this.rootQuery().resultType(), queries); } @@ -1797,11 +1797,11 @@ private IndexLabel findMatchedIndexLabel(ConditionQuery query, leftIndex) { Set matchedIndexes = this.tx.collectMatchedIndexes(query); for (MatchedIndex index : matchedIndexes) { - for (IndexLabel label : index.indexLabels()){ - if (label.indexField().equals(leftIndex.indexField())){ - return label; - } - } + for (IndexLabel label : index.indexLabels()) { + if (label.indexField().equals(leftIndex.indexField())) { + return label; + } + } } return null; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java index b599da8a5b..c2bebaf28d 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java @@ -611,7 +611,7 @@ public HugeVertex addVertex(HugeVertex vertex) { this.beforeWrite(); this.addedVertices.put(vertex.id(), vertex); this.afterWrite(); - } catch (Throwable e){ + }catch (Throwable e){ this.locksTable.unlock(); throw e; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java index b38caec912..33b89c3612 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java @@ -84,7 +84,7 @@ public class HugeGraphSONModule extends TinkerPopJacksonModule { @SuppressWarnings("rawtypes") private static final Map TYPE_DEFINITIONS; - private static final GraphSONSchemaSerializer schemaSerializer = + private static final GraphSONSchemaSerializer SCHEMA_SERIALIZER = new GraphSONSchemaSerializer(); // NOTE: jackson will synchronize DateFormat @@ -305,7 +305,7 @@ public void serialize(PropertyKey pk, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { - writeEntry(jsonGenerator, schemaSerializer.writePropertyKey(pk)); + writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writePropertyKey(pk)); } } @@ -321,7 +321,7 @@ public void serialize(VertexLabel vl, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { - writeEntry(jsonGenerator, schemaSerializer.writeVertexLabel(vl)); + writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeVertexLabel(vl)); } } @@ -336,7 +336,7 @@ public void serialize(EdgeLabel el, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { - writeEntry(jsonGenerator, schemaSerializer.writeEdgeLabel(el)); + writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeEdgeLabel(el)); } } @@ -352,7 +352,7 @@ public void serialize(IndexLabel il, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { - writeEntry(jsonGenerator, schemaSerializer.writeIndexLabel(il)); + writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeIndexLabel(il)); } } @@ -367,7 +367,7 @@ private static void writeEntry(JsonGenerator jsonGenerator, jsonGenerator.writeEndObject(); } - protected static abstract class HugeElementSerializer + protected abstract static class HugeElementSerializer extends StdSerializer { public HugeElementSerializer(Class clazz) { @@ -410,7 +410,7 @@ public void writePropertiesField(Collection> properties, "Failed to serialize property(%s: %s) " + "for vertex '%s'", key, val, property.element()); } - }; + } // End write properties generator.writeEndObject(); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java index 7770a84f19..c463ede2e9 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java @@ -32,13 +32,13 @@ public class LouvainComputer extends AbstractComputer { public static final String KEY_STABLE_TIMES = "stable_times"; public static final String KEY_PRECISION = "precision"; - public static final String KEY_SHOW_MOD= "show_modularity"; + public static final String KEY_SHOW_MOD = "show_modularity"; public static final String KEY_SHOW_COMM = "show_community"; public static final String KEY_EXPORT_COMM = "export_community"; public static final String KEY_SKIP_ISOLATED = "skip_isolated"; public static final String KEY_CLEAR = "clear"; - public static final long DEFAULT_STABLE_TIMES= 3L; + public static final long DEFAULT_STABLE_TIMES = 3L; private static final int MAX_TIMES = 2048; @Override diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java index beca52e751..ede9a03bb3 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java @@ -74,7 +74,7 @@ public V execute() throws Exception { */ private void deleteExpiredIndex(HugeGraphParams graph, HugeIndex index) { GraphTransaction tx = graph.graphTransaction(); - HugeType type = index.indexLabel().queryType().isVertex()? + HugeType type = index.indexLabel().queryType().isVertex() ? HugeType.VERTEX : HugeType.EDGE; IdQuery query = new IdQuery(type); query.query(index.elementId()); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java index 00b1b73a24..6051a05463 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java @@ -38,11 +38,11 @@ public class HugeGraphGremlinPlugin extends AbstractGremlinPlugin { private static final String PACKAGE = "com.baidu.hugegraph.type.define"; private static final String NAME = "HugeGraph"; - private static final HugeGraphGremlinPlugin instance; - private static final ImportCustomizer imports; + private static final HugeGraphGremlinPlugin INSTANCE; + private static final ImportCustomizer IMPORTS; static { - instance = new HugeGraphGremlinPlugin(); + INSTANCE = new HugeGraphGremlinPlugin(); Iterator classInfos; try { @@ -58,16 +58,16 @@ public class HugeGraphGremlinPlugin extends AbstractGremlinPlugin { // Add entrance class: graph = HugeFactory.open("hugegraph.properties") classes.add(HugeFactory.class); - imports = DefaultImportCustomizer.build() + IMPORTS = DefaultImportCustomizer.build() .addClassImports(classes) .create(); } public HugeGraphGremlinPlugin() { - super(NAME, imports); + super(NAME, IMPORTS); } public static HugeGraphGremlinPlugin instance() { - return instance; + return INSTANCE; } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java index 4e2d3e9cf8..965b5b6fed 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java @@ -431,7 +431,6 @@ private void checkAggregateType() { this.aggregateType, this.name, this.dataType); } - if (this.aggregateType.isNumber() && !this.dataType.isNumber() && !this.dataType.isDate()) { throw new NotAllowException( diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java index fa4aa7f79f..bc5ac13069 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java @@ -49,7 +49,6 @@ public class HugeSecurityManager extends SecurityManager { private static final Set DENIED_PERMISSIONS = ImmutableSet.of( "setSecurityManager" - //"suppressAccessChecks" ); private static final Set ACCEPT_CLASS_LOADERS = ImmutableSet.of( @@ -127,7 +126,7 @@ public class HugeSecurityManager extends SecurityManager { ImmutableSet.of("newSecurityException") ); - private static final Set ignoreCheckedClasses = new CopyOnWriteArraySet<>(); + private static final Set IGNORE_CHECKED_CLASSES =new CopyOnWriteArraySet<>(); public static void ignoreCheckedClass(String clazz) { if (callFromGremlin()) { @@ -135,7 +134,7 @@ public static void ignoreCheckedClass(String clazz) { "Not allowed to add ignore check via Gremlin"); } - ignoreCheckedClasses.add(clazz); + IGNORE_CHECKED_CLASSES.add(clazz); } @Override @@ -489,7 +488,7 @@ private static boolean callFromNewSecurityException() { } private static boolean callFromIgnoreCheckedClass() { - return callFromWorkerWithClass(ignoreCheckedClasses); + return callFromWorkerWithClass(IGNORE_CHECKED_CLASSES); } private static boolean callFromWorkerWithClass(Set classes) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java index c981e7550c..bf60af396d 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java @@ -637,7 +637,7 @@ public static HugeTask fromVertex(Vertex vertex) { private void checkPropertySize(String property, String propertyName) { byte[] bytes = StringEncoding.compress(property); - checkPropertySize(bytes.length, propertyName) ; + checkPropertySize(bytes.length, propertyName); } private void checkPropertySize(int propertyLength, String propertyName) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java index 9b1159d709..8cdaa98fb7 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java @@ -174,7 +174,7 @@ public V call() throws Exception { }; } - public static abstract class SysTaskCallable extends TaskCallable { + public abstract static class SysTaskCallable extends TaskCallable { private HugeGraphParams params = null; diff --git a/pom.xml b/pom.xml index b66f7988e3..600bc4a5eb 100644 --- a/pom.xml +++ b/pom.xml @@ -370,7 +370,6 @@ - From a8d074c5d7da756968f464b015e16b360063365a Mon Sep 17 00:00:00 2001 From: seagle Date: Tue, 19 Apr 2022 10:06:34 +0800 Subject: [PATCH 5/7] improve checkstyle ClassTypeParameterName --- style/checkstyle.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/style/checkstyle.xml b/style/checkstyle.xml index d07aa0ea16..f985007cf6 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -46,10 +46,10 @@ - - - - + + + + From 09320baa6f3df6f74c2822184fb20d9a0a6e19d0 Mon Sep 17 00:00:00 2001 From: seagle Date: Tue, 19 Apr 2022 10:16:27 +0800 Subject: [PATCH 6/7] improve ClassTypeParmeterName check --- style/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/style/checkstyle.xml b/style/checkstyle.xml index f985007cf6..87daf70145 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -47,7 +47,7 @@ - + From 067ac0f2445b12d34d3036c0254c12299da09e4f Mon Sep 17 00:00:00 2001 From: seagle Date: Tue, 19 Apr 2022 15:46:06 +0800 Subject: [PATCH 7/7] fix issue #1830 --- .../com/baidu/hugegraph/backend/store/hbase/HbaseTables.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseTables.java b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseTables.java index 658f7fd5f8..14a108a120 100644 --- a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseTables.java +++ b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseTables.java @@ -208,10 +208,10 @@ public void insert(Session session, BackendEntry entry) { long ttl = entry.ttl(); if (ttl == 0L) { session.put(this.table(), CF, col.name, - BinarySerializer.EMPTY_BYTES, col.value); + BytesBuffer.BYTES_EMPTY, col.value); } else { session.put(this.table(), CF, col.name, - BinarySerializer.EMPTY_BYTES, col.value, ttl); + BytesBuffer.BYTES_EMPTY, col.value, ttl); } }