diff --git a/hugegraph-store/hg-store-cli/src/main/java/org/apache/hugegraph/store/cli/loader/HgThread2DB.java b/hugegraph-store/hg-store-cli/src/main/java/org/apache/hugegraph/store/cli/loader/HgThread2DB.java index 5b388c4a72..f5cb9fe73b 100644 --- a/hugegraph-store/hg-store-cli/src/main/java/org/apache/hugegraph/store/cli/loader/HgThread2DB.java +++ b/hugegraph-store/hg-store-cli/src/main/java/org/apache/hugegraph/store/cli/loader/HgThread2DB.java @@ -465,7 +465,8 @@ private void queryAnd2Queue() { /** * Multi -thread query * - * @param Point Start Query Point, Followed Up According to this PointValue as the next query condition to iterate + * @param Point Start Query Point, Followed Up According to this PointValue as the next + * query condition to iterate * @param Scancount allows the number of threads to start * @throws IOException * @throws InterruptedException diff --git a/hugegraph-store/hg-store-cli/src/main/resources/log4j2.xml b/hugegraph-store/hg-store-cli/src/main/resources/log4j2.xml index 7b62afb0a7..4f595177e1 100644 --- a/hugegraph-store/hg-store-cli/src/main/resources/log4j2.xml +++ b/hugegraph-store/hg-store-cli/src/main/resources/log4j2.xml @@ -26,8 +26,8 @@ - - + + @@ -37,24 +37,24 @@ - - + + - - + + - + - - + + @@ -64,13 +64,13 @@ - + - + - + diff --git a/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScanner.java b/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScanner.java index 5b03bd5d39..d22036c00a 100644 --- a/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScanner.java +++ b/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScanner.java @@ -87,7 +87,8 @@ public KvBatchScanner( /** * Construct a streaming query iterator - * Scanquery for splitting, start multiple streaming requests to enhance the concurrentness of Store + * Scanquery for splitting, start multiple streaming requests to enhance the concurrentness + * of Store * * @param scanQuery scanQuery * @param handler task handler @@ -232,13 +233,18 @@ public boolean isFinished() { * Evaluate the maximum task number */ private void evaluateMaxTaskSize() { - if (maxTaskSize == 0) { // Based on the first batch of tasks, get the number of stores, and then calculate the maximum number of tasks + if (maxTaskSize == + 0) { // Based on the first batch of tasks, get the number of stores, and then + // calculate the maximum number of tasks if (scanQuery.getOrderType() == ScanOrderType.ORDER_STRICT) { - maxTaskSize = 1; // Sort, one stream of each machine, all other streams can be started after all the streams are over + maxTaskSize = + 1; // Sort, one stream of each machine, all other streams can be + // started after all the streams are over } else { maxTaskSize = this.notifier.getScannerCount() * maxTaskSizePerStore; } - maxBatchSize = this.notifier.getScannerCount() * maxBatchSize; // A maximum of 1,000 per machine + maxBatchSize = this.notifier.getScannerCount() * + maxBatchSize; // A maximum of 1,000 per machine /* * Limit less than10000 Start a stream to save network bandwidth @@ -274,7 +280,8 @@ public void splitTask() { // Evaluate the maximum task number evaluateMaxTaskSize(); if (this.notifier.getScannerCount() < this.maxTaskSize) { - splitTask(); // Do not reach the maximum number of tasks, continue to split + splitTask(); // Do not reach the maximum number of tasks, continue to + // split } } this.finished = !prefixItr.hasNext(); diff --git a/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScannerMerger.java b/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScannerMerger.java index 644a881e6d..02ace11621 100644 --- a/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScannerMerger.java +++ b/hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/KvBatchScannerMerger.java @@ -69,9 +69,12 @@ public boolean hasNext() { int waitTime = 0; while (current == null) { try { - // The queue has data, and there is an active query device, and the task is not allocated + // The queue has data, and there is an active query device, and the task is not + // allocated if (queue.size() != 0 || scanners.size() > 0 || !taskSplitter.isFinished()) { - current = queue.poll(1, TimeUnit.SECONDS); // Check whether the client is closed regularly + current = queue.poll(1, + TimeUnit.SECONDS); // Check whether the client is + // closed regularly } else { break; } @@ -179,7 +182,9 @@ public boolean hasNext() { try { int waitTime = 0; Supplier> current; - current = queue.poll(1, TimeUnit.SECONDS); // Check whether the client is closed regularly + current = queue.poll(1, + TimeUnit.SECONDS); // Check whether the client is + // closed regularly if (current == null) { if (++waitTime > maxWaitCount) { break; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java index 8bb058e4c4..b0ba1d9813 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java @@ -48,7 +48,8 @@ public class HeartbeatService implements Lifecycle, PartitionStateListener { private static final int MAX_HEARTBEAT_RETRY_COUNT = 5; // Heartbeat trial number - private static final int REGISTER_RETRY_INTERVAL = 1; // Register the time interval between retry, the unit seconds + private static final int REGISTER_RETRY_INTERVAL = 1; + // Register the time interval between retry, the unit seconds private final HgStoreEngine storeEngine; private final List stateListeners; private final Object partitionThreadLock = new Object(); @@ -123,7 +124,7 @@ public boolean isClusterReady() { /** * There are four types of service status - Be ready,在线、离线、死亡(从集群排除) + * Be ready,在线、离线、死亡(从集群排除) */ protected void doStoreHeartbeat() { while (!terminated) { @@ -170,7 +171,8 @@ protected void doPartitionHeartbeat() { protected void registerStore() { try { - // Register the store, register the PD for the first time to generate ID, and automatically assign value to StoreInfo + // Register the store, register the PD for the first time to generate ID, and + // automatically assign value to StoreInfo this.storeInfo.setStoreAddress(IpUtil.getNearestAddress(options.getGrpcAddress())); this.storeInfo.setRaftAddress(IpUtil.getNearestAddress(options.getRaftAddress())); diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java index 7651b23497..2eb80fcc75 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java @@ -87,7 +87,8 @@ public static HgStoreEngine getInstance() { } /** - * 1. ReadStoreid, register to PD, and register for the first time from PD to generate storeid, store to the local area + * 1. ReadStoreid, register to PD, and register for the first time from PD to generate + * storeid, store to the local area * 2. Successful registry, start Raft service * 3. Send regularlystore heartbeat and partition heartbeat, keep in touch with PD * @@ -288,7 +289,9 @@ private PartitionEngine createPartitionEngine(int groupId, ShardGroup shardGroup if ((engine = partitionEngines.get(groupId)) == null) { engineLocks.computeIfAbsent(groupId, k -> new Object()); synchronized (engineLocks.get(groupId)) { - // Special circumstances during division (the number of partitions in the cluster is different), which will lead to dividing partitions. It may not be on this machine. + // Special circumstances during division (the number of partitions in the cluster + // is different), which will lead to dividing partitions. It may not be on this + // machine. if (conf != null) { var list = conf.listPeers(); list.addAll(conf.listLearners()); @@ -341,7 +344,8 @@ private PartitionEngine createPartitionEngine(int groupId, ShardGroup shardGroup } /** - * Create Raft group, in addition to creating a local Raft Node, it is also necessary to notify other Peer to create Raft Node + * Create Raft group, in addition to creating a local Raft Node, it is also necessary to + * notify other Peer to create Raft Node * 1. Travelpartition.shards * 2, accounting tostoreid to get store information * 3. Establish to OtherStore's RAFT RPC, send StartRaft messages @@ -365,7 +369,8 @@ public PartitionEngine createPartitionGroups(Partition partition) { if (store == null || partitionManager.isLocalStore(store)) { return; } - // Send a message to other Peer and create RAFT grouping.Here is an asynchronous sending + // Send a message to other Peer and create RAFT grouping.Here is an + // asynchronous sending hgCmdClient.createRaftNode(store.getRaftAddress(), List.of(partition), status -> { log.info( @@ -391,7 +396,8 @@ public void destroyPartitionGroups(Partition partition) { if (store == null) { return; } - // Send a message to other Peer and create RAFT grouping.Here is an asynchronous sending + // Send a message to other Peer and create RAFT grouping.Here is an asynchronous + // sending hgCmdClient.destroyRaftNode(store.getRaftAddress(), Arrays.asList(new Partition[]{partition}), status -> { @@ -549,7 +555,8 @@ public List getDataLocations() { * Add toraft task * 1. Checkpartition * 1.1. If not exist, check the PD inquiry partition whether it belongs to the local area - * 1.1.1 if the partition belongs to the local area, then create Raft packets and notify other Stores + * 1.1.1 if the partition belongs to the local area, then create Raft packets and notify + * other Stores * 1.1.2 if partitions are not local, then abnormal * 1.2 ExaminationPartition Is it a leader * 1.2.1 If Yesleader, the task is submitted @@ -569,7 +576,8 @@ public void addRaftTask(String graphName, Integer partId, RaftOperation operatio Partition partition = partitionManager.findPartition(graphName, partId); if (partition != null) { engine = this.createPartitionGroups(partition); - // May migrate, should not be created, put it in the Synchronize body to avoid the later ones + // May migrate, should not be created, put it in the Synchronize body to + // avoid the later ones if (engine != null) { engine.waitForLeader(options.getWaitLeaderTimeout() * 1000); } @@ -588,7 +596,8 @@ public void addRaftTask(String graphName, Integer partId, RaftOperation operatio Store store = partitionManager.getStoreByRaftEndpoint(engine.getShardGroup(), leader.toString()); if (store.getId() == 0) { - // Not found the store information of the leader locally, maybe partition has not yet been synchronized and re -obtain it from the Leader. + // Not found the store information of the leader locally, maybe partition has + // not yet been synchronized and re -obtain it from the Leader. Store leaderStore = hgCmdClient.getStoreInfo(leader.toString()); store = leaderStore != null ? leaderStore : store; log.error("getStoreByRaftEndpoint error store:{}, shard: {}, leader is {}", @@ -702,7 +711,8 @@ public void run(Status status) { } /** - * Partition objectKey range and status change, by actively looking for leaders and then notifying other Follower + * Partition objectKey range and status change, by actively looking for leaders and then + * notifying other Follower */ @Override public UpdatePartitionResponse rangeOrStateChanged(UpdatePartitionRequest request) { diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java index b41e2d085e..1feff71a63 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java @@ -260,7 +260,8 @@ public LogStorage createLogStorage(final String uri, final RaftOptions raftOptio this.raftNode = raftGroupService.start(false); this.raftNode.addReplicatorStateListener(new ReplicatorStateListener()); - // Check whether the Peers returned by the PD is consistent with the local area. If it is not consistent, reset the peerlist + // Check whether the Peers returned by the PD is consistent with the local area. If it is + // not consistent, reset the peerlist if (this.raftNode != null) { // Todo check the peer list, if the peer changes, the reset started = true; @@ -280,7 +281,8 @@ public ShardGroup getShardGroup() { } /** - * 1. Partition migration instructions sent by ReceivePd, add migration tasks to the status machine, and the state is newly built + * 1. Partition migration instructions sent by ReceivePd, add migration tasks to the status + * machine, and the state is newly built * 2. Execute the Status Machine Message, add to the task queue, and execute the task * 3, Relatively New and Oldpeer, find the new and deleted Peer * 4. If there is a new onepeer @@ -364,7 +366,9 @@ public Status changePeers(List peers, final Closure done) { result = HgRaftError.TASK_ERROR.toStatus(); } } else if (snapshotOk) { - result = Status.OK(); // Without Learner, it means that only delete operations are done + result = + Status.OK(); // Without Learner, it means that only delete operations + // are done } } if (result.isOk()) { @@ -563,7 +567,8 @@ public Endpoint waitForLeader(long timeOut) { if (partitionManager.isLocalPartition(this.options.getGroupId())) { log.error("Raft {} leader not found, try to repair!", this.options.getGroupId()); - // TODO judge whether RAFT is the machine, if so, try to repair the leader, including checking whether the configuration is correct + // TODO judge whether RAFT is the machine, if so, try to repair the + // leader, including checking whether the configuration is correct storeEngine.createPartitionGroups( partitionManager.getPartitionList(getGroupId()).get(0)); } @@ -734,7 +739,8 @@ public Status transferLeader(String graphName, Metapb.Shard shard) { * 1. Compared with new and oldpeer to find the new and deleted peer * 2. For the newly addedpeer, add it as a Learner manner * 3. Surveillance snapshot synchronization event - * 4. After the snapshot is synchronized, call Changepers, modify the Learner to the follower, delete the old Peer + * 4. After the snapshot is synchronized, call Changepers, modify the Learner to the + * follower, delete the old Peer */ public void doChangeShard(final MetaTask.Task task, Closure done) { if (!isLeader()) { @@ -757,7 +763,8 @@ public void doChangeShard(final MetaTask.Task task, Closure done) { List peers = partitionManager.shards2Peers(task.getChangeShard().getShardList()); HashSet hashSet = new HashSet<>(peers); - // There is the same peers in the task, indicating that the task itself is wrong, and the task is ignored + // There is the same peers in the task, indicating that the task itself is + // wrong, and the task is ignored if (peers.size() != hashSet.size()) { log.info("Raft {} doChangeShard peer is repeat, peers:{}", getGroupId(), peers); @@ -965,14 +972,16 @@ private Status handleMoveTask(MetaTask.Task task) { } /** - * For the Cleaarence of the Entire Picture Deleted, delete the partition, if there are no other pictures, destroy RAFT Group. + * For the Cleaarence of the Entire Picture Deleted, delete the partition, if there are no + * other pictures, destroy RAFT Group. * NEED to put it to callmove data * - * @param graphName graph name - * @param partitionId partition id - * @param Keystart Key Start is used to verify - * @param Keynd Key END for verification - * @param IsleaderLeader, avoid the leader drift, take the leader status when taking the Move Data + * @param graphName graph name + * @param partitionId partition id + * @param Keystart Key Start is used to verify + * @param Keynd Key END for verification + * @param IsleaderLeader, avoid the leader drift, take the leader status when taking the Move + * Data */ private synchronized void destroyPartitionIfGraphsNull(String graphName, int partitionId, long keyStart, long keyEnd, diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/DefaultDataMover.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/DefaultDataMover.java index f0b21263da..c56658a00d 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/DefaultDataMover.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/DefaultDataMover.java @@ -77,7 +77,8 @@ public Status moveData(Metapb.Partition source, List targets) if (response.getStatus().isOK()) { status = moveData(source, targets, DefaultDataMover::findPartition); - // After the data migration is successful, set up a new partition range and online new partition + // After the data migration is successful, set up a new partition range and online + // new partition for (var target : targets) { if (status.isOk()) { if (!(updatePartitionRange(target, (int) target.getStartKey(), diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdClient.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdClient.java index ff90e3fde5..03697e6061 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdClient.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdClient.java @@ -164,7 +164,8 @@ public HgCmdBase.BaseResponse tryInternalCallSyncWithRpc(HgCmdBase.BaseRequest r } else if (HgCmdProcessor.Status.LEADER_REDIRECT == response.getStatus() && response.partitionLeaders != null ) { - // When returning leader drift and partitionleaders are not empty, you need to reset the leader + // When returning leader drift and partitionleaders are not empty, you + // need to reset the leader } else { log.error( "HgCmdClient tryInternalCallSyncWithRpc error msg {} leaders is {}", diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdProcessor.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdProcessor.java index 6b7e00a3eb..f93c811a31 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdProcessor.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/cmd/HgCmdProcessor.java @@ -34,7 +34,8 @@ import lombok.extern.slf4j.Slf4j; /** - * Spickness SynchronizationRPC processor, after the leader is completed in batches, the newly added KV based on seqnum is sent to Follower in batches. + * Spickness SynchronizationRPC processor, after the leader is completed in batches, the newly + * added KV based on seqnum is sent to Follower in batches. * * @param */ diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/PartitionManager.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/PartitionManager.java index 3b48fbc1ee..823d841685 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/PartitionManager.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/PartitionManager.java @@ -52,7 +52,8 @@ import lombok.extern.slf4j.Slf4j; /** - * Partition Object Management Strategy, requires a cloning portion of each modification, and the version number increasing + * Partition Object Management Strategy, requires a cloning portion of each modification, and the + * version number increasing */ @Slf4j public class PartitionManager extends GlobalMetaStore { @@ -118,9 +119,10 @@ public void addPartitionChangedListener(PartitionChangedListener listener) { /** * Judging the Storage Path as partitionid or partition ID * - * @param detections dir list - * @param partitionId partition id - * @param Checklogdir: WHETHER It Contains A Subdirectory Log (Raft Snapshot and Log separation, you need further inspection) + * @param detections dir list + * @param partitionId partition id + * @param Checklogdir: WHETHER It Contains A Subdirectory Log (Raft Snapshot and Log + * separation, you need further inspection) * @return true if contains partition id, otherwise false */ private Boolean checkPathContains(File[] detections, int partitionId, boolean checkLogDir) { @@ -145,8 +147,10 @@ private Boolean checkPathContains(File[] detections, int partitionId, boolean ch } /** - * According to the Configuration File Root Directory, recycles the storage path of partitioning partition - * According to the AgreementDB data at DataPath/DB/partition ID directory, Raft data in DataPath/Raft/partition ID directory + * According to the Configuration File Root Directory, recycles the storage path of + * partitioning partition + * According to the AgreementDB data at DataPath/DB/partition ID directory, Raft data in + * DataPath/Raft/partition ID directory * Detect whether the storage folder exists */ private Boolean resetPartitionPath(int partitionId) { @@ -269,7 +273,9 @@ private void loadPartitions() { } Partition partition = new Partition(metaPart); - partition.setWorkState(Metapb.PartitionState.PState_Normal); // Start the restoration working status + partition.setWorkState( + Metapb.PartitionState.PState_Normal); // Start the restoration + // working status partitions.get(graph).put(partition.getId(), partition); log.info("load partition : {} -{}", partition.getGraphName(), partition.getId()); @@ -429,7 +435,8 @@ public Partition loadPartitionFromSnapshot(Partition partition) { } /** - * Find The Belonging to this MachinePartiton, first look for it from the local area, not found locally, and ask the PD. + * Find The Belonging to this MachinePartiton, first look for it from the local area, not + * found locally, and ask the PD. * * @param graph * @param partId @@ -473,7 +480,8 @@ public int getPartitionIdByCode(String graph, int code) { } /** - * Frombd obtains the partition information and merge with the local partition information.Leader and Shardlist are taken from local + * Frombd obtains the partition information and merge with the local partition information + * .Leader and Shardlist are taken from local */ public Partition getPartitionFromPD(String graph, int partId) { pdProvider.invalidPartitionCache(graph, partId); @@ -484,7 +492,8 @@ public Partition getPartitionFromPD(String graph, int partId) { if (partitions.containsKey(graph)) { Partition local = partitions.get(graph).get(partId); if (local != null) { - // Update the local key range to ensure the consistency of PD and local partition information + // Update the local key range to ensure the consistency of PD and local + // partition information local.setStartKey(partition.getStartKey()); local.setEndKey(partition.getEndKey()); savePartition(local, true, true); @@ -575,7 +584,9 @@ private void savePartition(Partition partition, Boolean changeLeader, Boolean ch pdProvider.updatePartitionCache(partition, changeLeader); partitionChangedListeners.forEach(listener -> { - listener.onChanged(partition); // Inform RAFT to synchronize the synchronous partition information synchronization + listener.onChanged( + partition); // Inform RAFT to synchronize the synchronous partition + // information synchronization }); } diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/StoreMetadata.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/StoreMetadata.java index 2a65308c32..c1269ede79 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/StoreMetadata.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/StoreMetadata.java @@ -54,7 +54,8 @@ public List getRaftLocations() { } public Store load() { - // In the case of multiple directory storage, create a folder in advance to facilitate the PD -side statistical file storage + // In the case of multiple directory storage, create a folder in advance to facilitate + // the PD -side statistical file storage dataLocations.forEach(path -> { String strPath = Paths.get(path).toAbsolutePath().toString(); File dbFile = new File(strPath); diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/AsyncTask.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/AsyncTask.java index 2083b5f31f..407d47172d 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/AsyncTask.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/AsyncTask.java @@ -20,7 +20,8 @@ public interface AsyncTask { /** - * When you need to check the asynchronous task, check the current state, do the corresponding processing according to the status + * When you need to check the asynchronous task, check the current state, do the + * corresponding processing according to the status */ void handleTask(); diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/CleanTask.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/CleanTask.java index a472d337d2..601e88a994 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/CleanTask.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/asynctask/CleanTask.java @@ -53,7 +53,8 @@ private void cleanTask() { CleanDataRequest request = (CleanDataRequest) getExtra(); var partition = storeEngine.getPartitionManager() .getPartition(getGraphName(), getPartitionId()); - // Only allow data outside the district.Tasks such as retracting will cause interference, and cannot delete partitions + // Only allow data outside the district.Tasks such as retracting will cause + // interference, and cannot delete partitions if (request.getKeyEnd() == partition.getStartKey() && request.getKeyEnd() == partition.getEndKey() && request.getCleanType() == CleanType.CLEAN_TYPE_EXCLUDE_RANGE && diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java index 6577f39dba..6dc602e47c 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java @@ -100,7 +100,8 @@ public static class RaftOptions { */ private final int maxEntriesSize = 256; /** - * After the data of the raft cluster occurs, after the backlog of data, speed limit waiting time unit milliseconds in milliseconds in milliseconds + * After the data of the raft cluster occurs, after the backlog of data, speed limit + * waiting time unit milliseconds in milliseconds in milliseconds **/ private final int overloadRateLimit = 100; private final int keepInMemorySegmentCount = 2; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/pd/DefaultPdProvider.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/pd/DefaultPdProvider.java index 44a8d29081..cd416c810d 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/pd/DefaultPdProvider.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/pd/DefaultPdProvider.java @@ -258,7 +258,8 @@ public boolean startHeartbeatStream(Consumer onError) { public void onNotice(PulseServerNotice response) { PulseResponse content = response.getContent(); - // Message consumption response, can correctly consume messages, call accept to return status code, otherwise do not call accept + // Message consumption response, can correctly consume messages, call accept to + // return status code, otherwise do not call accept Consumer consumer = integer -> { LOG.debug("Partition heartbeat accept instruction: {}", content); // LOG.info("accept notice id : {}, ts:{}", response.getNoticeId(), System diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/raft/RaftOperation.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/raft/RaftOperation.java index 6867dfaad0..7a1480663c 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/raft/RaftOperation.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/raft/RaftOperation.java @@ -46,8 +46,10 @@ public class RaftOperation { public static final byte DB_COMPACTION = 0x67; final static byte[] EMPTY_Bytes = new byte[0]; private static final Logger LOG = LoggerFactory.getLogger(RaftOperation.class); - private byte[] values; // The result of REQ serialization is used to transmit it to other RAFT NODE - private Object req; // Original object, for the treatment of this machine, reduce a back -sequence operation + private byte[] values; + // The result of REQ serialization is used to transmit it to other RAFT NODE + private Object req; + // Original object, for the treatment of this machine, reduce a back -sequence operation private byte op; // Operation type public static RaftOperation create(final byte op) { diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java index 1d15995da7..c5897fb795 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java @@ -56,7 +56,7 @@ private static List getIpAddress() throws SocketException { } /** - ? + * ? * * @param raftAddress raft addr * @return raft addr that have the nearest distance with given param diff --git a/hugegraph-store/hg-store-dist/pom.xml b/hugegraph-store/hg-store-dist/pom.xml index 13df60f0a5..79152da9eb 100644 --- a/hugegraph-store/hg-store-dist/pom.xml +++ b/hugegraph-store/hg-store-dist/pom.xml @@ -101,9 +101,9 @@ + classpathref="maven.plugin.classpath" /> - + tar zcvf \ @@ -119,13 +119,13 @@ - + + message="We only tar package in Linux env, you could check pom.xml in store-dist to modify it" /> diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml index 388d09e2fd..afc827e2d3 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml @@ -28,32 +28,32 @@ - - + + - - + + - - + + - + - - + + @@ -63,24 +63,24 @@ - - + + - - + + - + - - + + @@ -90,25 +90,25 @@ - + - + - - + + - - + + - - + + @@ -117,21 +117,21 @@ - + - + - + - + - - + + diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java index bd7a2a2b33..5d8f36519e 100644 --- a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java +++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java @@ -21,540 +21,637 @@ /** *
- **
+ * *
  * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
  * 
*/ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.39.0)", - comments = "Source: store_stream.proto") + value = "by gRPC proto compiler (version 1.39.0)", + comments = "Source: store_stream.proto") public final class HgStoreStreamGrpc { - private HgStoreStreamGrpc() {} - - public static final String SERVICE_NAME = "HgStoreStream"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getScanMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "Scan", - requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class, - responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getScanMethod() { - io.grpc.MethodDescriptor getScanMethod; - if ((getScanMethod = HgStoreStreamGrpc.getScanMethod) == null) { - synchronized (HgStoreStreamGrpc.class) { + public static final String SERVICE_NAME = "HgStoreStream"; + private static final int METHODID_SCAN_ONE_SHOT = 0; + private static final int METHODID_SCAN_BATCH_ONE_SHOT = 1; + private static final int METHODID_SCAN = 2; + private static final int METHODID_SCAN_BATCH = 3; + private static final int METHODID_SCAN_BATCH2 = 4; + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getScanMethod; + private static volatile io.grpc.MethodDescriptor getScanOneShotMethod; + private static volatile io.grpc.MethodDescriptor getScanBatchMethod; + private static volatile io.grpc.MethodDescriptor getScanBatch2Method; + private static volatile io.grpc.MethodDescriptor getScanBatchOneShotMethod; + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + private HgStoreStreamGrpc() { + } + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "Scan", + requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class, + responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor getScanMethod() { + io.grpc.MethodDescriptor + getScanMethod; if ((getScanMethod = HgStoreStreamGrpc.getScanMethod) == null) { - HgStoreStreamGrpc.getScanMethod = getScanMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Scan")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) - .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("Scan")) - .build(); - } - } - } - return getScanMethod; - } - - private static volatile io.grpc.MethodDescriptor getScanOneShotMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ScanOneShot", - requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class, - responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getScanOneShotMethod() { - io.grpc.MethodDescriptor getScanOneShotMethod; - if ((getScanOneShotMethod = HgStoreStreamGrpc.getScanOneShotMethod) == null) { - synchronized (HgStoreStreamGrpc.class) { + synchronized (HgStoreStreamGrpc.class) { + if ((getScanMethod = HgStoreStreamGrpc.getScanMethod) == null) { + HgStoreStreamGrpc.getScanMethod = getScanMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType( + io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, + "Scan")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) + .setSchemaDescriptor( + new HgStoreStreamMethodDescriptorSupplier( + "Scan")) + .build(); + } + } + } + return getScanMethod; + } + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ScanOneShot", + requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class, + responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getScanOneShotMethod() { + io.grpc.MethodDescriptor + getScanOneShotMethod; if ((getScanOneShotMethod = HgStoreStreamGrpc.getScanOneShotMethod) == null) { - HgStoreStreamGrpc.getScanOneShotMethod = getScanOneShotMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanOneShot")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) - .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanOneShot")) - .build(); - } - } - } - return getScanOneShotMethod; - } - - private static volatile io.grpc.MethodDescriptor getScanBatchMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ScanBatch", - requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, - responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getScanBatchMethod() { - io.grpc.MethodDescriptor getScanBatchMethod; - if ((getScanBatchMethod = HgStoreStreamGrpc.getScanBatchMethod) == null) { - synchronized (HgStoreStreamGrpc.class) { + synchronized (HgStoreStreamGrpc.class) { + if ((getScanOneShotMethod = HgStoreStreamGrpc.getScanOneShotMethod) == null) { + HgStoreStreamGrpc.getScanOneShotMethod = getScanOneShotMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType( + io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, + "ScanOneShot")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) + .setSchemaDescriptor( + new HgStoreStreamMethodDescriptorSupplier( + "ScanOneShot")) + .build(); + } + } + } + return getScanOneShotMethod; + } + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ScanBatch", + requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, + responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor getScanBatchMethod() { + io.grpc.MethodDescriptor + getScanBatchMethod; if ((getScanBatchMethod = HgStoreStreamGrpc.getScanBatchMethod) == null) { - HgStoreStreamGrpc.getScanBatchMethod = getScanBatchMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatch")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) - .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatch")) - .build(); - } - } - } - return getScanBatchMethod; - } - - private static volatile io.grpc.MethodDescriptor getScanBatch2Method; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ScanBatch2", - requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, - responseType = KvStream.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getScanBatch2Method() { - io.grpc.MethodDescriptor getScanBatch2Method; - if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) { - synchronized (HgStoreStreamGrpc.class) { + synchronized (HgStoreStreamGrpc.class) { + if ((getScanBatchMethod = HgStoreStreamGrpc.getScanBatchMethod) == null) { + HgStoreStreamGrpc.getScanBatchMethod = getScanBatchMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType( + io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, + "ScanBatch")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) + .setSchemaDescriptor( + new HgStoreStreamMethodDescriptorSupplier( + "ScanBatch")) + .build(); + } + } + } + return getScanBatchMethod; + } + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ScanBatch2", + requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, + responseType = KvStream.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor getScanBatch2Method() { + io.grpc.MethodDescriptor + getScanBatch2Method; if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) { - HgStoreStreamGrpc.getScanBatch2Method = getScanBatch2Method = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatch2")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - KvStream.getDefaultInstance())) - .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatch2")) - .build(); - } - } - } - return getScanBatch2Method; - } - - private static volatile io.grpc.MethodDescriptor getScanBatchOneShotMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ScanBatchOneShot", - requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, - responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getScanBatchOneShotMethod() { - io.grpc.MethodDescriptor getScanBatchOneShotMethod; - if ((getScanBatchOneShotMethod = HgStoreStreamGrpc.getScanBatchOneShotMethod) == null) { - synchronized (HgStoreStreamGrpc.class) { + synchronized (HgStoreStreamGrpc.class) { + if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) { + HgStoreStreamGrpc.getScanBatch2Method = getScanBatch2Method = + io.grpc.MethodDescriptor.newBuilder() + .setType( + io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, + "ScanBatch2")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + KvStream.getDefaultInstance())) + .setSchemaDescriptor( + new HgStoreStreamMethodDescriptorSupplier( + "ScanBatch2")) + .build(); + } + } + } + return getScanBatch2Method; + } + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ScanBatchOneShot", + requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, + responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getScanBatchOneShotMethod() { + io.grpc.MethodDescriptor + getScanBatchOneShotMethod; if ((getScanBatchOneShotMethod = HgStoreStreamGrpc.getScanBatchOneShotMethod) == null) { - HgStoreStreamGrpc.getScanBatchOneShotMethod = getScanBatchOneShotMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatchOneShot")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) - .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatchOneShot")) - .build(); - } - } - } - return getScanBatchOneShotMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static HgStoreStreamStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public HgStoreStreamStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamStub(channel, callOptions); - } - }; - return HgStoreStreamStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static HgStoreStreamBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public HgStoreStreamBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamBlockingStub(channel, callOptions); - } - }; - return HgStoreStreamBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static HgStoreStreamFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public HgStoreStreamFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamFutureStub(channel, callOptions); + synchronized (HgStoreStreamGrpc.class) { + if ((getScanBatchOneShotMethod = HgStoreStreamGrpc.getScanBatchOneShotMethod) == + null) { + HgStoreStreamGrpc.getScanBatchOneShotMethod = getScanBatchOneShotMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType( + io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, + "ScanBatchOneShot")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance())) + .setSchemaDescriptor( + new HgStoreStreamMethodDescriptorSupplier( + "ScanBatchOneShot")) + .build(); + } + } } - }; - return HgStoreStreamFutureStub.newStub(factory, channel); - } - - /** - *
-   **
-   * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
-   * 
- */ - public static abstract class HgStoreStreamImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver scan( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanMethod(), responseObserver); + return getScanBatchOneShotMethod; } /** + * Creates a new async stub that supports all call types for the service */ - public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanOneShotMethod(), responseObserver); + public static HgStoreStreamStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public HgStoreStreamStub newStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new HgStoreStreamStub(channel, callOptions); + } + }; + return HgStoreStreamStub.newStub(factory, channel); } /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the + * service */ - public io.grpc.stub.StreamObserver scanBatch( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatchMethod(), responseObserver); + public static HgStoreStreamBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public HgStoreStreamBlockingStub newStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new HgStoreStreamBlockingStub(channel, callOptions); + } + }; + return HgStoreStreamBlockingStub.newStub(factory, channel); } /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public io.grpc.stub.StreamObserver scanBatch2( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatch2Method(), responseObserver); + public static HgStoreStreamFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public HgStoreStreamFutureStub newStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new HgStoreStreamFutureStub(channel, callOptions); + } + }; + return HgStoreStreamFutureStub.newStub(factory, channel); + } + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (HgStoreStreamGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor( + new HgStoreStreamFileDescriptorSupplier()) + .addMethod( + getScanMethod()) + .addMethod( + getScanOneShotMethod()) + .addMethod( + getScanBatchMethod()) + .addMethod( + getScanBatch2Method()) + .addMethod( + getScanBatchOneShotMethod()) + .build(); + } + } + } + return result; } /** + *
+     * *
+     * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+     * 
*/ - public void scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanBatchOneShotMethod(), responseObserver); - } + public static abstract class HgStoreStreamImplBase implements io.grpc.BindableService { + + /** + * + */ + public io.grpc.stub.StreamObserver scan( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanMethod(), + responseObserver); + } - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getScanMethod(), - io.grpc.stub.ServerCalls.asyncBidiStreamingCall( - new MethodHandlers< - org.apache.hugegraph.store.grpc.stream.ScanStreamReq, - org.apache.hugegraph.store.grpc.stream.KvPageRes>( - this, METHODID_SCAN))) - .addMethod( - getScanOneShotMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.apache.hugegraph.store.grpc.stream.ScanStreamReq, - org.apache.hugegraph.store.grpc.stream.KvPageRes>( - this, METHODID_SCAN_ONE_SHOT))) - .addMethod( - getScanBatchMethod(), - io.grpc.stub.ServerCalls.asyncBidiStreamingCall( - new MethodHandlers< - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, - org.apache.hugegraph.store.grpc.stream.KvPageRes>( - this, METHODID_SCAN_BATCH))) - .addMethod( - getScanBatch2Method(), - io.grpc.stub.ServerCalls.asyncBidiStreamingCall( - new MethodHandlers< - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, - KvStream>( - this, METHODID_SCAN_BATCH2))) - .addMethod( - getScanBatchOneShotMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, - org.apache.hugegraph.store.grpc.stream.KvPageRes>( - this, METHODID_SCAN_BATCH_ONE_SHOT))) - .build(); - } - } - - /** - *
-   **
-   * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
-   * 
- */ - public static final class HgStoreStreamStub extends io.grpc.stub.AbstractAsyncStub { - private HgStoreStreamStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } + /** + * + */ + public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanOneShotMethod(), + responseObserver); + } - @java.lang.Override - protected HgStoreStreamStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamStub(channel, callOptions); - } + /** + * + */ + public io.grpc.stub.StreamObserver scanBatch( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatchMethod(), + responseObserver); + } - /** - */ - public io.grpc.stub.StreamObserver scan( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( - getChannel().newCall(getScanMethod(), getCallOptions()), responseObserver); - } + /** + * + */ + public io.grpc.stub.StreamObserver scanBatch2( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatch2Method(), + responseObserver); + } - /** - */ - public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request, responseObserver); - } + /** + * + */ + public void scanBatchOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanBatchOneShotMethod(), + responseObserver); + } - /** - */ - public io.grpc.stub.StreamObserver scanBatch( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( - getChannel().newCall(getScanBatchMethod(), getCallOptions()), responseObserver); + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getScanMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + org.apache.hugegraph.store.grpc.stream.ScanStreamReq, + org.apache.hugegraph.store.grpc.stream.KvPageRes>( + this, METHODID_SCAN))) + .addMethod( + getScanOneShotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.apache.hugegraph.store.grpc.stream.ScanStreamReq, + org.apache.hugegraph.store.grpc.stream.KvPageRes>( + this, + METHODID_SCAN_ONE_SHOT))) + .addMethod( + getScanBatchMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, + org.apache.hugegraph.store.grpc.stream.KvPageRes>( + this, + METHODID_SCAN_BATCH))) + .addMethod( + getScanBatch2Method(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, + KvStream>( + this, + METHODID_SCAN_BATCH2))) + .addMethod( + getScanBatchOneShotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq, + org.apache.hugegraph.store.grpc.stream.KvPageRes>( + this, + METHODID_SCAN_BATCH_ONE_SHOT))) + .build(); + } } /** + *
+     * *
+     * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+     * 
*/ - public io.grpc.stub.StreamObserver scanBatch2( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( - getChannel().newCall(getScanBatch2Method(), getCallOptions()), responseObserver); - } + public static final class HgStoreStreamStub extends + io.grpc.stub.AbstractAsyncStub { - /** - */ - public void scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request, responseObserver); - } - } - - /** - *
-   **
-   * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
-   * 
- */ - public static final class HgStoreStreamBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private HgStoreStreamBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } + private HgStoreStreamStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } - @java.lang.Override - protected HgStoreStreamBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamBlockingStub(channel, callOptions); - } + @java.lang.Override + protected HgStoreStreamStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new HgStoreStreamStub(channel, callOptions); + } - /** - */ - public org.apache.hugegraph.store.grpc.stream.KvPageRes scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getScanOneShotMethod(), getCallOptions(), request); - } + /** + * + */ + public io.grpc.stub.StreamObserver scan( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getScanMethod(), getCallOptions()), responseObserver); + } - /** - */ - public org.apache.hugegraph.store.grpc.stream.KvPageRes scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getScanBatchOneShotMethod(), getCallOptions(), request); - } - } - - /** - *
-   **
-   * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
-   * 
- */ - public static final class HgStoreStreamFutureStub extends io.grpc.stub.AbstractFutureStub { - private HgStoreStreamFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } + /** + * + */ + public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request, + responseObserver); + } - @java.lang.Override - protected HgStoreStreamFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new HgStoreStreamFutureStub(channel, callOptions); + /** + * + */ + public io.grpc.stub.StreamObserver scanBatch( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getScanBatchMethod(), getCallOptions()), responseObserver); + } + + /** + * + */ + public io.grpc.stub.StreamObserver scanBatch2( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getScanBatch2Method(), getCallOptions()), + responseObserver); + } + + /** + * + */ + public void scanBatchOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request, + responseObserver); + } } /** + *
+     * *
+     * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+     * 
*/ - public com.google.common.util.concurrent.ListenableFuture scanOneShot( - org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request); + public static final class HgStoreStreamBlockingStub extends + io.grpc.stub.AbstractBlockingStub { + + private HgStoreStreamBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected HgStoreStreamBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new HgStoreStreamBlockingStub(channel, callOptions); + } + + /** + * + */ + public org.apache.hugegraph.store.grpc.stream.KvPageRes scanOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getScanOneShotMethod(), getCallOptions(), request); + } + + /** + * + */ + public org.apache.hugegraph.store.grpc.stream.KvPageRes scanBatchOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getScanBatchOneShotMethod(), getCallOptions(), request); + } } /** + *
+     * *
+     * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+     * 
*/ - public com.google.common.util.concurrent.ListenableFuture scanBatchOneShot( - org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_SCAN_ONE_SHOT = 0; - private static final int METHODID_SCAN_BATCH_ONE_SHOT = 1; - private static final int METHODID_SCAN = 2; - private static final int METHODID_SCAN_BATCH = 3; - private static final int METHODID_SCAN_BATCH2 = 4; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final HgStoreStreamImplBase serviceImpl; - private final int methodId; - - MethodHandlers(HgStoreStreamImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } + public static final class HgStoreStreamFutureStub extends + io.grpc.stub.AbstractFutureStub { - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_SCAN_ONE_SHOT: - serviceImpl.scanOneShot((org.apache.hugegraph.store.grpc.stream.ScanStreamReq) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_SCAN_BATCH_ONE_SHOT: - serviceImpl.scanBatchOneShot((org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } + private HgStoreStreamFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_SCAN: - return (io.grpc.stub.StreamObserver) serviceImpl.scan( - (io.grpc.stub.StreamObserver) responseObserver); - case METHODID_SCAN_BATCH: - return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch( - (io.grpc.stub.StreamObserver) responseObserver); - case METHODID_SCAN_BATCH2: - return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch2( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } + @java.lang.Override + protected HgStoreStreamFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new HgStoreStreamFutureStub(channel, callOptions); + } - private static abstract class HgStoreStreamBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - HgStoreStreamBaseDescriptorSupplier() {} + /** + * + */ + public com.google.common.util.concurrent.ListenableFuture scanOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request); + } - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return HgStoreStreamProto.getDescriptor(); + /** + * + */ + public com.google.common.util.concurrent.ListenableFuture scanBatchOneShot( + org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request); + } } - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("HgStoreStream"); + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + + private final HgStoreStreamImplBase serviceImpl; + private final int methodId; + + MethodHandlers(HgStoreStreamImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SCAN_ONE_SHOT: + serviceImpl.scanOneShot( + (org.apache.hugegraph.store.grpc.stream.ScanStreamReq) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SCAN_BATCH_ONE_SHOT: + serviceImpl.scanBatchOneShot( + (org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SCAN: + return (io.grpc.stub.StreamObserver) serviceImpl.scan( + (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_SCAN_BATCH: + return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch( + (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_SCAN_BATCH2: + return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch2( + (io.grpc.stub.StreamObserver) responseObserver); + default: + throw new AssertionError(); + } + } } - } - private static final class HgStoreStreamFileDescriptorSupplier - extends HgStoreStreamBaseDescriptorSupplier { - HgStoreStreamFileDescriptorSupplier() {} - } + private static abstract class HgStoreStreamBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + + HgStoreStreamBaseDescriptorSupplier() { + } - private static final class HgStoreStreamMethodDescriptorSupplier - extends HgStoreStreamBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return HgStoreStreamProto.getDescriptor(); + } - HgStoreStreamMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("HgStoreStream"); + } } - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); + private static final class HgStoreStreamFileDescriptorSupplier + extends HgStoreStreamBaseDescriptorSupplier { + + HgStoreStreamFileDescriptorSupplier() { + } } - } - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + private static final class HgStoreStreamMethodDescriptorSupplier + extends HgStoreStreamBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (HgStoreStreamGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new HgStoreStreamFileDescriptorSupplier()) - .addMethod(getScanMethod()) - .addMethod(getScanOneShotMethod()) - .addMethod(getScanBatchMethod()) - .addMethod(getScanBatch2Method()) - .addMethod(getScanBatchOneShotMethod()) - .build(); - } - } + private final String methodName; + + HgStoreStreamMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } } - return result; - } } diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java index 7fb363b407..47fa26b17b 100644 --- a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java +++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java @@ -21,58 +21,63 @@ package org.apache.hugegraph.store.grpc.stream; public final class HgStoreStreamProto { - private HgStoreStreamProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_KvStream_descriptor; - static final + static final com.google.protobuf.Descriptors.Descriptor + internal_static_KvStream_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_KvStream_fieldAccessorTable; + internal_static_KvStream_fieldAccessorTable; + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\022store_stream.proto\032\022store_common.proto" + - "\032\027store_stream_meta.proto\"I\n\010KvStream\022\016\n" + - "\006seq_no\030\001 \001(\005\022\014\n\004over\030\002 \001(\010\022\017\n\007version\030\004" + - " \001(\r\022\016\n\006stream\030\005 \001(\0142\205\002\n\rHgStoreStream\022(" + - "\n\004Scan\022\016.ScanStreamReq\032\n.KvPageRes\"\000(\0010\001" + - "\022+\n\013ScanOneShot\022\016.ScanStreamReq\032\n.KvPage" + - "Res\"\000\0222\n\tScanBatch\022\023.ScanStreamBatchReq\032" + - "\n.KvPageRes\"\000(\0010\001\0222\n\nScanBatch2\022\023.ScanSt" + - "reamBatchReq\032\t.KvStream\"\000(\0010\001\0225\n\020ScanBat" + - "chOneShot\022\023.ScanStreamBatchReq\032\n.KvPageR" + - "es\"\000B=\n%org.apache.hugegraph.store.grpc.s" + - "treamB\022HgStoreStreamProtoP\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor(), - org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor(), - }); - internal_static_KvStream_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_KvStream_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_KvStream_descriptor, - new java.lang.String[] { "SeqNo", "Over", "Version", "Stream", }); - org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor(); - org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor(); - } + static { + java.lang.String[] descriptorData = { + "\n\022store_stream.proto\032\022store_common.proto" + + "\032\027store_stream_meta.proto\"I\n\010KvStream\022\016\n" + + "\006seq_no\030\001 \001(\005\022\014\n\004over\030\002 \001" + + "(\010\022\017\n\007version\030\004" + + " \001(\r\022\016\n\006stream\030\005 \001(\0142\205\002\n\rHgStoreStream\022(" + + "\n\004Scan\022\016.ScanStreamReq\032\n.KvPageRes\"\000(\0010\001" + + "\022+\n\013ScanOneShot\022\016.ScanStreamReq\032\n.KvPage" + + "Res\"\000\0222\n\tScanBatch\022\023.ScanStreamBatchReq\032" + + "\n.KvPageRes\"\000(\0010\001\0222\n\nScanBatch2\022\023.ScanSt" + + "reamBatchReq\032\t.KvStream\"\000(\0010\001\0225\n\020ScanBat" + + "chOneShot\022\023.ScanStreamBatchReq\032\n.KvPageR" + + "es\"\000B=\n%org.apache.hugegraph.store.grpc.s" + + "treamB\022HgStoreStreamProtoP\001b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[]{ + org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor(), + org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor(), + }); + internal_static_KvStream_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_KvStream_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_KvStream_descriptor, + new java.lang.String[]{"SeqNo", "Over", "Version", "Stream",}); + org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor(); + org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor(); + } + private HgStoreStreamProto() { + } - // @@protoc_insertion_point(outer_class_scope) + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + + // @@protoc_insertion_point(outer_class_scope) } diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java index 00476ffeb1..c0accbe9d0 100644 --- a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java +++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java @@ -24,7 +24,8 @@ import java.util.function.Consumer; /** - * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten. + * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo + * method needs to be rewritten. */ public final class KvStream extends com.google.protobuf.GeneratedMessageV3 implements @@ -32,6 +33,7 @@ public final class KvStream extends // (message_implements // :KvStream) KvStreamOrBuilder { + public static final int SEQ_NO_FIELD_NUMBER = 1; public static final int OVER_FIELD_NUMBER = 2; public static final int VERSION_FIELD_NUMBER = 4; @@ -71,6 +73,7 @@ private KvStream(com.google.protobuf.GeneratedMessageV3.Builder builder) { private KvStream() { stream_ = ByteBuffer.allocate(0); } + private KvStream( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -479,6 +482,7 @@ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:KvStream) KvStreamOrBuilder { + private int seqNo_; private boolean over_; private int version_; diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java index b848996432..850a93102f 100644 --- a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java +++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java @@ -23,48 +23,56 @@ import java.nio.ByteBuffer; public interface KvStreamOrBuilder extends - // @@protoc_insertion_point(interface_extends:KvStream) - com.google.protobuf.MessageOrBuilder { + // @@protoc_insertion_point(interface_extends:KvStream) + com.google.protobuf.MessageOrBuilder { - /** - *
-   *query times.
-   * 
- * - * int32 seq_no = 1; - * @return The seqNo. - */ - int getSeqNo(); + /** + *
+     * query times.
+     * 
+ * + * int32 seq_no = 1; + * + * @return The seqNo. + */ + int getSeqNo(); - /** - *
-   *true=no more data
-   * 
- * - * bool over = 2; - * @return The over. - */ - boolean getOver(); + /** + *
+     * true=no more data
+     * 
+ * + * bool over = 2; + * + * @return The over. + */ + boolean getOver(); - /** - * uint32 version = 4; - * @return The version. - */ - int getVersion(); + /** + * uint32 version = 4; + * + * @return The version. + */ + int getVersion(); - /** - * bytes stream = 5; - * @return The stream. - */ - ByteBuffer getStream(); - /** - * .KvStreamType type = 6; - * @return The enum numeric value on the wire for type. - */ - int getTypeValue(); - /** - * .KvStreamType type = 6; - * @return The type. - */ - org.apache.hugegraph.store.grpc.stream.KvStreamType getType(); + /** + * bytes stream = 5; + * + * @return The stream. + */ + ByteBuffer getStream(); + + /** + * .KvStreamType type = 6; + * + * @return The enum numeric value on the wire for type. + */ + int getTypeValue(); + + /** + * .KvStreamType type = 6; + * + * @return The type. + */ + org.apache.hugegraph.store.grpc.stream.KvStreamType getType(); } diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java index 9f6310fed0..e8e5e2aa19 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java @@ -43,7 +43,8 @@ public void run() { doSomethingForShutdown(); try { - mainThread.join(); // When receiving a stop signal, wait for the execution of Mainthread to complete + mainThread.join(); // When receiving a stop signal, wait for the execution of + // Mainthread to complete } catch (InterruptedException ignored) { } System.out.println("Shut down complete."); diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java index 25171882eb..34e26e73d1 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java @@ -186,7 +186,8 @@ public void waitFinish(StreamObserver observer, Function, V> ok, long } /** - * SELECT A Wrong Result from Multiple Results to Return, if there is no error, return the first one + * SELECT A Wrong Result from Multiple Results to Return, if there is no error, return the + * first one */ public FeedbackRes selectError(List results) { if (!CollectionUtils.isEmpty(results)) { diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java index 76bac0e052..70a9b2e5d8 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java @@ -127,7 +127,8 @@ public List getGraphLeaderPartitionIds(String graphName) { /** * Add Toraft task, forward data to RAFT * - * @Return true means that the data has ben submitted, False indicates that it is not submitted and used to reduce batch splitting by single copy. + * @Return true means that the data has ben submitted, False indicates that it is not + * submitted and used to reduce batch splitting by single copy. */ public void addRaftTask(byte methodId, String graphName, Integer partitionId, Req req, diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java index 022091c2e1..8fc0e00180 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java @@ -228,7 +228,8 @@ public void batch(BatchReq request, StreamObserver observer) { GraphMode graphMode = graphState.getMode(); if (graphMode != null && graphMode.getNumber() == GraphMode.ReadOnly_VALUE) { - // The state is to get the latest diagram status from the PD when reading. + // The state is to get the latest diagram status from the PD when + // reading. Metapb.Graph pdGraph = pd.getPDClient().getGraph(graph); Metapb.GraphState pdGraphState = @@ -237,13 +238,15 @@ public void batch(BatchReq request, StreamObserver observer) { pdGraphState.getMode() != null && pdGraphState.getMode().getNumber() == GraphMode.ReadOnly_VALUE) { - // Confirm that the current state stored in the PD is also read only, but data is not allowed to insert data + // Confirm that the current state stored in the PD is also read + // only, but data is not allowed to insert data throw new PDException(-1, "the graph space size " + "has " + "reached the threshold"); } - // The PD status is inconsistent with the local cache. The local cache update is the state in the PD + // The PD status is inconsistent with the local cache. The local + // cache update is the state in the PD managerGraph.setProtoObj(pdGraph); } } @@ -277,7 +280,8 @@ public void batch(BatchReq request, StreamObserver observer) { groups.get(id).add(entry); }); } else { - // Inquire the partition ID according to the keycode query, and group the partition ID + // Inquire the partition ID according to the keycode query, and group the + // partition ID Integer partitionId = pd.getPartitionByCode(graph, startKey.getCode()) .getId(); diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java index 52d89fae38..d5b5febcf0 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java @@ -113,7 +113,8 @@ public boolean doTable(int partId, TableMethod method, String graph, String tabl public boolean doGraph(int partId, GraphMethod method, String graph) { boolean flag = true; - if (method == GRAPH_METHOD_DELETE) {// See it to RAFT for execution, there is no handling here + if (method == + GRAPH_METHOD_DELETE) {// See it to RAFT for execution, there is no handling here flag = true; } else { throw new UnsupportedOperationException("GraphMethod: " + method.name()); diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java index d57b2c3527..76ececb872 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java @@ -107,7 +107,9 @@ public boolean hasNext() { while (current == null && tryTimes < waitDataMaxTryTimes) { try { if (queue.size() != 0 || !finished) { - current = queue.poll(100, TimeUnit.MILLISECONDS); // Check whether the client is closed regularly + current = queue.poll(100, + TimeUnit.MILLISECONDS); // Check whether the client is + // closed regularly if (current == null && !finished) { wakeUpScanner(); } @@ -343,7 +345,8 @@ public void scanKV() { if ((entriesSize >= batchSize || bodySize >= maxBodySize) || (orderEdge && bodySize >= maxBodySize / 2)) { if (orderEdge) { - // Sort the side to ensure that all the edges of a point are continuous, prevent other points from inserting + // Sort the side to ensure that all the edges of a point are + // continuous, prevent other points from inserting canNext = putData(dataList, iterator != null && iterator.hasNext()); } else { canNext = putData(dataList); diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java index 7baad38c61..a125d458c9 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java @@ -40,7 +40,8 @@ * Batch Query Processor, query data in batches, and return data. * 1. Server streaming data to the client * 2. The Client Consumes A Batch of Data Per Consumption, returns the batch number to the server - * 3. How Much Data DOES The Server Decide According to the Batch Number to ensure the continuous transmission data, + * 3. How Much Data DOES The Server Decide According to the Batch Number to ensure the continuous + * transmission data, */ @Slf4j public class ScanBatchResponse implements StreamObserver { @@ -50,7 +51,8 @@ public class ScanBatchResponse implements StreamObserver { static ByteBufferAllocator alloc = new ByteBufferAllocator(ParallelScanIterator.maxBodySize * 3 / 2, 1000); private final int maxInFlightCount = PropertyUtil.getInt("app.scan.stream.inflight", 16); - private final int activeTimeout = PropertyUtil.getInt("app.scan.stream.timeout", 60); // Unit seconds + private final int activeTimeout = PropertyUtil.getInt("app.scan.stream.timeout", 60); + // Unit seconds private final StreamObserver sender; private final HgStoreWrapperEx wrapper; private final ThreadPoolExecutor executor; @@ -255,7 +257,9 @@ private State setStateIdle() { } /** - * Check WHETHER It is Active, for more than a certain period of time, the client does not have request data, and it is believed that it is not active and close the connection to release the resource + * Check WHETHER It is Active, for more than a certain period of time, the client does not + * have request data, and it is believed that it is not active and close the connection to + * release the resource */ public void checkActiveTimeout() { if ((System.currentTimeMillis() - activeTime) > activeTimeout * 1000L) { diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java index 883b0d2f3c..8dccfa49d3 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java @@ -81,7 +81,8 @@ public class ScanResponseObserver implements * 2022 November 2nd * 1. ReadRock * 2. Perform the data conversion and send it to the thread of the blocking queueoffer - * 3. Read Data from the blocking queue, and the threads sent, including wake up the thread send of reading and sent without reading the data + * 3. Read Data from the blocking queue, and the threads sent, including wake up the thread + * send of reading and sent without reading the data * */ public ScanResponseObserver(StreamObserver sender, diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java index 0a195c46f3..01d1f6989c 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java @@ -103,7 +103,8 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { client.listen(TIMESTAMP_KEY, (Consumer) o -> { log.info("receive message to restart :" + o); try { - // Prefer to update the latest configuration file, so as not to modify parameters such as port ports and cause old files to be loaded first + // Prefer to update the latest configuration file, so as not to modify + // parameters such as port ports and cause old files to be loaded first ScanPrefixResponse responseNew = client.scanPrefix(CONFIG_PREFIX); Map kvsMapNew = responseNew.getKvsMap(); String config = kvsMapNew.get(CONFIG_FIX_PREFIX); diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java index 098372bee6..b84489e282 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java @@ -33,7 +33,6 @@ import com.codahale.metrics.Counter; import com.codahale.metrics.Meter; import com.codahale.metrics.Snapshot; -import com.codahale.metrics.Timer; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; @@ -214,7 +213,7 @@ private static void registerTimer(String group, String name, com.codahale.metric String baseName = PREFIX + "." + name.toLowerCase(); - Gauge.builder(baseName + ".count", timer, t->t.getCount()) + Gauge.builder(baseName + ".count", timer, t -> t.getCount()) .tags(tags).register(registry); Gauge.builder(baseName + ".min", timer, t -> t.getSnapshot().getMin()) .tags(tags).register(registry); diff --git a/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml b/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml index 379acebbae..08cde7bda7 100644 --- a/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml +++ b/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml @@ -27,31 +27,31 @@ - + - - + + - - + + - + - - + + @@ -61,24 +61,24 @@ - - + + - - + + - + - - + + @@ -88,25 +88,25 @@ - + - + - - + + - - + + - - + + @@ -115,28 +115,28 @@ - + - - + + - - + + - - + + - - + + - - + + diff --git a/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml b/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml index 913ad3f4a1..e7c76fe8db 100644 --- a/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml +++ b/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml @@ -27,31 +27,31 @@ - + - - + + - - + + - + - - + + @@ -61,24 +61,24 @@ - - + + - - + + - + - - + + @@ -88,25 +88,25 @@ - + - + - - + + - - + + - - + + @@ -115,25 +115,25 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgBusinessImplTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgBusinessImplTest.java index 15deaa8462..f89127100b 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgBusinessImplTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgBusinessImplTest.java @@ -38,6 +38,7 @@ import org.junit.Assert; public class HgBusinessImplTest { + static String GRAPH_NAME = "graph_test"; static String[] GRAPH_TABLE = {"table1", "table2"}; diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerOneRaftFakePDTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerOneRaftFakePDTest.java index 7539cb6113..4e9f3be0e0 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerOneRaftFakePDTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerOneRaftFakePDTest.java @@ -38,6 +38,7 @@ * Usefake-PD, supporting RAFT unit test */ public class HgSessionManagerOneRaftFakePDTest { + private static final Map leaderMap = new ConcurrentHashMap<>(); private static final Map storeMap = new ConcurrentHashMap<>(); @@ -147,7 +148,6 @@ public void put_get2() { } - // @Test public void batchGet() { System.out.println("--- test batchGet ---"); @@ -428,7 +428,6 @@ public void scanIterator() { Assert.assertEquals(1000, count); } - // @Test public void truncate() { HgStoreTestUtil.println("--- test truncate ---"); @@ -444,7 +443,6 @@ public void truncate() { HgStoreTestUtil.batchPut(session, tableName2, keyName, 100); Assert.assertEquals(100, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); - session.truncate(); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName))); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftFakePDTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftFakePDTest.java index 9558855ec2..e3251f0468 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftFakePDTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftFakePDTest.java @@ -38,6 +38,7 @@ * Usefake-PD, supporting RAFT unit test */ public class HgSessionManagerRaftFakePDTest { + private static final Map leaderMap = new ConcurrentHashMap<>(); private static final Map storeMap = new ConcurrentHashMap<>(); @@ -189,7 +190,6 @@ public void put_get() { // } // } - // @Test public void batchGet() { System.out.println("--- test batchGet ---"); @@ -595,7 +595,6 @@ public void scanIterator() { Assert.assertEquals(1000, count); } - // @Test public void truncate() { HgStoreTestUtil.println("--- test truncate ---"); @@ -611,7 +610,6 @@ public void truncate() { HgStoreTestUtil.batchPut(session, tableName2, keyName, 100); Assert.assertEquals(100, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); - session.truncate(); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName))); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftPDTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftPDTest.java index 3ae7c5dee1..e84fd8e409 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftPDTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerRaftPDTest.java @@ -50,12 +50,12 @@ import lombok.extern.slf4j.Slf4j; - /** * usepd, support RAFT unit test */ @Slf4j public class HgSessionManagerRaftPDTest { + public final static String GRAPH_NAME_X = "default/hugegraph/x"; public final static String GRAPH_NAME_Y = "default/hugegraph/y"; public final static String GRAPH_NAME_Z = "default/hugegraph/z"; @@ -117,7 +117,6 @@ public void scanPartition() { HgStoreSession session = getStoreSession(); // System.out.println(amountOf(session.scanIterator(TABLE_NAME))); - Iterator iterator = session.scanIterator(HgStoreTestUtil.TABLE_NAME, 0, 65535, HgKvStore.SCAN_HASHCODE, EMPTY_BYTES); System.out.println(HgStoreTestUtil.amountOf(iterator)); @@ -158,7 +157,6 @@ public void put_get_unique() { HgStoreTestUtil.TABLE_NAME, key))); } - @Test public void testBatchPutExt() throws IOException { System.out.println("--- test batchPut ---"); @@ -179,7 +177,6 @@ public void testBatchPutExt() throws IOException { System.out.printf("%d entries have be put into graph %s\n", map.size(), HgStoreTestUtil.GRAPH_NAME); - int count = 0; HgKvIterator iterator = null; iterator = session.scanIterator(HgStoreTestUtil.TABLE_NAME); @@ -191,7 +188,6 @@ public void testBatchPutExt() throws IOException { } - // @Test public void testBatchGetExt() throws IOException, ClassNotFoundException { File outputFile = new File("tmp/batch_put_list"); @@ -712,7 +708,6 @@ public void truncate() { HgStoreTestUtil.batchPut(session, tableName2, keyName, 100); Assert.assertEquals(100, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); - session.truncate(); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName))); Assert.assertEquals(0, HgStoreTestUtil.amountOf(session.scanIterator(tableName2))); @@ -747,13 +742,11 @@ public void scanIteratorHuge() { Assert.assertEquals(amount, count); } - // @Test public void scanTable() { HgStoreSession session = getStoreSession("DEFAULT/hg1/g"); HgStoreTestUtil.println(session.scanIterator("g+v", 10)); - } // @Test @@ -919,7 +912,6 @@ public void benchmark_scanBatch2() throws IOException { log.info(" size is {}", count); log.info("*************************************************"); - } // @Test @@ -976,6 +968,5 @@ public void benchmark_scanBatch_SkipDegree() throws IOException { log.info(" size is {}", count); log.info("*************************************************"); - } } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerTest.java index 31ea350c7d..ac69434ab9 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/HgSessionManagerTest.java @@ -48,6 +48,7 @@ @Slf4j public class HgSessionManagerTest { + private static final Map leaderMap = new ConcurrentHashMap<>(); private static final Map storeMap = new ConcurrentHashMap<>(); @@ -593,7 +594,6 @@ public void paging() { if (count >= max) break; } - iterator = session.scanIterator(tableName , HgStoreTestUtil.toAllPartitionKey(keyName + "-000") , HgStoreClientConst.EMPTY_OWNER_KEY @@ -666,7 +666,6 @@ public void scanBatch() { HgStoreTestUtil.println("-- test scan-batch prefix --"); - iterators = session.scanBatch( HgScanQuery.prefixOf(tableName, prefixList) ); @@ -796,12 +795,10 @@ public void handle_table() { HgStoreTestUtil.toStr(session.get(tableName, key))); Assert.assertTrue(session.existsTable(tableName)); - HgStoreTestUtil.println("-- test dropTable --"); Assert.assertTrue(session.dropTable(tableName)); Assert.assertFalse(session.existsTable(tableName)); - HgStoreTestUtil.println("-- test existsTable --"); Assert.assertFalse(session.existsTable(tableName)); @@ -930,7 +927,6 @@ public void put_Benchmark() { Assert.assertEquals(amount, HgStoreTestUtil.amountOf(session.scanIterator(tableName))); - } //// @Test @@ -1065,7 +1061,6 @@ public void benchmark_scan() { Assert.assertEquals(amount, count); } - //// @Test public void extreme_scan_close() { /*************** test close **************/ diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/PartitionEngineTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/PartitionEngineTest.java index b54377ba2a..d88781d132 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/PartitionEngineTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/PartitionEngineTest.java @@ -39,7 +39,6 @@ public void test() { List oldPeers1 = Arrays.asList("1", "2", "3"); List oldLearner1 = Arrays.asList("4", "5"); - List oldPeers = oldPeers1.stream().map(peer -> peer).collect(Collectors.toList()); oldPeers.addAll( @@ -106,7 +105,6 @@ public void test() { } - // @Test public void testPartition() { Partition p = new Partition(); @@ -139,7 +137,6 @@ public void testUpdateShardsList() { reqShards.add(Metapb.Shard.newBuilder().setStoreId(1004).setRole(Metapb.ShardRole.Leader) .build()); - long leaderStoreId = 0; for (Metapb.Shard shard : curShards) { if (shard.getRole() == Metapb.ShardRole.Leader) { @@ -214,7 +211,6 @@ public void testPriority() { } } - } // @Test diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/UnitTestBase.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/UnitTestBase.java index 86532583e8..8ba3315f89 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/UnitTestBase.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/UnitTestBase.java @@ -22,7 +22,6 @@ import java.util.Map; import org.apache.hugegraph.rocksdb.access.RocksDBFactory; -import org.apache.hugegraph.rocksdb.access.RocksDBOptions; import org.apache.hugegraph.rocksdb.access.RocksDBSession; import org.apache.hugegraph.store.business.BusinessHandler; import org.apache.hugegraph.store.business.BusinessHandlerImpl; @@ -59,7 +58,6 @@ public void initDB(String dbPath) { RaftRocksdbOptions.initRocksdbGlobalConfig(configMap); BusinessHandlerImpl.initRocksdb(configMap, null); - } protected BusinessHandler getBusinessHandler() { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreClientBase.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreClientBase.java index 18d393f9c9..a3df08a04d 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreClientBase.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreClientBase.java @@ -27,9 +27,9 @@ public class HgStoreClientBase { + private static final String PD_ADDRESS = "127.0.0.1:8686"; protected static String GRAPH_NAME = "testGraphName"; protected static String TABLE_NAME = UnitTestBase.DEFAULT_TEST_TABLE; - private static final String PD_ADDRESS = "127.0.0.1:8686"; protected HgStoreClient storeClient; protected PDClient pdClient; diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStateTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStateTest.java index f1bb94c333..aa770b6482 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStateTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStateTest.java @@ -23,6 +23,7 @@ import org.junit.Test; public class HgStoreNodeStateTest { + private static final HgStoreNodeManager NODE_MANAGER = HgStoreNodeManager.getInstance(); static int nodeNumber = 0; @@ -38,7 +39,6 @@ private static void registerNode(String graphName, Long nodeId, String address) .build()); } - @Test public void isNodeHealthy() { AtomicInteger count = new AtomicInteger(0); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStreamTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStreamTest.java index aeee3da6b7..f5be9edefd 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStreamTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/HgStoreNodeStreamTest.java @@ -17,18 +17,11 @@ package org.apache.hugegraph.store.client; -import static org.apache.hugegraph.store.util.HgStoreTestUtil.GRAPH_NAME; -import static org.apache.hugegraph.store.util.HgStoreTestUtil.batchPut; -import static org.apache.hugegraph.store.util.HgStoreTestUtil.println; -import static org.apache.hugegraph.store.util.HgStoreTestUtil.toOwnerKey; - import java.util.NoSuchElementException; import org.apache.hugegraph.store.HgKvEntry; import org.apache.hugegraph.store.HgKvIterator; import org.apache.hugegraph.store.HgStoreSession; -import org.apache.hugegraph.store.client.HgStoreNode; -import org.apache.hugegraph.store.client.HgStoreNodeManager; import org.apache.hugegraph.store.util.HgStoreTestUtil; import org.junit.Assert; @@ -36,6 +29,7 @@ * created on 2021/10/12 */ public class HgStoreNodeStreamTest { + private static final HgStoreNodeManager nodeManager = HgStoreNodeManager.getInstance(); private static HgStoreNode node; @@ -69,7 +63,8 @@ public void scanIterator() { HgStoreTestUtil.println("-- test 0 element --"); iterator = - session.scanIterator(tableName, HgStoreTestUtil.toOwnerKey("__SCAN-001"), HgStoreTestUtil.toOwnerKey("__SCAN-100"), + session.scanIterator(tableName, HgStoreTestUtil.toOwnerKey("__SCAN-001"), + HgStoreTestUtil.toOwnerKey("__SCAN-100"), 0); Assert.assertFalse(iterator.hasNext()); try { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/graph/GraphStoreClientTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/graph/GraphStoreClientTest.java index 4514ef676e..c9dba44b9f 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/graph/GraphStoreClientTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/client/graph/GraphStoreClientTest.java @@ -155,7 +155,6 @@ public void onCompleted() { } } - @Test public void getDataSingle() { CountDownLatch latch = new CountDownLatch(1); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java index 7508ec4d5e..0067b11ae7 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java @@ -21,6 +21,7 @@ import org.junit.BeforeClass; public class BaseCommonTest { + @BeforeClass public static void beforeClass() throws Exception { } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java index a665b4d764..afa1f2baba 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java @@ -22,6 +22,7 @@ // import org.junit.Test; public class BitsTest { + // @Test public void test() { for (int i = 0; i < Integer.MAX_VALUE; i = i + 10) { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java index 90aae3a2e8..0faf3457c7 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java @@ -27,6 +27,7 @@ @Slf4j public class ByteBufferAllocatorTest extends BaseCommonTest { + @Test public void getAndReleaseTest() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(2); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java index 2ef65cf3b0..092cc804fe 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java @@ -30,4 +30,5 @@ @Slf4j public class CommonSuiteTest { + } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/BaseCoreTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/BaseCoreTest.java index 3ecbb1da73..aa35f5c753 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/BaseCoreTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/BaseCoreTest.java @@ -24,7 +24,6 @@ import org.junit.After; import org.junit.BeforeClass; - public class BaseCoreTest { @BeforeClass diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/HgBusinessImplTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/HgBusinessImplTest.java index d30e37e8a3..15084eb307 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/HgBusinessImplTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/HgBusinessImplTest.java @@ -31,11 +31,11 @@ import lombok.extern.slf4j.Slf4j; - @Slf4j public class HgBusinessImplTest extends StoreEngineTestBase { public static final String TABLE_NAME = UnitTestBase.DEFAULT_TEST_TABLE; + public BusinessHandler getBusinessHandler() { return getStoreEngine().getBusinessHandler(); } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/HgStoreStateMachineTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/HgStoreStateMachineTest.java index 752a17ea59..7b9b37b21f 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/HgStoreStateMachineTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/HgStoreStateMachineTest.java @@ -41,7 +41,6 @@ import com.alipay.sofa.jraft.Iterator; import com.alipay.sofa.jraft.Status; import com.alipay.sofa.jraft.conf.Configuration; -import com.alipay.sofa.jraft.entity.LeaderChangeContext; import com.alipay.sofa.jraft.entity.PeerId; import com.alipay.sofa.jraft.entity.Task; import com.alipay.sofa.jraft.error.RaftError; @@ -183,7 +182,6 @@ public void testGetLeaderTerm() { assertEquals(-1L, result); } - @Test public void testOnLeaderStart() { // Setup diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/MockStateMachine.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/MockStateMachine.java index 2af5c683c9..d6690f2700 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/MockStateMachine.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/MockStateMachine.java @@ -21,6 +21,7 @@ import com.alipay.sofa.jraft.core.StateMachineAdapter; public class MockStateMachine extends StateMachineAdapter { + @Override public void onApply(Iterator iter) { while (iter.hasNext()) { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftOperationTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftOperationTest.java index 586c2d8c10..8316ce2266 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftOperationTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftOperationTest.java @@ -17,6 +17,9 @@ package org.apache.hugegraph.store.core.raft; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + import org.apache.hugegraph.pd.grpc.Metapb; import org.apache.hugegraph.store.raft.RaftOperation; import org.junit.Before; @@ -24,9 +27,6 @@ import com.google.protobuf.GeneratedMessageV3; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - public class RaftOperationTest { private RaftOperation raftOperationUnderTest; @@ -36,7 +36,6 @@ public void setUp() { raftOperationUnderTest = new RaftOperation(); } - @Test public void testCreate1() { // Run the test diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftUtilsTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftUtilsTest.java index 9f8b72b3b1..e845b250df 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftUtilsTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/raft/RaftUtilsTest.java @@ -38,6 +38,7 @@ import com.alipay.sofa.jraft.util.Endpoint; public class RaftUtilsTest { + final String ip = "127.0.0.1"; final int port = 12456; final String dataPath = "tmp/raftUtils"; @@ -101,7 +102,6 @@ public void testGetPeerEndpoints1() throws InterruptedException { assertTrue(node.init(nodeOptions)); node.isLeader(true); - // Run the test final List result = RaftUtils.getPeerEndpoints(node); // Verify the results diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/snapshot/HgSnapshotHandlerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/snapshot/HgSnapshotHandlerTest.java index ff5ef24acf..dca61fb379 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/snapshot/HgSnapshotHandlerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/snapshot/HgSnapshotHandlerTest.java @@ -37,7 +37,6 @@ import com.alipay.sofa.jraft.storage.snapshot.SnapshotWriter; import com.google.protobuf.Message; - public class HgSnapshotHandlerTest extends StoreEngineTestBase { private static HgSnapshotHandler hgSnapshotHandlerUnderTest; @@ -167,7 +166,6 @@ public void close() throws IOException { hgSnapshotHandlerUnderTest.onSnapshotLoad(reader, 0L); } - @Test public void testTrimStartPath() { assertEquals("str", HgSnapshotHandler.trimStartPath("str", "prefix")); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/PartitionManagerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/PartitionManagerTest.java index 0cdee7333a..08b64dd5a3 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/PartitionManagerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/PartitionManagerTest.java @@ -102,7 +102,6 @@ public void testChangeKeyRange() { assertEquals(partition2.getEndKey(), 2000); } - @Test public void testUpdatePartitionRangeOrState() { createPartitionEngine(4); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/asynctask/CleanTaskTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/asynctask/CleanTaskTest.java index 816c4ccdd3..c792364bb4 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/asynctask/CleanTaskTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/meta/asynctask/CleanTaskTest.java @@ -19,14 +19,13 @@ import static org.junit.Assert.assertEquals; +import org.apache.hugegraph.store.core.StoreEngineTestBase; import org.apache.hugegraph.store.meta.asynctask.AbstractAsyncTask; import org.apache.hugegraph.store.meta.asynctask.AsyncTask; import org.apache.hugegraph.store.meta.asynctask.AsyncTaskState; import org.apache.hugegraph.store.meta.asynctask.CleanTask; import org.junit.Test; -import org.apache.hugegraph.store.core.StoreEngineTestBase; - public class CleanTaskTest extends StoreEngineTestBase { @Test diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/util/MiscUtilClassTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/util/MiscUtilClassTest.java index 0102dcd9c5..8bd56eb5a3 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/util/MiscUtilClassTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/core/store/util/MiscUtilClassTest.java @@ -89,5 +89,4 @@ public void testManualResetEvent() throws InterruptedException { assertTrue(event.isSignalled()); } - } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphIDManagerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphIDManagerTest.java index 60bb542a9b..f80ff2ec09 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphIDManagerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphIDManagerTest.java @@ -28,6 +28,7 @@ import org.junit.Test; public class GraphIDManagerTest extends UnitTestBase { + @Before public void init() { String dbPath = "/tmp/junit"; diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphManagerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphManagerTest.java index 8777700afe..1f11fb60b8 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphManagerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/meta/GraphManagerTest.java @@ -17,17 +17,16 @@ package org.apache.hugegraph.store.meta; - import org.junit.Assert; // import org.junit.Test; public class GraphManagerTest { + // @Test public void testCloneGraph() { Graph graph = new Graph(); graph.setGraphName("test1"); - Graph graph1 = graph.clone(); Assert.assertNotSame(graph, graph1); @@ -35,7 +34,6 @@ public void testCloneGraph() { Assert.assertEquals(graph.getGraphName(), graph1.getGraphName()); graph1.setGraphName("test4"); - Assert.assertNotEquals(graph.getGraphName(), graph1.getGraphName()); Assert.assertEquals(graph.getGraphName(), "test1"); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/BaseRocksDbTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/BaseRocksDbTest.java index 4fd36665e9..597ed57ab6 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/BaseRocksDbTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/BaseRocksDbTest.java @@ -28,6 +28,7 @@ import org.junit.BeforeClass; public class BaseRocksDbTest { + @BeforeClass public static void init() { OptionSpace.register("org/apache/hugegraph/store/rocksdb", diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDBFactoryTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDBFactoryTest.java index 61931fac9c..0bf925c9bb 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDBFactoryTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDBFactoryTest.java @@ -23,6 +23,7 @@ import org.junit.Test; public class RocksDBFactoryTest extends BaseRocksDbTest { + @Test public void testCreateSession() { RocksDBFactory factory = RocksDBFactory.getInstance(); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDbSuiteTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDbSuiteTest.java index 59c1cd9986..1ed8f37eeb 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDbSuiteTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/rocksdb/RocksDbSuiteTest.java @@ -29,4 +29,5 @@ @Slf4j public class RocksDbSuiteTest { + } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/BaseServerTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/BaseServerTest.java index ca0a8fd248..51d0fc3b96 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/BaseServerTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/BaseServerTest.java @@ -21,6 +21,7 @@ import org.junit.BeforeClass; public class BaseServerTest { + @BeforeClass public static void init() { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/ServerSuiteTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/ServerSuiteTest.java index 00a58d490e..82c51d8ef8 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/ServerSuiteTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/ServerSuiteTest.java @@ -29,4 +29,5 @@ @Slf4j public class ServerSuiteTest { + } diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/SessionTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/SessionTest.java index 38449a106e..ade43cf2a6 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/SessionTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/service/SessionTest.java @@ -23,6 +23,7 @@ @Slf4j public class SessionTest { + @Test public void testQuota() { diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCacheTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCacheTest.java index 86d03fd534..e6bf557c1b 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCacheTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCacheTest.java @@ -20,18 +20,18 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import com.caucho.hessian.io.Hessian2Input; -import com.caucho.hessian.io.Hessian2Output; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Map; import java.util.Set; -import org.apache.hugegraph.store.util.CopyOnWriteCache; import org.junit.Before; import org.junit.Test; +import com.caucho.hessian.io.Hessian2Input; +import com.caucho.hessian.io.Hessian2Output; + public class CopyOnWriteCacheTest { private CopyOnWriteCache writeCache; diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/FutureClosureTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/FutureClosureTest.java index 1c06f97f26..528b80a7e6 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/FutureClosureTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/FutureClosureTest.java @@ -23,6 +23,7 @@ import com.alipay.sofa.jraft.Status; public class FutureClosureTest { + @Test public void test() { FutureClosure closure = new FutureClosure(); diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/HgStoreTestUtil.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/HgStoreTestUtil.java index 6a19a026b6..6c7798361f 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/HgStoreTestUtil.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/HgStoreTestUtil.java @@ -43,6 +43,7 @@ import org.apache.hugegraph.store.client.util.MetricX; public class HgStoreTestUtil { + public static final String GRAPH_NAME = "default/hugegraph/g"; public static final String GRAPH_NAME2 = "default/hugegraph2/g"; public static final String TABLE_NAME = "unit-table"; diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/UnsafeUtilTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/UnsafeUtilTest.java index 5e3c40c017..44f0fbf333 100644 --- a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/UnsafeUtilTest.java +++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/UnsafeUtilTest.java @@ -23,8 +23,6 @@ import java.lang.reflect.Field; -import org.apache.hugegraph.store.util.UnsafeUtf8Util; -import org.apache.hugegraph.store.util.UnsafeUtil; import org.junit.Test; import lombok.Data; @@ -32,7 +30,6 @@ public class UnsafeUtilTest { - @Test public void testHasUnsafe() { assertTrue(UnsafeUtil.hasUnsafe()); @@ -159,6 +156,7 @@ public void testUnsafeAccessor() { @Data private class TestObject { + private Object o; private byte b; diff --git a/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml b/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml index c8fa4195f6..0a3aae7b9d 100644 --- a/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml +++ b/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml @@ -26,8 +26,8 @@ - - + + @@ -37,24 +37,24 @@ - - + + - - + + - + - - + + @@ -64,25 +64,25 @@ - + - + - - + + - - + + - - + + @@ -91,11 +91,11 @@ - + - - + +