Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release all sp from freeze pool if there is no way to create new… #1424

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading