mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-13 06:03:10 +01:00
fix: off by 1 error in parallel work archive
Fix an error in which the amount of workers archived in parallel was the wal the archive command was called on + the maxParallel, actually using one worker more than requested. Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
This commit is contained in:
parent
600c721549
commit
8867eab905
@ -146,7 +146,7 @@ func (w WALServiceImplementation) Archive(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isDeletedFromSpool {
|
if isDeletedFromSpool {
|
||||||
contextLogger.Info("Archived WAL file (parallel)",
|
contextLogger.Info("WAL file already archived, skipping",
|
||||||
"walName", baseWalName)
|
"walName", baseWalName)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -158,14 +158,15 @@ func (w WALServiceImplementation) Archive(
|
|||||||
}
|
}
|
||||||
|
|
||||||
maxParallel := 1
|
maxParallel := 1
|
||||||
if objectStore.Spec.Configuration.Wal != nil {
|
if objectStore.Spec.Configuration.Wal != nil && objectStore.Spec.Configuration.Wal.MaxParallel > 0 {
|
||||||
maxParallel = objectStore.Spec.Configuration.Wal.MaxParallel
|
maxParallel = objectStore.Spec.Configuration.Wal.MaxParallel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maxResults := maxParallel - 1
|
||||||
walFilesList := walUtils.GatherReadyWALFiles(
|
walFilesList := walUtils.GatherReadyWALFiles(
|
||||||
ctx,
|
ctx,
|
||||||
walUtils.GatherReadyWALFilesConfig{
|
walUtils.GatherReadyWALFilesConfig{
|
||||||
MaxResults: maxParallel,
|
MaxResults: maxResults,
|
||||||
SkipWALs: []string{baseWalName},
|
SkipWALs: []string{baseWalName},
|
||||||
PgDataPath: w.PGDataPath,
|
PgDataPath: w.PGDataPath,
|
||||||
},
|
},
|
||||||
@ -174,6 +175,7 @@ func (w WALServiceImplementation) Archive(
|
|||||||
// Ensure the requested WAL file is always the first one being
|
// Ensure the requested WAL file is always the first one being
|
||||||
// archived
|
// archived
|
||||||
walFilesList.Ready = append([]string{request.GetSourceFileName()}, walFilesList.Ready...)
|
walFilesList.Ready = append([]string{request.GetSourceFileName()}, walFilesList.Ready...)
|
||||||
|
contextLogger.Debug("WAL files to archive: %v", "walFilesListReady", walFilesList.Ready)
|
||||||
|
|
||||||
result := arch.ArchiveList(ctx, walFilesList.ReadyItemsToSlice(), options)
|
result := arch.ArchiveList(ctx, walFilesList.ReadyItemsToSlice(), options)
|
||||||
for _, archiverResult := range result {
|
for _, archiverResult := range result {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user