This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 031594b0 [YUNIKORN-2114] update read lock to rw lock (#692)
031594b0 is described below

commit 031594b0b52c2049136fbb5f067dd8fc0a2e2e79
Author: PoAn Yang <[email protected]>
AuthorDate: Fri Nov 3 09:45:20 2023 +0100

    [YUNIKORN-2114] update read lock to rw lock (#692)
    
    Signed-off-by: PoAn Yang <[email protected]>
    
    Closes: #692
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/scheduler/ugm/manager.go | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pkg/scheduler/ugm/manager.go b/pkg/scheduler/ugm/manager.go
index 0f431bc7..586366d2 100644
--- a/pkg/scheduler/ugm/manager.go
+++ b/pkg/scheduler/ugm/manager.go
@@ -408,6 +408,9 @@ func (m *Manager) internalProcessConfig(cur 
configs.QueueConfig, queuePath strin
 
 // clearEarlierSetLimits Clear already configured limits of users and groups 
for which limits have been configured before but not now
 func (m *Manager) clearEarlierSetLimits(newUserLimits 
map[string]map[string]*LimitConfig, newGroupLimits 
map[string]map[string]*LimitConfig) {
+       m.Lock()
+       defer m.Unlock()
+
        // Clear already configured limits of group for which limits have been 
configured before but not now
        m.clearEarlierSetGroupLimits(newGroupLimits)
 
@@ -418,8 +421,6 @@ func (m *Manager) clearEarlierSetLimits(newUserLimits 
map[string]map[string]*Lim
 // clearEarlierSetUserLimits Traverse new user config and decide whether 
earlier usage needs to be cleared or not
 // by comparing with the existing config. Reset earlier usage only config set 
earlier but not now
 func (m *Manager) clearEarlierSetUserLimits(newUserLimits 
map[string]map[string]*LimitConfig) {
-       m.RLock()
-       defer m.RUnlock()
        for queuePath, limitConfig := range m.userLimits {
                // Is queue path exists?
                if newUserLimit, ok := newUserLimits[queuePath]; !ok {
@@ -467,8 +468,6 @@ func (m *Manager) resetUserEarlierUsage(ut *UserTracker, 
queuePath string) {
 // clearEarlierSetGroupLimits Traverse new group config and decide whether 
earlier usage needs to be cleared or not
 // by comparing with the existing config. Reset earlier usage only config set 
earlier but not now
 func (m *Manager) clearEarlierSetGroupLimits(newGroupLimits 
map[string]map[string]*LimitConfig) {
-       m.RLock()
-       defer m.RUnlock()
        for queuePath, limitConfig := range m.groupLimits {
                // Is queue path exists?
                if newGroupLimit, ok := newGroupLimits[queuePath]; !ok {


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

Reply via email to