Skip to content

Commit 782783f

Browse files
committed
add config for enable/disable netty isWritable check
1 parent 6f3cda7 commit 782783f

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ public void checkStatus() throws Exception {
244244
if (connection.getChannel() == null || !connection.getChannel().isActive()) {
245245
reconnect("Check connection failed for address: " + connection.getUrl());
246246
}
247-
if (!connection.getChannel().isWritable()) {
247+
if (obTable.isNettyCheckWritableEnabled() && !connection.getChannel().isWritable()) {
248248
LOGGER.warn("The connection might be write overflow : " + connection.getUrl());
249249
// Wait some interval for the case when a big package is blocking the buffer but server is ok.
250250
// Don't bother to call flush() here as we invoke writeAndFlush() when send request.
251251
Thread.sleep(obTable.getNettyBlockingWaitInterval());
252252
if (!connection.getChannel().isWritable()) {
253253
throw new ObTableConnectionUnWritableException(
254254
"Check connection failed for address: " + connection.getUrl()
255-
+ ", maybe write overflow!");
255+
+ ", maybe write overflow! channel used buffer size:" + connection.getChannel().bytesBeforeWritable());
256256
}
257257
}
258258
}

src/main/java/com/alipay/oceanbase/rpc/property/Property.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ public enum Property {
136136
// when a big package is blocking the buffer but the server is OK.
137137
NETTY_BLOCKING_WAIT_INTERVAL("bolt.netty.blocking.wait.interval", 1, "netty写缓存满后等待时间"),
138138

139+
NETTY_CHECK_WRITABLE_ENABLED("bolt.netty.check.writable.enabled", true, "是否启用netty写缓存可写性检查"),
140+
139141
// [ObTable][OTHERS]
140142
SERVER_ENABLE_REROUTING("server.enable.rerouting", false, "开启server端的重定向回复功能"),
141143

src/main/java/com/alipay/oceanbase/rpc/table/AbstractObTable.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public abstract class AbstractObTable extends AbstractTable {
4141

4242
protected int nettyBlockingWaitInterval = NETTY_BLOCKING_WAIT_INTERVAL.getDefaultInt();
4343

44+
protected boolean nettyCheckWritableEnabled = NETTY_CHECK_WRITABLE_ENABLED.getDefaultBoolean();
45+
4446
protected long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME.getDefaultLong();
4547

4648
/*
@@ -162,6 +164,13 @@ public int getNettyBlockingWaitInterval() {
162164
return nettyBlockingWaitInterval;
163165
}
164166

167+
/*
168+
* Get netty check writable enabled.
169+
*/
170+
public boolean isNettyCheckWritableEnabled() {
171+
return nettyCheckWritableEnabled;
172+
}
173+
165174
/*
166175
* Get connection max expired time
167176
*/

src/main/java/com/alipay/oceanbase/rpc/table/ObTable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ private void initProperties() {
178178
nettyBufferHighWatermark);
179179
nettyBlockingWaitInterval = parseToInt(NETTY_BLOCKING_WAIT_INTERVAL.getKey(),
180180
nettyBlockingWaitInterval);
181+
nettyCheckWritableEnabled = parseToBoolean(NETTY_CHECK_WRITABLE_ENABLED.getKey(),
182+
nettyCheckWritableEnabled);
181183
enableRerouting = parseToBoolean(SERVER_ENABLE_REROUTING.getKey(), enableRerouting);
182184
maxConnExpiredTime = parseToLong(MAX_CONN_EXPIRED_TIME.getKey(), maxConnExpiredTime);
183185

0 commit comments

Comments
 (0)