Skip to content

Commit

Permalink
chore(pd): translate CJK comments to English (#2536)
Browse files Browse the repository at this point in the history
  • Loading branch information
VGalaxies committed May 13, 2024
1 parent c1e8ea5 commit b056c5f
Show file tree
Hide file tree
Showing 64 changed files with 839 additions and 905 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ protected <ReqT, RespT, StubT extends AbstractBlockingStub<StubT>> RespT blockin
log.error(method.getFullMethodName() + " exception, {}", e.getMessage());
if (e instanceof StatusRuntimeException) {
if (retry < stubProxy.getHostCount()) {
// 网络不通,关掉之前连接,换host重新连接
synchronized (this) {
stubProxy.setBlockingStub(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public LinkedList<String> getHostList() {

public String nextHost() {
String host = hostList.poll();
hostList.offer(host); //移到尾部
hostList.offer(host);
return host;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ private KVPair<Partition, Shard> getPair(int partId, GraphCache graph) {
return null;
}

/**
* 根据key的hashcode返回分区信息
*
* @param graphName
* @param code
* @return
*/
public KVPair<Partition, Shard> getPartitionByCode(String graphName, long code) {
try {
GraphCache graph = initGraph(graphName);
Expand Down Expand Up @@ -172,12 +165,6 @@ private void initCache() throws PDException {
}
}

/**
* 返回key所在的分区信息
*
* @param key
* @return
*/
public KVPair<Partition, Shard> getPartitionByKey(String graphName, byte[] key) {
int code = PartitionUtils.calcHashcode(key);
return getPartitionByCode(graphName, code);
Expand All @@ -193,8 +180,6 @@ public boolean update(String graphName, int partId, Partition partition) {
RangeMap<Long, Integer> range = graph.getRange();
graph.addPartition(partId, partition);
if (p != null) {
// old [1-3) 被 [2-3)覆盖了。当 [1-3) 变成[1-2) 不应该删除原先的[1-3)
// 当确认老的 start, end 都是自己的时候,才可以删除老的. (即还没覆盖)
if (Objects.equals(partition.getId(), range.get(partition.getStartKey())) &&
Objects.equals(partition.getId(), range.get(partition.getEndKey() - 1))) {
range.remove(range.getEntry(partition.getStartKey()).getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public abstract class DiscoveryClient implements Closeable, Discoverable {

private final Timer timer = new Timer("serverHeartbeat", true);
private final AtomicBoolean requireResetStub = new AtomicBoolean(false);
protected int period; //心跳周期
protected int period;
LinkedList<String> pdAddresses = new LinkedList<>();
ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
private volatile int currentIndex; // 当前在用pd地址位置
private volatile int currentIndex;
private int maxTime = 6;
private ManagedChannel channel = null;
private DiscoveryServiceGrpc.DiscoveryServiceBlockingStub registerStub;
Expand Down Expand Up @@ -88,9 +88,6 @@ private <V, R> R tryWithTimes(Function<V, R> function, V v) {
return null;
}

/***
* 按照pd列表重置stub
*/
private void resetStub() {
String errLog = null;
for (int i = currentIndex + 1; i <= pdAddresses.size() + currentIndex; i++) {
Expand All @@ -115,11 +112,6 @@ private void resetStub() {
}
}

/***
* 按照某个pd的地址重置channel和stub
* @param singleAddress
* @throws PDException
*/
private void resetChannel(String singleAddress) throws PDException {

readWriteLock.writeLock().lock();
Expand All @@ -146,7 +138,7 @@ private void resetChannel(String singleAddress) throws PDException {
}

/***
* 获取注册节点信息
* Obtain the registration node information
* @param query
* @return
*/
Expand All @@ -167,7 +159,7 @@ public NodeInfos getNodeInfos(Query query) {
}

/***
* 启动心跳任务
* Start the heartbeat task
*/
@Override
public void scheduleTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
public class DiscoveryClientImpl extends DiscoveryClient {

private final String id;
private final RegisterType type; // 心跳类型,备用
private final RegisterType type;
private final String version;
private final String appName;
private final int times; // 心跳过期次数,备用
private final int times;
private final String address;
private final Map labels;
private final Consumer registerConsumer;
Expand Down
Loading

0 comments on commit b056c5f

Please sign in to comment.