feat(xo-server/backups-ng): limit number of gc-ed deltas (#4674)

Merging multiple VHDs is currently a slow process which could be optimized by doing a single merge of a synthetic delta.

Until this is implement, the number of garbage collected deltas should be limited to avoid taking too much time (and possibly interrupted jobs) in case of an important retention change.
This commit is contained in:
Julien Fontanet
2019-11-26 11:29:55 +01:00
committed by GitHub
parent 6cb4faf33d
commit 688b65ccde
3 changed files with 21 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
- [Metadata backup] Add 10 minutes timeout to avoid stuck jobs [#4657](https://github.com/vatesfr/xen-orchestra/issues/4657) (PR [#4666](https://github.com/vatesfr/xen-orchestra/pull/4666))
- [Metadata backups] Fix out-of-date listing for 1 minute due to cache (PR [#4672](https://github.com/vatesfr/xen-orchestra/pull/4672))
- [Delta backup] Limit the number of merged deltas per run to avoid interrupted jobs (PR [#4674](https://github.com/vatesfr/xen-orchestra/pull/4674))
### Released packages

View File

@@ -67,6 +67,11 @@ poolMetadataTimeout = '10 minutes'
#[http.helmet.hsts]
#includeSubDomains = false
# This is a work-around.
#
# See https://github.com/vatesfr/xen-orchestra/pull/4674
maxMergedDeltasPerRun = 2
[[http.listen]]
port = 80

View File

@@ -1594,6 +1594,21 @@ export default class BackupNg {
_ => _.mode === 'delta' && _.scheduleId === scheduleId
)
): any)
// FIXME: implement optimized multiple VHDs merging with synthetic
// delta
//
// For the time being, limit the number of deleted backups by run
// because it can take a very long time and can lead to
// interrupted backup with broken VHD chain.
//
// The old backups will be eventually merged in future runs of the
// job.
const { maxMergedDeltasPerRun } = this._backupOptions
if (oldBackups.length > maxMergedDeltasPerRun) {
oldBackups.length = maxMergedDeltasPerRun
}
const deleteOldBackups = () =>
wrapTask(
{