Commit cc381578 authored by zhujiashun's avatar zhujiashun

revived_from_all_failed: remove unnecessary logs and comments

parent 2b550fd0
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <butil/time.h> #include <butil/time.h>
#include "brpc/circuit_breaker.h" #include "brpc/circuit_breaker.h"
#include "brpc/errno.pb.h"
#include "butil/logging.h"
namespace brpc { namespace brpc {
......
...@@ -75,8 +75,7 @@ private: ...@@ -75,8 +75,7 @@ private:
int64_t _usable_cache_time_ms; int64_t _usable_cache_time_ms;
}; };
// Return a DefaultClusterRecoverPolicy object by params. The caller is responsible // Return a DefaultClusterRecoverPolicy object by params.
// for memory management of the return value.
bool GetRecoverPolicyByParams(const butil::StringPiece& params, bool GetRecoverPolicyByParams(const butil::StringPiece& params,
std::shared_ptr<ClusterRecoverPolicy>* ptr_out); std::shared_ptr<ClusterRecoverPolicy>* ptr_out);
......
...@@ -31,10 +31,6 @@ inline uint32_t GenRandomStride() { ...@@ -31,10 +31,6 @@ inline uint32_t GenRandomStride() {
return prime_offset[butil::fast_rand_less_than(ARRAY_SIZE(prime_offset))]; return prime_offset[butil::fast_rand_less_than(ARRAY_SIZE(prime_offset))];
} }
RandomizedLoadBalancer::RandomizedLoadBalancer()
: _cluster_recover_policy(NULL)
{}
bool RandomizedLoadBalancer::Add(Servers& bg, const ServerId& id) { bool RandomizedLoadBalancer::Add(Servers& bg, const ServerId& id) {
if (bg.server_list.capacity() < 128) { if (bg.server_list.capacity() < 128) {
bg.server_list.reserve(128); bg.server_list.reserve(128);
......
...@@ -31,7 +31,6 @@ namespace policy { ...@@ -31,7 +31,6 @@ namespace policy {
// than RoundRobinLoadBalancer. // than RoundRobinLoadBalancer.
class RandomizedLoadBalancer : public LoadBalancer { class RandomizedLoadBalancer : public LoadBalancer {
public: public:
RandomizedLoadBalancer();
bool AddServer(const ServerId& id); bool AddServer(const ServerId& id);
bool RemoveServer(const ServerId& id); bool RemoveServer(const ServerId& id);
size_t AddServersInBatch(const std::vector<ServerId>& servers); size_t AddServersInBatch(const std::vector<ServerId>& servers);
......
...@@ -790,13 +790,13 @@ TEST_F(LoadBalancerTest, health_check_no_valid_server) { ...@@ -790,13 +790,13 @@ TEST_F(LoadBalancerTest, health_check_no_valid_server) {
TEST_F(LoadBalancerTest, revived_from_all_failed_sanity) { TEST_F(LoadBalancerTest, revived_from_all_failed_sanity) {
brpc::LoadBalancer* lb = NULL; brpc::LoadBalancer* lb = NULL;
// TODO(zhujiashun) int rand = butil::fast_rand_less_than(2);
int rand = butil::fast_rand_less_than(1);
if (rand == 0) { if (rand == 0) {
brpc::policy::RandomizedLoadBalancer rlb; brpc::policy::RandomizedLoadBalancer rlb;
lb = rlb.New("minimum_working_instances=2 hold_time_ms=2000"); lb = rlb.New("minimum_working_instances=2 hold_time_ms=2000");
} else if (rand == 1) { } else if (rand == 1) {
lb = new brpc::policy::RoundRobinLoadBalancer; brpc::policy::RoundRobinLoadBalancer rrlb;
lb = rrlb.New("minimum_working_instances=2 hold_time_ms=2000");
} }
brpc::SocketUniquePtr ptr[2]; brpc::SocketUniquePtr ptr[2];
for (size_t i = 0; i < ARRAY_SIZE(servers); ++i) { for (size_t i = 0; i < ARRAY_SIZE(servers); ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment