Skip to content

Commit

Permalink
translate remaining files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pengzna committed Aug 4, 2024
1 parent bd0e4bb commit f3c819d
Show file tree
Hide file tree
Showing 44 changed files with 214 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private void queryAnd2Queue() {
/**
* Multi -thread query
*
* @param Point Start Query Point, followed up according to this pointvalue做为下一次的查询条件进行迭代
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public interface HgKvStore {
boolean put(String table, HgOwnerKey ownerKey, byte[] value);

/**
* This version isstore内部使用。向分区写入数据,
* Partitionid andkey.keyCode必须与pd存储的分区信息保持一致。
* This version isstore Internal use.Write data to the partition,
* Partitionid andkey.keycode must be consistent with the partition information of PD storage.
*/
boolean directPut(String table, int partitionId, HgOwnerKey key, byte[] value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public HgStoreNodePartitionerImpl(PDClient pdClient, HgStoreNodeManager nodeMana
}

/**
* Query partition information,结果通过HgNodePartitionerBuilder返回
* Query Partition Information, the result is returned through HGNODEPARTITITITITINERBUILDER
*/
@Override
public int partition(HgNodePartitionerBuilder builder, String graphName,
Expand Down Expand Up @@ -141,7 +141,7 @@ public int partition(HgNodePartitionerBuilder builder, String graphName,
}

/**
* Inquirehgstore信息
* Inquirehgstore information
*
* @return hgstore
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public KvBatchScanner(

/**
* Construct a streaming query iterator
* Scanquery for splitting,启动多个流式请求,提升store的并发性
* Scanquery for splitting, start multiple streaming requests to enhance the concurrentness of Store
*
* @param scanQuery scanQuery
* @param handler task handler
Expand Down Expand Up @@ -241,7 +241,7 @@ private void evaluateMaxTaskSize() {
maxBatchSize = this.notifier.getScannerCount() * maxBatchSize; // A maximum of 1,000 per machine

/*
* Limit less than10000时启动一个流,节省网络带宽
* Limit less than10000 Start a stream to save network bandwidth
*/
if (scanQuery.getLimit() < maxBatchSize * 30L) {
maxTaskSize = 1;
Expand All @@ -250,7 +250,7 @@ private void evaluateMaxTaskSize() {
}

/**
* Disassembling task,任务拆分为多个grpc请求
* Dissembling Task, task split into multiple GRPC requests
*/
public void splitTask() {
if (this.finished || this.splitting) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import lombok.extern.slf4j.Slf4j;

/**
* Batch query results are classified,阻塞队列工作模式
* Demolition of the request task,创建多个请求队列
* Batch Query Results are classify, blocking queue working mode
* Demolition of the request task, create multiple request queues
*/
@Slf4j
public class KvBatchScannerMerger implements KvCloseableIterator<HgKvIterator<HgKvEntry>>,
Expand Down Expand Up @@ -125,7 +125,7 @@ public void registerScanner(KvBatchScanner closeable) {
}

/**
* return value<0表示任务结束
* Return value <0 means the task is over
*
* @param closeable
* @return
Expand All @@ -146,7 +146,7 @@ public int getScannerCount() {
}

/**
* Assemble aScanner的多个有序迭代器为一个迭代器
* ASSEMBLE ASCANNer's multiple ordered iterator is an iterator
*/
static class ScannerDataQueue {

Expand All @@ -170,7 +170,7 @@ public void add(Supplier<HgKvIterator<HgKvEntry>> supplier) {
}

/**
* Whether the iterator is valid,如果没有数据,等待数据到达
* WHETHER the ITERATOR is value, if no data, wait for the data to arrive
*
* @return
*/
Expand Down Expand Up @@ -221,7 +221,7 @@ private void moveNext() {
}

/**
* MultipleScanner返回结果进行归并排序
* Multiplescanner return results for merger and sorting
*/
static class SortedScannerMerger extends KvBatchScannerMerger {

Expand Down Expand Up @@ -286,8 +286,8 @@ public HgKvEntry next() {
}

/**
* From multipleScanner中挑选一个sn最小的迭代器
* ifScanner没有数据,等待数据到达。
* Select a SN smallest iterator in the From Multiplescanner
* Ifscanner has no data, waiting for the data to arrive.
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public static HgStoreEngine getInstance() {
}

/**
* 1. ReadStoreId,向pd注册,初次注册由PD生成StoreId,存储到本地
* 2. Successful registration,启动raft服务
* 3. Send regularlyStore心跳和Partition心跳,与PD保持联系
* 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
*
* @param opts
* @return
Expand Down Expand Up @@ -153,7 +153,7 @@ public synchronized boolean init(final HgStoreEngineOptions opts) {
}

/**
* Createraft rpc server,用于store之间通讯
* Createraft RPC Server, used for communication between store
*/
private RpcServer createRaftRpcServer(String raftAddr) {
Endpoint endpoint = JRaftUtils.getEndPoint(raftAddr);
Expand Down Expand Up @@ -207,8 +207,8 @@ public void stateChanged(Store store, Metapb.StoreState oldState, Metapb.StoreSt
}

/**
* Restore localPartitionEngine,恢复PD返回的分区信息
* 1. You need to check the partition of this preservation,删除作废的分区
* RESTORE LOCALPARTITITITINGINE, restore the partition information returned by PD
* 1. You need to check the partition of this preservice, delete the invalid partition
*/
public void restoreLocalPartitionEngine() {
try {
Expand All @@ -235,7 +235,7 @@ public void restoreLocalPartitionEngine() {
}

/**
* receivestore raft addr 变更,需要重新创建raft group
* ReceiveStore Raft Addr change, you need to re -create Raft Group
*
* @param Storeid changedstore id
*/
Expand Down Expand Up @@ -341,10 +341,10 @@ private PartitionEngine createPartitionEngine(int groupId, ShardGroup shardGroup
}

/**
* Create raft分组,除了创建本地raft node,还要通知其他peer创建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, according tostoreId获取Store信息
* 3. Establish to otherstore的raft rpc,发送StartRaft消息
* 2, accounting tostoreid to get store information
* 3. Establish to OtherStore's RAFT RPC, send StartRaft messages
*
* @param partition
* @return
Expand Down Expand Up @@ -406,7 +406,7 @@ public void destroyPartitionGroups(Partition partition) {
}

/**
* Stop the partition,并销毁数据
* Stop the partition, and destroy data
*/
public synchronized void destroyPartitionEngine(Integer groupId, List<String> graphNames) {
log.info("Partition {} start to be destroyed", groupId);
Expand Down Expand Up @@ -434,7 +434,7 @@ public synchronized void destroyPartitionEngine(Integer groupId, List<String> gr
}

/**
* Delete diagram data,删除本地数据,并删除PD上的分区信息
* Delete Diagram Data, delete local data, and delete partition information on PD
*/
public void deletePartition(Integer groupId, String graphName) {
log.info("Partition {}-{} deletePartition", graphName, groupId);
Expand All @@ -454,7 +454,7 @@ public void deletePartition(Integer groupId, String graphName) {
}

/**
* Get everythingleader分区
* Get EverythingLeader partition
*
* @return
*/
Expand Down Expand Up @@ -546,14 +546,14 @@ public List<String> getDataLocations() {
}

/**
* Add toraft任务
* 1. Checkpartition是否存在
* 1.1. If not exist,则向PD查询分区是否属于本地
* 1.1.1 If the partition belongs to the local area,则创建raft分组,并通知其他Store
* 1.1.2 If partitions are not local,则抛出异常
* 1.2 ExaminationPartition是否是leader
* 1.2.1 If yesleader,则提交任务
* 1.2.2 Otherwise,返回错误
* 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.2 if partitions are not local, then abnormal
* 1.2 ExaminationPartition Is it a leader
* 1.2.1 If Yesleader, the task is submitted
* 1.2.2 Otherwise, return error
*
* @param partId
* @param operation
Expand Down Expand Up @@ -648,7 +648,7 @@ public int getRaftGroupCount() {
}

/**
* Monitorrocksdb事件
* MonitorRocksdb event
*
* @return
*/
Expand All @@ -673,7 +673,7 @@ public void onCompacted(String dbName) {
class PartitionChangedListener implements PartitionManager.PartitionChangedListener {

/**
* Partition object changes,leader通知到其他的follower
* Partition object changes, Leader notified to other Follower
*/
@Override
public void onChanged(Partition partition) {
Expand Down Expand Up @@ -702,7 +702,7 @@ public void run(Status status) {
}

/**
* Partition objectkey范围、状态发生改变,通过主动寻找leader再通知到其他的follower
* Partition objectKey range and status change, by actively looking for leaders and then notifying other Follower
*/
@Override
public UpdatePartitionResponse rangeOrStateChanged(UpdatePartitionRequest request) {
Expand Down
Loading

0 comments on commit f3c819d

Please sign in to comment.