VGalaxies commented on code in PR #2623:
URL:
https://github.com/apache/incubator-hugegraph/pull/2623#discussion_r1705489714
##########
hugegraph-store/hg-store-cli/src/main/java/org/apache/hugegraph/store/cli/loader/HgThread2DB.java:
##########
@@ -51,13 +51,13 @@
import lombok.extern.slf4j.Slf4j;
/**
- * 使用pd,支持raft
- * 读取文件并多线程进行入库
+ * Use pd, support raft
+ * Read files and perform multi-threaded storage processing.
*/
@Slf4j
public class HgThread2DB {
- /*正在进行和在排队的任务的总数*/
+ /*Total number of tasks in progress and in queue*/
Review Comment:
```suggestion
/* Total number of tasks in progress and in queue */
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java:
##########
@@ -47,8 +47,8 @@
@Slf4j
public class HeartbeatService implements Lifecycle<HgStoreEngineOptions>,
PartitionStateListener {
- private static final int MAX_HEARTBEAT_RETRY_COUNT = 5; // 心跳重试次数
- private static final int REGISTER_RETRY_INTERVAL = 1; //注册重试时间间隔,单位秒
+ private static final int MAX_HEARTBEAT_RETRY_COUNT = 5; // Heartbeat
retry count
+ private static final int REGISTER_RETRY_INTERVAL = 1; //Registration
retry interval, in seconds
Review Comment:
```suggestion
private static final int REGISTER_RETRY_INTERVAL = 1; // Registration
retry interval, in seconds
```
##########
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/NodeTxSessionProxy.java:
##########
@@ -692,7 +692,7 @@ public boolean doAction(String table, HgOwnerKey startKey,
Integer code,
}
private List<NodeTkv> toNodeTkvList(Builder scanReqBuilder) {
- // TODO 使用builder获取owner
+ // TODO use builder to get owner
Review Comment:
```suggestion
// TODO: use builder to get owner
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -563,7 +563,7 @@ public Endpoint waitForLeader(long timeOut) {
if
(partitionManager.isLocalPartition(this.options.getGroupId())) {
log.error("Raft {} leader not found, try to repair!",
this.options.getGroupId());
- // TODO 判断raft是否本机,如果是,尝试修复Leader,包括检查配置是否正确
+ // TODO Check if raft is local, if so, try to fix the
Leader, including checking if the configuration is correct.
Review Comment:
```suggestion
// TODO: Check if raft is local, if so, try to fix
the Leader, including checking if the configuration is correct.
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandler.java:
##########
@@ -108,23 +108,23 @@ void loadSnapshot(String snapshotPath, String graph, int
partId, long version) t
long getLatestSequenceNumber(String graph, int partId);
- // 扫描分区从 seqnum 开始的 kv
+ // Scan partition starting from seqnum for kv
ScanIterator scanRaw(String graph, int partId, long seqNum) throws
HgStoreException;
void ingestSstFile(String graph, int partId, Map<byte[], List<String>>
sstFiles) throws
HgStoreException;
- //提交分区分裂,删除旧数据
- // 删除分区数据
+ //Submit partition split, delete old data
+ // Delete partition data
boolean deletePartition(String graph, int partId);
- //清理分区,删除多余的数据
+ //Clean up partitions, delete unnecessary data
Review Comment:
```suggestion
// Clean up partitions, delete unnecessary data
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandler.java:
##########
@@ -108,23 +108,23 @@ void loadSnapshot(String snapshotPath, String graph, int
partId, long version) t
long getLatestSequenceNumber(String graph, int partId);
- // 扫描分区从 seqnum 开始的 kv
+ // Scan partition starting from seqnum for kv
ScanIterator scanRaw(String graph, int partId, long seqNum) throws
HgStoreException;
void ingestSstFile(String graph, int partId, Map<byte[], List<String>>
sstFiles) throws
HgStoreException;
- //提交分区分裂,删除旧数据
- // 删除分区数据
+ //Submit partition split, delete old data
+ // Delete partition data
boolean deletePartition(String graph, int partId);
- //清理分区,删除多余的数据
+ //Clean up partitions, delete unnecessary data
boolean cleanPartition(String graph, int partId);
boolean cleanPartition(String graph, int partId, long startKey, long
endKey,
CleanType cleanType);
- //所有指定分区图的所有 table 名
+ // All table names for all specified partition diagrams
Review Comment:
```suggestion
// All table names for all specified partition graph
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/meta/StoreMetadata.java:
##########
@@ -197,12 +197,12 @@ public String getPartitionStoreLocation(int partitionId,
String dbName) {
synchronized (this) {
location = getPartitionStore(partitionId);
if (location == null) {
- // 查找分区数最少的存储
+ // Find the storage with the least number of partitions
location = Metapb.PartitionStore.newBuilder()
.setPartitionId(partitionId)
.setStoreLocation(getMinDataLocation())
.build();
- // TODO 选择分区数最小的路径
+ // TODO Select the path with the least number of
partitions.
Review Comment:
```suggestion
// TODO: Select the path with the least number of
partitions.
```
##########
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcUtil.java:
##########
@@ -63,7 +63,7 @@ static Key.Builder getOwnerKeyBuilder() {
Key.Builder builder = keyBuilder.get();
if (builder == null) {
builder = Key.newBuilder();
- // TODO 线程级变量,寻找删除时机
+ // TODO Thread-level variables, find the timing for deletion
Review Comment:
```suggestion
// TODO: Thread-level variables, find the timing for deletion
```
##########
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcUtil.java:
##########
@@ -86,7 +86,7 @@ static Key toKey(HgOwnerKey ownerKey) {
Key.Builder builder = keyBuilder.get();
if (builder == null) {
builder = Key.newBuilder();
- // TODO 线程级变量,寻找删除时机
+ // TODO Thread-level variables, find the timing for deletion
Review Comment:
```suggestion
// TODO: Thread-level variables, find the timing for deletion
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java:
##########
@@ -443,9 +443,9 @@ public void deletePartition(Integer groupId, String
graphName) {
}
PartitionEngine ptEngine = partitionEngines.get(groupId);
ptEngine.removePartition(graphName);
- // 删除数据
+ // Delete data
businessHandler.deletePartition(graphName, groupId);
- //通知PD删除分区数据
+ //Notify PD to delete partition data
Review Comment:
```suggestion
// Notify PD to delete partition data
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java:
##########
@@ -325,26 +325,26 @@ private PartitionEngine createPartitionEngine(int
groupId, ShardGroup shardGroup
ptOpts.setRaftDataPath(partitionManager.getRaftDataPath(groupId));
ptOpts.setRaftSnapShotPath(partitionManager.getRaftSnapShotPath(groupId));
ptOpts.setRaftOptions(options.getRaftOptions());
- // raft任务处理器
+ // raft task processor
ptOpts.setTaskHandler(options.getTaskHandler());
- // 分区状态监听
+ // Partition status listening
engine.addStateListener(this.heartbeatService);
engine.init(ptOpts);
partitionEngines.put(ptOpts.getGroupId(), engine);
}
}
}
- // 检查是否活跃,如果不活跃,则重新创建
+ // Check if active, if not active, recreate
engine.checkActivity();
return engine;
}
/**
- * 创建 raft分组,除了创建本地raft node,还要通知其他peer创建raft node
- * 1、遍历partition.shards
- * 2、根据storeId获取Store信息
- * 3、建立向其他store的raft rpc,发送StartRaft消息
+ * Create raft group, in addition to creating the local raft node, also
need to notify other peers to create raft nodes.
+ * 1. Traverse partition.shards
+ Information by storeId
Review Comment:
```suggestion
* 2. Retrieve Store information based on storeId
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -253,16 +253,16 @@ public LogStorage createLogStorage(final String uri,
final RaftOptions raftOptio
final PeerId serverId = JRaftUtils.getPeerId(options.getRaftAddress());
- // 构建raft组并启动raft
+ // Build raft group and start raft
this.raftGroupService = new RaftGroupService(raftPrefix +
options.getGroupId(),
serverId, nodeOptions,
storeEngine.getRaftRpcServer(), true);
this.raftNode = raftGroupService.start(false);
this.raftNode.addReplicatorStateListener(new
ReplicatorStateListener());
- // 检查pd返回的peers是否和本地一致,如果不一致,重置peerlist
+ // Check if the peers returned by pd are consistent with the local
ones, if not, reset the peerlist
if (this.raftNode != null) {
- //TODO 检查peer列表,如果peer发生改变,进行重置
+ //TODO Check peer list, if peer changes, perform reset
Review Comment:
```suggestion
// TODO: Check peer list, if peer changes, perform reset
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -398,19 +398,19 @@ public Status changePeers(List<String> peers, final
Closure done) {
}
if (!RaftUtils.configurationEquals(oldConf, conf)) {
- // 2. 新的peer以learner身份加入
- // 5. peer切换,增加新的peer,删除旧的peer
+ // 2. The new peer joins as a learner.
+ // 5. peer switching, add new peer, delete old peer
FutureClosure closure = new FutureClosure();
raftNode.changePeers(conf, closure);
if (closure.get().isOk()) {
if (!removedPeers.isEmpty()) {
removedPeers.forEach(peer -> Utils.runInThread(() -> {
- // 6. 停止已被删除的peer
+ // 6. Stop the deleted peer
rpcClient.destroyRaftNode(peer,
partitionManager.getPartitionList(getGroupId()),
status -> {
if (!status.isOk()) {
- // TODO 失败了怎么办?
+ // TODO What if it
fails?
Review Comment:
```suggestion
// TODO: What if
it fails?
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -630,9 +630,9 @@ public void onStartFollowing(final PeerId newLeaderId,
final long newTerm) {
public void onConfigurationCommitted(Configuration conf) {
try {
- //更新shardlist
+ //Update shardlist
Review Comment:
```suggestion
// Update shardlist
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -965,29 +965,29 @@ private Status handleMoveTask(MetaTask.Task task) {
}
/**
- * 对于整个图删除的清空,删除分区, 如果没有其他的图,销毁raft group.
- * 需要放到调用move data 之后
+ * For the entire graph deletion, clear the deletion partition, if there
are no other graphs, destroy the raft group.
+ * Need to be placed after the call to move data
*
* @param graphName graph name
* @param partitionId partition id
- * @param keyStart key start 用于验证
- * @param keyEnd key end 用于验证
- * @param isLeader 是否leader,避免leader漂移,采取move data时候的leader状态
+ * @param keyStart key start used for verification
+ * @param keyEnd key end used for verification
+ * @param isLeader Whether leader, to avoid leader drifting, the leader
status when moving data
*/
private synchronized void destroyPartitionIfGraphsNull(String graphName,
int partitionId,
long keyStart, long
keyEnd,
boolean isLeader) {
Partition partition = partitionManager.getPartition(graphName,
partitionId);
- // key range 校验
+ // key range validation
if (partition != null && partition.getEndKey() == keyEnd &&
partition.getStartKey() == keyStart) {
log.info("remove partition id :{}, graph:{}", partition.getId(),
partition.getGraphName());
storeEngine.deletePartition(partitionId, graphName);
}
- // 没有partition engine的情况
+ // without partition engine的情况
Review Comment:
```suggestion
// No partition engine present
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandlerImpl.java:
##########
@@ -719,7 +719,7 @@ public void createTable(String graph, int partId, String
table) {
@Override
public void deleteTable(String graph, int partId, String table) {
dropTable(graph, partId, table);
- // todo 检查表是否为空,为空则真实删除表
+ // todo Check if the table is empty, if empty then truly delete the
table
Review Comment:
```suggestion
// TODO: Check if the table is empty, if empty then truly delete the
table
```
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandler.java:
##########
@@ -108,23 +108,23 @@ void loadSnapshot(String snapshotPath, String graph, int
partId, long version) t
long getLatestSequenceNumber(String graph, int partId);
- // 扫描分区从 seqnum 开始的 kv
+ // Scan partition starting from seqnum for kv
ScanIterator scanRaw(String graph, int partId, long seqNum) throws
HgStoreException;
void ingestSstFile(String graph, int partId, Map<byte[], List<String>>
sstFiles) throws
HgStoreException;
- //提交分区分裂,删除旧数据
- // 删除分区数据
+ //Submit partition split, delete old data
Review Comment:
```suggestion
// Submit partition split, delete old data
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]