Skip to content

Commit 69e3e6a

Browse files
authored
K8SPSMDB-1097 add NumParallelCollections to CR (#1842)
* K8SPSMDB-1097 add NumParallelCollections to CR * K8SPSMDB-1097 add NumParallelCollections to CR
1 parent e3a379b commit 69e3e6a

File tree

10 files changed

+55
-18
lines changed

10 files changed

+55
-18
lines changed

config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ spec:
5050
properties:
5151
backupOptions:
5252
properties:
53+
numParallelCollections:
54+
type: integer
5355
oplogSpanMin:
5456
type: number
5557
priority:
@@ -83,6 +85,8 @@ spec:
8385
type: integer
8486
numInsertionWorkers:
8587
type: integer
88+
numParallelCollections:
89+
type: integer
8690
type: object
8791
type: object
8892
containerSecurityContext:

deploy/bundle.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ spec:
746746
properties:
747747
backupOptions:
748748
properties:
749+
numParallelCollections:
750+
type: integer
749751
oplogSpanMin:
750752
type: number
751753
priority:
@@ -779,6 +781,8 @@ spec:
779781
type: integer
780782
numInsertionWorkers:
781783
type: integer
784+
numParallelCollections:
785+
type: integer
782786
type: object
783787
type: object
784788
containerSecurityContext:

deploy/cr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,12 @@ spec:
688688
# timeouts:
689689
# startingStatus: 33
690690
# oplogSpanMin: 10
691+
# numParallelCollections: 2
691692
# restoreOptions:
692693
# batchSize: 500
693694
# numInsertionWorkers: 10
694695
# numDownloadWorkers: 4
696+
# numParallelCollections: 2
695697
# maxDownloadBufferMb: 0
696698
# downloadChunkMb: 32
697699
# mongodLocation: /usr/bin/mongo

deploy/crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ spec:
746746
properties:
747747
backupOptions:
748748
properties:
749+
numParallelCollections:
750+
type: integer
749751
oplogSpanMin:
750752
type: number
751753
priority:
@@ -779,6 +781,8 @@ spec:
779781
type: integer
780782
numInsertionWorkers:
781783
type: integer
784+
numParallelCollections:
785+
type: integer
782786
type: object
783787
type: object
784788
containerSecurityContext:

deploy/cw-bundle.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ spec:
746746
properties:
747747
backupOptions:
748748
properties:
749+
numParallelCollections:
750+
type: integer
749751
oplogSpanMin:
750752
type: number
751753
priority:
@@ -779,6 +781,8 @@ spec:
779781
type: integer
780782
numInsertionWorkers:
781783
type: integer
784+
numParallelCollections:
785+
type: integer
782786
type: object
783787
type: object
784788
containerSecurityContext:

e2e-tests/version-service/conf/crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ spec:
746746
properties:
747747
backupOptions:
748748
properties:
749+
numParallelCollections:
750+
type: integer
749751
oplogSpanMin:
750752
type: number
751753
priority:
@@ -779,6 +781,8 @@ spec:
779781
type: integer
780782
numInsertionWorkers:
781783
type: integer
784+
numParallelCollections:
785+
type: integer
782786
type: object
783787
type: object
784788
containerSecurityContext:

pkg/apis/psmdb/v1/psmdb_types.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,19 +1003,21 @@ type BackupTimeouts struct {
10031003
}
10041004

10051005
type BackupOptions struct {
1006-
OplogSpanMin float64 `json:"oplogSpanMin"`
1007-
Priority map[string]float64 `json:"priority,omitempty"`
1008-
Timeouts *BackupTimeouts `json:"timeouts,omitempty"`
1006+
OplogSpanMin float64 `json:"oplogSpanMin"`
1007+
NumParallelCollections int `json:"numParallelCollections,omitempty"`
1008+
Priority map[string]float64 `json:"priority,omitempty"`
1009+
Timeouts *BackupTimeouts `json:"timeouts,omitempty"`
10091010
}
10101011

10111012
type RestoreOptions struct {
1012-
BatchSize int `json:"batchSize,omitempty"`
1013-
NumInsertionWorkers int `json:"numInsertionWorkers,omitempty"`
1014-
NumDownloadWorkers int `json:"numDownloadWorkers,omitempty"`
1015-
MaxDownloadBufferMb int `json:"maxDownloadBufferMb,omitempty"`
1016-
DownloadChunkMb int `json:"downloadChunkMb,omitempty"`
1017-
MongodLocation string `json:"mongodLocation,omitempty"`
1018-
MongodLocationMap map[string]string `json:"mongodLocationMap,omitempty"`
1013+
BatchSize int `json:"batchSize,omitempty"`
1014+
NumInsertionWorkers int `json:"numInsertionWorkers,omitempty"`
1015+
NumDownloadWorkers int `json:"numDownloadWorkers,omitempty"`
1016+
NumParallelCollections int `json:"numParallelCollections,omitempty"`
1017+
MaxDownloadBufferMb int `json:"maxDownloadBufferMb,omitempty"`
1018+
DownloadChunkMb int `json:"downloadChunkMb,omitempty"`
1019+
MongodLocation string `json:"mongodLocation,omitempty"`
1020+
MongodLocationMap map[string]string `json:"mongodLocationMap,omitempty"`
10191021
}
10201022

10211023
type BackupConfig struct {

pkg/psmdb/backup/pbm.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ func GetPBMConfig(ctx context.Context, k8sclient client.Client, cluster *api.Per
251251

252252
if cluster.Spec.Backup.Configuration.BackupOptions != nil {
253253
conf.Backup = &config.BackupConf{
254-
OplogSpanMin: cluster.Spec.Backup.Configuration.BackupOptions.OplogSpanMin,
254+
OplogSpanMin: cluster.Spec.Backup.Configuration.BackupOptions.OplogSpanMin,
255+
NumParallelCollections: cluster.Spec.Backup.Configuration.BackupOptions.NumParallelCollections,
255256
Timeouts: &config.BackupTimeouts{
256257
Starting: cluster.Spec.Backup.Configuration.BackupOptions.Timeouts.Starting,
257258
},
@@ -270,13 +271,14 @@ func GetPBMConfig(ctx context.Context, k8sclient client.Client, cluster *api.Per
270271

271272
if cluster.Spec.Backup.Configuration.RestoreOptions != nil {
272273
conf.Restore = &config.RestoreConf{
273-
BatchSize: cluster.Spec.Backup.Configuration.RestoreOptions.BatchSize,
274-
NumInsertionWorkers: cluster.Spec.Backup.Configuration.RestoreOptions.NumInsertionWorkers,
275-
NumDownloadWorkers: cluster.Spec.Backup.Configuration.RestoreOptions.NumDownloadWorkers,
276-
MaxDownloadBufferMb: cluster.Spec.Backup.Configuration.RestoreOptions.MaxDownloadBufferMb,
277-
DownloadChunkMb: cluster.Spec.Backup.Configuration.RestoreOptions.DownloadChunkMb,
278-
MongodLocation: cluster.Spec.Backup.Configuration.RestoreOptions.MongodLocation,
279-
MongodLocationMap: cluster.Spec.Backup.Configuration.RestoreOptions.MongodLocationMap,
274+
BatchSize: cluster.Spec.Backup.Configuration.RestoreOptions.BatchSize,
275+
NumInsertionWorkers: cluster.Spec.Backup.Configuration.RestoreOptions.NumInsertionWorkers,
276+
NumDownloadWorkers: cluster.Spec.Backup.Configuration.RestoreOptions.NumDownloadWorkers,
277+
NumParallelCollections: cluster.Spec.Backup.Configuration.RestoreOptions.NumParallelCollections,
278+
MaxDownloadBufferMb: cluster.Spec.Backup.Configuration.RestoreOptions.MaxDownloadBufferMb,
279+
DownloadChunkMb: cluster.Spec.Backup.Configuration.RestoreOptions.DownloadChunkMb,
280+
MongodLocation: cluster.Spec.Backup.Configuration.RestoreOptions.MongodLocation,
281+
MongodLocationMap: cluster.Spec.Backup.Configuration.RestoreOptions.MongodLocationMap,
280282
}
281283
}
282284

pkg/psmdb/backup/pbm_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func TestApplyCustomPBMConfig(t *testing.T) {
5353
t.Errorf("expected %d, got %d", expectedBackupOptions.Timeouts.Starting, config.Backup.Timeouts.Starting)
5454
}
5555

56+
if expectedBackupOptions.NumParallelCollections != config.Backup.NumParallelCollections {
57+
t.Errorf("expected %d, got %d", expectedBackupOptions.NumParallelCollections, config.Backup.NumParallelCollections)
58+
}
59+
5660
expectedRestoreOptions := cr.Spec.Backup.Configuration.RestoreOptions
5761
if expectedRestoreOptions.BatchSize != config.Restore.BatchSize {
5862
t.Errorf("expected %d, got %d", expectedRestoreOptions.BatchSize, config.Restore.BatchSize)
@@ -63,6 +67,11 @@ func TestApplyCustomPBMConfig(t *testing.T) {
6367
if expectedRestoreOptions.NumDownloadWorkers != config.Restore.NumDownloadWorkers {
6468
t.Errorf("expected %d, got %d", expectedRestoreOptions.NumDownloadWorkers, config.Restore.NumDownloadWorkers)
6569
}
70+
71+
if expectedRestoreOptions.NumParallelCollections != config.Restore.NumParallelCollections {
72+
t.Errorf("expected %d, got %d", expectedRestoreOptions.NumParallelCollections, config.Restore.NumParallelCollections)
73+
}
74+
6675
if expectedRestoreOptions.MaxDownloadBufferMb != config.Restore.MaxDownloadBufferMb {
6776
t.Errorf("expected %d, got %d", expectedRestoreOptions.MaxDownloadBufferMb, config.Restore.MaxDownloadBufferMb)
6877
}

pkg/psmdb/backup/testdata/cr-with-pbm-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ spec:
153153
timeouts:
154154
startingStatus: 33
155155
oplogSpanMin: 20
156+
numParallelCollections: 2
156157
restoreOptions:
157158
batchSize: 500
158159
numInsertionWorkers: 10
159160
numDownloadWorkers: 4
161+
numParallelCollections: 2
160162
maxDownloadBufferMb: 0
161163
downloadChunkMb: 32
162164
mongodLocation: /usr/bin/mongo

0 commit comments

Comments
 (0)