未验证 提交 1dc838eb 编写于 作者: H He Wang 提交者: GitHub

use safeTimestamp (#48)

上级 444e62ed
......@@ -137,7 +137,12 @@ public class ObReaderConfig extends AbstractConnectionConfig {
@Override
public void updateCheckpoint(String checkpoint) {
try {
startTimestamp.set(Long.parseLong(checkpoint));
long timestamp = Long.parseLong(checkpoint);
if (timestamp < 0) {
throw new IllegalArgumentException(
"update checkpoint with invalid value: " + checkpoint);
}
startTimestamp.set(timestamp);
} catch (NumberFormatException e) {
// do nothing
}
......
......@@ -331,10 +331,14 @@ public class ClientHandler extends ChannelInboundHandlerAdapter {
throw new LogProxyClientException(ErrorCode.E_PARSE, e);
}
if (logger.isTraceEnabled()) {
logger.trace("Log message: {}", logMessage);
}
while (true) {
try {
recordQueue.put(new StreamContext.TransferPacket(logMessage));
stream.setCheckpointString(logMessage.getTimestamp());
stream.setCheckpointString(logMessage.getSafeTimestamp());
break;
} catch (InterruptedException e) {
// do nothing
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册