From 397996bb5acf4a624423be087397e2ca3981051e Mon Sep 17 00:00:00 2001 From: liguohao <948193394@qq.com> Date: Tue, 7 Nov 2023 15:28:13 +0000 Subject: [PATCH] MacOS --- run.sh | 2 -- src/meta/partition_guardian.cpp | 4 ++-- src/meta/test/json_compacity.cpp | 2 +- src/redis_protocol/proxy_lib/proxy_layer.h | 2 +- src/replica/replica_stub.cpp | 2 +- src/runtime/rpc/rpc_host_port.h | 6 ++++++ 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/run.sh b/run.sh index d989b1dad3f..1b4b3f70b3d 100755 --- a/run.sh +++ b/run.sh @@ -848,7 +848,6 @@ function run_start_onebox() sed "s/@META_PORT@/$meta_port/;s/@REPLICA_PORT@/34800/;s/@PROMETHEUS_PORT@/$prometheus_port/" ${ROOT}/config-server.ini >config.ini $PWD/pegasus_server config.ini -app_list meta &>result & PID=$! - sleep 1 ps -ef | grep '/pegasus_server config.ini' | grep "\<$PID\>" cd .. done @@ -862,7 +861,6 @@ function run_start_onebox() sed "s/@META_PORT@/34600/;s/@REPLICA_PORT@/$replica_port/;s/@PROMETHEUS_PORT@/$prometheus_port/" ${ROOT}/config-server.ini >config.ini $PWD/pegasus_server config.ini -app_list replica &>result & PID=$! - sleep 1 ps -ef | grep '/pegasus_server config.ini' | grep "\<$PID\>" cd .. done diff --git a/src/meta/partition_guardian.cpp b/src/meta/partition_guardian.cpp index 77ae6c21a69..636586d175a 100644 --- a/src/meta/partition_guardian.cpp +++ b/src/meta/partition_guardian.cpp @@ -161,11 +161,11 @@ bool partition_guardian::from_proposals(meta_view &view, goto invalid_action; } if (!is_node_alive(*(view.nodes), action.hp_target)) { - sprintf(reason, "action target(%s) is not alive", action.hp_target.to_string().c_str()); + sprintf(reason, "action target(%s) is not alive", action.hp_target.get_char_ctr()); goto invalid_action; } if (!is_node_alive(*(view.nodes), action.hp_node)) { - sprintf(reason, "action node(%s) is not alive", action.hp_node.to_string().c_str()); + sprintf(reason, "action node(%s) is not alive", action.hp_node.get_char_ctr()); goto invalid_action; } if (cc.lb_actions.is_abnormal_learning_proposal()) { diff --git a/src/meta/test/json_compacity.cpp b/src/meta/test/json_compacity.cpp index 801436b21fb..cda3f9c368b 100644 --- a/src/meta/test/json_compacity.cpp +++ b/src/meta/test/json_compacity.cpp @@ -99,7 +99,7 @@ void meta_service_test_app::json_compacity() ASSERT_EQ(1, pc.hp_secondaries.size()); ASSERT_EQ(1, pc.secondaries.size()); ASSERT_STREQ("127.0.0.1:6", pc.secondaries[0].to_string()); - ASSERT_STREQ("localhost:6", pc.hp_secondaries[0].to_string().c_str()); + ASSERT_STREQ("localhost:6", pc.hp_secondaries[0].get_char_ctr()); ASSERT_EQ(157, pc.last_committed_decree); ASSERT_EQ(0, pc.partition_flags); diff --git a/src/redis_protocol/proxy_lib/proxy_layer.h b/src/redis_protocol/proxy_lib/proxy_layer.h index 9d9c748cef9..d40e5ead5ed 100644 --- a/src/redis_protocol/proxy_lib/proxy_layer.h +++ b/src/redis_protocol/proxy_lib/proxy_layer.h @@ -70,7 +70,7 @@ class proxy_session : public std::enable_shared_from_this virtual bool parse(dsn::message_ex *msg) = 0; dsn::message_ex *create_response(); - const char *log_prefix() const { return _remote_host_port.to_string().c_str(); } + const char *log_prefix() const { return _remote_host_port.get_char_ctr(); } protected: proxy_stub *_stub; diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp index 44098d4297c..8c0b3e7090a 100644 --- a/src/replica/replica_stub.cpp +++ b/src/replica/replica_stub.cpp @@ -586,7 +586,7 @@ void replica_stub::initialize(bool clear /* = false*/) void replica_stub::initialize(const replication_options &opts, bool clear /* = false*/) { _primary_host_port = dsn_primary_host_port(); - strcpy(_primary_address_str, _primary_host_port.to_string().c_str()); + strcpy(_primary_address_str, _primary_host_port.get_char_ctr()); LOG_INFO("primary_address = {}", _primary_address_str); set_options(opts); diff --git a/src/runtime/rpc/rpc_host_port.h b/src/runtime/rpc/rpc_host_port.h index abd0a1833e9..1a4d8fab900 100644 --- a/src/runtime/rpc/rpc_host_port.h +++ b/src/runtime/rpc/rpc_host_port.h @@ -92,6 +92,12 @@ class host_port std::string to_string() const; +// TODO(liguohao): fix this warn +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-stack-address" + const char *get_char_ctr() const { return to_string().c_str(); } +#pragma clang diagnostic pop + friend std::ostream &operator<<(std::ostream &os, const host_port &hp) { return os << hp.to_string();