From: Christian Ebner <c.ebner@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>,
"Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [RFC v2 proxmox-backup 10/21] datastore: mark namespace as trash instead of deleting it
Date: Mon, 12 May 2025 12:35:35 +0200 [thread overview]
Message-ID: <6144ff70-d18c-4526-a693-575bd6f0a5d9@proxmox.com> (raw)
In-Reply-To: <1747042727.5oy8el2pyl.astroid@yuna.none>
On 5/12/25 11:46, Fabian Grünbichler wrote:
> On May 12, 2025 9:47 am, Christian Ebner wrote:
>> On 5/9/25 14:27, Fabian Grünbichler wrote:
>>> On May 8, 2025 3:05 pm, Christian Ebner wrote:
>>>> As for backup snapshots and groups, mark the namespace as trash
>>>> instead of removing it and the contents right away, if the trash
>>>> should not be bypassed.
>>>>
>>>> Actual removal of the hirarchical folder structure has to be taken
>>>> care of by the garbage collection.
>>>>
>>>> In order to avoid races during removal, first mark the namespaces as
>>>> trash pending, mark the snapshots and groups as trash and only after
>>>> rename the pending marker file to the trash marker file. By this,
>>>> concurrent backups can remove the trash pending marker to avoid the
>>>> namespace being trashed.
>>>>
>>>> On re-creation of a trashed namespace remove the marker file on itself
>>>> and any parent component from deepest to shallowest. As trashing a full
>>>> namespace can also set the trash pending state for recursive namespace
>>>> cleanup, remove encounters of that marker file as well to avoid the
>>>> namespace or its parent being trashed.
>>>
>>> this is fairly involved since we don't have locks on namespaces..
>>>
>>> should we have them for creation/removal/trashing/untrashing?
>>
>> That is what I did try to avoid at all cost with the two-marker
>> approach, as locking the namespace might be rather invasive. But if that
>> does not work out as intended, I see no other way as to add exclusive
>> locking for namespaces as well, yes.
>>
>>>
>>> I assume those are fairly rare occurrences, I haven't yet analyzed the
>>> interactions here to see whether the two-marker approach is actually
>>> race-free..
>>>
>>> OTOH, do we really need to (be able to) trash namespaces?
>>
>> Yes, I think we do need that as well since the datastore's hierarchy
>> should remain in place, and the namespace iterator requires a way to
>> distinguish between a namespace which has been trashed/deleted and a
>> namespace which has not, but might contain trashed items. Otherwise a
>> user requesting to forget a namespace, still sees the (empty as only
>> trashed contents) namespace tree after the operation. Which would be
>> rather unexpected?
>
> we could also require emptying the trash as part of forgetting a
> namespace? we already have the `delete_groups` option and only remove a
> non-empty namespace is set, we could re-use that or add a new
> `empty_trash` option next to it, if we want double-opt-in ;)
>
> else, we'd also need to support trashing whole datastores if
> we follow this line of thinking..
>
> like I said, I don't think forgetting namespaces is something that is
> done very often, as namespaces are normally fairly static.. and if I
> want to remove a namespace, I probably also want to remove all its
> contents (trash or regular ;)).
Ah okay, requiring to clear trashed contents as well when deleting a
namespace seems the better approach indeed. Will adapt the code
accordingly.
_______________________________________________
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-05-12 10:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 13:05 [pbs-devel] [RFC v2 proxmox-backup 00/21] implement trash bin functionality Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 01/21] datastore/api: mark snapshots as trash on destroy Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 02/21] datastore: mark groups " Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 03/21] datastore: allow filtering of backups by their trash status Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 9:32 ` Christian Ebner
2025-05-12 10:08 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 04/21] datastore: ignore trashed snapshots for last successful backup Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 05/21] sync: ignore trashed snapshots when reading from local source Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 06/21] api: tape: check trash marker when trying to write snapshot Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 9:19 ` Christian Ebner
2025-05-12 9:38 ` Fabian Grünbichler
2025-05-12 9:46 ` Christian Ebner
2025-05-12 9:55 ` Christian Ebner
2025-05-12 10:09 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 07/21] sync: ignore trashed groups in local source reader Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 08/21] datastore: namespace: add filter for trash status Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 09/21] datastore: refactor recursive namespace removal Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 10/21] datastore: mark namespace as trash instead of deleting it Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 7:47 ` Christian Ebner
2025-05-12 9:46 ` Fabian Grünbichler
2025-05-12 10:35 ` Christian Ebner [this message]
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 11/21] datastore: check for trash marker in namespace exists check Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 12/21] datastore: clear trashed snapshot dir if re-creation requested Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 8:31 ` Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 13/21] datastore: recreate trashed backup groups if requested Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 8:05 ` Christian Ebner
2025-05-12 10:02 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 14/21] datastore: GC: clean-up trashed snapshots, groups and namespaces Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 15/21] client: expose skip trash flags for cli commands Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 16/21] api: datastore: add flag to list trashed snapshots only Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-12 7:57 ` Christian Ebner
2025-05-12 10:01 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 17/21] api: namespace: add option to list all namespaces, including trashed Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 18/21] api: admin: implement endpoints to restore trashed contents Christian Ebner
2025-05-09 12:27 ` Fabian Grünbichler
2025-05-09 12:59 ` Christian Ebner
2025-05-12 10:03 ` Fabian Grünbichler
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 19/21] ui: add recover for trashed items tab to datastore panel Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 20/21] ui: drop 'permanent' in group/snapshot forget, default is to trash Christian Ebner
2025-05-08 13:05 ` [pbs-devel] [RFC v2 proxmox-backup 21/21] ui: allow to skip trash on namespace deletion Christian Ebner
2025-05-13 13:54 ` [pbs-devel] superseded: [RFC v2 proxmox-backup 00/21] implement trash bin functionality Christian Ebner
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=6144ff70-d18c-4526-a693-575bd6f0a5d9@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=f.gruenbichler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal