Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backups): deduplication #6929

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat(backups): deduplication #6929

wants to merge 2 commits into from

Conversation

fbeauchamp
Copy link
Collaborator

@fbeauchamp fbeauchamp commented Jul 3, 2023

Description

All that is needed is Linux kernel version 5.9 or newer on both the server and client, then mount with NFS version 4.2 or newer. Support for extended attributes is enabled automatically when both server and client support nfs 4.2.

  • only dedup blocks of vhd directory
  • compatible with encryption/compression
  • not compatile with dedup feat(backup): make remote immutable #6928
  • write block in /xo-block-store
  • hard link block in the vhd/block directory
  • on delete, remove block from store if there are no other link( the FS count them for us)
  • on merge : check if there is an overwrite => trigger delete before rename
  • differenciate by name vhd with dedup enabled : alias point to a uuid.dedup.vhd instead of uuid.vhd
  • only check if you need to dedup on unlink / rename in theses identified VHD
  • @todo : show gain
  • @todo : ui for dedup remote
  • @todo: test on windows / non ext fs

Checklist

  • Commit
    • Title follows commit conventions
    • Reference the relevant issue (Fixes #007, See xoa-support#42, See https://...)
    • If bug fix, add Introduced by
  • Changelog
    • If visible by XOA users, add changelog entry
    • Update "Packages to release" in CHANGELOG.unreleased.md
  • PR
    • If UI changes, add screenshots
    • If not finished or not tested, open as Draft

@fbeauchamp fbeauchamp force-pushed the feat_dedup branch 8 times, most recently from 103fe3d to 8f76708 Compare July 5, 2023 11:58
import assert from 'node:assert'
import { createHash } from 'node:crypto'

export default class DedupedLocalHandler extends LocalHandler {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge with LocalHandler.


async _sync() {
await super._sync()
await this.mkdir(this.#dedupFolder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should only be created when necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a function to garbage collect orphaned files in the dedup store.

It will be used via xo-fs CLI and should be documented in a small doc @xen-orchestra/backups/docs/dedup.md.

import { createHash } from 'node:crypto'

export default class DedupedLocalHandler extends LocalHandler {
#dedupFolder = '/xo-block-store'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer directory to folder.

@fbeauchamp fbeauchamp force-pushed the feat_dedup branch 3 times, most recently from 1cb7901 to a6376bc Compare July 13, 2023 13:06
@fbeauchamp fbeauchamp requested a review from julien-f July 13, 2023 13:15
@fbeauchamp fbeauchamp marked this pull request as ready for review July 13, 2023 13:15
@fbeauchamp fbeauchamp force-pushed the feat_dedup branch 6 times, most recently from 6174c22 to 50f378e Compare July 20, 2023 08:12
@julien-f julien-f removed their request for review July 24, 2023 06:20
@@ -285,7 +293,7 @@ exports.VhdDirectory = class VhdDirectory extends VhdAbstract {
}

async writeEntireBlock(block) {
await this._writeChunk(this.#getBlockPath(block.id), block.buffer)
await this._writeChunk(this.#getBlockPath(block.id), block.buffer, this.#dedup)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use the right flag to ensure we don't overwrite silently, since we'll have to check old block for deletion before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants