-
Notifications
You must be signed in to change notification settings - Fork 258
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
checkpoints: fix performance drop on big volume restores #1345
checkpoints: fix performance drop on big volume restores #1345
Conversation
f183406
to
52e56d7
Compare
52e56d7
to
8882856
Compare
f838940
to
b6c219c
Compare
jobmedia
table entries are added
jobmedia
table entries are added12325b2
to
8c0b01a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks fine. I have some comments, but it is mostly about naming and using const
.
core/src/stored/append.cc
Outdated
auto now | ||
= std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); | ||
time_t next_checkpoint_time = now + me->checkpoint_interval; | ||
bool checkpoints_enabled = me->checkpoint_interval > 0 ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool checkpoints_enabled = me->checkpoint_interval > 0 ? true : false; | |
const bool checkpoints_enabled = me->checkpoint_interval > 0; |
core/src/stored/append.cc
Outdated
bool block_changed | ||
= current_block_number != jcr->sd_impl->dcr->block->BlockNumber; | ||
bool volume_changed | ||
= jcr->sd_impl->dcr->VolMediaId != current_volumeid && block_changed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool block_changed | |
= current_block_number != jcr->sd_impl->dcr->block->BlockNumber; | |
bool volume_changed | |
= jcr->sd_impl->dcr->VolMediaId != current_volumeid && block_changed; | |
const bool block_changed | |
= current_block_number != jcr->sd_impl->dcr->block->BlockNumber; | |
const bool volume_changed | |
= jcr->sd_impl->dcr->VolMediaId != current_volumeid && block_changed; |
core/src/stored/checkpointhandler.h
Outdated
void DoBackupCheckpoint(JobControlRecord* jcr); | ||
void DoTimedCheckpoint(JobControlRecord* jcr); | ||
void DoVolumeChangeBackupCheckpoint(JobControlRecord* jcr); | ||
void SetReadyForCheckpoint(bool ready) { ready_for_checkpoint_ = ready; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rest of the codebase uses SetXYZ()
/ ClearXYZ()
, so maybe we want to apply that pattern here, too.
Also ClearReadyForCheckpoint()
could even be made private.
core/src/stored/checkpointhandler.h
Outdated
void DoTimedCheckpoint(JobControlRecord* jcr); | ||
void DoVolumeChangeBackupCheckpoint(JobControlRecord* jcr); | ||
void SetReadyForCheckpoint(bool ready) { ready_for_checkpoint_ = ready; } | ||
bool ReadyForCheckpoint() const { return ready_for_checkpoint_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this looks completely reasonable here in context, ReadyForCheckpoint()
could also mean "I am ready for a checkpoint now" instead of "Am I ready for a checkpoint?"
Mark at least as [[nodiscard]]
or rename to IsXYZ()
.
core/src/stored/checkpointhandler.cc
Outdated
|
||
namespace storagedaemon { | ||
|
||
CheckpointHandler::CheckpointHandler(time_t interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the class' name is CheckpointHandler
I would have named the files checkpoint_handler.cc
and checkpoint_handler.h
.
812e8a4
to
878d413
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the include guards needs to be changed after renaming the file, also bareos-check-sources is unhappy with the headers in append.cc and append.h.
Also, some of the commit headlines exceed the limit that pr-tool is willing to accept.
core/src/stored/checkpoint_handler.h
Outdated
#ifndef BAREOS_STORED_CHECKPOINTHANDLER_H_ | ||
#define BAREOS_STORED_CHECKPOINTHANDLER_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include guard needs to be changed on rename, too.
core/src/stored/checkpoint_handler.h
Outdated
}; | ||
|
||
} // namespace storagedaemon | ||
#endif // BAREOS_STORED_CHECKPOINTHANDLER_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include guard needs to be changed on rename, too.
4b49f99
to
6f55b4b
Compare
remove unused `PossibleIncompleteJob` function
Previously, when updating backup checkpoints, DIR would try to update the jobmedia table entries or create a new one in case an update is not possible which in consequence made the jobmedia table entries kind of merged. The change lowered the number of entries in the jobmedia table but had the unwanted consequence of slowing restores in certain situations (restores on big volumes for example). With this change, jobmedia entries will only get created, and checkpoints will add an entry into the jobmedia table instead of updating existing entries.
* changed when checkpoints are triggered relative to attribute saving * add extra checks for when to trigger checkpoints
after jobmedia entry creation
6f55b4b
to
b270c90
Compare
Thank you for contributing to the Bareos Project!
Description
In this PR,
jobmedia
table entries are not updated anymore, and only new entries can be created. This change fixes a performance issue on restores of big volumes.Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Separate commit for CHANGELOG.md ("update CHANGELOG.md"). The PR number is correct.Source code quality
bareos-check-sources --since-merge
does not report any problems