MaxMaeder / DriveBackupV2

Uploads Minecraft backups to Google Drive/OneDrive or by (S)FTP
https://dev.bukkit.org/projects/drivebackupv2
MIT License
160 stars 49 forks source link

[Feature Request] Prune Google Drive Backups before Uploading New #167

Closed Veivel closed 5 months ago

Veivel commented 5 months ago

What feature do you want to see added?

Problem

Google Drive offers 15GB of free storage. Let's say my overworld world size is between 8-14 GBs, and I want DriveBackupV2 to use Google Drive. This means I can't have more than one backup on the drive at any given point.

The real problem, however, is with the fact that I have to delete every backup if I want the next one to work. If not, the Google Drive API will see that there's not enough storage to upload the next backup, and as a result will not succeed.

Using keep-limit: 1 in config does not solve this problem, as the plugin still attempts to upload to new backup BEFORE pruning old backups according to the keep-limit value.

Potential Solution

Modify .../drivebackup/uploaders/googledrive/GoogleDriveUploader.java to prune backups according to keep-limit value BEFORE uploading the next backup. That way, if the world takes 8GB of space, and I only have 15GB of Google Drive storage, using keep-limit: 1 means the plugin will delete my old backup, then the next backup can still be uploaded to my drive.

Concerns

It is possible that the pruning succeeds but uploading the next backup fails, for one reason or another. But then again, any part of the backup could fail at any point, for any reason – but we can still rely on the plugin's exception handling.

Are there any alternatives?

No response

rhld16 commented 5 months ago

As mentioned, this change is in-feasible since the plugin has to prioritise data integrity over storage space.

A config toggle could fix this but it would just mean we have a ton of users losing backups due to misc uploading errors.