From cfee835266afd9f2f7e8c57091b42078b82e22be Mon Sep 17 00:00:00 2001 From: Rama Chavali Date: Sat, 2 Mar 2019 15:03:18 +0530 Subject: [PATCH 1/4] original dst log line Signed-off-by: Rama Chavali --- .../common/upstream/original_dst_cluster.cc | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index f339491069ebd..536a0e684313e 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -160,16 +160,17 @@ void OriginalDstCluster::cleanup() { // Given the current config, only EDS clusters support multiple priorities. ASSERT(priority_set_.hostSetsPerPriority().size() == 1); const auto& host_set = priority_set_.getOrCreateHostSet(0); - - ENVOY_LOG(debug, "Cleaning up stale original dst hosts."); - for (const HostSharedPtr& host : host_set.hosts()) { - if (host->used()) { - ENVOY_LOG(debug, "Keeping active host {}.", host->address()->asString()); - new_hosts->emplace_back(host); - host->used(false); // Mark to be removed during the next round. - } else { - ENVOY_LOG(debug, "Removing stale host {}.", host->address()->asString()); - to_be_removed.emplace_back(host); + if (!host_set.hosts().empty()) { + ENVOY_LOG(debug, "Cleaning up stale original dst hosts."); + for (const HostSharedPtr& host : host_set.hosts()) { + if (host->used()) { + ENVOY_LOG(debug, "Keeping active host {}.", host->address()->asString()); + new_hosts->emplace_back(host); + host->used(false); // Mark to be removed during the next round. + } else { + ENVOY_LOG(debug, "Removing stale host {}.", host->address()->asString()); + to_be_removed.emplace_back(host); + } } } From 58625f35e44849f9f80c6f609760ea394a419fed Mon Sep 17 00:00:00 2001 From: Rama Chavali Date: Sun, 3 Mar 2019 10:52:35 +0530 Subject: [PATCH 2/4] change to trace Signed-off-by: Rama Chavali --- .../common/upstream/original_dst_cluster.cc | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index 536a0e684313e..8fe4bd9b04a45 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -160,17 +160,15 @@ void OriginalDstCluster::cleanup() { // Given the current config, only EDS clusters support multiple priorities. ASSERT(priority_set_.hostSetsPerPriority().size() == 1); const auto& host_set = priority_set_.getOrCreateHostSet(0); - if (!host_set.hosts().empty()) { - ENVOY_LOG(debug, "Cleaning up stale original dst hosts."); - for (const HostSharedPtr& host : host_set.hosts()) { - if (host->used()) { - ENVOY_LOG(debug, "Keeping active host {}.", host->address()->asString()); - new_hosts->emplace_back(host); - host->used(false); // Mark to be removed during the next round. - } else { - ENVOY_LOG(debug, "Removing stale host {}.", host->address()->asString()); - to_be_removed.emplace_back(host); - } + ENVOY_LOG(trace, "Cleaning up stale original dst hosts."); + for (const HostSharedPtr& host : host_set.hosts()) { + if (host->used()) { + ENVOY_LOG(trace, "Keeping active host {}.", host->address()->asString()); + new_hosts->emplace_back(host); + host->used(false); // Mark to be removed during the next round. + } else { + ENVOY_LOG(trace, "Removing stale host {}.", host->address()->asString()); + to_be_removed.emplace_back(host); } } From b42c079730f9c2c5ed22475fa608944fe276601d Mon Sep 17 00:00:00 2001 From: Rama Chavali Date: Sun, 3 Mar 2019 11:58:21 +0530 Subject: [PATCH 3/4] add additional trace Signed-off-by: Rama Chavali --- .../common/upstream/original_dst_cluster.cc | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index 8fe4bd9b04a45..a76a0449a2b60 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -160,15 +160,18 @@ void OriginalDstCluster::cleanup() { // Given the current config, only EDS clusters support multiple priorities. ASSERT(priority_set_.hostSetsPerPriority().size() == 1); const auto& host_set = priority_set_.getOrCreateHostSet(0); - ENVOY_LOG(trace, "Cleaning up stale original dst hosts."); - for (const HostSharedPtr& host : host_set.hosts()) { - if (host->used()) { - ENVOY_LOG(trace, "Keeping active host {}.", host->address()->asString()); - new_hosts->emplace_back(host); - host->used(false); // Mark to be removed during the next round. - } else { - ENVOY_LOG(trace, "Removing stale host {}.", host->address()->asString()); - to_be_removed.emplace_back(host); + ENVOY_LOG(trace, "stale original dst hosts cleanup triggered"); + if (!host_set.hosts().empty()) { + ENVOY_LOG(debug, "Cleaning up stale original dst hosts."); + for (const HostSharedPtr& host : host_set.hosts()) { + if (host->used()) { + ENVOY_LOG(debug, "Keeping active host {}.", host->address()->asString()); + new_hosts->emplace_back(host); + host->used(false); // Mark to be removed during the next round. + } else { + ENVOY_LOG(debug, "Removing stale host {}.", host->address()->asString()); + to_be_removed.emplace_back(host); + } } } From bce1701ba8d12afcc08b0cfbe43652aeef7d1d01 Mon Sep 17 00:00:00 2001 From: Rama Chavali Date: Sun, 3 Mar 2019 12:13:41 +0530 Subject: [PATCH 4/4] comments Signed-off-by: Rama Chavali --- source/common/upstream/original_dst_cluster.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index a76a0449a2b60..b1bd085b152e4 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -160,7 +160,7 @@ void OriginalDstCluster::cleanup() { // Given the current config, only EDS clusters support multiple priorities. ASSERT(priority_set_.hostSetsPerPriority().size() == 1); const auto& host_set = priority_set_.getOrCreateHostSet(0); - ENVOY_LOG(trace, "stale original dst hosts cleanup triggered"); + ENVOY_LOG(trace, "Stale original dst hosts cleanup triggered."); if (!host_set.hosts().empty()) { ENVOY_LOG(debug, "Cleaning up stale original dst hosts."); for (const HostSharedPtr& host : host_set.hosts()) {