Skip to content

Commit 8c685cc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into xds_resource_timer_change
2 parents 6327cfd + 097bc74 commit 8c685cc

File tree

5 files changed

+126
-23
lines changed

5 files changed

+126
-23
lines changed

MAINTAINERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ for general contribution guidelines.
2828
- [matthewstevenson88](https://github.com/matthewstevenson88), Google LLC
2929
- [murgatroid99](https://github.com/murgatroid99), Google LLC
3030
- [nanahpang](https://github.com/nanahpang), Google LLC
31+
- [pawbhard](https://github.com/pawbhard), Google LLC
3132
- [pfreixes](https://github.com/pfreixes), Skyscanner Ltd
3233
- [ran-su](https://github.com/ran-su), Google LLC
3334
- [sanjaypujare](https://github.com/sanjaypujare), Google LLC

src/core/xds/xds_client/xds_client.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ void XdsClient::XdsChannel::AdsCall::UnsubscribeLocked(
759759
authority_map.erase(name.key);
760760
if (authority_map.empty()) {
761761
type_state_map.subscribed_resources.erase(name.authority);
762+
// Note: We intentionally do not remove the top-level map entry for
763+
// the resource type even if the authority map for the type is empty,
764+
// because we need to retain the nonce in case a new watch is
765+
// started for a resource of this type while this stream is still open.
762766
}
763767
// Don't need to send unsubscription message if this was the last
764768
// resource we were subscribed to, since we'll be closing the stream

test/core/xds/xds_client_test.cc

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -777,17 +777,15 @@ class XdsClientTest : public ::testing::Test {
777777

778778
// Sets transport_factory_ and initializes xds_client_ with the
779779
// specified bootstrap config.
780-
void InitXdsClient(
781-
FakeXdsBootstrap::Builder bootstrap_builder = FakeXdsBootstrap::Builder(),
782-
Duration resource_request_timeout = Duration::Seconds(15)) {
780+
void InitXdsClient(FakeXdsBootstrap::Builder bootstrap_builder =
781+
FakeXdsBootstrap::Builder()) {
783782
transport_factory_ = MakeRefCounted<FakeXdsTransportFactory>(
784783
[]() { FAIL() << "Multiple concurrent reads"; }, event_engine_);
785784
auto metrics_reporter = std::make_unique<MetricsReporter>(event_engine_);
786785
metrics_reporter_ = metrics_reporter.get();
787786
xds_client_ = MakeRefCounted<XdsClient>(
788787
bootstrap_builder.Build(), transport_factory_, event_engine_,
789-
std::move(metrics_reporter), "foo agent", "foo version",
790-
resource_request_timeout * grpc_test_slowdown_factor());
788+
std::move(metrics_reporter), "foo agent", "foo version");
791789
}
792790

793791
// Starts and cancels a watch for a Foo resource.
@@ -2438,9 +2436,7 @@ TEST_F(XdsClientTest, StreamClosedByServerWithoutSeeingResponse) {
24382436
}
24392437

24402438
TEST_F(XdsClientTest, ConnectionFails) {
2441-
// Lower resources-does-not-exist timeout, to make sure that we're not
2442-
// triggering that here.
2443-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(3));
2439+
InitXdsClient();
24442440
// Tell transport to let us manually trigger completion of the
24452441
// send_message ops to XdsClient.
24462442
transport_factory_->SetAutoCompleteMessagesFromClient(false);
@@ -2639,7 +2635,7 @@ TEST_F(XdsClientTest, ConnectionFailsWithCachedResource) {
26392635
}
26402636

26412637
TEST_F(XdsClientTest, ResourceDoesNotExistUponTimeout) {
2642-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(1));
2638+
InitXdsClient();
26432639
// Start a watch for "foo1".
26442640
auto watcher = StartFooWatch("foo1");
26452641
// Watcher should initially not see any resource reported.
@@ -2725,8 +2721,7 @@ TEST_F(XdsClientTest, ResourceDoesNotExistUponTimeout) {
27252721
}
27262722

27272723
TEST_F(XdsClientTest, ResourceDoesNotExistAfterStreamRestart) {
2728-
// Lower resources-does-not-exist timeout so test finishes faster.
2729-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(3));
2724+
InitXdsClient();
27302725
// Metrics should initially be empty.
27312726
EXPECT_THAT(metrics_reporter_->resource_updates_valid(),
27322727
::testing::ElementsAre());
@@ -2840,9 +2835,7 @@ TEST_F(XdsClientTest, ResourceDoesNotExistAfterStreamRestart) {
28402835
}
28412836

28422837
TEST_F(XdsClientTest, DoesNotExistTimerNotStartedUntilSendCompletes) {
2843-
// Lower resources-does-not-exist timeout, to make sure that we're not
2844-
// triggering that here.
2845-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(3));
2838+
InitXdsClient();
28462839
// Tell transport to let us manually trigger completion of the
28472840
// send_message ops to XdsClient.
28482841
transport_factory_->SetAutoCompleteMessagesFromClient(false);
@@ -2925,7 +2918,7 @@ TEST_F(XdsClientTest, DoesNotExistTimerNotStartedUntilSendCompletes) {
29252918
// update containing that resource.
29262919
TEST_F(XdsClientTest,
29272920
ResourceDoesNotExistUnsubscribeAndResubscribeWhileSendMessagePending) {
2928-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(1));
2921+
InitXdsClient();
29292922
// Tell transport to let us manually trigger completion of the
29302923
// send_message ops to XdsClient.
29312924
transport_factory_->SetAutoCompleteMessagesFromClient(false);
@@ -3074,9 +3067,7 @@ TEST_F(XdsClientTest,
30743067
}
30753068

30763069
TEST_F(XdsClientTest, DoNotSendDoesNotExistForCachedResource) {
3077-
// Lower resources-does-not-exist timeout, to make sure that we're not
3078-
// triggering that here.
3079-
InitXdsClient(FakeXdsBootstrap::Builder(), Duration::Seconds(3));
3070+
InitXdsClient();
30803071
// Start a watch for "foo1".
30813072
auto watcher = StartFooWatch("foo1");
30823073
// Watcher should initially not see any resource reported.
@@ -3358,7 +3349,48 @@ TEST_F(XdsClientTest, MultipleResourceTypes) {
33583349
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
33593350
/*version_info=*/"1", /*response_nonce=*/"A",
33603351
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
3361-
// Now cancel watch for "bar1".
3352+
// Server sends an empty response for the resource type.
3353+
// (The server doesn't need to do this, but it may.)
3354+
stream->SendMessageToClient(
3355+
ResponseBuilder(XdsFooResourceType::Get()->type_url())
3356+
.set_version_info("1")
3357+
.set_nonce("C")
3358+
.Serialize());
3359+
// Client should ACK.
3360+
request = WaitForRequest(stream.get());
3361+
ASSERT_TRUE(request.has_value());
3362+
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
3363+
/*version_info=*/"1", /*response_nonce=*/"C",
3364+
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
3365+
// Now subscribe to foo2.
3366+
watcher = StartFooWatch("foo2");
3367+
// Client sends a subscription request, which retains the nonce and
3368+
// version seen previously.
3369+
request = WaitForRequest(stream.get());
3370+
ASSERT_TRUE(request.has_value());
3371+
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
3372+
/*version_info=*/"1", /*response_nonce=*/"C",
3373+
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{"foo2"});
3374+
// Server sends foo2.
3375+
stream->SendMessageToClient(
3376+
ResponseBuilder(XdsFooResourceType::Get()->type_url())
3377+
.set_version_info("1")
3378+
.set_nonce("D")
3379+
.AddFooResource(XdsFooResource("foo2", 8))
3380+
.Serialize());
3381+
// Watcher receives the resource.
3382+
resource = watcher->WaitForNextResource();
3383+
ASSERT_NE(resource, nullptr);
3384+
EXPECT_EQ(resource->name, "foo2");
3385+
EXPECT_EQ(resource->value, 8);
3386+
// Client ACKs.
3387+
request = WaitForRequest(stream.get());
3388+
ASSERT_TRUE(request.has_value());
3389+
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
3390+
/*version_info=*/"1", /*response_nonce=*/"D",
3391+
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{"foo2"});
3392+
// Cancel watches.
3393+
CancelFooWatch(watcher.get(), "foo2", /*delay_unsubscription=*/true);
33623394
CancelBarWatch(watcher2.get(), "bar1");
33633395
EXPECT_TRUE(stream->IsOrphaned());
33643396
}

tools/internal_ci/linux/grpc_e2e_performance_gke.sh

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,25 @@ buildConfigs() {
120120
-o "loadtest_with_prebuilt_workers_${pool}.yaml"
121121
}
122122

123+
# Regex to disable specific tests.
124+
# https://stackoverflow.com/questions/406230
125+
disableTestsRegex() {
126+
if (($# == 0)); then
127+
echo '.*'
128+
return
129+
fi
130+
local s='^((?!'
131+
s+="$1"
132+
shift
133+
while (($# > 0)); do
134+
s+='|'
135+
s+="$1"
136+
shift
137+
done
138+
s+=').)*$'
139+
echo "${s}"
140+
}
141+
123142
# List all languages.
124143
declare -A useLanguage=(
125144
[c++]=1
@@ -190,8 +209,22 @@ if [[ -v "useLanguage[ruby]" ]]; then
190209
runnerLangArgs+=(-l "ruby:${GRPC_CORE_REPO}:${GRPC_CORE_COMMIT}")
191210
fi
192211

193-
buildConfigs "${WORKER_POOL_8CORE}" "${BIGQUERY_TABLE_8CORE}" "${configLangArgs8core[@]}"
194-
buildConfigs "${WORKER_POOL_32CORE}" "${BIGQUERY_TABLE_32CORE}" "${configLangArgs32core[@]}"
212+
# Disable broken tests by regex.
213+
# The test disabled here hangs on 8 cores. The result of this test is not
214+
# displayed on the public dashboard. The test runs and passes on the 30-core
215+
# ("32core") node pool. This can be considered a permanent fix, selectively
216+
# removing an unnecessary test and allowing the test run to become green.
217+
declare -a disabledTests8core=(
218+
cpp_protobuf_async_client_unary_1channel_64wide_128breq_8mbresp_insecure
219+
)
220+
declare -a disabledTests32core=()
221+
222+
# Arguments to disable tests.
223+
regexArgs8core=(-r "$(disabledTestsRegex "${disabledTests8core[@]}")")
224+
regexArgs32core=(-r "$(disabledTestsRegex "${disabledTests32core[@]}")")
225+
226+
buildConfigs "${WORKER_POOL_8CORE}" "${BIGQUERY_TABLE_8CORE}" "${configLangArgs8core[@]}" "${regexArgs8core[@]}"
227+
buildConfigs "${WORKER_POOL_32CORE}" "${BIGQUERY_TABLE_32CORE}" "${configLangArgs32core[@]}" "${regexArgs32core[@]}"
195228

196229
# Delete prebuilt images on exit.
197230
deleteImages() {

tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ buildConfigs() {
115115
-o "loadtest_with_prebuilt_workers_${pool}.yaml"
116116
}
117117

118+
# Regex to disable specific tests.
119+
# https://stackoverflow.com/questions/406230
120+
disableTestsRegex() {
121+
if (($# == 0)); then
122+
echo '.*'
123+
return
124+
fi
125+
local s='^((?!'
126+
s+="$1"
127+
shift
128+
while (($# > 0)); do
129+
s+='|'
130+
s+="$1"
131+
shift
132+
done
133+
s+=').)*$'
134+
echo "${s}"
135+
}
136+
118137
# List all languages.
119138
declare -A useLanguage=(
120139
[c++]=1
@@ -185,8 +204,22 @@ if [[ -v "useLanguage[ruby]" ]]; then
185204
runnerLangArgs+=(-l "ruby:${GRPC_CORE_REPO}:${GRPC_CORE_COMMIT}")
186205
fi
187206

188-
buildConfigs "${WORKER_POOL_8CORE}" "${BIGQUERY_TABLE_8CORE}" "${configLangArgs8core[@]}"
189-
buildConfigs "${WORKER_POOL_32CORE}" "${BIGQUERY_TABLE_32CORE}" "${configLangArgs32core[@]}"
207+
# Disable broken tests by regex.
208+
# The test disabled here hangs on 8 cores. The result of this test is not
209+
# displayed on the public dashboard. The test runs and passes on the 30-core
210+
# ("32core") node pool. This can be considered a permanent fix, selectively
211+
# removing an unnecessary test and allowing the test run to become green.
212+
declare -a disabledTests8core=(
213+
cpp_protobuf_async_client_unary_1channel_64wide_128breq_8mbresp_insecure
214+
)
215+
declare -a disabledTests32core=()
216+
217+
# Arguments to disable tests.
218+
regexArgs8core=(-r "$(disabledTestsRegex "${disabledTests8core[@]}")")
219+
regexArgs32core=(-r "$(disabledTestsRegex "${disabledTests32core[@]}")")
220+
221+
buildConfigs "${WORKER_POOL_8CORE}" "${BIGQUERY_TABLE_8CORE}" "${configLangArgs8core[@]}" "${regexArgs8core[@]}"
222+
buildConfigs "${WORKER_POOL_32CORE}" "${BIGQUERY_TABLE_32CORE}" "${configLangArgs32core[@]}" "${regexArgs32core[@]}"
190223

191224
# Delete prebuilt images on exit.
192225
deleteImages() {

0 commit comments

Comments
 (0)