From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>,
Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox-backup 4/4] garbage collection: read pruned snapshot index files from trash
Date: Thu, 17 Apr 2025 13:27:03 +0200 (CEST) [thread overview]
Message-ID: <1150446519.2905.1744889223276@webmail.proxmox.com> (raw)
In-Reply-To: <fdfc7c7d-49ee-4c13-811b-1a3036bda2a9@proxmox.com>
> Christian Ebner <c.ebner@proxmox.com> hat am 17.04.2025 12:38 CEST geschrieben:
> On 4/17/25 11:29, Fabian Grünbichler wrote:
> > On April 16, 2025 4:18 pm, Christian Ebner wrote:
> >> Snapshots pruned during phase 1 are now also assured to be included
> >> in the marking phase by reading the index files from trash and
> >> touching these chunks as well.
> >>
> >> Clear any trash before starting with phase 1, so that only snapshots
> >> pruned during GC are consided.
> >>
> >> Further, drop the retry logic used before to assure eventually newly
> >> written index files are included in the marking phase, if the
> >> previously last one was pruned. This is not necessary anymore as the
> >> previously last one will be read from trash.
> >>
> >> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> >> ---
> >> pbs-datastore/src/datastore.rs | 141 +++++++++++++++------------------
> >> 1 file changed, 65 insertions(+), 76 deletions(-)
> >>
> >> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
> >> index 97b78f000..688e65247 100644
> >> --- a/pbs-datastore/src/datastore.rs
> >> +++ b/pbs-datastore/src/datastore.rs
> >> @@ -1137,7 +1137,13 @@ impl DataStore {
> >> //
> >> // By this it is assured that all index files are used, even if they would not have been
> >> // seen by the regular logic and the user is informed by the garbage collection run about
> >> - // the detected index files not following the iterators logic.
> >> + // the detected index files not following the iterators logic. Further, include trashed
> >> + // snapshots which have been pruned during garbage collections marking phase.
> >> +
> >> + let trash = PathBuf::from(".trash/");
> >> + let mut full_trash_path = self.base_path();
> >> + full_trash_path.push(&trash);
> >> + let _ = std::fs::remove_dir_all(full_trash_path);
> >
> > I think this would need some locking, else we start recursively deleting
> > here while at the same time a prune operation is moving something into
> > the trash..
>
> True, if there is a concurrent insert, then deletion will probably fail
> because the sub-directory is then not empty anymore. Instead of locking,
> I could do an atomic rename of the whole trash can instead, and cleanup
> the renamed one? Should be not only more efficient but also easier to
> implement.
that only works if you assume that nothing operates on (or rather, inside of)
the trash dir via an already opened FD.. which seems like a dangerous and
easy to miss assumption..
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-04-17 11:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 14:17 [pbs-devel] [RFC proxmox-backup 0/4] implement trash can for snapshots Christian Ebner
2025-04-16 14:18 ` [pbs-devel] [RFC proxmox-backup 1/4] datastore: always skip over base directory when listing index files Christian Ebner
2025-04-17 9:29 ` Fabian Grünbichler
2025-04-17 10:27 ` Christian Ebner
2025-04-16 14:18 ` [pbs-devel] [RFC proxmox-backup 2/4] datastore: allow to specify sub-directory for index file listing Christian Ebner
2025-04-18 9:38 ` Thomas Lamprecht
2025-04-18 9:55 ` Christian Ebner
2025-04-16 14:18 ` [pbs-devel] [RFC proxmox-backup 3/4] datastore: move snapshots to trash folder on destroy Christian Ebner
2025-04-17 9:29 ` Fabian Grünbichler
2025-04-18 11:06 ` Thomas Lamprecht
2025-04-18 11:49 ` Christian Ebner
2025-04-18 12:03 ` Fabian Grünbichler
2025-04-18 12:45 ` Christian Ebner
2025-04-22 7:54 ` Fabian Grünbichler
2025-04-29 11:27 ` Christian Ebner
2025-04-18 11:51 ` Fabian Grünbichler
2025-04-16 14:18 ` [pbs-devel] [RFC proxmox-backup 4/4] garbage collection: read pruned snapshot index files from trash Christian Ebner
2025-04-17 9:29 ` Fabian Grünbichler
2025-04-17 10:38 ` Christian Ebner
2025-04-17 11:27 ` Fabian Grünbichler [this message]
2025-04-17 9:29 ` [pbs-devel] [RFC proxmox-backup 0/4] implement trash can for snapshots Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1150446519.2905.1744889223276@webmail.proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal