From d8f2f4db63cb546b3e7b35dda47770aebb8ef7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 24 Sep 2026 15:33:29 +0200 Subject: [PATCH] docs(storage-users): document the delete-stale-nodes command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- services/storage-users/README.md | 46 ++++++++++++++++++- services/storage-users/pkg/command/uploads.go | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/services/storage-users/README.md b/services/storage-users/README.md index 0289db18f0..5e1af2448d 100644 --- a/services/storage-users/README.md +++ b/services/storage-users/README.md @@ -55,7 +55,8 @@ opencloud storage-users uploads ```plaintext COMMANDS: - sessions Print a list of upload sessions + delete-stale-nodes Delete (or revert) all nodes in processing state that are not referenced by any upload session + sessions Print a list of upload sessions ``` #### Sessions command @@ -140,6 +141,49 @@ opencloud storage-users uploads sessions --expired=true --clean opencloud storage-users uploads sessions --processing=false --has-virus=false --resume ``` + +#### Delete Stale Nodes command + +This command allows to remove (or revert) nodes that are stale, meaning they are in postprocessing but their upload session is gone. +It will check all nodes that are in postprocessing and find those without an upload session. Then it will delete the node if there are no other versions. If there are other versions, it will instead revert the node to the previous version. + +```bash + opencloud storage-users uploads delete-stale-nodes +``` +```plaintext +Delete (or revert) all nodes in processing state that are not referenced by any upload session + +Usage: + opencloud storage-users uploads delete-stale-nodes [flags] + +Flags: + --dry-run Only show what would be deleted without actually deleting (default true) + -h, --help help for delete-stale-nodes + --spaceid string Space ID to check for processing nodes (omit to check all spaces) + --verbose Enable verbose logging +``` + +#### Command Examples + +Dry run to see what would be deleted (recommended first step) + +```bash +opencloud storage-users uploads delete-stale-nodes +``` + +Set `--dry-run=false` to actually delete the stale nodes + +```bash +opencloud storage-users uploads delete-stale-nodes --dry-run=false +``` + +Use `--verbose` to get more information about what is happening + +```bash +opencloud storage-users uploads delete-stale-nodes --dry-run=false --verbose +``` + + ### Manage Trash-Bin Items This command set provides commands to get an overview of trash-bin items, restore items and purge old items of `personal` spaces and `project` spaces (spaces that have been created manually). `trash-bin` commands require a `spaceID` as parameter. diff --git a/services/storage-users/pkg/command/uploads.go b/services/storage-users/pkg/command/uploads.go index 117c6b339e..3f0b1180fc 100644 --- a/services/storage-users/pkg/command/uploads.go +++ b/services/storage-users/pkg/command/uploads.go @@ -333,7 +333,7 @@ func buildInfo(filter storage.UploadSessionFilter) string { func DeleteStaleProcessingNodes(cfg *config.Config) *cobra.Command { deleteStaleNodesCmd := &cobra.Command{ Use: "delete-stale-nodes", - Short: "Delete all nodes in processing state that are not referenced by any upload session", + Short: "Delete (or revert) all nodes in processing state that are not referenced by any upload session", PreRunE: func(cmd *cobra.Command, args []string) error { return configlog.ReturnFatal(parser.ParseConfig(cfg)) },