Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Apache RocketMQ
Rocketmq
提交
3183122c
R
Rocketmq
项目概览
Apache RocketMQ
/
Rocketmq
上一次同步 大约 3 年
通知
267
Star
16139
Fork
68
代码
文件
提交
分支
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看板
未验证
提交
3183122c
编写于
7月 06, 2021
作者:
H
huangli
提交者:
GitHub
7月 06, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate array copy (#2886)
[Part C] Improve produce performance in M/S mode.
上级
d65778f3
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
14 addition
and
14 deletion
+14
-14
broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java
...he/rocketmq/broker/plugin/AbstractPluginMessageStore.java
+2
-2
store/src/main/java/org/apache/rocketmq/store/CommitLog.java
store/src/main/java/org/apache/rocketmq/store/CommitLog.java
+2
-2
store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
...n/java/org/apache/rocketmq/store/DefaultMessageStore.java
+2
-2
store/src/main/java/org/apache/rocketmq/store/MessageStore.java
...src/main/java/org/apache/rocketmq/store/MessageStore.java
+3
-1
store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java
...a/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java
+1
-1
store/src/main/java/org/apache/rocketmq/store/ha/HAService.java
...src/main/java/org/apache/rocketmq/store/ha/HAService.java
+4
-6
未找到文件。
broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java
浏览文件 @
3183122c
...
...
@@ -180,8 +180,8 @@ public abstract class AbstractPluginMessageStore implements MessageStore {
}
@Override
public
boolean
appendToCommitLog
(
long
startOffset
,
byte
[]
data
)
{
return
next
.
appendToCommitLog
(
startOffset
,
data
);
public
boolean
appendToCommitLog
(
long
startOffset
,
byte
[]
data
,
int
dataStart
,
int
dataLength
)
{
return
next
.
appendToCommitLog
(
startOffset
,
data
,
dataStart
,
dataLength
);
}
@Override
...
...
store/src/main/java/org/apache/rocketmq/store/CommitLog.java
浏览文件 @
3183122c
...
...
@@ -1185,7 +1185,7 @@ public class CommitLog {
this
.
mappedFileQueue
.
destroy
();
}
public
boolean
appendData
(
long
startOffset
,
byte
[]
data
)
{
public
boolean
appendData
(
long
startOffset
,
byte
[]
data
,
int
dataStart
,
int
dataLength
)
{
putMessageLock
.
lock
();
try
{
MappedFile
mappedFile
=
this
.
mappedFileQueue
.
getLastMappedFile
(
startOffset
);
...
...
@@ -1194,7 +1194,7 @@ public class CommitLog {
return
false
;
}
return
mappedFile
.
appendMessage
(
data
);
return
mappedFile
.
appendMessage
(
data
,
dataStart
,
dataLength
);
}
finally
{
putMessageLock
.
unlock
();
}
...
...
store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
浏览文件 @
3183122c
...
...
@@ -921,13 +921,13 @@ public class DefaultMessageStore implements MessageStore {
}
@Override
public
boolean
appendToCommitLog
(
long
startOffset
,
byte
[]
data
)
{
public
boolean
appendToCommitLog
(
long
startOffset
,
byte
[]
data
,
int
dataStart
,
int
dataLength
)
{
if
(
this
.
shutdown
)
{
log
.
warn
(
"message store has shutdown, so appendToPhyQueue is forbidden"
);
return
false
;
}
boolean
result
=
this
.
commitLog
.
appendData
(
startOffset
,
data
);
boolean
result
=
this
.
commitLog
.
appendData
(
startOffset
,
data
,
dataStart
,
dataLength
);
if
(
result
)
{
this
.
reputMessageService
.
wakeup
();
}
else
{
...
...
store/src/main/java/org/apache/rocketmq/store/MessageStore.java
浏览文件 @
3183122c
...
...
@@ -245,9 +245,11 @@ public interface MessageStore {
*
* @param startOffset starting offset.
* @param data data to append.
* @param dataStart the start index of data array
* @param dataLength the length of data array
* @return true if success; false otherwise.
*/
boolean
appendToCommitLog
(
final
long
startOffset
,
final
byte
[]
data
);
boolean
appendToCommitLog
(
final
long
startOffset
,
final
byte
[]
data
,
int
dataStart
,
int
dataLength
);
/**
* Execute file deletion manually.
...
...
store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java
浏览文件 @
3183122c
...
...
@@ -905,7 +905,7 @@ public class DLedgerCommitLog extends CommitLog {
}
@Override
public
boolean
appendData
(
long
startOffset
,
byte
[]
data
)
{
public
boolean
appendData
(
long
startOffset
,
byte
[]
data
,
int
dataStart
,
int
dataLength
)
{
//the old ha service will invoke method, here to prevent it
return
false
;
}
...
...
store/src/main/java/org/apache/rocketmq/store/ha/HAService.java
浏览文件 @
3183122c
...
...
@@ -440,7 +440,6 @@ public class HAService {
private
boolean
dispatchReadRequest
()
{
final
int
msgHeaderSize
=
8
+
4
;
// phyoffset + size
int
readSocketPos
=
this
.
byteBufferRead
.
position
();
while
(
true
)
{
int
diff
=
this
.
byteBufferRead
.
position
()
-
this
.
dispatchPosition
;
...
...
@@ -459,13 +458,12 @@ public class HAService {
}
if
(
diff
>=
(
msgHeaderSize
+
bodySize
))
{
byte
[]
bodyData
=
new
byte
[
bodySize
];
this
.
byteBufferRead
.
position
(
this
.
dispatchPosition
+
msgHeaderSize
);
this
.
byteBufferRead
.
get
(
bodyData
);
byte
[]
bodyData
=
byteBufferRead
.
array
();
int
dataStart
=
this
.
dispatchPosition
+
msgHeaderSize
;
HAService
.
this
.
defaultMessageStore
.
appendToCommitLog
(
masterPhyOffset
,
bodyData
);
HAService
.
this
.
defaultMessageStore
.
appendToCommitLog
(
masterPhyOffset
,
bodyData
,
dataStart
,
bodySize
);
this
.
byteBufferRead
.
position
(
readSocketPos
);
this
.
dispatchPosition
+=
msgHeaderSize
+
bodySize
;
if
(!
reportSlaveMaxOffsetPlus
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录