Skip to content

Commit

Permalink
changes for racmaint in occ
Browse files Browse the repository at this point in the history
  • Loading branch information
rajesh-1983 committed Sep 24, 2024
1 parent d8670b9 commit 4000eab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/racmaint.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func InitRacMaint(cmdLineModuleName string) {
interval := GetConfig().RacMaintReloadInterval
if interval > 0 {
for i := 0; i < GetConfig().NumOfShards; i++ {
go racMaintMain(i, interval, cmdLineModuleName)
shardIndex := i //Address the behavior called variable capture.
go racMaintMain(shardIndex, interval, cmdLineModuleName)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/workerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ func (pool *WorkerPool) RacMaint(racReq racAct) {
}

if logger.GetLogger().V(logger.Verbose) {
logger.GetLogger().Log(logger.Verbose, "Rac maint activating, worker", i, pool.workers[i].pid, "exittime=", pool.workers[i].exitTime, now, window, pool.currentSize)
logger.GetLogger().Log(logger.Verbose, "Rac maint activating, worker", i, pool.workers[i].pid, "exittime=", pool.workers[i].exitTime, now, window, pool.currentSize, "rac.req timestamp=", racReq.tm)
}
//Trigger individual event for worker
evt := cal.NewCalEvent("RAC_ID", fmt.Sprintf("%d", racReq.instID), cal.TransOK, "")
Expand Down
4 changes: 4 additions & 0 deletions tests/unittest/rac_maint_async/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,9 @@ func TestRacMaintWithRandomStatusChangeInAsync(t *testing.T) {
t.Fatalf("ram maint status 'U' should not skip with invalid-status event")
}

if testutil.RegexCountFile("RAC_ID", "cal.log") < 20 {
t.Fatalf("ram maint should trigger for all workers once.")
}

logger.GetLogger().Log(logger.Debug, "TestRacMaintWithRandomStatusChangeInAsync done -------------------------------------------------------------")
}

0 comments on commit 4000eab

Please sign in to comment.