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

Retention timer not work #50

Open
SmartHome2021 opened this issue Oct 8, 2024 · 11 comments
Open

Retention timer not work #50

SmartHome2021 opened this issue Oct 8, 2024 · 11 comments

Comments

@SmartHome2021
Copy link

Hi, I'm having some problems with auto-deleting old archives.
During the setup process, I experimented with the time of the auto-delete value, it seems that this does not affect anything.

At the moment, I have the following parameters set:
cloud backup - 30 days
local backup - 3 days

Despite this, local backups have been stored since 19.09, for 19 days now.

I periodically delete them myself, but this is not the experience I would like to have

I will be glad of any advice. Thanks
backup
wault

@Stitch10925
Copy link

I am seeing the same problem. I have a fairly big database of around 3 GB that holds non-crucial data. As such I have set the retention to 2 days. However, the backup folder for the database has now grown to 21 GB. When looking into the folders I can indeed see that some old versions are not being deleted.

@SmartHome2021
Copy link
Author

SmartHome2021 commented Oct 17, 2024

I almost understood what was going on. The Docker container logs show that the deletion is trying to work, but there is a problem with the file path. .

{"time":"2024-10-17T15:10:00.014281114+03:00","level":"ERROR","msg":"error soft deleting expired executions","error":"failed to delete file /backups/backups/billing////

/dump-.zip/2024/09/17/dump-20240917-142336-01bd3366-3296-438d-958d-db0f36152afe.zip: remove /backups/backups/billing////
/dump-.zip/2024/09/17/dump-20240917-142336-01bd3366-3296-438d-958d-db0f36152afe.zip: no such file or directory","id":"c532adfd-0903-4931-b0f4-2bc0e03d1d0c"}

It remains to understand why this happened

UPD. this file was deleted by me on my own, the file cannot be found because it is not there.
2 backups with the success status are stuck in the completed ones. now there is no way to delete them even from the web. It seems that this causes the cause

@Stitch10925
Copy link

I also have a backup in the database of which the file does not exist anymore (because I changed the file structure). When the cron job runs it seems to fail on that one file and stop, so other backups from other databases are not cleaned up.

I also cannot manually delete the file, since I get the error that the file does not exist anymore. There seems to be no way to delete the database entry.

Why not simply delete the database entry when a "delete" is tried but the file does not exist anymore?

@SmartHome2021
Copy link
Author

SmartHome2021 commented Oct 18, 2024

I also have a backup in the database of which the file does not exist anymore (because I changed the file structure). When the cron job runs it seems to fail on that one file and stop, so other backups from other databases are not cleaned up.

I also cannot manually delete the file, since I get the error that the file does not exist anymore. There seems to be no way to delete the database entry.

Why not simply delete the database entry when a "delete" is tried but the file does not exist anymore?

Try to create a text file using the path specified in the error , for example: backup_name.zip . In theory, this will be enough for the system to see the file and send it. Naturally, the name must match the name of the deleted file

Unfortunately, the situation is more complicated for me, I made a mistake in the installation and I have the first phantom backup stored on the path :
/backups/backups/billing/<destination-directory>/<YYYY>/<MM>/<DD>/dump-<random-suffix>.zip/2024/09/17/dump-20240917-142336-01bd3366-3296-438d-958d-db0f36152afe.zip
The < symbol causes an error and the system cannot delete the file, even though I was late all the way.

Such characters should be escaped with the \ character, then everything works correctly.

I hope this error will be noticed by the developer and he will tell you what to do

@SmartHome2021
Copy link
Author

SmartHome2021 commented Oct 21, 2024

I also have a backup in the database of which the file does not exist anymore (because I changed the file structure). When the cron job runs it seems to fail on that one file and stop, so other backups from other databases are not cleaned up.

I also cannot manually delete the file, since I get the error that the file does not exist anymore. There seems to be no way to delete the database entry.

Why not simply delete the database entry when a "delete" is tried but the file does not exist anymore?

I have solved this problem, and I am giving you a solution.

  1. Connect via ssh to the server on which docker is deployed
  2. run sudo docker ps to display the list of containers
  3. copy the container_id of the container that is responsible for the database (image postgres:*)
  4. enter the sudo docker exec -it command (your copied id) bash
    I have this : sudo docker exec -it 004891c02e6b bash
    5.psql -U postgres - let's connect to the database setup
  5. SELECT datname FROM pg_database; - getting a list of databases
  6. \connect pgbackweb - connecting to the database
    8.\dt - getting a list of tables in the current database
  7. SELECT * FROM executions; - getting the contents of the table
  8. we look for problematic entries and copy the path value for each, I chose based on the path, you can navigate by the date or the name of the backup
  9. delete bad entries with the DELETE FROM executions WHERE path ='(copied path)' command

It looks like this for me : DELETE FROM executions WHERE path = 'backups/billing/<destination-directory>/<YYYY>/<MM>/<DD>/dump-<random-suffix>.zip/2024/09/17/dump-20240917-142336-01bd3366-3296-438d-958d-db0f36152afe.zip'

PROFIT! There is no need to reboot anything, we wait 10 minutes and open the catalog. The old versions have been deleted.

@TristisOris
Copy link

TristisOris commented Feb 6, 2025

But retention still not working. I have 3 months old dumps, with 7days rule.

task: [migrate-serve] task serve

task: [serve] ./dist/app

2025-02-06T09:43:46.644174583+03:00 INFO msg=cron scheduler initialized

2025-02-06T09:43:46.661246092+03:00 INFO msg=connected to DB

2025-02-06T09:43:46.674732116+03:00 ERROR msg=error soft deleting expired executions error=failed to delete file /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: remove /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: no such file or directory id=17a1aa65-5342-4ed4-a669-b96b5288ed38

2025-02-06T09:43:46.675528529+03:00 INFO msg=old sessions deleted

2025-02-06T09:43:46.75117401+03:00 INFO msg=all databases tested

2025-02-06T09:43:46.751718712+03:00 INFO msg=all destinations tested

2025-02-06T09:43:46.752467831+03:00 INFO msg=all active backups scheduled

2025-02-06T09:43:46.752747562+03:00 INFO msg=server started at http://localhost:8085 listenHost=0.0.0.0 listenPort=8085

2025-02-06T09:50:00.027214165+03:00 INFO msg=old sessions deleted

2025-02-06T09:50:00.028794535+03:00 ERROR msg=error soft deleting expired executions error=failed to delete file /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: remove /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: no such file or directory id=17a1aa65-5342-4ed4-a669-b96b5288ed38

2025-02-06T09:50:00.029276+03:00 INFO msg=all destinations tested

2025-02-06T09:50:00.074975363+03:00 INFO msg=all databases tested

2025-02-06T10:00:00.023530121+03:00 INFO msg=old sessions deleted

2025-02-06T10:00:00.024732893+03:00 INFO msg=all destinations tested

2025-02-06T10:00:00.040352867+03:00 ERROR msg=error soft deleting expired executions error=failed to delete file /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: remove /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: no such file or directory id=17a1aa65-5342-4ed4-a669-b96b5288ed38

2025-02-06T10:00:00.116384094+03:00 INFO msg=all databases tested

2025-02-06T10:10:00.002192639+03:00 INFO msg=old sessions deleted

2025-02-06T10:10:00.022544738+03:00 INFO msg=all destinations tested

2025-02-06T10:10:00.037369668+03:00 ERROR msg=error soft deleting expired executions error=failed to delete file /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: remove /backups/backups/2024/12/28/dump-20241228-123943-aa3714e9-dfe8-4382-8d06-d2dc9d0b2fd3.zip: no such file or directory id=17a1aa65-5342-4ed4-a669-b96b5288ed38

@Stitch10925
Copy link

I am also still seeing delete errors despite having gone through and manually deleting the files that were giving errors recently:

[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:30:00.159274696+01:00","level":"ERROR","msg":"error soft deleting expired executions","error":"failed to delete file /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: remove /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: no such file or directory","id":"c9f94d84-2ecb-44f3-83f5-279910020b46"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:30:00.172702179+01:00","level":"INFO","msg":"all destinations tested"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:30:00.177905537+01:00","level":"INFO","msg":"old sessions deleted"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:30:00.471197436+01:00","level":"INFO","msg":"all databases tested"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:40:00.16680243+01:00","level":"INFO","msg":"old sessions deleted"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:40:00.189690651+01:00","level":"INFO","msg":"all destinations tested"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:40:00.19453001+01:00","level":"ERROR","msg":"error soft deleting expired executions","error":"failed to delete file /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: remove /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: no such file or directory","id":"c9f94d84-2ecb-44f3-83f5-279910020b46"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:40:00.633317106+01:00","level":"INFO","msg":"all databases tested"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:50:00.015611018+01:00","level":"INFO","msg":"old sessions deleted"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:50:00.016080668+01:00","level":"INFO","msg":"all destinations tested"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:50:00.061721206+01:00","level":"ERROR","msg":"error soft deleting expired executions","error":"failed to delete file /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: remove /backups/prowlarr/2024/10/03/dump-20241003-030000-42f6c311-33b0-44d8-a72a-d7aaed6373d5.zip: no such file or directory","id":"c9f94d84-2ecb-44f3-83f5-279910020b46"}
[m0k9x ](http://192.168.13.30:9000/#/tasks/m0k9xfg5wpjpfoswkiz9k6c87?log=1) {"time":"2025-02-06T09:50:00.684583391+01:00","level":"INFO","msg":"all databases tested"}

I also saw a permission issue to delete the files, but I haven't seen it recently. So I'm not quite sure what is going on.

@eduardolat
Copy link
Owner

let me take a look

@eduardolat eduardolat reopened this Feb 6, 2025
@eduardolat
Copy link
Owner

@Stitch10925 Can you please verify in your file system if the files in the logs exists?

@Stitch10925
Copy link

@eduardolat
Yes, the files exist. When I manually delete them, the error goes away.

@Stitch10925
Copy link

Maybe to give a bit more context, at least in my case:

I use an NFS volume mount to my NAS to mount the directory where the backups are stored. Writing always seems to work, but removing seems to be an issue, even though manually deleting the files has never been a problem.

Hmm, I just realized, maybe something is changing the permissions of the files causing issues with the deletion, I will have to check that this weekend 🤔

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

No branches or pull requests

4 participants