Skip to content

Commit

Permalink
fix: release all sp from freeze pool if there is no way to create new…
Browse files Browse the repository at this point in the history
… GVG to serve
  • Loading branch information
alexgao001 committed Jun 18, 2024
1 parent f73c7a5 commit cba3ed7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/gfspvgmgr/virtual_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ func (vgm *virtualGroupManager) FreezeSPAndGVGs(spID uint32, gvgs []*virtualgrou
vgm.freezeSPPool.FreezeSPAndGVGs(spID, gvgs)
}

func (vgm *virtualGroupManager) ReleaseAllSP() {
vgm.freezeSPPool.ReleaseAllSP()
}

// releaseSPAndGVGLoop runs periodically to release SP from the freeze pool
func (vgm *virtualGroupManager) releaseSPAndGVGLoop() {
ticker := time.NewTicker(ReleaseSPJobInterval)
Expand Down
3 changes: 3 additions & 0 deletions core/vgmgr/virtual_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ type VirtualGroupManager interface {
// For those SPs which are in the pool will be skipped when creating a GVG, GVGs in the pool will not be chosen to seal Object
// until released
FreezeSPAndGVGs(spID uint32, gvgs []*virtualgrouptypes.GlobalVirtualGroup)
// ReleaseAllSP release all sp and their related GVG, in case that there is no enough balance to create a new GVG.
// should use the exisiting GVG even it failed to serve previously.
ReleaseAllSP()
}

// NewVirtualGroupManager is the virtual group manager init api.
Expand Down
12 changes: 12 additions & 0 deletions core/vgmgr/virtual_group_manager_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modular/manager/manage_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (m *ManageModular) pickGVGAndReplicate(ctx context.Context, vgfID uint32, t
gvgMeta, err := m.pickGlobalVirtualGroup(ctx, vgfID, task.GetStorageParams())
log.CtxInfow(ctx, "pick global virtual group", "time_cost", time.Since(startPickGVGTime).Seconds(), "gvg_meta", gvgMeta, "error", err)
if err != nil {
// If there is no way to create a new GVG, release all sp from freeze Pool, better than not serving requests.
m.virtualGroupManager.ReleaseAllSP()
return err
}
replicateTask := &gfsptask.GfSpReplicatePieceTask{}
Expand Down

0 comments on commit cba3ed7

Please sign in to comment.