-
Notifications
You must be signed in to change notification settings - Fork 873
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
Use an atomic rename for the backup file, instead of just opening and writing #5931
Comments
Is there a planned milestone for this? |
That is enhancement so I put it in 3.0 version |
Implemented, closing. |
The code in the linked diff doesn't actually perform an atomic rename operation -- the |
@obi1kenobi thank you for the observation, reopening. Usually, if the file system supports atomic renames, regular renames are also atomic. Anyway, for the sake of strictness I will pass |
|
Looks great, thank you! It might also be good to log an error to inform the user that atomic moves are not supported by their system -- I definitely would like to know if that were the case for my database. |
@obi1kenobi ok, I will add a warning to the log. |
Warning added: 2c5c1e3 |
Looks great, thank you! |
I'm running OrientDB 2.1.9 configured with the backup plugin. I noticed that when backing up, the database simply opens its intended backup file and keeps writing data to it until finished. This is bad because it would leave the backup file corrupted in the event of a database crash mid-backup, but I wouldn't be able to notice since the file exists in its expected location.
A suggested solution is to do what other databases do -- write the backup to a separate file, say
<intended_backup_filename>.tmp
and when done writing the file, perform an atomic rename operation to change the name of the file from the.tmp
one to the final filename.This is a non-breaking change, since externally the behavior will be the same -- the backup file will have the same name and be in the same location. However, we will be guaranteed that any
.zip
files in the backup directory are valid backups and not corrupted.The text was updated successfully, but these errors were encountered: