Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
Rocketmq
提交
bf2a7e51
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看板
提交
bf2a7e51
编写于
6月 17, 2019
作者:
K
kexianjun
提交者:
dinglei
6月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix typo (#1260)
上级
ac7b16da
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
14 deletion
+14
-14
store/src/main/java/org/apache/rocketmq/store/ha/HAConnection.java
.../main/java/org/apache/rocketmq/store/ha/HAConnection.java
+4
-4
store/src/main/java/org/apache/rocketmq/store/ha/HAService.java
...src/main/java/org/apache/rocketmq/store/ha/HAService.java
+10
-10
未找到文件。
store/src/main/java/org/apache/rocketmq/store/ha/HAConnection.java
浏览文件 @
bf2a7e51
...
@@ -83,7 +83,7 @@ public class HAConnection {
...
@@ -83,7 +83,7 @@ public class HAConnection {
private
final
Selector
selector
;
private
final
Selector
selector
;
private
final
SocketChannel
socketChannel
;
private
final
SocketChannel
socketChannel
;
private
final
ByteBuffer
byteBufferRead
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
private
final
ByteBuffer
byteBufferRead
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
private
int
processPostion
=
0
;
private
int
processPos
i
tion
=
0
;
private
volatile
long
lastReadTimestamp
=
System
.
currentTimeMillis
();
private
volatile
long
lastReadTimestamp
=
System
.
currentTimeMillis
();
public
ReadSocketService
(
final
SocketChannel
socketChannel
)
throws
IOException
{
public
ReadSocketService
(
final
SocketChannel
socketChannel
)
throws
IOException
{
...
@@ -150,7 +150,7 @@ public class HAConnection {
...
@@ -150,7 +150,7 @@ public class HAConnection {
if
(!
this
.
byteBufferRead
.
hasRemaining
())
{
if
(!
this
.
byteBufferRead
.
hasRemaining
())
{
this
.
byteBufferRead
.
flip
();
this
.
byteBufferRead
.
flip
();
this
.
processPostion
=
0
;
this
.
processPos
i
tion
=
0
;
}
}
while
(
this
.
byteBufferRead
.
hasRemaining
())
{
while
(
this
.
byteBufferRead
.
hasRemaining
())
{
...
@@ -159,10 +159,10 @@ public class HAConnection {
...
@@ -159,10 +159,10 @@ public class HAConnection {
if
(
readSize
>
0
)
{
if
(
readSize
>
0
)
{
readSizeZeroTimes
=
0
;
readSizeZeroTimes
=
0
;
this
.
lastReadTimestamp
=
HAConnection
.
this
.
haService
.
getDefaultMessageStore
().
getSystemClock
().
now
();
this
.
lastReadTimestamp
=
HAConnection
.
this
.
haService
.
getDefaultMessageStore
().
getSystemClock
().
now
();
if
((
this
.
byteBufferRead
.
position
()
-
this
.
processPostion
)
>=
8
)
{
if
((
this
.
byteBufferRead
.
position
()
-
this
.
processPos
i
tion
)
>=
8
)
{
int
pos
=
this
.
byteBufferRead
.
position
()
-
(
this
.
byteBufferRead
.
position
()
%
8
);
int
pos
=
this
.
byteBufferRead
.
position
()
-
(
this
.
byteBufferRead
.
position
()
%
8
);
long
readOffset
=
this
.
byteBufferRead
.
getLong
(
pos
-
8
);
long
readOffset
=
this
.
byteBufferRead
.
getLong
(
pos
-
8
);
this
.
processPostion
=
pos
;
this
.
processPos
i
tion
=
pos
;
HAConnection
.
this
.
slaveAckOffset
=
readOffset
;
HAConnection
.
this
.
slaveAckOffset
=
readOffset
;
if
(
HAConnection
.
this
.
slaveRequestOffset
<
0
)
{
if
(
HAConnection
.
this
.
slaveRequestOffset
<
0
)
{
...
...
store/src/main/java/org/apache/rocketmq/store/ha/HAService.java
浏览文件 @
bf2a7e51
...
@@ -332,7 +332,7 @@ public class HAService {
...
@@ -332,7 +332,7 @@ public class HAService {
private
long
lastWriteTimestamp
=
System
.
currentTimeMillis
();
private
long
lastWriteTimestamp
=
System
.
currentTimeMillis
();
private
long
currentReportedOffset
=
0
;
private
long
currentReportedOffset
=
0
;
private
int
dispatchPostion
=
0
;
private
int
dispatchPos
i
tion
=
0
;
private
ByteBuffer
byteBufferRead
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
private
ByteBuffer
byteBufferRead
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
private
ByteBuffer
byteBufferBackup
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
private
ByteBuffer
byteBufferBackup
=
ByteBuffer
.
allocate
(
READ_MAX_BUFFER_SIZE
);
...
@@ -378,9 +378,9 @@ public class HAService {
...
@@ -378,9 +378,9 @@ public class HAService {
}
}
private
void
reallocateByteBuffer
()
{
private
void
reallocateByteBuffer
()
{
int
remain
=
READ_MAX_BUFFER_SIZE
-
this
.
dispatchPostion
;
int
remain
=
READ_MAX_BUFFER_SIZE
-
this
.
dispatchPos
i
tion
;
if
(
remain
>
0
)
{
if
(
remain
>
0
)
{
this
.
byteBufferRead
.
position
(
this
.
dispatchPostion
);
this
.
byteBufferRead
.
position
(
this
.
dispatchPos
i
tion
);
this
.
byteBufferBackup
.
position
(
0
);
this
.
byteBufferBackup
.
position
(
0
);
this
.
byteBufferBackup
.
limit
(
READ_MAX_BUFFER_SIZE
);
this
.
byteBufferBackup
.
limit
(
READ_MAX_BUFFER_SIZE
);
...
@@ -391,7 +391,7 @@ public class HAService {
...
@@ -391,7 +391,7 @@ public class HAService {
this
.
byteBufferRead
.
position
(
remain
);
this
.
byteBufferRead
.
position
(
remain
);
this
.
byteBufferRead
.
limit
(
READ_MAX_BUFFER_SIZE
);
this
.
byteBufferRead
.
limit
(
READ_MAX_BUFFER_SIZE
);
this
.
dispatchPostion
=
0
;
this
.
dispatchPos
i
tion
=
0
;
}
}
private
void
swapByteBuffer
()
{
private
void
swapByteBuffer
()
{
...
@@ -435,10 +435,10 @@ public class HAService {
...
@@ -435,10 +435,10 @@ public class HAService {
int
readSocketPos
=
this
.
byteBufferRead
.
position
();
int
readSocketPos
=
this
.
byteBufferRead
.
position
();
while
(
true
)
{
while
(
true
)
{
int
diff
=
this
.
byteBufferRead
.
position
()
-
this
.
dispatchPostion
;
int
diff
=
this
.
byteBufferRead
.
position
()
-
this
.
dispatchPos
i
tion
;
if
(
diff
>=
msgHeaderSize
)
{
if
(
diff
>=
msgHeaderSize
)
{
long
masterPhyOffset
=
this
.
byteBufferRead
.
getLong
(
this
.
dispatchPostion
);
long
masterPhyOffset
=
this
.
byteBufferRead
.
getLong
(
this
.
dispatchPos
i
tion
);
int
bodySize
=
this
.
byteBufferRead
.
getInt
(
this
.
dispatchPostion
+
8
);
int
bodySize
=
this
.
byteBufferRead
.
getInt
(
this
.
dispatchPos
i
tion
+
8
);
long
slavePhyOffset
=
HAService
.
this
.
defaultMessageStore
.
getMaxPhyOffset
();
long
slavePhyOffset
=
HAService
.
this
.
defaultMessageStore
.
getMaxPhyOffset
();
...
@@ -452,13 +452,13 @@ public class HAService {
...
@@ -452,13 +452,13 @@ public class HAService {
if
(
diff
>=
(
msgHeaderSize
+
bodySize
))
{
if
(
diff
>=
(
msgHeaderSize
+
bodySize
))
{
byte
[]
bodyData
=
new
byte
[
bodySize
];
byte
[]
bodyData
=
new
byte
[
bodySize
];
this
.
byteBufferRead
.
position
(
this
.
dispatchPostion
+
msgHeaderSize
);
this
.
byteBufferRead
.
position
(
this
.
dispatchPos
i
tion
+
msgHeaderSize
);
this
.
byteBufferRead
.
get
(
bodyData
);
this
.
byteBufferRead
.
get
(
bodyData
);
HAService
.
this
.
defaultMessageStore
.
appendToCommitLog
(
masterPhyOffset
,
bodyData
);
HAService
.
this
.
defaultMessageStore
.
appendToCommitLog
(
masterPhyOffset
,
bodyData
);
this
.
byteBufferRead
.
position
(
readSocketPos
);
this
.
byteBufferRead
.
position
(
readSocketPos
);
this
.
dispatchPostion
+=
msgHeaderSize
+
bodySize
;
this
.
dispatchPos
i
tion
+=
msgHeaderSize
+
bodySize
;
if
(!
reportSlaveMaxOffsetPlus
())
{
if
(!
reportSlaveMaxOffsetPlus
())
{
return
false
;
return
false
;
...
@@ -532,7 +532,7 @@ public class HAService {
...
@@ -532,7 +532,7 @@ public class HAService {
}
}
this
.
lastWriteTimestamp
=
0
;
this
.
lastWriteTimestamp
=
0
;
this
.
dispatchPostion
=
0
;
this
.
dispatchPos
i
tion
=
0
;
this
.
byteBufferBackup
.
position
(
0
);
this
.
byteBufferBackup
.
position
(
0
);
this
.
byteBufferBackup
.
limit
(
READ_MAX_BUFFER_SIZE
);
this
.
byteBufferBackup
.
limit
(
READ_MAX_BUFFER_SIZE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录