Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ public void checkStatus() throws Exception {
if (connection.getChannel() == null || !connection.getChannel().isActive()) {
reconnect("Check connection failed for address: " + connection.getUrl());
}
if (!connection.getChannel().isWritable()) {
if (obTable.isNettyCheckWritableEnabled() && !connection.getChannel().isWritable()) {
LOGGER.warn("The connection might be write overflow : " + connection.getUrl());
// Wait some interval for the case when a big package is blocking the buffer but server is ok.
// Don't bother to call flush() here as we invoke writeAndFlush() when send request.
Thread.sleep(obTable.getNettyBlockingWaitInterval());
if (!connection.getChannel().isWritable()) {
throw new ObTableConnectionUnWritableException(
"Check connection failed for address: " + connection.getUrl()
+ ", maybe write overflow!");
+ ", maybe write overflow! Overflow bytes:" + connection.getChannel().bytesBeforeWritable());
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/alipay/oceanbase/rpc/property/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public enum Property {
// when a big package is blocking the buffer but the server is OK.
NETTY_BLOCKING_WAIT_INTERVAL("bolt.netty.blocking.wait.interval", 1, "netty写缓存满后等待时间"),

NETTY_CHECK_WRITABLE_ENABLED("bolt.netty.check.writable.enabled", true, "是否启用netty写缓存可写性检查"),
Comment thread
WeiXinChan marked this conversation as resolved.
Outdated

// [ObTable][OTHERS]
SERVER_ENABLE_REROUTING("server.enable.rerouting", false, "开启server端的重定向回复功能"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public abstract class AbstractObTable extends AbstractTable {

protected int nettyBlockingWaitInterval = NETTY_BLOCKING_WAIT_INTERVAL.getDefaultInt();

protected boolean nettyCheckWritableEnabled = NETTY_CHECK_WRITABLE_ENABLED.getDefaultBoolean();

protected long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME.getDefaultLong();

/*
Expand Down Expand Up @@ -162,6 +164,13 @@ public int getNettyBlockingWaitInterval() {
return nettyBlockingWaitInterval;
}

/*
* Get netty check writable enabled.
*/
public boolean isNettyCheckWritableEnabled() {
return nettyCheckWritableEnabled;
}

/*
* Get connection max expired time
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/alipay/oceanbase/rpc/table/ObTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ private void initProperties() {
nettyBufferHighWatermark);
nettyBlockingWaitInterval = parseToInt(NETTY_BLOCKING_WAIT_INTERVAL.getKey(),
nettyBlockingWaitInterval);
nettyCheckWritableEnabled = parseToBoolean(NETTY_CHECK_WRITABLE_ENABLED.getKey(),
nettyCheckWritableEnabled);
enableRerouting = parseToBoolean(SERVER_ENABLE_REROUTING.getKey(), enableRerouting);
maxConnExpiredTime = parseToLong(MAX_CONN_EXPIRED_TIME.getKey(), maxConnExpiredTime);

Expand Down