git-hulk commented on code in PR #3357:
URL: https://github.com/apache/kvrocks/pull/3357#discussion_r2752345146
##########
src/common/io_util.cc:
##########
@@ -468,6 +471,93 @@ Status SockSend(int fd, const std::string &data,
[[maybe_unused]] bufferevent *b
#endif
}
+Status SockSendWithTimeout(int fd, const std::string &data, int timeout_ms) {
+ ssize_t n = 0;
+ auto start = std::chrono::steady_clock::now();
+
Review Comment:
Should we check if the value of timeout_ms is > 0?
##########
src/config/config.cc:
##########
@@ -206,6 +206,8 @@ Config::Config() {
{"replication-no-slowdown", false, new
YesNoField(&replication_no_slowdown, true)},
{"replication-delay-bytes", false, new
IntField(&max_replication_delay_bytes, 16 * 1024, 1, INT_MAX)},
{"replication-delay-updates", false, new
IntField(&max_replication_delay_updates, 16, 1, INT_MAX)},
+ {"max-replication-lag", false, new Int64Field(&max_replication_lag,
100000000, 1, INT64_MAX)},
Review Comment:
Can we allow setting `max_replication_lag` to 0 for disabling this feature,
and make it the default value for now?
##########
src/common/io_util.cc:
##########
@@ -468,6 +471,93 @@ Status SockSend(int fd, const std::string &data,
[[maybe_unused]] bufferevent *b
#endif
}
+Status SockSendWithTimeout(int fd, const std::string &data, int timeout_ms) {
+ ssize_t n = 0;
+ auto start = std::chrono::steady_clock::now();
+
+ while (n < static_cast<ssize_t>(data.size())) {
Review Comment:
We could reuse `WriteImpl` to simplify this implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]