-
Notifications
You must be signed in to change notification settings - Fork 21
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
github issue #159: Setup CP periodic timer and dirty buf exceed callback #182
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,10 @@ | |
#include <homestore/homestore.hpp> | ||
#include <homestore/meta_service.hpp> | ||
#include <homestore/checkpoint/cp_mgr.hpp> | ||
|
||
#include <homestore/homestore.hpp> | ||
#include "common/homestore_assert.hpp" | ||
#include "common/homestore_config.hpp" | ||
#include "common/resource_mgr.hpp" | ||
#include "cp.hpp" | ||
|
||
namespace homestore { | ||
|
@@ -35,6 +36,9 @@ CPManager::CPManager() : | |
[this](meta_blk* mblk, sisl::byte_view buf, size_t size) { on_meta_blk_found(std::move(buf), (void*)mblk); }, | ||
nullptr); | ||
|
||
resource_mgr().register_dirty_buf_exceed_cb( | ||
[this]([[maybe_unused]] int64_t dirty_buf_count) { this->trigger_cp_flush(false /* false */); }); | ||
|
||
start_cp_thread(); | ||
} | ||
|
||
|
@@ -46,6 +50,11 @@ void CPManager::start(bool first_time_boot) { | |
create_first_cp(); | ||
m_sb.write(); | ||
} | ||
|
||
LOGINFO("cp timer is set to {} usec", HS_DYNAMIC_CONFIG(generic.cp_timer_us)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is here instead of constructor to make some of the recover test happy. |
||
m_cp_timer_hdl = iomanager.schedule_global_timer( | ||
HS_DYNAMIC_CONFIG(generic.cp_timer_us) * 1000, true, nullptr /*cookie*/, iomgr::reactor_regex::all_worker, | ||
[this](void*) { trigger_cp_flush(false /* false */); }, true /* wait_to_schedule */); | ||
} | ||
|
||
void CPManager::on_meta_blk_found(const sisl::byte_view& buf, void* meta_cookie) { | ||
|
@@ -70,6 +79,9 @@ void CPManager::shutdown() { | |
m_wd_cp->stop(); | ||
m_wd_cp.reset(); | ||
} | ||
|
||
iomanager.cancel_timer(m_cp_timer_hdl, true); | ||
m_cp_timer_hdl = iomgr::null_timer_handle; | ||
} | ||
|
||
void CPManager::register_consumer(cp_consumer_t consumer_id, std::unique_ptr< CPCallbacks > callbacks) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we wait for cp flush to complete in this exceeded size case ?
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.
cp manager controls this, right? If a cp is running, a back-2-back cp will be created.
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.
Q: will
dirty_buf_exceed_cb
every time a new dirty_buf added after exceeding the limit?Trying to avoid the case that we exceeded the dirty limit for a moment and a lot of unnecessary CP get triggered.
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.
CP manager will garunteen only one cp can be running at anytime. e.g. if a cp is already running, it returns immediately. And if consumer asks for a forced trigger_cp, a back-2-back cp will be created.
If cp is slow or stuck (due to bugs or disk issues), it push the back pressure to consumers, e.g. no more dirty buffer can be allocated and push back I/O failures.