Skip to content

Commit

Permalink
Merge remote-tracking branch 'grpc/master' into examples/flow_control
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneo committed Sep 23, 2024
2 parents 914b77a + 4a52db6 commit 5d751ea
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 106 deletions.
3 changes: 1 addition & 2 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/core/lib/experiments/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ bool IsTestExperimentEnabled(size_t experiment_id) {
return (*g_test_experiments)[experiment_id];
}

// This is VLOG(2) for Open Source gRPC because of a lot of log noise
// complaints. However, internally we want LOG(INFO) so that it is easier for us
// to debug prod issues.
#define GRPC_EXPERIMENT_LOG VLOG(2)

void PrintExperimentsList() {
Expand Down
32 changes: 0 additions & 32 deletions src/core/xds/grpc/xds_bootstrap_grpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include <stdlib.h>

#include <algorithm>
#include <set>
#include <string>
#include <utility>
#include <vector>
Expand All @@ -36,29 +34,14 @@
#include <grpc/support/json.h>
#include <grpc/support/port_platform.h>

#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/security/credentials/channel_creds_registry.h"
#include "src/core/util/json/json.h"
#include "src/core/util/json/json_object_loader.h"
#include "src/core/util/json/json_reader.h"
#include "src/core/util/json/json_writer.h"
#include "src/core/util/string.h"

namespace grpc_core {

namespace {
bool IsFallbackExperimentEnabled() {
auto fallback_enabled = GetEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK");
bool enabled = false;
return gpr_parse_bool_value(fallback_enabled.value_or("0").c_str(),
&enabled) &&
enabled;
}

} // namespace

//
// GrpcXdsBootstrap::GrpcNode::Locality
//
Expand Down Expand Up @@ -106,16 +89,6 @@ const JsonLoaderInterface* GrpcXdsBootstrap::GrpcAuthority::JsonLoader(
return loader;
}

void GrpcXdsBootstrap::GrpcAuthority::JsonPostLoad(
const Json& /*json*/, const JsonArgs& /*args*/,
ValidationErrors* /*errors*/) {
if (!IsFallbackExperimentEnabled()) {
if (servers_.size() > 1) {
servers_.resize(1);
}
}
}

//
// GrpcXdsBootstrap
//
Expand Down Expand Up @@ -190,11 +163,6 @@ void GrpcXdsBootstrap::JsonPostLoad(const Json& /*json*/,
}
}
}
if (!IsFallbackExperimentEnabled()) {
if (servers_.size() > 1) {
servers_.resize(1);
}
}
}

std::string GrpcXdsBootstrap::ToString() const {
Expand Down
5 changes: 0 additions & 5 deletions src/core/xds/grpc/xds_bootstrap_grpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>

Expand All @@ -29,9 +28,7 @@

#include <grpc/support/port_platform.h>

#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/security/credentials/channel_creds_registry.h"
#include "src/core/util/json/json.h"
#include "src/core/util/json/json_args.h"
#include "src/core/util/json/json_object_loader.h"
Expand Down Expand Up @@ -93,8 +90,6 @@ class GrpcXdsBootstrap final : public XdsBootstrap {
}

static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
void JsonPostLoad(const Json& json, const JsonArgs& args,
ValidationErrors* errors);

private:
std::vector<GrpcXdsServer> servers_;
Expand Down
1 change: 0 additions & 1 deletion test/core/xds/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ grpc_cc_test(
"//src/core:grpc_xds_client",
"//src/core:xds_server_grpc",
"//test/core/test_util:grpc_test_util",
"//test/core/test_util:scoped_env_var",
],
)

Expand Down
24 changes: 1 addition & 23 deletions test/core/xds/xds_bootstrap_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/security/certificate_provider/certificate_provider_factory.h"
#include "src/core/lib/security/credentials/channel_creds_registry.h"
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
#include "src/core/util/json/json.h"
#include "src/core/util/json/json_args.h"
#include "src/core/util/json/json_object_loader.h"
Expand All @@ -50,7 +49,6 @@
#include "src/core/xds/grpc/certificate_provider_store.h"
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
#include "src/core/xds/grpc/xds_server_grpc.h"
#include "test/core/test_util/scoped_env_var.h"
#include "test/core/test_util/test_config.h"

namespace grpc_core {
Expand Down Expand Up @@ -94,16 +92,6 @@ TEST(XdsBootstrapTest, Basic) {
" }"
" ],"
" \"ignore\": 0"
" },"
" {"
" \"server_uri\": \"fake:///lb2\","
" \"channel_creds\": ["
" {"
" \"type\": \"fake\","
" \"ignore\": 0"
" }"
" ],"
" \"ignore\": 0"
" }"
" ],"
" \"authorities\": {"
Expand All @@ -123,15 +111,6 @@ TEST(XdsBootstrapTest, Basic) {
" \"xds_v3\","
" \"ignore_resource_deletion\""
" ]"
" },"
" {"
" \"server_uri\": \"fake:///xds_server2\","
" \"channel_creds\": ["
" {"
" \"type\": \"fake\""
" }"
" ],"
" \"server_features\": [\"xds_v3\"]"
" }"
" ]"
" },"
Expand Down Expand Up @@ -744,8 +723,7 @@ TEST(XdsBootstrapTest, XdsServerToJsonAndParse) {
EXPECT_EQ(*xds_server, *output_xds_server);
}

TEST(XdsBootstrapTest, NoXdsServersEnvVar) {
ScopedEnvVar fallback_enabled("GRPC_EXPERIMENTAL_XDS_FALLBACK", "1");
TEST(XdsBootstrapTest, MultipleXdsServers) {
const char* json_str =
"{"
" \"xds_servers\": ["
Expand Down
40 changes: 0 additions & 40 deletions test/cpp/end2end/xds/xds_fallback_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include <iostream>
#include <memory>
#include <string>
#include <string_view>
Expand All @@ -29,18 +28,9 @@
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/status.h>

#include "src/core/client_channel/backup_poller.h"
#include "src/core/lib/config/config_vars.h"
#include "src/core/lib/gprpp/env.h"
#include "src/cpp/client/secure_credentials.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "src/proto/grpc/testing/echo_messages.pb.h"
#include "src/proto/grpc/testing/xds/v3/cluster.grpc.pb.h"
#include "src/proto/grpc/testing/xds/v3/endpoint.grpc.pb.h"
#include "src/proto/grpc/testing/xds/v3/http_connection_manager.grpc.pb.h"
#include "src/proto/grpc/testing/xds/v3/listener.grpc.pb.h"
#include "src/proto/grpc/testing/xds/v3/route.grpc.pb.h"
#include "test/core/test_util/resolve_localhost_ip46.h"
#include "test/core/test_util/scoped_env_var.h"
#include "test/core/test_util/test_config.h"
#include "test/cpp/end2end/xds/xds_end2end_test_lib.h"
Expand Down Expand Up @@ -123,8 +113,6 @@ class XdsFallbackTest : public XdsEnd2endTest {
};

TEST_P(XdsFallbackTest, FallbackAndRecover) {
grpc_core::testing::ScopedEnvVar fallback_enabled(
"GRPC_EXPERIMENTAL_XDS_FALLBACK", "1");
auto broken_balancer = CreateAndStartBalancer("Broken balancer");
broken_balancer->ads_service()->ForceADSFailure(
Status(StatusCode::RESOURCE_EXHAUSTED, kErrorMessage));
Expand All @@ -151,31 +139,7 @@ TEST_P(XdsFallbackTest, FallbackAndRecover) {
broken_balancer->Shutdown();
}

TEST_P(XdsFallbackTest, EnvVarNotSet) {
InitClient(XdsBootstrapBuilder().SetServers({
balancer_->target(),
fallback_balancer_->target(),
}));
// Primary xDS server has backends_[0] configured and fallback server has
// backends_[1]
CreateAndStartBackends(2);
SetXdsResourcesForServer(balancer_.get(), 0);
SetXdsResourcesForServer(fallback_balancer_.get(), 1);
balancer_->ads_service()->ForceADSFailure(
Status(StatusCode::RESOURCE_EXHAUSTED, kErrorMessage));
// Primary server down, failure should be reported
CheckRpcSendFailure(
DEBUG_LOCATION, StatusCode::UNAVAILABLE,
absl::StrFormat("server.example.com: UNAVAILABLE: xDS channel for server "
"localhost:%d: xDS call failed with no responses "
"received; status: RESOURCE_EXHAUSTED: test forced ADS "
"stream failure \\(node ID:xds_end2end_test\\)",
balancer_->port()));
}

TEST_P(XdsFallbackTest, PrimarySecondaryNotAvailable) {
grpc_core::testing::ScopedEnvVar fallback_enabled(
"GRPC_EXPERIMENTAL_XDS_FALLBACK", "1");
InitClient(XdsBootstrapBuilder().SetServers(
{balancer_->target(), fallback_balancer_->target()}));
balancer_->ads_service()->ForceADSFailure(
Expand All @@ -194,8 +158,6 @@ TEST_P(XdsFallbackTest, PrimarySecondaryNotAvailable) {

TEST_P(XdsFallbackTest, UsesCachedResourcesAfterFailure) {
constexpr absl::string_view kServerName2 = "server2.example.com";
grpc_core::testing::ScopedEnvVar fallback_enabled(
"GRPC_EXPERIMENTAL_XDS_FALLBACK", "1");
InitClient(XdsBootstrapBuilder().SetServers(
{balancer_->target(), fallback_balancer_->target()}));
// 4 backends - cross product of two data plane targets and two balancers
Expand Down Expand Up @@ -223,8 +185,6 @@ TEST_P(XdsFallbackTest, PerAuthorityFallback) {
// Use cleanup in case test assertion fails
auto balancer2_cleanup =
absl::MakeCleanup([&]() { fallback_balancer2->Shutdown(); });
grpc_core::testing::ScopedEnvVar fallback_enabled(
"GRPC_EXPERIMENTAL_XDS_FALLBACK", "1");
grpc_core::testing::ScopedExperimentalEnvVar env_var(
"GRPC_EXPERIMENTAL_XDS_FEDERATION");
const char* kAuthority1 = "xds1.example.com";
Expand Down

0 comments on commit 5d751ea

Please sign in to comment.