Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Bug Fixes
* upstream: cluster slow start config add ``min_weight_percent`` field to avoid too big EDF deadline which cause slow start endpoints receiving no traffic, default 10%. This fix is releted to `issue#19526 <https://github.com/envoyproxy/envoy/issues/19526>`_.
* upstream: fix stack overflow when a cluster with large number of idle connections is removed.
* xds: fix a crash that occurs when Envoy receives a discovery response without ``control_plane`` field.
* xds: fix the wildcard resource versions that are sent upon reconnection when using delta-xds mode.
* xray: fix the AWS X-Ray tracer extension to not sample the trace if ``sampled=`` keyword is not present in the header ``x-amzn-trace-id``.
* xray: fix the AWS X-Ray tracer extension to annotate a child span with ``type=subsegment`` to correctly relate subsegments to a parent segment. Previously a subsegment would be treated as an independent segment.
* xray: fix the AWS X-Ray tracer extension to reuse the trace ID already present in the header ``x-amzn-trace-id`` instead of creating a new one.
Expand Down
4 changes: 2 additions & 2 deletions source/common/config/new_delta_subscription_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void NewDeltaSubscriptionState::updateSubscriptionInterest(
// won't be a wildcard resource then. If r is Wildcard itself, then it never has a version
// attached to it, so it will not be moved to ambiguous category.
if (!it->second.isWaitingForServer()) {
ambiguous_resource_state_.insert({it->first, it->second.version()});
ambiguous_resource_state_.insert_or_assign(it->first, it->second.version());
}
requested_resource_state_.erase(it);
actually_erased = true;
Expand Down Expand Up @@ -375,7 +375,7 @@ void NewDeltaSubscriptionState::addResourceStateFromServer(
ASSERT(!ambiguous_resource_state_.contains(resource.name()));
} else {
// It is a resource that is a part of our wildcard request.
wildcard_resource_state_.insert({resource.name(), resource.version()});
wildcard_resource_state_.insert_or_assign(resource.name(), resource.version());
// The resource could be ambiguous before, but now the ambiguity
// is resolved.
ambiguous_resource_state_.erase(resource.name());
Expand Down
4 changes: 2 additions & 2 deletions source/common/config/xds_mux/delta_subscription_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void DeltaSubscriptionState::updateSubscriptionInterest(
// won't be a wildcard resource then. If r is Wildcard itself, then it never has a version
// attached to it, so it will not be moved to ambiguous category.
if (!it->second.isWaitingForServer()) {
ambiguous_resource_state_.insert({it->first, it->second.version()});
ambiguous_resource_state_.insert_or_assign(it->first, it->second.version());
}
requested_resource_state_.erase(it);
actually_erased = true;
Expand Down Expand Up @@ -317,7 +317,7 @@ void DeltaSubscriptionState::addResourceStateFromServer(
ASSERT(!ambiguous_resource_state_.contains(resource.name()));
} else {
// It is a resource that is a part of our wildcard request.
wildcard_resource_state_.insert({resource.name(), resource.version()});
wildcard_resource_state_.insert_or_assign(resource.name(), resource.version());
// The resource could be ambiguous before, but now the ambiguity
// is resolved.
ambiguous_resource_state_.erase(resource.name());
Expand Down
24 changes: 24 additions & 0 deletions test/common/config/delta_subscription_state_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,30 @@ TEST_P(DeltaSubscriptionStateTestBlank, LegacyWildcardInitialRequests) {
EXPECT_TRUE(req->resource_names_unsubscribe().empty());
}

// Validate that the resources versions are updated and sent upon reconnection.
// Regression test of: https://github.com/envoyproxy/envoy/issues/20699
TEST_P(DeltaSubscriptionStateTestBlank, ReconnectResourcesVersions) {
// Subscribe to foo and bar.
updateSubscriptionInterest({WildcardStr, "foo", "bar"}, {});
auto req = getNextRequestAckless();
EXPECT_THAT(req->resource_names_subscribe(), UnorderedElementsAre(WildcardStr, "foo", "bar"));
EXPECT_TRUE(req->resource_names_unsubscribe().empty());
EXPECT_TRUE(req->initial_resource_versions().empty());
// Deliver foo, bar, and a wild with version 1.
deliverSimpleDiscoveryResponse({{"foo", "1"}, {"bar", "1"}, {"wild", "1"}}, {}, "d1");

// Update the versions of foo and wild to 2.
deliverSimpleDiscoveryResponse({{"foo", "2"}, {"wild", "2"}}, {}, "d2");

// Reconnect, and end validate the initial resources versions.
markStreamFresh();
req = getNextRequestAckless();
EXPECT_THAT(req->resource_names_subscribe(), UnorderedElementsAre(WildcardStr, "foo", "bar"));
EXPECT_TRUE(req->resource_names_unsubscribe().empty());
EXPECT_THAT(req->initial_resource_versions(),
UnorderedElementsAre(Pair("foo", "2"), Pair("bar", "1"), Pair("wild", "2")));
}

// Check that ambiguous resources may also receive a heartbeat message.
TEST_P(DeltaSubscriptionStateTestBlank, AmbiguousResourceTTL) {
Event::SimulatedTimeSystem time_system;
Expand Down