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

Rollback changes in case of unsucessful apply stage #708

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

spyrkob
Copy link
Collaborator

@spyrkob spyrkob commented Jun 28, 2024

Before applying changes to a server, backup the state of the server in a <SERVER_HOME>.update.old folder. The backup is done using hardlinks if the file system allows it to save disk space.

If the update fails due to IOException, we try and restore the server state. If the update is interrupted, either by the user or a program crash, the original state will be available for the user to perform manual restore.

@spyrkob spyrkob force-pushed the atomic_apply branch 13 times, most recently from 6fc6698 to 30ef534 Compare July 5, 2024 10:29
@spyrkob spyrkob marked this pull request as ready for review July 5, 2024 10:29
@spyrkob
Copy link
Collaborator Author

spyrkob commented Jul 12, 2024

@TomasHofman if you have a moment could you review this PR please?

@TomasHofman
Copy link
Contributor

Sure, will check.

// fallback on copy if Filesystem doesn't support hardlinks
try {
Files.createLink(backupRoot.resolve(relative), file);
} catch (UnsupportedEncodingException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that the exception that's gonna be thrown when unable to create a hardlink? I would expect UnsupportedOperationException.

Copy link
Contributor

Choose a reason for hiding this comment

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

We may try to check explicitly if the paths are on the same filesystem and revert to copy if they are not, to avoid the exception. It would not simplify the code, just avoided the exception in one predictable case. No big deal though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch, thanks. That should be UnsupportedOperationException.

We may try to check explicitly if the paths are on the same filesystem.

That would assume the installation of WildFly itself is split between different filesystems, Is that something we support/anticipate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, probably not 👍

Copy link
Contributor

@TomasHofman TomasHofman left a comment

Choose a reason for hiding this comment

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

Looks OK to me.

@spyrkob spyrkob force-pushed the atomic_apply branch 2 times, most recently from 231976f to 66e77d6 Compare July 18, 2024 10:19
@spyrkob spyrkob merged commit 1c6355b into wildfly-extras:main Jul 22, 2024
7 checks passed
@spyrkob spyrkob deleted the atomic_apply branch July 22, 2024 10:24
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

Successfully merging this pull request may close these issues.

2 participants