-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: add metric is_eligible_for_master_election to support reelection decision in codis-sentinel #2766
fix: add metric is_eligible_for_master_election to support reelection decision in codis-sentinel #2766
Changes from all commits
475b48e
10f72c1
444f00a
dce0e1d
63bb2ee
853622f
8aae3a0
5146c41
0ef1887
beb06db
82e8a16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -185,6 +185,14 @@ int PikaConf::Load() { | |||||||||||||||||||
SetAdminCmd(admin_cmd_list); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
std::string unfinished_full_sync; | ||||||||||||||||||||
GetConfStr("internal-used-unfinished-full-sync", &unfinished_full_sync); | ||||||||||||||||||||
if (replication_id_.empty()) { | ||||||||||||||||||||
unfinished_full_sync.clear(); | ||||||||||||||||||||
} | ||||||||||||||||||||
SetInternalUsedUnFinishedFullSync(unfinished_full_sync); | ||||||||||||||||||||
Comment on lines
+188
to
+193
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. Ensure robust handling of configuration parameters. The implementation clears the - if (replication_id_.empty()) {
- unfinished_full_sync.clear();
- } Consider documenting the rationale behind this conditional or ensuring that it aligns with the intended logic. Committable suggestion
Suggested change
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. 1 unfinished_full_sync is related with replication_id_ 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. @cheniujh, glad you agree! I'll make sure to remember this for future reviews. Learnings added
Learnings used
|
||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
GetConfInt("sync-thread-num", &sync_thread_num_); | ||||||||||||||||||||
if (sync_thread_num_ <= 0) { | ||||||||||||||||||||
sync_thread_num_ = 3; | ||||||||||||||||||||
|
@@ -701,6 +709,7 @@ int PikaConf::Load() { | |||||||||||||||||||
} else { | ||||||||||||||||||||
rsync_timeout_ms_.store(tmp_rsync_timeout_ms); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
return ret; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -774,6 +783,7 @@ int PikaConf::ConfigRewrite() { | |||||||||||||||||||
SetConfDouble("min-check-resume-ratio", min_check_resume_ratio_); | ||||||||||||||||||||
SetConfInt("slave-priority", slave_priority_); | ||||||||||||||||||||
SetConfInt("throttle-bytes-per-second", throttle_bytes_per_second_); | ||||||||||||||||||||
SetConfStr("internal-used-unfinished-full-sync", pstd::Set2String(internal_used_unfinished_full_sync_, ',')); | ||||||||||||||||||||
SetConfInt("max-rsync-parallel-num", max_rsync_parallel_num_); | ||||||||||||||||||||
SetConfInt("sync-window-size", sync_window_size_.load()); | ||||||||||||||||||||
SetConfInt("consensus-level", consensus_level_.load()); | ||||||||||||||||||||
|
@@ -828,6 +838,7 @@ int PikaConf::ConfigRewrite() { | |||||||||||||||||||
int PikaConf::ConfigRewriteReplicationID() { | ||||||||||||||||||||
std::lock_guard l(rwlock_); | ||||||||||||||||||||
SetConfStr("replication-id", replication_id_); | ||||||||||||||||||||
SetConfStr("internal-used-unfinished-full-sync", pstd::Set2String(internal_used_unfinished_full_sync_, ',')); | ||||||||||||||||||||
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. Duplication in handling configuration rewriting. The method - SetConfStr("internal-used-unfinished-full-sync", pstd::Set2String(internal_used_unfinished_full_sync_, ',')); Consider centralizing the handling of this configuration to ensure consistency and reduce code duplication.
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. internal-used-unfinished-full-sync is related with replicationID, that's why I put them together there. 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. @cheniujh, thank you for the clarification. I understand now that Learnings added
|
||||||||||||||||||||
if (!diff_commands_.empty()) { | ||||||||||||||||||||
std::vector<pstd::BaseConf::Rep::ConfItem> filtered_items; | ||||||||||||||||||||
for (const auto& diff_command : diff_commands_) { | ||||||||||||||||||||
|
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.
Dynamic management of sync configurations.
The
AddInternalUsedUnfinishedFullSync
method dynamically updates the internal set and rewrites the configuration. This approach is flexible but could lead to performance issues if called frequently due to the repeated calls toConfigRewrite
.Evaluate the impact of these operations on system performance, especially under high load, and consider optimizing by batching or deferring updates.
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.
ConfigRewrite() is not that expensive although it write files, and more important, AddInternalUsedUnfinishedFullSync(const std::string& db_name) will not be called frequently and which is the main reason of no need of worry about performance
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.
@cheniujh, thank you for the clarification. It's good to know that
ConfigRewrite()
is not expensive andAddInternalUsedUnfinishedFullSync
will not be called frequently. This alleviates concerns about potential performance issues.Learnings added
Learnings used