Skip to content

Commit

Permalink
[TUBEMQ-105] Substitute Chinese comments with English - server module (
Browse files Browse the repository at this point in the history
  • Loading branch information
Technoboy- authored May 31, 2020
1 parent ccb3490 commit 7474d07
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* Save offset occur error throw this Exception.
*/
public class OffsetStoreException extends Exception {
// Offset存储异常包装类,
// 在存储数据到zk时的异常封装

static final long serialVersionUID = -1L;

public OffsetStoreException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void updateBrokerTopicConfigMap(long newBrokerMetaConfId,
public boolean updateBrokerRemoveTopicMap(boolean isTakeRemoveTopics,
List<String> rmvTopicMetaConfInfoLst,
final StringBuilder sb) {
// 该部分根据Master上的指示进行对应Topic的删除操作
// This part deletes the corresponding topic according to the instructions on the Master
boolean needProcess = false;
if (isTakeRemoveTopics) {
List<String> origTopics = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
boolean isSelectBig,
ConsumerBandInfo consumerBandInfo,
final StringBuilder strBuffer) throws Exception {
// 该部分处理主要是检查新接入的客户端是否与已存在的消费端消费目标一致,
// 包括是否绑定消费,绑定消费的参数是否一致,订阅的topic集合是否一致,订阅的过滤消费项集合是否一致
// This part is mainly to check whether the newly accessed client is consistent with the existing
// consumer consumption target
ParamCheckResult retResult = new ParamCheckResult();
if (consumerBandInfo == null) {
retResult.setCheckData(inConsumerInfo);
return retResult;
}
// 确认消费行为是不是一致
// check whether the consumer behavior is consistent
if (inConsumerInfo.isRequireBound() != consumerBandInfo.isBandConsume()) {
if (inConsumerInfo.isRequireBound()) {
strBuffer.append("[Inconsistency subscribe] ").append(inConsumerInfo.getConsumerId())
Expand All @@ -275,7 +275,7 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
logger.warn(strBuffer.toString());
return retResult;
}
// 先检查消费的topic集合
// check the topics of consumption
List<ConsumerInfo> infoList = consumerBandInfo.getConsumerInfoList();
Set<String> existedTopics = consumerBandInfo.getTopicSet();
Map<String, TreeSet<String>> existedTopicConditions = consumerBandInfo.getTopicConditions();
Expand Down Expand Up @@ -306,7 +306,7 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
.append(" is inconsistency with other consumers in the group: topic without conditions");
}
} else {
// 该部分主要是做topic的过滤条件比较
// check the filter conditions of the topic
if (inConsumerInfo.getTopicConditions().isEmpty()) {
isCondEqual = false;
strBuffer.append("[Inconsistency subscribe] ").append(inConsumerInfo.getConsumerId())
Expand Down Expand Up @@ -354,8 +354,9 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
}
}
if (inConsumerInfo.isRequireBound()) {
// 如果sessionKey不一致,则表示上一轮的消费还没完全退出
// 为了避免offset设置不完全,需要完全清理之上的数据后才进行本轮次的消费重置及消费
// If the sessionKey is inconsistent, it means that the previous round of consumption has not completely
// exited. In order to avoid the incomplete offset setting, it is necessary to completely clear the above
// data before resetting and consuming this round of consumption
if (!inConsumerInfo.getSessionKey().equals(consumerBandInfo.getSessionKey())) {
strBuffer.append("[Inconsistency subscribe] ").append(inConsumerInfo.getConsumerId())
.append("'s sessionKey is inconsistency with other consumers in the group, required is ")
Expand All @@ -367,7 +368,7 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
logger.warn(strBuffer.toString());
return retResult;
}
// 选择offset的偏好也要保持一致
// check the offset config
if (isSelectBig != consumerBandInfo.isSelectedBig()) {
strBuffer.append("[Inconsistency subscribe] ").append(inConsumerInfo.getConsumerId())
.append("'s isSelectBig is inconsistency with other consumers in the group, required is ")
Expand All @@ -379,7 +380,7 @@ public static ParamCheckResult validConsumerExistInfo(ConsumerInfo inConsumerInf
logger.warn(strBuffer.toString());
return retResult;
}
// 启动最少的消费者量也要一致,如果不一致有些offset就无法作设置,形成数据消费丢的情况
// check the consumers count
if (inConsumerInfo.getSourceCount() != consumerBandInfo.getSourceCount()) {
strBuffer.append("[Inconsistency subscribe] ").append(inConsumerInfo.getConsumerId())
.append("'s sourceCount is inconsistency with other consumers in the group, required is ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
package org.apache.tubemq.server.common.utils;

/**
* 来自于twitter项目snowflake的id产生方案,全局唯一,时间有序
* https://github.com/twitter/snowflake/blob/master/src/main/scala/com/twitter/service/snowflake/IdWorker.scala
* reference :https://github.com/twitter/snowflake/blob/master/src/main/scala/com/twitter/service/snowflake/IdWorker.scala
*/
public class IdWorker {
private static final long twepoch = 1350282310830L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void setPageSize(Integer pSize) {
if ((pSize == null) || (pSize.intValue() < 0)) {
this.pageSize = null;
} else if (pSize > MAX_PAGE_SIZE || pSize < 1) {
throw new IllegalArgumentException("每页显示条数范围为1~" + MAX_PAGE_SIZE + "条");
throw new IllegalArgumentException("The number of displayed pages per page ranges from 1~" + MAX_PAGE_SIZE);
} else {
this.pageSize = pSize;
}
Expand All @@ -285,7 +285,8 @@ public void setPageSizeString(String pageSizeString) {
try {
Integer integer = new Integer(pageSizeString);
if (integer > MAX_PAGE_SIZE || integer < 1) {
throw new IllegalArgumentException("每页显示条数范围为1~" + MAX_PAGE_SIZE + "条");
throw new IllegalArgumentException("The number of displayed pages per page ranges from 1~" +
MAX_PAGE_SIZE);
}
this.setPageSize(integer);
} catch (NumberFormatException ignore) {
Expand Down Expand Up @@ -353,7 +354,7 @@ public int getPageFirstItem() {
int cPage = this.getCurrentPage().intValue();

if (cPage == 1) {
return 1; // 第一页开始当然是第 1 条记录
return 1;
}

cPage--;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
import org.slf4j.LoggerFactory;

/**
* Broker的缺省配置操作类,包括新增broker配置记录,变更配置,删除配置,以及修改broker的线上管理状态
* 需要注意的是每个IP只能部署一个Broker,每个brokerId必须要唯一
* 相关逻辑比较简单,API代码里有对应要求,代码只是做对应的处理
* <p>
* The class to handle the default config of broker, including:
* - Add config
Expand Down Expand Up @@ -596,8 +593,6 @@ public StringBuilder adminSetReadOrWriteBrokerConf(HttpServletRequest req) throw
Map<Integer, BrokerInfo> oldBrokerInfoMap =
master.getBrokerHolder().getBrokerInfoMap();

// 确认待修改broker状态的broker当前状态与预期状态信息,确认是否有修改
// 如果有修改则检查当前broker状态是否满足修改,如果都满足则形成修改记录
// Check the current status and status after the change, to see if there are changes.
// If yes, check if the current status complies with the change.
// If it complies, record the change.
Expand Down Expand Up @@ -1537,7 +1532,8 @@ public StringBuilder adminQueryBrokerDefConfEntityInfo(HttpServletRequest req) t
*/
private boolean isValidRecord(final Set<String> batchTopicNames, int topicStatusId, Boolean isInclude,
ConcurrentHashMap<String, BdbTopicConfEntity> bdbTopicConfEntityMap) {
// 首先检查指定了topic并且要求进行topic区分,并且broker有topic记录时,按照业务指定的topic区分要求进行过滤
// First check the difference between specified topic and request topic, and then when the broker
// has a topic record, filter according to the topic requirements specified by the business
if (!batchTopicNames.isEmpty() && isInclude != null) {
if ((bdbTopicConfEntityMap == null) || (bdbTopicConfEntityMap.isEmpty())) {
if (isInclude) {
Expand Down Expand Up @@ -1567,8 +1563,6 @@ private boolean isValidRecord(final Set<String> batchTopicNames, int topicStatus
}
}
}
// 然后按照指定的topic状态进行过滤
// 符合状态要求的才会被认为有效
// Filter according to the topic status
if (topicStatusId == TBaseConstants.META_VALUE_UNDEFINED) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


public class ConfigFileParser {
// 配置文件解析类,前台相关的内容处理
private static final String ROOT_ELEMENT = "simpleMVConfig";
private static final String DEFAULT_PAGE = "default-page";
private static final String RESOURCES = "resources";
Expand Down

0 comments on commit 7474d07

Please sign in to comment.