[ 
https://issues.apache.org/jira/browse/HDDS-1209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16788898#comment-16788898
 ] 

Nanda kumar commented on HDDS-1209:
-----------------------------------

Thanks [~avijayan] for working on this, overall the patch looks good to me.

We can replace the below logic

{code}
      ContainerInfo containerInfo = null;
      // Checking if excludedContainers is empty so that we don't loop around
      // containerIDs for every allocate block.
      if (CollectionUtils.isNotEmpty(excludedContainers)) {
        NavigableSet<ContainerID> allowedContainerIDs = containerIDs
            .parallelStream()
            .filter(containerID -> !excludedContainers.contains(containerID))
            .collect(Collectors.toCollection(TreeSet<ContainerID>::new));

        containerInfo = containerStateManager.getMatchingContainer(
            sizeRequired, owner, pipeline.getId(), allowedContainerIDs);
      } else {
        containerInfo = containerStateManager.getMatchingContainer(
            sizeRequired, owner, pipeline.getId(), containerIDs);
      }
{code}

with

{code}
    containerIDs.removeAll(excludedContainers);
    ContainerInfo containerInfo =
          containerStateManager.getMatchingContainer(sizeRequired, owner,
              pipeline.getId(), containerIDs);
{code}


Can you also add a test case to verify if we are creating a new container in 
the selected pipeline if all the existing containers are in the excluded list?

> Fix the block allocation logic in SCM when client wants to exclude all 
> available open containers in a chosen pipeline
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-1209
>                 URL: https://issues.apache.org/jira/browse/HDDS-1209
>             Project: Hadoop Distributed Data Store
>          Issue Type: Improvement
>            Reporter: Shashikant Banerjee
>            Assignee: Aravindan Vijayan
>            Priority: Major
>         Attachments: HDDS-1209-000.patch, HDDS-1209-001.patch
>
>
> As per [~nandakumar131] comments here in HDDS-726 ,
> https://issues.apache.org/jira/browse/HDDS-726?focusedCommentId=16779554&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16779554
> We may end up in case in SCM where all the open containers available in a 
> chosen pipeline are there in the exclude list provided by client during 
> allocate block call. In such case, blockMamager in SCM will run in an 
> infinite loop. This needs to be fixed as a part of this jira.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to