From 12d40dfdfc5f1741928915e8988bf5f6ee5d6c4b Mon Sep 17 00:00:00 2001 From: zhjc1124 Date: Tue, 16 May 2023 03:11:18 +0000 Subject: [PATCH] fix server bw limit unset --- src/observer/net/ob_ingress_bw_alloc_service.cpp | 7 +++---- src/observer/ob_srv_network_frame.cpp | 10 +++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/observer/net/ob_ingress_bw_alloc_service.cpp b/src/observer/net/ob_ingress_bw_alloc_service.cpp index c945435b68..0940be61c9 100644 --- a/src/observer/net/ob_ingress_bw_alloc_service.cpp +++ b/src/observer/net/ob_ingress_bw_alloc_service.cpp @@ -393,10 +393,9 @@ void ObIngressBWAllocService::follower_task() ret = OB_NOT_INIT; COMMON_LOG(WARN, "not init", K(ret), K(is_inited_)); } else if (server_standby_bw > 0) { - // do nothing, reload _server_standby_fetch_log_bandwidth_limit in ObSrvNetworkFrame::reload_config() - // if (OB_FAIL(obrpc::global_poc_server.update_server_standby_fetch_log_bandwidth_limit(server_standby_bw))) { - // COMMON_LOG(WARN, "Failed to set server-level standby fetchlog bandwidth limit"); - // } + if (OB_FAIL(obrpc::global_poc_server.update_server_standby_fetch_log_bandwidth_limit(server_standby_bw))) { + COMMON_LOG(WARN, "Failed to set server-level standby fetchlog bandwidth limit"); + } } else if (GCONF.standby_fetch_log_bandwidth_limit == 0) { // unlimited if (OB_FAIL(obrpc::global_poc_server.update_server_standby_fetch_log_bandwidth_limit(RATE_UNLIMITED))) { diff --git a/src/observer/ob_srv_network_frame.cpp b/src/observer/ob_srv_network_frame.cpp index 4255355005..2854dc7923 100644 --- a/src/observer/ob_srv_network_frame.cpp +++ b/src/observer/ob_srv_network_frame.cpp @@ -250,7 +250,6 @@ int ObSrvNetworkFrame::reload_config() int32_t tcp_keepintvl = static_cast(GCONF.tcp_keepintvl); int32_t tcp_keepcnt = static_cast(GCONF.tcp_keepcnt); int32_t user_timeout = static_cast(GCONF.dead_socket_detection_timeout); - int64_t server_standby_bw = static_cast(GCONF._server_standby_fetch_log_bandwidth_limit); if (GCONF._enable_easy_keepalive) { enable_easy_keepalive = 1; @@ -280,8 +279,6 @@ int ObSrvNetworkFrame::reload_config() tcp_keepidle, tcp_keepintvl, tcp_keepcnt))) { LOG_WARN("Failed to set sql tcp keepalive parameters for sql nio server", K(ret)); - } else if (OB_FAIL(obrpc::global_poc_server.update_server_standby_fetch_log_bandwidth_limit(server_standby_bw))) { - LOG_WARN("Failed to set server-level standby fetchlog bandwidth limit"); } return ret; } @@ -644,6 +641,13 @@ int ObSrvNetworkFrame::net_endpoint_predict_ingress(const ObNetEndpointKey &endp int ObSrvNetworkFrame::net_endpoint_set_ingress(const ObNetEndpointKey &endpoint_key, int64_t assigned_bw) { int ret = OB_SUCCESS; + if ((int64_t)GCONF._server_standby_fetch_log_bandwidth_limit > 0) { + } else if (GCONF.standby_fetch_log_bandwidth_limit == 0) { + // unlimited + if (OB_FAIL(obrpc::global_poc_server.update_server_standby_fetch_log_bandwidth_limit(RATE_UNLIMITED))) { + COMMON_LOG(WARN, "Failed to set server-level standby fetchlog bandwidth limit"); + } + } if (OB_UNLIKELY(assigned_bw == -1)) { ret = OB_INVALID_CONFIG; LOG_WARN("assigned bandwidtth is invalid", K(ret), K(endpoint_key), K(assigned_bw));