You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by la...@apache.org on 2022/11/15 07:29:14 UTC

[kudu] branch master updated (f88c33cca -> 25890025c)

This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


    from f88c33cca [KUDU-3420] Fixbug of list local replica
     new e2a399602 [docker] Update Maven download link
     new 25890025c [refactor] improve code readability by reducing if-statement levels

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docker/bootstrap-maven-env.sh     |  2 +-
 src/kudu/util/net/dns_resolver.cc | 38 ++++++++++++++++++++++----------------
 2 files changed, 23 insertions(+), 17 deletions(-)


[kudu] 01/02: [docker] Update Maven download link

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit e2a399602690a4fbc972ab9f0a38e36496ea0f8e
Author: Marton Greber <gr...@gmail.com>
AuthorDate: Mon Nov 14 19:16:11 2022 +0100

    [docker] Update Maven download link
    
    This patch updates the download link in the Maven bootstrap script, as
    the old one was outdated and was not working.
    
    Change-Id: Ife4540a8e7f53d5ee5877a07cb38522071720fa5
    Reviewed-on: http://gerrit.cloudera.org:8080/19245
    Tested-by: Kudu Jenkins
    Reviewed-by: Attila Bukor <ab...@apache.org>
---
 docker/bootstrap-maven-env.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker/bootstrap-maven-env.sh b/docker/bootstrap-maven-env.sh
index 8bb6429f4..1885c8a43 100755
--- a/docker/bootstrap-maven-env.sh
+++ b/docker/bootstrap-maven-env.sh
@@ -29,7 +29,7 @@ set -o pipefail
 MVN_VERSION="3.6.3"
 MVN_CHECKSUM="c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0"
 wget -nv \
-  https://www-us.apache.org/dist/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz
+  https://downloads.apache.org/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz
 sha512sum -c - <<< "$MVN_CHECKSUM apache-maven-$MVN_VERSION-bin.tar.gz"
 tar -C /usr/local/ -xf apache-maven-$MVN_VERSION-bin.tar.gz
 ln -s /usr/local/apache-maven-$MVN_VERSION/bin/mvn /usr/local/bin


[kudu] 02/02: [refactor] improve code readability by reducing if-statement levels

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 25890025c12249e62600a182bc9252954f524e7c
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Mon Nov 14 16:46:26 2022 +0800

    [refactor] improve code readability by reducing if-statement levels
    
    Change-Id: I846a74e3525b0de986b95a05e8a39b476c3daa91
    Reviewed-on: http://gerrit.cloudera.org:8080/19239
    Tested-by: Kudu Jenkins
    Reviewed-by: Yuqi Du <sh...@gmail.com>
    Reviewed-by: Yifan Zhang <ch...@163.com>
    Reviewed-by: Alexey Serbin <al...@apache.org>
---
 src/kudu/util/net/dns_resolver.cc | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/kudu/util/net/dns_resolver.cc b/src/kudu/util/net/dns_resolver.cc
index 5eb9f0d19..d1fb9df30 100644
--- a/src/kudu/util/net/dns_resolver.cc
+++ b/src/kudu/util/net/dns_resolver.cc
@@ -151,24 +151,30 @@ void DnsResolver::DoResolutionCb(const HostPort& hostport,
 
 bool DnsResolver::GetCachedAddresses(const HostPort& hostport,
                                      vector<Sockaddr>* addresses) {
-  if (PREDICT_TRUE(cache_)) {
-    auto handle = cache_->Get(hostport.host());
-    if (handle) {
-      if (addresses) {
-        // Copy the cached records and set the result port number as necessary:
-        // a cached port number is not relevant and stored in the cache as a
-        // by-product: HostRecordCache stores not just IPs address, but Sockaddr
-        // structures.
-        vector<Sockaddr> result_addresses(handle.value());
-        for (auto& addr : result_addresses) {
-          addr.set_port(hostport.port());
-        }
-        *addresses = std::move(result_addresses);
-      }
-      return true;
+  if (PREDICT_FALSE(!cache_)) {
+    // Cache is disabled.
+    return false;
+  }
+
+  auto handle = cache_->Get(hostport.host());
+  if (!handle) {
+    // The key is not found.
+    return false;
+  }
+
+  if (addresses) {
+    // Copy the cached records and set the result port number as necessary:
+    // a cached port number is not relevant and stored in the cache as a
+    // by-product: HostRecordCache stores not just IPs address, but Sockaddr
+    // structures.
+    vector<Sockaddr> result_addresses(handle.value());
+    for (auto& addr : result_addresses) {
+      addr.set_port(hostport.port());
     }
+    *addresses = std::move(result_addresses);
   }
-  return false;
+
+  return true;
 }
 
 } // namespace kudu