Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18388#discussion_r124715952
  
    --- Diff: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java
 ---
    @@ -90,16 +96,28 @@ protected void handleMessage(
           try {
             OpenBlocks msg = (OpenBlocks) msgObj;
             checkAuth(client, msg.appId);
    -        long streamId = streamManager.registerStream(client.getClientId(),
    -          new ManagedBufferIterator(msg.appId, msg.execId, msg.blockIds));
    -        if (logger.isTraceEnabled()) {
    -          logger.trace("Registered streamId {} with {} buffers for client 
{} from host {}",
    -                       streamId,
    -                       msg.blockIds.length,
    -                       client.getClientId(),
    -                       getRemoteAddress(client.getChannel()));
    +        // Return OpenBlocksFailed when memory usage is above the water 
mark.
    +        long usage = memoryUsage.getMemoryUsage();
    +        if (usage > memWaterMark) {
    +          logger.warn("Memory usage({}) is above water mark({}), rejecting 
'open blocks' request " +
    +            "from client({}, {}).", usage, memWaterMark, 
client.getClientId(),
    +            client.getSocketAddress());
    +          callback.onSuccess(new OpenBlocksFailed(1).toByteBuffer());
    +        } else {
    +          logger.trace("Memory usage({}) is under water mark({}), 
accepting 'open blocks' " +
    +            "request from client({}, {}).", usage, memWaterMark, 
client.getClientId(),
    +            client.getSocketAddress());
    +          long streamId = 
streamManager.registerStream(client.getClientId(),
    +            new ManagedBufferIterator(msg.appId, msg.execId, 
msg.blockIds));
    +          if (logger.isTraceEnabled()) {
    +            logger.trace("Registered streamId {} with {} buffers for 
client {} from host {}",
    --- End diff --
    
    shall we merge this and the above log into one log entry?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to