Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
Rocketmq
提交
0c6ee5c5
R
Rocketmq
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0c6ee5c5
编写于
11月 17, 2021
作者:
D
dongeforever
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add epoch, dirty to the topic mapping detail
上级
215c0e4d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
8 deletion
+30
-8
common/src/main/java/org/apache/rocketmq/common/TopicQueueMappingDetail.java
...a/org/apache/rocketmq/common/TopicQueueMappingDetail.java
+3
-3
common/src/main/java/org/apache/rocketmq/common/TopicQueueMappingInfo.java
...ava/org/apache/rocketmq/common/TopicQueueMappingInfo.java
+14
-5
common/src/main/java/org/apache/rocketmq/common/rpc/ClientMetadata.java
...n/java/org/apache/rocketmq/common/rpc/ClientMetadata.java
+2
-0
tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java
...etmq/tools/command/topic/UpdateStaticTopicSubCommand.java
+11
-0
未找到文件。
common/src/main/java/org/apache/rocketmq/common/TopicQueueMappingDetail.java
浏览文件 @
0c6ee5c5
...
...
@@ -29,8 +29,8 @@ public class TopicQueueMappingDetail extends TopicQueueMappingInfo {
// make sure this value is not null
private
ConcurrentMap
<
Integer
/*global id*/
,
ImmutableList
<
LogicQueueMappingItem
>>
hostedQueues
=
new
ConcurrentHashMap
<
Integer
,
ImmutableList
<
LogicQueueMappingItem
>>();
public
TopicQueueMappingDetail
(
String
topic
,
int
totalQueues
,
String
bname
,
int
gen
)
{
super
(
topic
,
totalQueues
,
bname
,
gen
);
public
TopicQueueMappingDetail
(
String
topic
,
int
totalQueues
,
String
bname
,
int
epoch
)
{
super
(
topic
,
totalQueues
,
bname
,
epoch
);
buildIdMap
();
}
...
...
@@ -118,7 +118,7 @@ public class TopicQueueMappingDetail extends TopicQueueMappingInfo {
public
TopicQueueMappingInfo
cloneAsMappingInfo
()
{
TopicQueueMappingInfo
topicQueueMappingInfo
=
new
TopicQueueMappingInfo
(
this
.
topic
,
this
.
totalQueues
,
this
.
bname
,
this
.
gen
);
TopicQueueMappingInfo
topicQueueMappingInfo
=
new
TopicQueueMappingInfo
(
this
.
topic
,
this
.
totalQueues
,
this
.
bname
,
this
.
epoch
);
topicQueueMappingInfo
.
currIdMap
=
this
.
buildIdMap
(
LEVEL_0
);
topicQueueMappingInfo
.
prevIdMap
=
this
.
buildIdMap
(
LEVEL_1
);
...
...
common/src/main/java/org/apache/rocketmq/common/TopicQueueMappingInfo.java
浏览文件 @
0c6ee5c5
...
...
@@ -28,19 +28,28 @@ public class TopicQueueMappingInfo extends RemotingSerializable {
String
topic
;
// redundant field
int
totalQueues
;
String
bname
;
//identify the hosted broker name
int
gen
;
//important to fence the old dirty data
int
epoch
;
//important to fence the old dirty data
boolean
dirty
;
//indicate if the data is dirty
//register to broker to construct the route
transient
ConcurrentMap
<
Integer
/*logicId*/
,
Integer
/*physicalId*/
>
currIdMap
=
new
ConcurrentHashMap
<
Integer
,
Integer
>();
//register to broker to help detect remapping failure
transient
ConcurrentMap
<
Integer
/*logicId*/
,
Integer
/*physicalId*/
>
prevIdMap
=
new
ConcurrentHashMap
<
Integer
,
Integer
>();
public
TopicQueueMappingInfo
(
String
topic
,
int
totalQueues
,
String
bname
,
int
gen
)
{
public
TopicQueueMappingInfo
(
String
topic
,
int
totalQueues
,
String
bname
,
int
epoch
)
{
this
.
topic
=
topic
;
this
.
totalQueues
=
totalQueues
;
this
.
bname
=
bname
;
this
.
gen
=
gen
;
this
.
epoch
=
epoch
;
this
.
dirty
=
false
;
}
public
boolean
isDirty
()
{
return
dirty
;
}
public
void
setDirty
(
boolean
dirty
)
{
this
.
dirty
=
dirty
;
}
public
int
getTotalQueues
()
{
return
totalQueues
;
...
...
@@ -58,8 +67,8 @@ public class TopicQueueMappingInfo extends RemotingSerializable {
return
topic
;
}
public
int
get
Gen
()
{
return
gen
;
public
int
get
Epoch
()
{
return
epoch
;
}
public
ConcurrentMap
<
Integer
,
Integer
>
getCurrIdMap
()
{
...
...
common/src/main/java/org/apache/rocketmq/common/rpc/ClientMetadata.java
浏览文件 @
0c6ee5c5
...
...
@@ -57,9 +57,11 @@ public class ClientMetadata {
return
new
ConcurrentHashMap
<
MessageQueue
,
String
>();
}
ConcurrentMap
<
MessageQueue
,
String
>
mqEndPoints
=
new
ConcurrentHashMap
<
MessageQueue
,
String
>();
int
totalNums
=
0
;
for
(
Map
.
Entry
<
String
,
TopicQueueMappingInfo
>
entry
:
route
.
getTopicQueueMappingByBroker
().
entrySet
())
{
String
brokerName
=
entry
.
getKey
();
//TODO check the epoch of
if
(
entry
.
getValue
().
getTotalQueues
()
>
totalNums
)
{
if
(
totalNums
!=
0
)
{
log
.
warn
(
"The static logic queue totalNums dose not match before {} {} != {}"
,
topic
,
totalNums
,
entry
.
getValue
().
getTotalQueues
());
...
...
tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java
浏览文件 @
0c6ee5c5
...
...
@@ -21,6 +21,7 @@ import org.apache.commons.cli.Option;
import
org.apache.commons.cli.OptionGroup
;
import
org.apache.commons.cli.Options
;
import
org.apache.rocketmq.common.TopicConfig
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.sysflag.TopicSysFlag
;
import
org.apache.rocketmq.remoting.RPCHook
;
import
org.apache.rocketmq.srvutil.ServerUtil
;
...
...
@@ -74,6 +75,16 @@ public class UpdateStaticTopicSubCommand implements SubCommand {
defaultMQAdminExt
.
setInstanceName
(
Long
.
toString
(
System
.
currentTimeMillis
()));
try
{
String
topic
=
commandLine
.
getOptionValue
(
't'
).
trim
();
int
queueNum
=
Integer
.
parseInt
(
commandLine
.
getOptionValue
(
"qn"
).
trim
());
String
cluster
=
commandLine
.
getOptionValue
(
'c'
).
trim
();
//first check the topic route
{
TopicRouteData
routeData
=
defaultMQAdminExt
.
examineTopicRouteInfo
(
topic
);
}
TopicConfig
topicConfig
=
new
TopicConfig
();
topicConfig
.
setReadQueueNums
(
8
);
topicConfig
.
setWriteQueueNums
(
8
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录