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

Choose WAL-G backup by start time when cloning and deleting #1

Open
wants to merge 3 commits into
base: ol/3.0-p1-extras
Choose a base branch
from

Conversation

@OlleLarsson
Copy link

Thanks! Will take a look early next week!

Copy link

@OlleLarsson OlleLarsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@davidumea davidumea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@simonklb
Copy link
Author

simonklb commented Jun 18, 2024

This fixes the immediate problem of cleaning up backups based on start time instead of modified time: fcb00b1

Note that this is not at all backwards compatible with wal-e, so don't merge this! ⚠️

However, when working on this I found this: wal-g/wal-g#816 which suggests that there is already built-in support for this. Also, using delete retain instead of delete before could also slim down the script even further as it currently tries to calculate how many backups to retain on it's own instead of relying on wal-g.

@simonklb simonklb force-pushed the simonklb/choose-backup-by-start-time branch from fcb00b1 to bb77d67 Compare June 20, 2024 12:54
@simonklb
Copy link
Author

simonklb commented Jun 20, 2024

Here's a new patch that makes use of wal-g delete retain --after: bb77d67
PTAL!

Diff it with ignore whitespace and it'll look less intimidating. :)

@simonklb simonklb changed the title Choose WAL-G backup by start time when cloning Choose WAL-G backup by start time when cloning and deleting Jun 20, 2024
@simonklb simonklb force-pushed the simonklb/choose-backup-by-start-time branch from bb77d67 to 30b4d13 Compare June 20, 2024 14:36
@simonklb
Copy link
Author

simonklb commented Jun 20, 2024

FWIW the Spilo tests passes with these changes cherry-picked on master and with USE_WALG=true.

However, without USE_WALG=true some tests fail logs similar to this:

2024-06-20 16:08:59,805 INFO: Trying s3://testbucket/spilo/demo/wal/12/ for clone
INFO: 2024/06/20 16:08:59.822165 List backups from storages: [default]
INFO: 2024/06/20 16:08:59.823516 No backups found
2024-06-20 16:08:59,825 INFO: Trying s3://testbucket/spilo/demo/wal/11/ for clone
INFO: 2024/06/20 16:08:59.840049 List backups from storages: [default]
ERROR: 2024/06/20 16:08:59.841804 object 'base_000000010000000000000005_00000208/metadata.json' not found in storage
2024-06-20 16:08:59,843 ERROR: Clone failed

This is expected because if the backups are created with wal-e the metadata.json file is never created, so if we want to try to get this merged upstream we'll probably have to work around this as well or query if wal-e support is planned to be dropped in the near future.

Note that this is should only be an issue if you are trying to migrate from wal-e to wal-g. Using wal-e exclusively should still work.

@OlleLarsson
Copy link

...
This is expected because if the backups are created with wal-e the metadata.json file is never created, so if we want to try to get this merged upstream we'll probably have to work around this as well or query if wal-e support is planned to be dropped in the near future.

Note that this is should only be an issue if you are trying to migrate from wal-e to wal-g. Using wal-e exclusively should still work.

I think it makes sense to ask if they are planning on removing wal-e support.

@OlleLarsson
Copy link

Ugh, running into some issues building the image from this branch, seem to fail on building wal-g 🤔

[100%] Built target brotli
+ bash link_libsodium.sh

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c bash /builddeps/dependencies.sh' returned a non-zero code: 2

@simonklb
Copy link
Author

Ugh, running into some issues building the image from this branch, seem to fail on building wal-g 🤔

[100%] Built target brotli
+ bash link_libsodium.sh

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c bash /builddeps/dependencies.sh' returned a non-zero code: 2

wal-g/wal-g#1738

@simonklb
Copy link
Author

Blocked by: wal-g/wal-g#1738

Temp fix to allow for testing while we wait for the fix to be released: 8416ba1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants