adrian-lin-1-0-0 commented on code in PR #1037:
URL: https://github.com/apache/yunikorn-core/pull/1037#discussion_r2461211130
##########
pkg/scheduler/objects/queue.go:
##########
@@ -89,9 +89,42 @@ type Queue struct {
template *template.Template
queueEvents *schedEvt.QueueEvents
+ // appID -> queuePath index
+ appIndex *appQueueMapping
+
+ locking.RWMutex
+}
+
+// appQueueMapping is a thread safe mapping from applicationID to queuePath
+type appQueueMapping struct {
+ byAppID map[string]string
locking.RWMutex
}
Review Comment:
I initially tried managing the global state in `PartitionContext`,
but `FindQueueByAppID` is often called together with other
`PartitionContext` operations.
When `PartitionContext` holds a lock and the `queue` calls any `getXXXX`
function, it can cause a deadlock.
As you suggested, making `AppQueueMapping` public, limiting the lock scope
to `AppQueueMapping` itself, and injecting it into the queue should prevent
this issue.
I’ll confirm the scope of changes and push an updated version.
Thanks for the review!
--
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]