sanha commented on a change in pull request #112: [NEMO-179] Delayed Task 
Cloning
URL: https://github.com/apache/incubator-nemo/pull/112#discussion_r211809651
 
 

 ##########
 File path: 
runtime/master/src/main/java/edu/snu/nemo/runtime/master/BlockManagerMaster.java
 ##########
 @@ -302,21 +297,36 @@ private BlockMetadata getBlockMetaData(final String 
blockId) {
   }
 
   /**
-   * Deals with a request for the location of a block.
-   *
    * @param message        the request message.
    * @param messageContext the message context which will be used for response.
    */
-  void onRequestBlockLocation(final ControlMessage.Message message,
-                              final MessageContext messageContext) {
+  private void registerLocationRequest(final ControlMessage.Message message, 
final MessageContext messageContext) {
     assert (message.getType() == 
ControlMessage.MessageType.RequestBlockLocation);
     final String blockIdWildcard = 
message.getRequestBlockLocationMsg().getBlockIdWildcard();
     final long requestId = message.getId();
     final Lock readLock = lock.readLock();
     readLock.lock();
     try {
-      final BlockRequestHandler locationFuture = 
getBlockLocationHandler(blockIdWildcard);
-      locationFuture.registerRequest(requestId, messageContext);
+      // (CASE 1) Check AVAILABLE blocks.
+      final List<BlockRequestHandler> availableBlocks = 
getBlockHandlers(blockIdWildcard, BlockState.State.AVAILABLE);
+      if (!availableBlocks.isEmpty()) {
+        // random pick
 
 Review comment:
   Why do we have to choose randomly? In my thought, the `BlockManagerMaster` 
should return all possible candidates and let the receiver choose one of them.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to