Skip to content

Commit 805e3fb

Browse files
weixiulisrowen
authored andcommitted
[SPARK-37462][CORE] Avoid unnecessary calculating the number of outstanding fetch requests and RPCS
### What changes were proposed in this pull request? Avoid unnecessary calculating the number of outstanding fetch requests and RPCS ### Why are the changes needed? It is unnecessary to calculate the number of outstanding fetch requests and RPCS when the IdleStateEvent is not IDLE or the last request is not timeout. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Exist unittests. Closes #34711 from weixiuli/SPARK-37462. Authored-by: weixiuli <weixiuli@jd.com> Signed-off-by: Sean Owen <srowen@gmail.com>
1 parent f6be769 commit 805e3fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
158158
// To avoid a race between TransportClientFactory.createClient() and this code which could
159159
// result in an inactive client being returned, this needs to run in a synchronized block.
160160
synchronized (this) {
161-
boolean hasInFlightRequests = responseHandler.numOutstandingRequests() > 0;
162161
boolean isActuallyOverdue =
163162
System.nanoTime() - responseHandler.getTimeOfLastRequestNs() > requestTimeoutNs;
164163
if (e.state() == IdleState.ALL_IDLE && isActuallyOverdue) {
164+
boolean hasInFlightRequests = responseHandler.numOutstandingRequests() > 0;
165165
if (hasInFlightRequests) {
166166
String address = getRemoteAddress(ctx.channel());
167167
logger.error("Connection to {} has been quiet for {} ms while there are outstanding " +

0 commit comments

Comments
 (0)