tigerquoll commented on code in PR #1122:
URL: https://github.com/apache/yunikorn-core/pull/1122#discussion_r3757450886


##########
pkg/scheduler/objects/application.go:
##########
@@ -664,6 +666,9 @@ func (sa *Application) AddAllocationAsk(ask *Allocation) 
error {
        var oldAskResource *resources.Resource = nil
        if oldAsk := sa.requests[ask.GetAllocationKey()]; oldAsk != nil && 
!oldAsk.IsAllocated() {
                oldAskResource = oldAsk.GetAllocatedResource().Clone()
+               // the old ask was pending and is being replaced: remove it 
from the pending histogram so the
+               // new ask's addAllocationAskInternal (via incPendingPriority) 
nets correctly.
+               sa.decPendingPriority(oldAsk.GetPriority())
        }

Review Comment:
   You are right - oldAsk is always nil in production.  Only a single-threaded 
add from a new ask or a recovery option results in an insertion into 
sa.requests — and the two operations cannot overlap by basic design.
   
   [YUNIKORN-3358](https://issues.apache.org/jira/browse/YUNIKORN-3358) added 
for the cleanup task
   
   
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to