-
Notifications
You must be signed in to change notification settings - Fork 312
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
feat: support to force send non-idempotent write when doing duplication #1908
base: master
Are you sure you want to change the base?
Conversation
This PR's base function is in line with expectations , however I was requested by business department to add more matrix for surveillance system about this feature. I will update this PR in recently days. |
31a4271
to
61b446f
Compare
src/common/duplication_common.h
Outdated
@@ -31,6 +31,7 @@ | |||
#include "utils/fmt_utils.h" | |||
|
|||
DSN_DECLARE_uint32(duplicate_log_batch_bytes); | |||
DSN_DECLARE_bool(force_send_no_idempotent_when_duplication); |
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.
Is it necessary to add it here?
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.
I think it's necessary . Cause once I remove this line , compilation can not be passed.
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 DSN_DECLARE_xxx macros are recommended to move to cpp files where actually use it, don't make the header files to be too large.
The same to DSN_DECLARE_uint32(duplicate_log_batch_bytes);
|
||
if (request.task_code == dsn::apps::RPC_RRDB_RRDB_INCR) { | ||
incr_rpc rpc(write); | ||
resp.__set_error(_impl->incr(ctx.decree, rpc.request(), rpc.response())); |
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.
Add some comments to describe what's you aim here.
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
…cubator-pegasus into support_no_idempotent_dup
src/common/duplication_common.h
Outdated
@@ -31,6 +31,7 @@ | |||
#include "utils/fmt_utils.h" | |||
|
|||
DSN_DECLARE_uint32(duplicate_log_batch_bytes); | |||
DSN_DECLARE_bool(duplication_unsafe_allow_non_idempotent); |
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.
Move these declarations to the places where actually use them, don't put them in header files.
@@ -89,8 +94,14 @@ class pegasus_mutation_duplicator : public dsn::replication::mutation_duplicator | |||
|
|||
size_t _total_shipped_size{0}; | |||
|
|||
const std::set<dsn::task_code> _non_idempotent_code = { |
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.
const std::set<dsn::task_code> _non_idempotent_code = { | |
const std::set<dsn::task_code> _non_idempotent_codes = { |
@@ -89,8 +94,14 @@ class pegasus_mutation_duplicator : public dsn::replication::mutation_duplicator | |||
|
|||
size_t _total_shipped_size{0}; | |||
|
|||
const std::set<dsn::task_code> _non_idempotent_code = { |
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.
Try to reuse it in some other places, e.g. src/server/pegasus_write_service.cpp
src/server/pegasus_write_service.cpp
Outdated
// receive non-idempotent request from master cluster via duplication when | ||
// FLAG_duplication_unsafe_allow_non_idempotent set as true. | ||
// This metric greater than zero means that there is already the possibility of | ||
// inconsistency between clusters |
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.
Move these comments to the dup_unsafe_received_non_idempotent_duplicate_request metric description, then users know what does it mean from http API, rather than finding out the comments in code.
@@ -189,6 +211,9 @@ void pegasus_mutation_duplicator::on_duplicate_reply(uint64_t hash, | |||
// retry this rpc | |||
_inflights[hash].push_front(rpc); | |||
_env.schedule([hash, cb, this]() { send(hash, cb); }, 1_s); |
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.
Will the non-idempotent request be retried twice here?
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.
Yes,it will. So I record specific raw_key
into log.
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
Co-authored-by: Yingchun Lai <laiyingchun@apache.org>
What problem does this PR solve?
#1907
What is changed and how does it work?
Tests
when user want to force dup non-idempotent mutations. Type following command in admin-cli: