Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oblogclient
提交
92bcf94e
O
oblogclient
项目概览
oceanbase
/
oblogclient
1 年多 前同步成功
通知
5
Star
15
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oblogclient
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
92bcf94e
编写于
6月 29, 2022
作者:
H
He Wang
提交者:
GitHub
6月 29, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix parseRecord (#50)
* fix parseRecord * set checkpoint after put successfully
上级
33f737e7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
15 deletion
+16
-15
logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java
.../oceanbase/clogproxy/client/connection/ClientHandler.java
+15
-14
logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java
...m/oceanbase/clogproxy/client/connection/ClientStream.java
+1
-1
未找到文件。
logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java
浏览文件 @
92bcf94e
...
@@ -309,25 +309,23 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
...
@@ -309,25 +309,23 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
int
offset
=
0
;
int
offset
=
0
;
while
(
offset
<
bytes
.
length
)
{
while
(
offset
<
bytes
.
length
)
{
int
dataLength
=
Conversion
.
byteArrayToInt
(
bytes
,
offset
+
4
,
0
,
0
,
4
);
int
dataLength
=
Conversion
.
byteArrayToInt
(
bytes
,
offset
+
4
,
0
,
0
,
4
);
LogMessage
logMessage
;
/*
* We must copy a byte array and call parse after then,
* or got a !!!RIDICULOUS EXCEPTION!!!,
* if we wrap an unpooled buffer with offset and call setByteBuf just as same as `parse` function do.
*/
LogMessage
logMessage
=
new
LogMessage
(
false
);
byte
[]
data
=
new
byte
[
dataLength
+
8
];
System
.
arraycopy
(
bytes
,
offset
,
data
,
0
,
data
.
length
);
try
{
try
{
/*
* We must copy a byte array and call parse after then,
* or got a !!!RIDICULOUS EXCEPTION!!!,
* if we wrap an unpooled buffer with offset and call setByteBuf just as same as `parse` function do.
*/
logMessage
=
new
LogMessage
(
false
);
byte
[]
data
=
new
byte
[
dataLength
+
8
];
System
.
arraycopy
(
bytes
,
offset
,
data
,
0
,
data
.
length
);
logMessage
.
parse
(
data
);
logMessage
.
parse
(
data
);
}
catch
(
Exception
e
)
{
if
(
config
.
isIgnoreUnknownRecordType
())
{
if
(
config
.
isIgnoreUnknownRecordType
())
{
// unsupported type, ignore
// unsupported type, ignore
logger
.
debug
(
"Unsupported record type: {}"
,
logMessage
);
logger
.
debug
(
"Unsupported record type: {}"
,
logMessage
);
offset
+=
(
8
+
dataLength
);
offset
+=
(
8
+
dataLength
);
continue
;
continue
;
}
}
}
catch
(
Exception
e
)
{
throw
new
LogProxyClientException
(
ErrorCode
.
E_PARSE
,
e
);
throw
new
LogProxyClientException
(
ErrorCode
.
E_PARSE
,
e
);
}
}
...
@@ -338,15 +336,18 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
...
@@ -338,15 +336,18 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
while
(
true
)
{
while
(
true
)
{
try
{
try
{
recordQueue
.
put
(
new
StreamContext
.
TransferPacket
(
logMessage
));
recordQueue
.
put
(
new
StreamContext
.
TransferPacket
(
logMessage
));
stream
.
setCheckpointString
(
logMessage
.
getSafeTimestamp
());
break
;
break
;
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
// do nothing
// do nothing
}
catch
(
IllegalArgumentException
e
)
{
logger
.
error
(
"Failed to update checkpoint for log message: "
+
logMessage
,
e
);
}
}
}
}
try
{
stream
.
setCheckpointString
(
logMessage
.
getSafeTimestamp
());
}
catch
(
IllegalArgumentException
e
)
{
logger
.
error
(
"Failed to update checkpoint for log message: "
+
logMessage
,
e
);
}
offset
+=
(
8
+
dataLength
);
offset
+=
(
8
+
dataLength
);
}
}
}
}
...
...
logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java
浏览文件 @
92bcf94e
...
@@ -297,7 +297,7 @@ public class ClientStream {
...
@@ -297,7 +297,7 @@ public class ClientStream {
*/
*/
public
void
setCheckpointString
(
String
checkpointString
)
{
public
void
setCheckpointString
(
String
checkpointString
)
{
long
timestamp
=
Long
.
parseLong
(
checkpointString
);
long
timestamp
=
Long
.
parseLong
(
checkpointString
);
if
(
timestamp
<
0
)
{
if
(
timestamp
<
=
0
)
{
throw
new
IllegalArgumentException
(
throw
new
IllegalArgumentException
(
"Update checkpoint with invalid value: "
+
timestamp
);
"Update checkpoint with invalid value: "
+
timestamp
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录