Skip to content

Commit d46e925

Browse files
Merge pull request #1081 from percona/PBM-14780-pbm-restore-do-not-work-for-single-cpu
PBM-1478 PBM restore doesn't work by default on server with single CPU
2 parents 58ea420 + 795de29 commit d46e925

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd/pbm-agent/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (a *Agent) Restore(ctx context.Context, r *ctrl.RestoreCmd, opid ctrl.OPID,
184184
}
185185

186186
func getNumParallelCollsConfig(rParallelColls *int32, restoreConf *config.RestoreConf) int {
187-
numParallelColls := runtime.NumCPU() / 2
187+
numParallelColls := max(runtime.NumCPU()/2, 1)
188188
if rParallelColls != nil && *rParallelColls > 0 {
189189
numParallelColls = int(*rParallelColls)
190190
} else if restoreConf != nil && restoreConf.NumParallelCollections > 0 {

cmd/pbm-agent/restore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestGetNumParallelCollsConfig(t *testing.T) {
8787

8888
rZeroParallelColls := int32(0)
8989
rValidParallelColls := int32(99)
90-
defaultValue := runtime.NumCPU() / 2
90+
defaultValue := max(runtime.NumCPU()/2, 1)
9191

9292
tests := []struct {
9393
name string

0 commit comments

Comments
 (0)