yangwwei commented on a change in pull request #108: [YUNIKORN-47] Support node 
update action
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/108#discussion_r398331257
 
 

 ##########
 File path: pkg/cache/partition_info.go
 ##########
 @@ -477,12 +477,17 @@ func (pi *PartitionInfo) 
releaseAllocationsForApplication(toRelease *commonevent
        for _, alloc := range allocationsToRelease {
                // remove allocation from node
                node := pi.nodes[alloc.AllocationProto.NodeID]
+               // node could be nil if when release happens, the node is 
already
+               // removed from the cluster. in this case, we need to make sure
+               // resources are released correctly. otherwise these resources 
will
+               // be leaked.
                if node == nil || 
node.GetAllocation(alloc.AllocationProto.UUID) == nil {
-                       log.Logger().Info("node is not found for allocation",
-                               zap.Any("allocation", alloc))
-                       continue
+                       log.Logger().Info("node is not found or the allocation 
is not found",
+                               zap.String("node", 
alloc.AllocationProto.NodeID),
+                               zap.String("allocationID", 
alloc.AllocationProto.UUID))
+               } else {
+                       node.RemoveAllocation(alloc.AllocationProto.UUID)
                }
-               node.RemoveAllocation(alloc.AllocationProto.UUID)
                totalReleasedResource.AddTo(alloc.AllocatedResource)
 
 Review comment:
   Sorry, I missed this one earlier. Just done in the latest commit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: dev-h...@yunikorn.apache.org

Reply via email to