fix(bakups): fix merge resume issue when child is disk chain#9668
fix(bakups): fix merge resume issue when child is disk chain#9668spacotte-vates wants to merge 2 commits intomasterfrom
Conversation
| await parent.init({ force: isResumingMerge }) | ||
| await child1.init({ force: isResumingMerge }) | ||
| await child2.init({ force: isResumingMerge }) | ||
| await childDiskChain.init({ force: isResumingMerge }) |
There was a problem hiding this comment.
I think force is false by default no? We can secure it but I think it s
| await parent.init({ force: isResumingMerge }) | |
| await child1.init({ force: isResumingMerge }) | |
| await child2.init({ force: isResumingMerge }) | |
| await childDiskChain.init({ force: isResumingMerge }) | |
| await parent.init({ force: false }) | |
| await child1.init({ force: false }) | |
| await child2.init({ force: false }) | |
| await childDiskChain.init({ force: false }) |
pierrebrunet289
left a comment
There was a problem hiding this comment.
LGTM
Just missing changelog
| await parent2.init({ force: isResumingMerge2 }) | ||
| await child1b.init({ force: isResumingMerge2 }) | ||
| await child2b.init({ force: isResumingMerge2 }) | ||
| await childDiskChain2.init({ force: isResumingMerge2 }) |
There was a problem hiding this comment.
| await parent2.init({ force: isResumingMerge2 }) | |
| await child1b.init({ force: isResumingMerge2 }) | |
| await child2b.init({ force: isResumingMerge2 }) | |
| await childDiskChain2.init({ force: isResumingMerge2 }) | |
| await parent2.init({ force: true }) | |
| await child1b.init({ force: true }) | |
| await child2b.init({ force: true }) | |
| await childDiskChain2.init({ force: true }) |
There was a problem hiding this comment.
we have confirmed that isResumingMerge is true immediatly above
| if (this.#removeUnused) { | ||
| await childDisk.unlink() | ||
| } | ||
|
|
||
| try { | ||
| await parentDisk.rename(mergeTargetPath) | ||
| } catch (error) { | ||
| // @ts-ignore | ||
| if (error.code === 'ENOENT' && this.#isResuming) { | ||
| // @ts-ignore | ||
| this.#logInfo(`the parent disk was already renamed`, { | ||
| parent: parentDisk.getPath(), | ||
| mergeTarget: mergeTargetPath, | ||
| }) | ||
| } else { | ||
| throw error | ||
| } | ||
| } |
There was a problem hiding this comment.
Just an idea: To avoid a potential issue if merge is interrupted exactly at this moment (I think it is a rare possibility but still...)
| try { | |
| await parentDisk.rename(mergeTargetPath) | |
| } catch (error) { | |
| // @ts-ignore | |
| if (error.code === 'ENOENT' && this.#isResuming) { | |
| // @ts-ignore | |
| this.#logInfo(`the parent disk was already renamed`, { | |
| parent: parentDisk.getPath(), | |
| mergeTarget: mergeTargetPath, | |
| }) | |
| } else { | |
| throw error | |
| } | |
| } | |
| if (this.#removeUnused) { | |
| await childDisk.unlink() | |
| } | |
| } |
There was a problem hiding this comment.
I think this is irrelevant to this PR, but can be a good idea as a separated, not in patch, PR
| this.#state.chain = | ||
| childPaths !== undefined | ||
| ? [parentDisk.getPath(), ...childPaths].map(p => relativeFromFile(this.#statePath, p)) | ||
| : undefined |
There was a problem hiding this comment.
there is a chain even if you merge only two disk , don't rely on the fallback mechanism of cleanVm
| if (this.#removeUnused) { | ||
| await childDisk.unlink() | ||
| } | ||
|
|
||
| try { | ||
| await parentDisk.rename(mergeTargetPath) | ||
| } catch (error) { | ||
| // @ts-ignore | ||
| if (error.code === 'ENOENT' && this.#isResuming) { | ||
| // @ts-ignore | ||
| this.#logInfo(`the parent disk was already renamed`, { | ||
| parent: parentDisk.getPath(), | ||
| mergeTarget: mergeTargetPath, | ||
| }) | ||
| } else { | ||
| throw error | ||
| } | ||
| } |
There was a problem hiding this comment.
I think this is irrelevant to this PR, but can be a good idea as a separated, not in patch, PR
| await parent2.init({ force: isResumingMerge2 }) | ||
| await child1b.init({ force: isResumingMerge2 }) | ||
| await child2b.init({ force: isResumingMerge2 }) | ||
| await childDiskChain2.init({ force: isResumingMerge2 }) |
There was a problem hiding this comment.
we have confirmed that isResumingMerge is true immediatly above
pierrebrunet289
left a comment
There was a problem hiding this comment.
just the changelogs to add as it is a patch
Description
Short explanation of this PR (feel free to re-use commit message)
Checklist
Fixes #007,See xoa-support#42,See https://...)Introduced byCHANGELOG.unreleased.mdReview process
If you are an external contributor, you can skip this part. Simply create the pull request, and we'll get back to you as soon as possible.
Notes: