From f630ce148fb9764c83481b2ebabf2e11944ba41a Mon Sep 17 00:00:00 2001 From: liguohao <48315319+GehaFearless@users.noreply.github.com> Date: Tue, 4 Apr 2023 11:06:18 +0800 Subject: [PATCH] feat: add new macro definitions (#1429) issue: https://github.com/apache/incubator-pegasus/issues/1426 Add some macro definitions & fix a little docker build problem. --- docker/pegasus-build-env/centos6/Dockerfile | 2 +- src/geo/lib/geo_client.cpp | 5 +---- src/redis_protocol/proxy_lib/redis_parser.cpp | 21 +++++++++++-------- src/utils/errors.h | 12 +++++++++-- src/utils/fmt_logging.h | 14 +++++++++++++ 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/docker/pegasus-build-env/centos6/Dockerfile b/docker/pegasus-build-env/centos6/Dockerfile index 3e042b7d64..18283121f6 100644 --- a/docker/pegasus-build-env/centos6/Dockerfile +++ b/docker/pegasus-build-env/centos6/Dockerfile @@ -76,7 +76,7 @@ ENV MAVEN_HOME=/opt/rh/rh-maven33/root/usr/ ENV PATH=$MAVEN_HOME/bin:$JAVA_HOME/bin:$GCC_HOME/bin:$PYTHON2_HOME/bin/:$PATH ENV LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:$PYTHON2_HOME/lib64/:$LD_LIBRARY_PATH -RUN python -m pip install --user --upgrade pip==20.3.4 && python -m pip install --no-cache-dir cmake -i https://pypi.tuna.tsinghua.edu.cn/simple +RUN python -m pip install --no-cache-dir --user --upgrade pip==20.3.4 && python -m pip install --no-cache-dir cmake -i https://pypi.tuna.tsinghua.edu.cn/simple RUN wget --progress=dot:giga https://github.com/apache/thrift/archive/refs/tags/0.11.0.tar.gz -P /opt/thrift && \ cd /opt/thrift && tar xzf 0.11.0.tar.gz && cd thrift-0.11.0 && ./bootstrap.sh && \ diff --git a/src/geo/lib/geo_client.cpp b/src/geo/lib/geo_client.cpp index e7a4009b78..335afda62e 100644 --- a/src/geo/lib/geo_client.cpp +++ b/src/geo/lib/geo_client.cpp @@ -111,10 +111,7 @@ geo_client::geo_client(const char *config_file, CHECK_NOTNULL(_geo_data_client, "init pegasus _geo_data_client failed"); dsn::error_s s = _codec.set_latlng_indices(FLAGS_latitude_index, FLAGS_longitude_index); - CHECK(s.is_ok(), - "set_latlng_indices({}, {}) failed", - FLAGS_latitude_index, - FLAGS_longitude_index); + CHECK_OK(s, "set_latlng_indices({}, {}) failed", FLAGS_latitude_index, FLAGS_longitude_index); } dsn::error_s geo_client::set_max_level(int level) diff --git a/src/redis_protocol/proxy_lib/redis_parser.cpp b/src/redis_protocol/proxy_lib/redis_parser.cpp index ba009616c2..8712f23457 100644 --- a/src/redis_protocol/proxy_lib/redis_parser.cpp +++ b/src/redis_protocol/proxy_lib/redis_parser.cpp @@ -807,14 +807,16 @@ void redis_parser::geo_radius(message_entry &entry) // longitude latitude double lng_degrees = 0.0; const std::string &str_lng_degrees = redis_request.sub_requests[2].data.to_string(); - if (!dsn::buf2double(str_lng_degrees, lng_degrees)) { - LOG_WARNING("longitude parameter '{}' is error, use {}", str_lng_degrees, lng_degrees); - } + LOG_WARNING_IF(!dsn::buf2double(str_lng_degrees, lng_degrees), + "longitude parameter '{}' is error, use {}", + str_lng_degrees, + lng_degrees); double lat_degrees = 0.0; const std::string &str_lat_degrees = redis_request.sub_requests[3].data.to_string(); - if (!dsn::buf2double(str_lat_degrees, lat_degrees)) { - LOG_WARNING("latitude parameter '{}' is error, use {}", str_lat_degrees, lat_degrees); - } + LOG_WARNING_IF(!dsn::buf2double(str_lat_degrees, lat_degrees), + "latitude parameter '{}' is error, use {}", + str_lat_degrees, + lat_degrees); // radius m|km|ft|mi [WITHCOORD] [WITHDIST] [COUNT count] [ASC|DESC] double radius_m = 100.0; @@ -1049,9 +1051,10 @@ void redis_parser::parse_geo_radius_parameters(const std::vector