This is an automated email from the ASF dual-hosted git repository.
wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 97f7c3032 fix(duplication): dup request is rejected by remote cluster
due to `max_allowed_write_size` (#1841)
97f7c3032 is described below
commit 97f7c30321298b3a021f6f95574a6ba6cfb75901
Author: ninsmiracle <[email protected]>
AuthorDate: Wed Mar 27 21:49:46 2024 +0800
fix(duplication): dup request is rejected by remote cluster due to
`max_allowed_write_size` (#1841)
https://github.com/apache/incubator-pegasus/issues/1840
Add config `dup_max_allowed_write_size` to restrict the size of dup request
in case that the request is reject by remote cluster.
New configuration is added:
```diff
[replication]
dup_max_allowed_write_size = 1048576
```
---
src/server/pegasus_mutation_duplicator.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/server/pegasus_mutation_duplicator.cpp
b/src/server/pegasus_mutation_duplicator.cpp
index d30f70400..de13e8ee9 100644
--- a/src/server/pegasus_mutation_duplicator.cpp
+++ b/src/server/pegasus_mutation_duplicator.cpp
@@ -46,6 +46,7 @@
#include "utils/chrono_literals.h"
#include "utils/error_code.h"
#include "utils/errors.h"
+#include "utils/flags.h"
#include "utils/fmt_logging.h"
#include "utils/rand.h"
@@ -63,6 +64,13 @@ namespace dsn {
namespace replication {
struct replica_base;
+DSN_DEFINE_uint64(replication,
+ dup_max_allowed_write_size,
+ 1 << 20,
+ "The maximum piece of request can be add to "
+ "the duplication batch, 0 means no check");
+DSN_TAG_VARIABLE(dup_max_allowed_write_size, FT_MUTABLE);
+
/// static definition of mutation_duplicator::creator.
/*static*/ std::function<std::unique_ptr<mutation_duplicator>(
replica_base *, absl::string_view, absl::string_view)>
@@ -234,7 +242,8 @@ void
pegasus_mutation_duplicator::duplicate(mutation_tuple_set muts, callback cb
batch_bytes += raw_message.length();
}
- if (batch_count == muts.size() || batch_bytes >=
FLAGS_duplicate_log_batch_bytes) {
+ if (batch_count == muts.size() || batch_bytes >=
FLAGS_duplicate_log_batch_bytes ||
+ batch_bytes >= dsn::replication::FLAGS_dup_max_allowed_write_size)
{
// since all the plog's mutations of replica belong to same gpid
though the hash of
// mutation is different, use the last mutation of one batch to
get and represents the
// current hash value, it will still send to remote correct replica
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]