wilfred-s 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_r398318824
 
 

 ##########
 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:
   This needs to be reverted too. If we have a nil node we need to continue. It 
is almost an error case but we can only update if we have a node and an alloc.
   The queue will get out of sync if we remove the alloc while the node is nil. 
The nil node is a result of the queue already being updated.

----------------------------------------------------------------
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