From 92ab8e83144809ca8282b83477c76f2a8f646653 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 8 Oct 2018 15:39:57 -0700 Subject: Bump version to v1.16.0-pre1 --- BUILD | 4 ++-- build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index 5c8d085934..8deb0a8817 100644 --- a/BUILD +++ b/BUILD @@ -66,9 +66,9 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "gao" -core_version = "6.0.0-dev" +core_version = "6.0.0-pre1" -version = "1.16.0-dev" +version = "1.16.0-pre1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 6f81bf7afc..dcb28c5ead 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 6.0.0-dev + core_version: 6.0.0-pre1 g_stands_for: gao - version: 1.16.0-dev + version: 1.16.0-pre1 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From cda4e7d1df8ff78c733777a1fcf0bec3bc561eda Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 8 Oct 2018 16:02:27 -0700 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 6 +++--- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 4 ++-- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 31 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66799c456f..e55aef8637 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.16.0-dev") +set(PACKAGE_VERSION "1.16.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 1c61664fcc..f4be70d4be 100644 --- a/Makefile +++ b/Makefile @@ -437,9 +437,9 @@ E = @echo Q = @ endif -CORE_VERSION = 6.0.0-dev -CPP_VERSION = 1.16.0-dev -CSHARP_VERSION = 1.16.0-dev +CORE_VERSION = 6.0.0-pre1 +CPP_VERSION = 1.16.0-pre1 +CSHARP_VERSION = 1.16.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index f2d9a814c3..2227f82ff2 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.16.0-dev' + # version = '1.16.0-pre1' version = '0.0.3' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.16.0-dev' + grpc_version = '1.16.0-pre1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d575ca666a..e47acd8c3e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.16.0-dev' + version = '1.16.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 75fd592e75..1c3bbe218f 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.16.0-dev' + version = '1.16.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index ecd786e7b3..58cea85e9f 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.16.0-dev' + version = '1.16.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 9164b2169a..695e7ea794 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.16.0-dev' + version = '1.16.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 586bab004f..6f2a2199f7 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.16.0dev - 1.16.0dev + 1.16.0RC1 + 1.16.0RC1 beta diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index a44f9acdc3..f2f9f2122b 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -23,6 +23,6 @@ #include -const char* grpc_version_string(void) { return "6.0.0-dev"; } +const char* grpc_version_string(void) { return "6.0.0-pre1"; } const char* grpc_g_stands_for(void) { return "gao"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index cc797f1546..c67ce1b73f 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.16.0-dev"; } +grpc::string Version() { return "1.16.0-pre1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 18515ea1e8..30eb70fcb6 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.16.0-dev + 1.16.0-pre1 3.6.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 55d09dda7a..c4dbed0896 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.16.0-dev"; + public const string CurrentVersion = "1.16.0-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 24d016104c..b40a6e238f 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0-dev +set VERSION=1.16.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 4e7ac4e414..ac82b00dae 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0-dev +set VERSION=1.16.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 200cee5b7b..e42c1c0ce2 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.16.0-dev' + v = '1.16.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 38862e102a..db439de53d 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.16.0-pre1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 82833102ad..824c505e13 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0-dev" -#define GRPC_C_VERSION_STRING @"6.0.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.16.0-pre1" +#define GRPC_C_VERSION_STRING @"6.0.0-pre1" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 469a48e782..924c0f6e15 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.16.0dev" +#define PHP_GRPC_VERSION "1.16.0RC1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 24e1557578..cc628a899e 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.16.0.dev0""" +__version__ = """1.16.0rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 6ffe1eb827..191cefabfd 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index e080bf2cbc..1d24fc32ea 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 4b3b95fee9..f9e1b2aba9 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index c12aa153a4..ba3c7ed63d 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index f4b8a34a46..ea853ad60d 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 0c3e1ef734..d180d1f3d3 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.16.0.dev' + VERSION = '1.16.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 03d977c064..605a031df1 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.16.0.dev' + VERSION = '1.16.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 581dab3b4e..e1536c5067 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.16.0.dev0' +VERSION = '1.16.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 97599be443..251d0db0e9 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0-dev +PROJECT_NUMBER = 1.16.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c852b29fce..b72e8192e6 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0-dev +PROJECT_NUMBER = 1.16.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 0c2569d0d8..d879f9d05f 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-dev +PROJECT_NUMBER = 6.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index d9ab712301..e702bc66df 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-dev +PROJECT_NUMBER = 6.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From f16e7966d3e33472c9337217e228a7a7a6d7f8f2 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 22 Oct 2018 15:17:05 -0700 Subject: Bump version to 1.16.0 --- BUILD | 4 ++-- build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index 8deb0a8817..4faf8b13ea 100644 --- a/BUILD +++ b/BUILD @@ -66,9 +66,9 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "gao" -core_version = "6.0.0-pre1" +core_version = "6.0.0" -version = "1.16.0-pre1" +version = "1.16.0" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index dcb28c5ead..4d8ea44a3b 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 6.0.0-pre1 + core_version: 6.0.0 g_stands_for: gao - version: 1.16.0-pre1 + version: 1.16.0 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From 3dd82ec3c276b6c0fd57f893a827296d49a1bc58 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 22 Oct 2018 15:18:07 -0700 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 6 +++--- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 4 ++-- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 31 files changed, 38 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e55aef8637..ab1802ef5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.16.0-pre1") +set(PACKAGE_VERSION "1.16.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index f4be70d4be..ab7c440fb8 100644 --- a/Makefile +++ b/Makefile @@ -437,9 +437,9 @@ E = @echo Q = @ endif -CORE_VERSION = 6.0.0-pre1 -CPP_VERSION = 1.16.0-pre1 -CSHARP_VERSION = 1.16.0-pre1 +CORE_VERSION = 6.0.0 +CPP_VERSION = 1.16.0 +CSHARP_VERSION = 1.16.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 2227f82ff2..5b8e4cf81f 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.16.0-pre1' + # version = '1.16.0' version = '0.0.3' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.16.0-pre1' + grpc_version = '1.16.0' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index e47acd8c3e..af7e1e63f3 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.16.0-pre1' + version = '1.16.0' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 1c3bbe218f..5a0cf53c47 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.16.0-pre1' + version = '1.16.0' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 58cea85e9f..3d18440ce6 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.16.0-pre1' + version = '1.16.0' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 695e7ea794..58b0e45bf8 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.16.0-pre1' + version = '1.16.0' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 6f2a2199f7..d1624a440b 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.16.0RC1 - 1.16.0RC1 + 1.16.0 + 1.16.0 - beta - beta + stable + stable Apache 2.0 diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index f2f9f2122b..50e38df3ad 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -23,6 +23,6 @@ #include -const char* grpc_version_string(void) { return "6.0.0-pre1"; } +const char* grpc_version_string(void) { return "6.0.0"; } const char* grpc_g_stands_for(void) { return "gao"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index c67ce1b73f..2ddbf77d47 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.16.0-pre1"; } +grpc::string Version() { return "1.16.0"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 30eb70fcb6..88ffa6fa30 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.16.0-pre1 + 1.16.0 3.6.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index c4dbed0896..f8b7c1b58c 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.16.0-pre1"; + public const string CurrentVersion = "1.16.0"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index b40a6e238f..9064b71a98 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0-pre1 +set VERSION=1.16.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index ac82b00dae..c6eaeed392 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0-pre1 +set VERSION=1.16.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index e42c1c0ce2..7d45a5e872 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.16.0-pre1' + v = '1.16.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index db439de53d..fcdd492303 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.16.0" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 824c505e13..38a8211ea5 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0-pre1" -#define GRPC_C_VERSION_STRING @"6.0.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.16.0" +#define GRPC_C_VERSION_STRING @"6.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 924c0f6e15..0dc00a2393 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.16.0RC1" +#define PHP_GRPC_VERSION "1.16.0" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index cc628a899e..149136ee86 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.16.0rc1""" +__version__ = """1.16.0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 191cefabfd..c3010a2935 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 1d24fc32ea..f9e500a87e 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index f9e1b2aba9..395f544d62 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index ba3c7ed63d..2725422e29 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index ea853ad60d..a5f87c8519 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index d180d1f3d3..8e4e8a5736 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.16.0.pre1' + VERSION = '1.16.0' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 605a031df1..c694b8866f 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.16.0.pre1' + VERSION = '1.16.0' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index e1536c5067..f1ea4ac0ca 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.16.0rc1' +VERSION = '1.16.0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 251d0db0e9..0e9e39e6b4 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0-pre1 +PROJECT_NUMBER = 1.16.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index b72e8192e6..a49e09bc73 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0-pre1 +PROJECT_NUMBER = 1.16.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index d879f9d05f..44594769ab 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-pre1 +PROJECT_NUMBER = 6.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e702bc66df..00bfea9452 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-pre1 +PROJECT_NUMBER = 6.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From 7820b8d088687b5efc1a6b0be3fc62e3ccdbcaf4 Mon Sep 17 00:00:00 2001 From: Clemens Gruber Date: Thu, 11 Oct 2018 17:56:58 +0200 Subject: Fix invalid version .so links in Makefile --- templates/Makefile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Makefile.template b/templates/Makefile.template index 0b67416d3e..8bb06176bf 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -1370,7 +1370,7 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]})-dll.a $(prefix)/lib/lib${lib.name}.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major} + $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so endif % endif -- cgit v1.2.3 From 3a0faa4565dfaee059517b6b3a158d76daedba73 Mon Sep 17 00:00:00 2001 From: Clemens Gruber Date: Thu, 25 Oct 2018 16:42:36 +0200 Subject: Regenerate projects --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d0a3f86383..4a66cf9dbe 100644 --- a/Makefile +++ b/Makefile @@ -3054,7 +3054,7 @@ install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-con ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3063,7 +3063,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_cronet.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3072,7 +3072,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_error_details.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3081,7 +3081,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_reflection.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3090,7 +3090,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_unsecure.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3099,7 +3099,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpcpp_channelz$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpcpp_channelz.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpcpp_channelz.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpcpp_channelz.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpcpp_channelz.so endif ifneq ($(SYSTEM),MINGW32) @@ -3116,7 +3116,7 @@ install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so endif ifneq ($(SYSTEM),MINGW32) -- cgit v1.2.3 From 1ef01a1c2905c409287e6dedb5cdfef07e4cdb0e Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 17:51:15 -0700 Subject: Add failing unit test --- src/python/grpcio_tests/tests/unit/BUILD.bazel | 1 + .../grpcio_tests/tests/unit/_logging_test.py | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/python/grpcio_tests/tests/unit/_logging_test.py diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index dcd6d9fbb2..de33b81e32 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -17,6 +17,7 @@ GRPCIO_TESTS_UNIT = [ "_interceptor_test.py", "_invalid_metadata_test.py", "_invocation_defects_test.py", + "_logging_test.py", "_metadata_code_details_test.py", "_metadata_test.py", # TODO: Issue 16336 diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py new file mode 100644 index 0000000000..263a967025 --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -0,0 +1,26 @@ +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Test of gRPC Python's interaction with the python logging module""" + +import unittest +import six +import grpc +import logging + +class LoggingTest(unittest.TestCase): + def test_logger_not_occupied(self): + self.assertEqual(0, len(logging.getLogger().handlers)) + +if __name__ == '__main__': + unittest.main(verbosity=2) -- cgit v1.2.3 From 3990ff1dcfb25670781fc1e113a2a9779af343a1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 17:53:50 -0700 Subject: Revert "Configure module level loggers with basicConfig()" This reverts commit a20e2073c1c53cbdd81a4fb750982a0b13e0c24e. --- src/python/grpcio/grpc/_channel.py | 1 - src/python/grpcio/grpc/_common.py | 1 - src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi | 1 - src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 1 - src/python/grpcio/grpc/_plugin_wrapping.py | 1 - src/python/grpcio/grpc/_server.py | 1 - src/python/grpcio/grpc/framework/foundation/callable_util.py | 1 - src/python/grpcio/grpc/framework/foundation/logging_pool.py | 1 - src/python/grpcio/grpc/framework/foundation/stream_util.py | 1 - src/python/grpcio_testing/grpc_testing/_channel/_invocation.py | 1 - src/python/grpcio_testing/grpc_testing/_server/_rpc.py | 1 - src/python/grpcio_testing/grpc_testing/_time.py | 1 - src/python/grpcio_tests/tests/interop/server.py | 1 - 13 files changed, 13 deletions(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 3494c9b15a..6876601785 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -24,7 +24,6 @@ from grpc import _grpcio_metadata from grpc._cython import cygrpc from grpc.framework.foundation import callable_util -logging.basicConfig() _LOGGER = logging.getLogger(__name__) _USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__) diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index 3805c7e82a..8358cbec5b 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -20,7 +20,6 @@ import six import grpc from grpc._cython import cygrpc -logging.basicConfig() _LOGGER = logging.getLogger(__name__) CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = { diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi index 334e561baa..00a1b23a67 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi @@ -14,7 +14,6 @@ import logging -logging.basicConfig() _LOGGER = logging.getLogger(__name__) # This function will ascii encode unicode string inputs if neccesary. diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 5779437b92..ce701724fd 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -18,7 +18,6 @@ import logging import time import grpc -logging.basicConfig() _LOGGER = logging.getLogger(__name__) cdef class Server: diff --git a/src/python/grpcio/grpc/_plugin_wrapping.py b/src/python/grpcio/grpc/_plugin_wrapping.py index 88ab4d8371..916ee080b6 100644 --- a/src/python/grpcio/grpc/_plugin_wrapping.py +++ b/src/python/grpcio/grpc/_plugin_wrapping.py @@ -20,7 +20,6 @@ import grpc from grpc import _common from grpc._cython import cygrpc -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index daa000a6e1..7276a7fd90 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -27,7 +27,6 @@ from grpc import _interceptor from grpc._cython import cygrpc from grpc.framework.foundation import callable_util -logging.basicConfig() _LOGGER = logging.getLogger(__name__) _SHUTDOWN_TAG = 'shutdown' diff --git a/src/python/grpcio/grpc/framework/foundation/callable_util.py b/src/python/grpcio/grpc/framework/foundation/callable_util.py index fb8d5f7c1e..24daf3406f 100644 --- a/src/python/grpcio/grpc/framework/foundation/callable_util.py +++ b/src/python/grpcio/grpc/framework/foundation/callable_util.py @@ -21,7 +21,6 @@ import logging import six -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/src/python/grpcio/grpc/framework/foundation/logging_pool.py index 7702d1785f..216e3990db 100644 --- a/src/python/grpcio/grpc/framework/foundation/logging_pool.py +++ b/src/python/grpcio/grpc/framework/foundation/logging_pool.py @@ -17,7 +17,6 @@ import logging from concurrent import futures -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py index 9184f95873..1faaf29bd7 100644 --- a/src/python/grpcio/grpc/framework/foundation/stream_util.py +++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py @@ -19,7 +19,6 @@ import threading from grpc.framework.foundation import stream _NO_VALUE = object() -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py index d7205ca579..191b1c1726 100644 --- a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py +++ b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py @@ -18,7 +18,6 @@ import threading import grpc _NOT_YET_OBSERVED = object() -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py index 736b714dc6..b856da100f 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py @@ -18,7 +18,6 @@ import threading import grpc from grpc_testing import _common -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_testing/grpc_testing/_time.py b/src/python/grpcio_testing/grpc_testing/_time.py index 9692c34e6f..75e6db3458 100644 --- a/src/python/grpcio_testing/grpc_testing/_time.py +++ b/src/python/grpcio_testing/grpc_testing/_time.py @@ -21,7 +21,6 @@ import time as _time import grpc import grpc_testing -logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_tests/tests/interop/server.py b/src/python/grpcio_tests/tests/interop/server.py index 768cdaf468..fd28d498a1 100644 --- a/src/python/grpcio_tests/tests/interop/server.py +++ b/src/python/grpcio_tests/tests/interop/server.py @@ -25,7 +25,6 @@ from tests.interop import methods from tests.interop import resources from tests.unit import test_common -logging.basicConfig() _ONE_DAY_IN_SECONDS = 60 * 60 * 24 _LOGGER = logging.getLogger(__name__) -- cgit v1.2.3 From e57c10d9f0efb2e20bdfccefe881e856aab9032d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 18:16:53 -0700 Subject: Add NullHandler to avoid warnings about no handler --- src/python/grpcio/grpc/_channel.py | 1 + src/python/grpcio/grpc/_common.py | 1 + src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi | 1 + src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 1 + src/python/grpcio/grpc/_plugin_wrapping.py | 1 + src/python/grpcio/grpc/framework/foundation/callable_util.py | 1 + src/python/grpcio/grpc/framework/foundation/logging_pool.py | 1 + src/python/grpcio/grpc/framework/foundation/stream_util.py | 1 + src/python/grpcio_tests/tests/unit/_logging_test.py | 1 + 9 files changed, 9 insertions(+) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 6876601785..f5e882921e 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -25,6 +25,7 @@ from grpc._cython import cygrpc from grpc.framework.foundation import callable_util _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler) _USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__) diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index 8358cbec5b..d35f4566bd 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -21,6 +21,7 @@ import grpc from grpc._cython import cygrpc _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = { cygrpc.ConnectivityState.idle: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi index 00a1b23a67..fa356d913e 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi @@ -15,6 +15,7 @@ import logging _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) # This function will ascii encode unicode string inputs if neccesary. # In Python3, unicode strings are the default str type. diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index ce701724fd..f9d1e863ca 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -19,6 +19,7 @@ import time import grpc _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) cdef class Server: diff --git a/src/python/grpcio/grpc/_plugin_wrapping.py b/src/python/grpcio/grpc/_plugin_wrapping.py index 916ee080b6..53af2ff913 100644 --- a/src/python/grpcio/grpc/_plugin_wrapping.py +++ b/src/python/grpcio/grpc/_plugin_wrapping.py @@ -21,6 +21,7 @@ from grpc import _common from grpc._cython import cygrpc _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) class _AuthMetadataContext( diff --git a/src/python/grpcio/grpc/framework/foundation/callable_util.py b/src/python/grpcio/grpc/framework/foundation/callable_util.py index 24daf3406f..36066e19df 100644 --- a/src/python/grpcio/grpc/framework/foundation/callable_util.py +++ b/src/python/grpcio/grpc/framework/foundation/callable_util.py @@ -22,6 +22,7 @@ import logging import six _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) class Outcome(six.with_metaclass(abc.ABCMeta)): diff --git a/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/src/python/grpcio/grpc/framework/foundation/logging_pool.py index 216e3990db..dfb8dbdc30 100644 --- a/src/python/grpcio/grpc/framework/foundation/logging_pool.py +++ b/src/python/grpcio/grpc/framework/foundation/logging_pool.py @@ -18,6 +18,7 @@ import logging from concurrent import futures _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(logging.NullHandler()) def _wrap(behavior): diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py index 1faaf29bd7..df8c93d3e5 100644 --- a/src/python/grpcio/grpc/framework/foundation/stream_util.py +++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py @@ -20,6 +20,7 @@ from grpc.framework.foundation import stream _NO_VALUE = object() _LOGGER = logging.getLogger(__name__) +_LOGGER.addHandler(NullHandler()) class TransformingConsumer(stream.Consumer): diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index 263a967025..dcafd38878 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -19,6 +19,7 @@ import grpc import logging class LoggingTest(unittest.TestCase): + def test_logger_not_occupied(self): self.assertEqual(0, len(logging.getLogger().handlers)) -- cgit v1.2.3 From 619f7e767b64ac4db051d18d2af15040c26aeace Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 18:43:18 -0700 Subject: Add basicConfig handler to unit tests --- src/python/grpcio_tests/tests/unit/_api_test.py | 1 + src/python/grpcio_tests/tests/unit/_auth_context_test.py | 1 + src/python/grpcio_tests/tests/unit/_auth_test.py | 1 + src/python/grpcio_tests/tests/unit/_channel_args_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_channel_close_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_compression_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_credentials_test.py | 3 +++ src/python/grpcio_tests/tests/unit/_empty_message_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_exit_scenarios.py | 2 ++ src/python/grpcio_tests/tests/unit/_exit_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_interceptor_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_invocation_defects_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_metadata_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_reconnect_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_resource_exhausted_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_rpc_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_server_test.py | 2 ++ src/python/grpcio_tests/tests/unit/_session_cache_test.py | 2 ++ 23 files changed, 44 insertions(+) diff --git a/src/python/grpcio_tests/tests/unit/_api_test.py b/src/python/grpcio_tests/tests/unit/_api_test.py index f6245be77d..5dfb8b2b54 100644 --- a/src/python/grpcio_tests/tests/unit/_api_test.py +++ b/src/python/grpcio_tests/tests/unit/_api_test.py @@ -102,4 +102,5 @@ class ChannelTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_auth_context_test.py b/src/python/grpcio_tests/tests/unit/_auth_context_test.py index d174051070..67f222d4b1 100644 --- a/src/python/grpcio_tests/tests/unit/_auth_context_test.py +++ b/src/python/grpcio_tests/tests/unit/_auth_context_test.py @@ -187,4 +187,5 @@ class AuthContextTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_auth_test.py b/src/python/grpcio_tests/tests/unit/_auth_test.py index e2cb938936..e125e77541 100644 --- a/src/python/grpcio_tests/tests/unit/_auth_test.py +++ b/src/python/grpcio_tests/tests/unit/_auth_test.py @@ -77,4 +77,5 @@ class AccessTokenAuthMetadataPluginTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_channel_args_test.py b/src/python/grpcio_tests/tests/unit/_channel_args_test.py index 869c2f4d2f..0f5e49cbd5 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_args_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_args_test.py @@ -15,6 +15,7 @@ from concurrent import futures import unittest +import logging import grpc @@ -46,4 +47,5 @@ class ChannelArgsTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_channel_close_test.py b/src/python/grpcio_tests/tests/unit/_channel_close_test.py index af3a9ee1ee..82fa165710 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_close_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_close_test.py @@ -13,6 +13,7 @@ # limitations under the License. """Tests server and client side compression.""" +import logging import threading import time import unittest @@ -182,4 +183,5 @@ class ChannelCloseTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py b/src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py index f9eb0011dc..727fb7d65f 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py @@ -13,6 +13,7 @@ # limitations under the License. """Tests of grpc._channel.Channel connectivity.""" +import logging import threading import time import unittest @@ -142,4 +143,5 @@ class ChannelConnectivityTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py b/src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py index 30b486079c..345460ef40 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py @@ -15,6 +15,7 @@ import threading import unittest +import logging import grpc from tests.unit.framework.common import test_constants @@ -85,4 +86,5 @@ class ChannelReadyFutureTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_compression_test.py b/src/python/grpcio_tests/tests/unit/_compression_test.py index 0b11f03adf..876d8e827e 100644 --- a/src/python/grpcio_tests/tests/unit/_compression_test.py +++ b/src/python/grpcio_tests/tests/unit/_compression_test.py @@ -15,6 +15,7 @@ import unittest +import logging import grpc from grpc import _grpcio_metadata @@ -117,4 +118,5 @@ class CompressionTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_credentials_test.py b/src/python/grpcio_tests/tests/unit/_credentials_test.py index f487fe66a2..4ba40e2e8a 100644 --- a/src/python/grpcio_tests/tests/unit/_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_credentials_test.py @@ -13,7 +13,9 @@ # limitations under the License. """Tests of credentials.""" + import unittest +import logging import grpc @@ -54,4 +56,5 @@ class CredentialsTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_empty_message_test.py b/src/python/grpcio_tests/tests/unit/_empty_message_test.py index c55ef61c13..3e8393b53c 100644 --- a/src/python/grpcio_tests/tests/unit/_empty_message_test.py +++ b/src/python/grpcio_tests/tests/unit/_empty_message_test.py @@ -13,6 +13,7 @@ # limitations under the License. import unittest +import logging import grpc @@ -118,4 +119,5 @@ class EmptyMessageTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_exit_scenarios.py b/src/python/grpcio_tests/tests/unit/_exit_scenarios.py index 0a0239a63d..f489db12cb 100644 --- a/src/python/grpcio_tests/tests/unit/_exit_scenarios.py +++ b/src/python/grpcio_tests/tests/unit/_exit_scenarios.py @@ -16,6 +16,7 @@ import argparse import threading import time +import logging import grpc @@ -161,6 +162,7 @@ def infinite_request_iterator(): if __name__ == '__main__': + logging.basicConfig() parser = argparse.ArgumentParser() parser.add_argument('scenario', type=str) parser.add_argument( diff --git a/src/python/grpcio_tests/tests/unit/_exit_test.py b/src/python/grpcio_tests/tests/unit/_exit_test.py index f40f3ae07c..5226537579 100644 --- a/src/python/grpcio_tests/tests/unit/_exit_test.py +++ b/src/python/grpcio_tests/tests/unit/_exit_test.py @@ -26,6 +26,7 @@ import sys import threading import time import unittest +import logging from tests.unit import _exit_scenarios @@ -187,4 +188,5 @@ class ExitTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_interceptor_test.py b/src/python/grpcio_tests/tests/unit/_interceptor_test.py index 3d547b71cd..99db0ac58b 100644 --- a/src/python/grpcio_tests/tests/unit/_interceptor_test.py +++ b/src/python/grpcio_tests/tests/unit/_interceptor_test.py @@ -17,6 +17,7 @@ import collections import itertools import threading import unittest +import logging from concurrent import futures import grpc @@ -598,4 +599,5 @@ class InterceptorTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py b/src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py index f153089a24..9771764635 100644 --- a/src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py +++ b/src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py @@ -14,6 +14,7 @@ """Test of RPCs made against gRPC Python's application-layer API.""" import unittest +import logging import grpc @@ -131,4 +132,5 @@ class InvalidMetadataTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_invocation_defects_test.py b/src/python/grpcio_tests/tests/unit/_invocation_defects_test.py index 93a5fdf9ff..00949e2236 100644 --- a/src/python/grpcio_tests/tests/unit/_invocation_defects_test.py +++ b/src/python/grpcio_tests/tests/unit/_invocation_defects_test.py @@ -15,6 +15,7 @@ import itertools import threading import unittest +import logging import grpc @@ -271,4 +272,5 @@ class InvocationDefectsTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py b/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py index ca10bd4dab..0dafab827a 100644 --- a/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py +++ b/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py @@ -15,6 +15,7 @@ import threading import unittest +import logging import grpc @@ -656,4 +657,5 @@ class MetadataCodeDetailsTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_metadata_test.py b/src/python/grpcio_tests/tests/unit/_metadata_test.py index 5908421011..777ab683e3 100644 --- a/src/python/grpcio_tests/tests/unit/_metadata_test.py +++ b/src/python/grpcio_tests/tests/unit/_metadata_test.py @@ -15,6 +15,7 @@ import unittest import weakref +import logging import grpc from grpc import _channel @@ -237,4 +238,5 @@ class MetadataTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_reconnect_test.py b/src/python/grpcio_tests/tests/unit/_reconnect_test.py index a708d8d862..f6d4fcbd0a 100644 --- a/src/python/grpcio_tests/tests/unit/_reconnect_test.py +++ b/src/python/grpcio_tests/tests/unit/_reconnect_test.py @@ -15,6 +15,7 @@ import socket import time +import logging import unittest import grpc @@ -100,4 +101,5 @@ class ReconnectTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_resource_exhausted_test.py b/src/python/grpcio_tests/tests/unit/_resource_exhausted_test.py index df4b129018..4fead8fcd5 100644 --- a/src/python/grpcio_tests/tests/unit/_resource_exhausted_test.py +++ b/src/python/grpcio_tests/tests/unit/_resource_exhausted_test.py @@ -15,6 +15,7 @@ import threading import unittest +import logging import grpc from grpc import _channel @@ -253,4 +254,5 @@ class ResourceExhaustedTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_rpc_test.py b/src/python/grpcio_tests/tests/unit/_rpc_test.py index 34e7831a98..a768d6c7c1 100644 --- a/src/python/grpcio_tests/tests/unit/_rpc_test.py +++ b/src/python/grpcio_tests/tests/unit/_rpc_test.py @@ -16,6 +16,7 @@ import itertools import threading import unittest +import logging from concurrent import futures import grpc @@ -846,4 +847,5 @@ class RPCTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py b/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py index 0d78034b7b..e733a59a5b 100644 --- a/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py @@ -35,6 +35,7 @@ import os import six import threading import unittest +import logging from concurrent import futures @@ -518,4 +519,5 @@ class ServerSSLCertReloadTestCertConfigReuse(_ServerSSLCertReloadTest): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_server_test.py b/src/python/grpcio_tests/tests/unit/_server_test.py index acf4a17921..47c32413dd 100644 --- a/src/python/grpcio_tests/tests/unit/_server_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_test.py @@ -14,6 +14,7 @@ from concurrent import futures import unittest +import logging import grpc @@ -49,4 +50,5 @@ class ServerTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_session_cache_test.py b/src/python/grpcio_tests/tests/unit/_session_cache_test.py index b4e4670fa7..9223a6da03 100644 --- a/src/python/grpcio_tests/tests/unit/_session_cache_test.py +++ b/src/python/grpcio_tests/tests/unit/_session_cache_test.py @@ -15,6 +15,7 @@ import pickle import unittest +import logging import grpc from grpc import _channel @@ -142,4 +143,5 @@ class SSLSessionCacheTest(unittest.TestCase): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) -- cgit v1.2.3 From 61011a3af466dd513bf964eda9cd4ecf8e15bd51 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 18:44:06 -0700 Subject: Add basicConfig handler to grpcio_testing --- src/python/grpcio_testing/grpc_testing/_channel/_invocation.py | 1 + src/python/grpcio_testing/grpc_testing/_server/_rpc.py | 2 +- src/python/grpcio_testing/grpc_testing/_time.py | 1 + src/python/grpcio_tests/tests/interop/server.py | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py index 191b1c1726..d7205ca579 100644 --- a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py +++ b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py @@ -18,6 +18,7 @@ import threading import grpc _NOT_YET_OBSERVED = object() +logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py index b856da100f..d713eb92c0 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py @@ -18,9 +18,9 @@ import threading import grpc from grpc_testing import _common +logging.basicConfig() _LOGGER = logging.getLogger(__name__) - class Rpc(object): def __init__(self, handler, invocation_metadata): diff --git a/src/python/grpcio_testing/grpc_testing/_time.py b/src/python/grpcio_testing/grpc_testing/_time.py index 75e6db3458..9692c34e6f 100644 --- a/src/python/grpcio_testing/grpc_testing/_time.py +++ b/src/python/grpcio_testing/grpc_testing/_time.py @@ -21,6 +21,7 @@ import time as _time import grpc import grpc_testing +logging.basicConfig() _LOGGER = logging.getLogger(__name__) diff --git a/src/python/grpcio_tests/tests/interop/server.py b/src/python/grpcio_tests/tests/interop/server.py index fd28d498a1..72f88a1c98 100644 --- a/src/python/grpcio_tests/tests/interop/server.py +++ b/src/python/grpcio_tests/tests/interop/server.py @@ -26,6 +26,7 @@ from tests.interop import resources from tests.unit import test_common _ONE_DAY_IN_SECONDS = 60 * 60 * 24 +logging.basicConfig() _LOGGER = logging.getLogger(__name__) -- cgit v1.2.3 From 916681911d0a5ab71a9ddfb441cfe9d3500150bf Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 30 Oct 2018 18:53:00 -0700 Subject: Fix various mind-numbing typos --- src/python/grpcio/grpc/_channel.py | 2 +- src/python/grpcio/grpc/framework/foundation/stream_util.py | 2 +- src/python/grpcio_tests/tests/unit/_api_test.py | 1 + src/python/grpcio_tests/tests/unit/_auth_context_test.py | 1 + src/python/grpcio_tests/tests/unit/_auth_test.py | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index f5e882921e..5d66cd2ac0 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -25,7 +25,7 @@ from grpc._cython import cygrpc from grpc.framework.foundation import callable_util _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler) +_LOGGER.addHandler(logging.NullHandler()) _USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__) diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py index df8c93d3e5..e03130cced 100644 --- a/src/python/grpcio/grpc/framework/foundation/stream_util.py +++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py @@ -20,7 +20,7 @@ from grpc.framework.foundation import stream _NO_VALUE = object() _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(NullHandler()) +_LOGGER.addHandler(logging.NullHandler()) class TransformingConsumer(stream.Consumer): diff --git a/src/python/grpcio_tests/tests/unit/_api_test.py b/src/python/grpcio_tests/tests/unit/_api_test.py index 5dfb8b2b54..38072861a4 100644 --- a/src/python/grpcio_tests/tests/unit/_api_test.py +++ b/src/python/grpcio_tests/tests/unit/_api_test.py @@ -14,6 +14,7 @@ """Test of gRPC Python's application-layer API.""" import unittest +import logging import six diff --git a/src/python/grpcio_tests/tests/unit/_auth_context_test.py b/src/python/grpcio_tests/tests/unit/_auth_context_test.py index 67f222d4b1..b1b5bbdcab 100644 --- a/src/python/grpcio_tests/tests/unit/_auth_context_test.py +++ b/src/python/grpcio_tests/tests/unit/_auth_context_test.py @@ -15,6 +15,7 @@ import pickle import unittest +import logging import grpc from grpc import _channel diff --git a/src/python/grpcio_tests/tests/unit/_auth_test.py b/src/python/grpcio_tests/tests/unit/_auth_test.py index e125e77541..d9df2add4f 100644 --- a/src/python/grpcio_tests/tests/unit/_auth_test.py +++ b/src/python/grpcio_tests/tests/unit/_auth_test.py @@ -16,6 +16,7 @@ import collections import threading import unittest +import logging from grpc import _auth -- cgit v1.2.3 From 7c3c8323cdd14ac2746fe89bde78c2a814a7d587 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 10:56:29 -0700 Subject: Add logging tests to tests.json --- src/python/grpcio_tests/tests/tests.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index 76d5d22d57..5505369867 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -46,6 +46,7 @@ "unit._interceptor_test.InterceptorTest", "unit._invalid_metadata_test.InvalidMetadataTest", "unit._invocation_defects_test.InvocationDefectsTest", + "unit._logging_test.LoggingTest", "unit._metadata_code_details_test.MetadataCodeDetailsTest", "unit._metadata_test.MetadataTest", "unit._reconnect_test.ReconnectTest", -- cgit v1.2.3 From 17dc8d30836f5616819fe83d6b94831685a7f31c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 11:47:13 -0700 Subject: Format code --- src/python/.gitignore | 1 + src/python/grpcio_testing/grpc_testing/_server/_rpc.py | 1 + src/python/grpcio_tests/tests/unit/_credentials_test.py | 1 - src/python/grpcio_tests/tests/unit/_logging_test.py | 6 ++++-- src/python/grpcio_tests/tests/unit/_server_test.py | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/python/.gitignore b/src/python/.gitignore index 7b520579a0..41813129bd 100644 --- a/src/python/.gitignore +++ b/src/python/.gitignore @@ -1,3 +1,4 @@ gens/ *_pb2.py *_pb2_grpc.py +*.egg-info/ diff --git a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py index d713eb92c0..736b714dc6 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py @@ -21,6 +21,7 @@ from grpc_testing import _common logging.basicConfig() _LOGGER = logging.getLogger(__name__) + class Rpc(object): def __init__(self, handler, invocation_metadata): diff --git a/src/python/grpcio_tests/tests/unit/_credentials_test.py b/src/python/grpcio_tests/tests/unit/_credentials_test.py index 4ba40e2e8a..be7378ecbc 100644 --- a/src/python/grpcio_tests/tests/unit/_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_credentials_test.py @@ -13,7 +13,6 @@ # limitations under the License. """Tests of credentials.""" - import unittest import logging diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index dcafd38878..08163089de 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -18,10 +18,12 @@ import six import grpc import logging + class LoggingTest(unittest.TestCase): - def test_logger_not_occupied(self): - self.assertEqual(0, len(logging.getLogger().handlers)) + def test_logger_not_occupied(self): + self.assertEqual(0, len(logging.getLogger().handlers)) + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_server_test.py b/src/python/grpcio_tests/tests/unit/_server_test.py index 47c32413dd..2c8205f365 100644 --- a/src/python/grpcio_tests/tests/unit/_server_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_test.py @@ -50,5 +50,5 @@ class ServerTest(unittest.TestCase): if __name__ == '__main__': - logging.basicConfig() + logging.basicConfig() unittest.main(verbosity=2) -- cgit v1.2.3 From 2acb85006a6d44c815b603803678a53825913d39 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 16:43:36 -0700 Subject: Add test for 'No handlers could be found' problem --- src/python/grpcio_tests/tests/unit/_logging_test.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index 08163089de..662cd1ea9d 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -15,15 +15,28 @@ import unittest import six -import grpc +from six.moves import reload_module import logging - +import grpc +import functools +import sys class LoggingTest(unittest.TestCase): def test_logger_not_occupied(self): self.assertEqual(0, len(logging.getLogger().handlers)) + def test_handler_found(self): + old_stderr = sys.stderr + sys.stderr = six.StringIO() + try: + reload_module(logging) + logging.basicConfig() + reload_module(grpc) + self.assertFalse("No handlers could be found" in sys.stderr.getvalue()) + finally: + sys.stderr = old_stderr + reload_module(logging) if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3 From e4b4f3131b4e66ca194aabc5e300e49c13f8122e Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 16:45:54 -0700 Subject: Pull out function to patch stderr --- src/python/grpcio_tests/tests/unit/_logging_test.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index 662cd1ea9d..39c3afbfc8 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -21,21 +21,30 @@ import grpc import functools import sys +def patch_stderr(f): + @functools.wraps(f) + def _impl(*args, **kwargs): + old_stderr = sys.stderr + sys.stderr = six.StringIO() + try: + f(args, kwargs) + finally: + sys.stderr = old_stderr + return _impl + class LoggingTest(unittest.TestCase): def test_logger_not_occupied(self): self.assertEqual(0, len(logging.getLogger().handlers)) + @patch_stderr def test_handler_found(self): - old_stderr = sys.stderr - sys.stderr = six.StringIO() try: reload_module(logging) logging.basicConfig() reload_module(grpc) self.assertFalse("No handlers could be found" in sys.stderr.getvalue()) finally: - sys.stderr = old_stderr reload_module(logging) if __name__ == '__main__': -- cgit v1.2.3 From a56a30f5a1f34ed1a53e42b80e5e01863e0b6b03 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 16:47:56 -0700 Subject: Format code --- src/python/grpcio_tests/tests/unit/_logging_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index 39c3afbfc8..0b14f5e325 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -21,7 +21,9 @@ import grpc import functools import sys + def patch_stderr(f): + @functools.wraps(f) def _impl(*args, **kwargs): old_stderr = sys.stderr @@ -30,8 +32,10 @@ def patch_stderr(f): f(args, kwargs) finally: sys.stderr = old_stderr + return _impl + class LoggingTest(unittest.TestCase): def test_logger_not_occupied(self): @@ -43,9 +47,11 @@ class LoggingTest(unittest.TestCase): reload_module(logging) logging.basicConfig() reload_module(grpc) - self.assertFalse("No handlers could be found" in sys.stderr.getvalue()) + self.assertFalse( + "No handlers could be found" in sys.stderr.getvalue()) finally: reload_module(logging) + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3 From 9aed6c8f8e5610b03735953ec351e7bc26a3b32b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 17:04:51 -0700 Subject: Fix splat --- src/python/grpcio_tests/tests/unit/_logging_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index 0b14f5e325..d378d466b3 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -29,7 +29,7 @@ def patch_stderr(f): old_stderr = sys.stderr sys.stderr = six.StringIO() try: - f(args, kwargs) + f(*args, **kwargs) finally: sys.stderr = old_stderr -- cgit v1.2.3 From 0139d8777db28623647fbc14ac9657a2fcdbcd06 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 17:20:43 -0700 Subject: Add explicit test that user can configure their own handler --- src/python/grpcio_tests/tests/unit/_logging_test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index d378d466b3..e409a24637 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -45,13 +45,23 @@ class LoggingTest(unittest.TestCase): def test_handler_found(self): try: reload_module(logging) - logging.basicConfig() reload_module(grpc) self.assertFalse( "No handlers could be found" in sys.stderr.getvalue()) finally: reload_module(logging) + def test_can_configure_logger(self): + reload_module(logging) + reload_module(grpc) + try: + intended_stream = six.StringIO() + logging.basicConfig(stream=intended_stream) + self.assertEqual(1, len(logging.getLogger().handlers)) + self.assertTrue(logging.getLogger().handlers[0].stream is intended_stream) + finally: + reload_module(logging) + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3 From a8d6e14721e8cc4c7a793b9f33aa0f1656077fa8 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 31 Oct 2018 17:22:30 -0700 Subject: Appease the yapf gods --- src/python/grpcio_tests/tests/unit/_logging_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index e409a24637..cc814ba46b 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -58,7 +58,8 @@ class LoggingTest(unittest.TestCase): intended_stream = six.StringIO() logging.basicConfig(stream=intended_stream) self.assertEqual(1, len(logging.getLogger().handlers)) - self.assertTrue(logging.getLogger().handlers[0].stream is intended_stream) + self.assertTrue( + logging.getLogger().handlers[0].stream is intended_stream) finally: reload_module(logging) -- cgit v1.2.3 From 056a1a8ea429d2caf6acc58e3575900ffda0a984 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Nov 2018 13:24:03 -0700 Subject: Isolate logging in all test cases --- .../grpcio_tests/tests/unit/_logging_test.py | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index cc814ba46b..d1384effde 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -36,32 +36,38 @@ def patch_stderr(f): return _impl +def isolated_logging(f): + + @functools.wraps(f) + def _impl(*args, **kwargs): + reload_module(logging) + reload_module(grpc) + try: + f(*args, **kwargs) + finally: + reload_module(logging) + + return _impl + + class LoggingTest(unittest.TestCase): + @isolated_logging def test_logger_not_occupied(self): self.assertEqual(0, len(logging.getLogger().handlers)) @patch_stderr + @isolated_logging def test_handler_found(self): - try: - reload_module(logging) - reload_module(grpc) - self.assertFalse( - "No handlers could be found" in sys.stderr.getvalue()) - finally: - reload_module(logging) + self.assertEqual(0, len(sys.stderr.getvalue())) + @isolated_logging def test_can_configure_logger(self): - reload_module(logging) - reload_module(grpc) - try: - intended_stream = six.StringIO() - logging.basicConfig(stream=intended_stream) - self.assertEqual(1, len(logging.getLogger().handlers)) - self.assertTrue( - logging.getLogger().handlers[0].stream is intended_stream) - finally: - reload_module(logging) + intended_stream = six.StringIO() + logging.basicConfig(stream=intended_stream) + self.assertEqual(1, len(logging.getLogger().handlers)) + self.assertTrue( + logging.getLogger().handlers[0].stream is intended_stream) if __name__ == '__main__': -- cgit v1.2.3 From 3c0c4fc1fdcd9ce0277a43c6f8c5bdeb44fc729d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Nov 2018 13:29:28 -0700 Subject: Use custom assertions --- src/python/grpcio_tests/tests/unit/_logging_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py index d1384effde..80b1f1b3c1 100644 --- a/src/python/grpcio_tests/tests/unit/_logging_test.py +++ b/src/python/grpcio_tests/tests/unit/_logging_test.py @@ -66,8 +66,7 @@ class LoggingTest(unittest.TestCase): intended_stream = six.StringIO() logging.basicConfig(stream=intended_stream) self.assertEqual(1, len(logging.getLogger().handlers)) - self.assertTrue( - logging.getLogger().handlers[0].stream is intended_stream) + self.assertIs(logging.getLogger().handlers[0].stream, intended_stream) if __name__ == '__main__': -- cgit v1.2.3 From 3f89327fd390b1bc2eaf4325301900d267ae79fc Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 12 Oct 2018 16:33:30 -0700 Subject: Enable building opencensus for bazel build --- include/grpcpp/opencensus.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/grpcpp/opencensus.h b/include/grpcpp/opencensus.h index 07a1333986..29b221f767 100644 --- a/include/grpcpp/opencensus.h +++ b/include/grpcpp/opencensus.h @@ -19,10 +19,6 @@ #ifndef GRPCPP_OPENCENSUS_H #define GRPCPP_OPENCENSUS_H -#ifndef GRPC_BAZEL_BUILD -#error OpenCensus for gRPC is only supported when building with bazel. -#endif - #include "opencensus/trace/span.h" namespace grpc { -- cgit v1.2.3 From 439f8e779d4d03c05c7cef34716fadddcb7c93a6 Mon Sep 17 00:00:00 2001 From: Srini Polavarapu Date: Tue, 6 Nov 2018 15:59:09 -0800 Subject: Bump version to 1.16.1-pre1 --- BUILD | 2 +- build.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index 4faf8b13ea..6a98e3d5e6 100644 --- a/BUILD +++ b/BUILD @@ -68,7 +68,7 @@ g_stands_for = "gao" core_version = "6.0.0" -version = "1.16.0" +version = "1.16.1-pre1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 4d8ea44a3b..21ea1a8b5b 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 6.0.0 g_stands_for: gao - version: 1.16.0 + version: 1.16.1-pre1 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From 1bf93a76f5042a87104181fd9960f2a22ca80b80 Mon Sep 17 00:00:00 2001 From: Srini Polavarapu Date: Tue, 6 Nov 2018 16:01:29 -0800 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 29 files changed, 35 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab1802ef5b..8f5f69441c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.16.0") +set(PACKAGE_VERSION "1.16.1-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index ab7c440fb8..1f1f4a0671 100644 --- a/Makefile +++ b/Makefile @@ -438,8 +438,8 @@ Q = @ endif CORE_VERSION = 6.0.0 -CPP_VERSION = 1.16.0 -CSHARP_VERSION = 1.16.0 +CPP_VERSION = 1.16.1-pre1 +CSHARP_VERSION = 1.16.1-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 5b8e4cf81f..959143f76e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.16.0' + # version = '1.16.1-pre1' version = '0.0.3' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.16.0' + grpc_version = '1.16.1-pre1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index af7e1e63f3..ad95f2dbfd 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.16.0' + version = '1.16.1-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 5a0cf53c47..5fbd6f1983 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.16.0' + version = '1.16.1-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 3d18440ce6..3c479c2382 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.16.0' + version = '1.16.1-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 58b0e45bf8..f916b6cae0 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.16.0' + version = '1.16.1-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index d1624a440b..d1890e9d2c 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.16.0 - 1.16.0 + 1.16.1RC1 + 1.16.1RC1 - stable - stable + beta + beta Apache 2.0 diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 2ddbf77d47..3c77ac6851 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.16.0"; } +grpc::string Version() { return "1.16.1-pre1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 88ffa6fa30..33b32cca21 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.16.0 + 1.16.1-pre1 3.6.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index f8b7c1b58c..c7d1bfeb03 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.16.0.0"; + public const string CurrentAssemblyFileVersion = "1.16.1.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.16.0"; + public const string CurrentVersion = "1.16.1-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 9064b71a98..efa9af8cae 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0 +set VERSION=1.16.1-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index c6eaeed392..693a46f146 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.0 +set VERSION=1.16.1-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 7d45a5e872..28cabe1596 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.16.0' + v = '1.16.1-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index fcdd492303..3ea30430f3 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0" +#define GRPC_OBJC_VERSION_STRING @"1.16.1-pre1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 38a8211ea5..179a3f33af 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.0" +#define GRPC_OBJC_VERSION_STRING @"1.16.1-pre1" #define GRPC_C_VERSION_STRING @"6.0.0" diff --git a/src/php/composer.json b/src/php/composer.json index f31423f8c0..825c1b3ea6 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.16.0", + "version": "1.16.1", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 0dc00a2393..3ac1169214 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.16.0" +#define PHP_GRPC_VERSION "1.16.1RC1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 149136ee86..8f3767cb6a 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.16.0""" +__version__ = """1.16.1rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index c3010a2935..eec2404853 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index f9e500a87e..0691206487 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 395f544d62..ddb294d14e 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 2725422e29..c3bcfec63a 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index a5f87c8519..76c62e7640 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 8e4e8a5736..7f17c940fd 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.16.0' + VERSION = '1.16.1.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index c694b8866f..102e64ee07 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.16.0' + VERSION = '1.16.1.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index f1ea4ac0ca..7b0d362609 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.16.0' +VERSION = '1.16.1rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 0e9e39e6b4..158c722b8a 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0 +PROJECT_NUMBER = 1.16.1-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index a49e09bc73..2acaa0689e 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.0 +PROJECT_NUMBER = 1.16.1-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From abbb317feed4f1732a3abb69595dc6b39e1bb124 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 8 Nov 2018 10:56:53 +0100 Subject: add ServiceBinderBase --- src/csharp/Grpc.Core/ServerServiceDefinition.cs | 8 +- src/csharp/Grpc.Core/ServiceBinderBase.cs | 101 ++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 src/csharp/Grpc.Core/ServiceBinderBase.cs diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs index 07c6aa1796..b040ab379c 100644 --- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs +++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs @@ -72,7 +72,7 @@ namespace Grpc.Core } /// - /// Adds a definitions for a single request - single response method. + /// Adds a definition for a single request - single response method. /// /// The request message class. /// The response message class. @@ -90,7 +90,7 @@ namespace Grpc.Core } /// - /// Adds a definitions for a client streaming method. + /// Adds a definition for a client streaming method. /// /// The request message class. /// The response message class. @@ -108,7 +108,7 @@ namespace Grpc.Core } /// - /// Adds a definitions for a server streaming method. + /// Adds a definition for a server streaming method. /// /// The request message class. /// The response message class. @@ -126,7 +126,7 @@ namespace Grpc.Core } /// - /// Adds a definitions for a bidirectional streaming method. + /// Adds a definition for a bidirectional streaming method. /// /// The request message class. /// The response message class. diff --git a/src/csharp/Grpc.Core/ServiceBinderBase.cs b/src/csharp/Grpc.Core/ServiceBinderBase.cs new file mode 100644 index 0000000000..d4909f4a26 --- /dev/null +++ b/src/csharp/Grpc.Core/ServiceBinderBase.cs @@ -0,0 +1,101 @@ +#region Copyright notice and license + +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Grpc.Core.Interceptors; +using Grpc.Core.Internal; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// + /// Allows binding server-side method implementations in alternative serving stacks. + /// Instances of this class are usually populated by the BindService method + /// that is part of the autogenerated code for a protocol buffers service definition. + /// + /// + public class ServiceBinderBase + { + /// + /// Adds a definition for a single request - single response method. + /// + /// The request message class. + /// The response message class. + /// The method. + /// The method handler. + public virtual void AddMethod( + Method method, + UnaryServerMethod handler) + where TRequest : class + where TResponse : class + { + throw new NotImplementedException(); + } + + /// + /// Adds a definition for a client streaming method. + /// + /// The request message class. + /// The response message class. + /// The method. + /// The method handler. + public virtual void AddMethod( + Method method, + ClientStreamingServerMethod handler) + where TRequest : class + where TResponse : class + { + throw new NotImplementedException(); + } + + /// + /// Adds a definition for a server streaming method. + /// + /// The request message class. + /// The response message class. + /// The method. + /// The method handler. + public virtual void AddMethod( + Method method, + ServerStreamingServerMethod handler) + where TRequest : class + where TResponse : class + { + throw new NotImplementedException(); + } + + /// + /// Adds a definition for a bidirectional streaming method. + /// + /// The request message class. + /// The response message class. + /// The method. + /// The method handler. + public virtual void AddMethod( + Method method, + DuplexStreamingServerMethod handler) + where TRequest : class + where TResponse : class + { + throw new NotImplementedException(); + } + } +} -- cgit v1.2.3 From a50c61edc11568e5e9a38af105d53b802fb20ec9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 8 Nov 2018 10:57:21 +0100 Subject: generate alternative BindService method --- src/compiler/csharp_generator.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index a923ce8e38..82deabe064 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -609,6 +609,39 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) { out->Print("\n"); } +void GenerateBindServiceWithBinderMethod(Printer* out, + const ServiceDescriptor* service) { + out->Print( + "/// Register service method implementations with a service " + "binder. Useful when customizing the service binding logic.\n"); + out->Print( + "/// Service methods will be bound by " + "calling AddMethod on this object." + "\n"); + out->Print( + "/// An object implementing the server-side" + " handling logic.\n"); + out->Print( + "public static void BindService(grpc::ServiceBinderBase serviceBinder, " + "$implclass$ " + "serviceImpl)\n", + "implclass", GetServerClassName(service)); + out->Print("{\n"); + out->Indent(); + + for (int i = 0; i < service->method_count(); i++) { + const MethodDescriptor* method = service->method(i); + out->Print( + "serviceBinder.AddMethod($methodfield$, serviceImpl.$methodname$);\n", + "methodfield", GetMethodFieldName(method), "methodname", + method->name()); + } + + out->Outdent(); + out->Print("}\n"); + out->Print("\n"); +} + void GenerateService(Printer* out, const ServiceDescriptor* service, bool generate_client, bool generate_server, bool internal_access) { @@ -637,6 +670,7 @@ void GenerateService(Printer* out, const ServiceDescriptor* service, } if (generate_server) { GenerateBindServiceMethod(out, service); + GenerateBindServiceWithBinderMethod(out, service); } out->Outdent(); -- cgit v1.2.3 From b187cfe460918cd7378da7be5c8211d682147b14 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 8 Nov 2018 11:17:22 +0100 Subject: regenerate protos --- src/csharp/Grpc.Examples/MathGrpc.cs | 11 ++ src/csharp/Grpc.HealthCheck/Health.cs | 20 ++- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 134 ++++++++++++++++++- .../BenchmarkServiceGrpc.cs | 12 ++ src/csharp/Grpc.IntegrationTesting/Control.cs | 144 +++++++++++++-------- .../Grpc.IntegrationTesting/EmptyServiceGrpc.cs | 7 + src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 9 ++ .../ReportQpsScenarioServiceGrpc.cs | 8 ++ src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 32 +++++ .../Grpc.IntegrationTesting/WorkerServiceGrpc.cs | 11 ++ src/csharp/Grpc.Reflection/ReflectionGrpc.cs | 8 ++ 11 files changed, 333 insertions(+), 63 deletions(-) diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 9578bb4d81..ec2cfe8b28 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -287,6 +287,17 @@ namespace Math { .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, MathBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Div, serviceImpl.Div); + serviceBinder.AddMethod(__Method_DivMany, serviceImpl.DivMany); + serviceBinder.AddMethod(__Method_Fib, serviceImpl.Fib); + serviceBinder.AddMethod(__Method_Sum, serviceImpl.Sum); + } + } } #endregion diff --git a/src/csharp/Grpc.HealthCheck/Health.cs b/src/csharp/Grpc.HealthCheck/Health.cs index a90f261d28..2c3bb45c3c 100644 --- a/src/csharp/Grpc.HealthCheck/Health.cs +++ b/src/csharp/Grpc.HealthCheck/Health.cs @@ -25,15 +25,17 @@ namespace Grpc.Health.V1 { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYx", - "IiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIpQBChNI", + "IiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIqkBChNI", "ZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVh", - "bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyI6Cg1T", + "bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyJPCg1T", "ZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9U", - "X1NFUlZJTkcQAjJaCgZIZWFsdGgSUAoFQ2hlY2sSIi5ncnBjLmhlYWx0aC52", - "MS5IZWFsdGhDaGVja1JlcXVlc3QaIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhD", - "aGVja1Jlc3BvbnNlQmEKEWlvLmdycGMuaGVhbHRoLnYxQgtIZWFsdGhQcm90", - "b1ABWixnb29nbGUuZ29sYW5nLm9yZy9ncnBjL2hlYWx0aC9ncnBjX2hlYWx0", - "aF92MaoCDkdycGMuSGVhbHRoLlYxYgZwcm90bzM=")); + "X1NFUlZJTkcQAhITCg9TRVJWSUNFX1VOS05PV04QAzKuAQoGSGVhbHRoElAK", + "BUNoZWNrEiIuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXF1ZXN0GiMu", + "Z3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXNwb25zZRJSCgVXYXRjaBIi", + "LmdycGMuaGVhbHRoLnYxLkhlYWx0aENoZWNrUmVxdWVzdBojLmdycGMuaGVh", + "bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UwAUJhChFpby5ncnBjLmhlYWx0", + "aC52MUILSGVhbHRoUHJvdG9QAVosZ29vZ2xlLmdvbGFuZy5vcmcvZ3JwYy9o", + "ZWFsdGgvZ3JwY19oZWFsdGhfdjGqAg5HcnBjLkhlYWx0aC5WMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -309,6 +311,10 @@ namespace Grpc.Health.V1 { [pbr::OriginalName("UNKNOWN")] Unknown = 0, [pbr::OriginalName("SERVING")] Serving = 1, [pbr::OriginalName("NOT_SERVING")] NotServing = 2, + /// + /// Used only by the Watch method. + /// + [pbr::OriginalName("SERVICE_UNKNOWN")] ServiceUnknown = 3, } } diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 5e79c04d2a..7bffb7f6cc 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -40,6 +40,13 @@ namespace Grpc.Health.V1 { __Marshaller_grpc_health_v1_HealthCheckRequest, __Marshaller_grpc_health_v1_HealthCheckResponse); + static readonly grpc::Method __Method_Watch = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "Watch", + __Marshaller_grpc_health_v1_HealthCheckRequest, + __Marshaller_grpc_health_v1_HealthCheckResponse); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -49,11 +56,44 @@ namespace Grpc.Health.V1 { /// Base class for server-side implementations of Health public abstract partial class HealthBase { + /// + /// If the requested service is unknown, the call will fail with status + /// NOT_FOUND. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). public virtual global::System.Threading.Tasks.Task Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } + /// + /// Performs a watch for the serving status of the requested service. + /// The server will immediately send back a message indicating the current + /// serving status. It will then subsequently send a new message whenever + /// the service's serving status changes. + /// + /// If the requested service is unknown when the call is received, the + /// server will send a message setting the serving status to + /// SERVICE_UNKNOWN but will *not* terminate the call. If at some + /// future point, the serving status of the service becomes known, the + /// server will send a new message with the service's serving status. + /// + /// If the call terminates with status UNIMPLEMENTED, then clients + /// should assume this method is not supported and should not retry the + /// call. If the call terminates with any other status (including OK), + /// clients should retry the call with appropriate exponential backoff. + /// + /// The request received from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + } /// Client for Health @@ -79,22 +119,104 @@ namespace Grpc.Health.V1 { { } + /// + /// If the requested service is unknown, the call will fail with status + /// NOT_FOUND. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Check(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } + /// + /// If the requested service is unknown, the call will fail with status + /// NOT_FOUND. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request); } + /// + /// If the requested service is unknown, the call will fail with status + /// NOT_FOUND. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. public virtual grpc::AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return CheckAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } + /// + /// If the requested service is unknown, the call will fail with status + /// NOT_FOUND. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. public virtual grpc::AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request); } + /// + /// Performs a watch for the serving status of the requested service. + /// The server will immediately send back a message indicating the current + /// serving status. It will then subsequently send a new message whenever + /// the service's serving status changes. + /// + /// If the requested service is unknown when the call is received, the + /// server will send a message setting the serving status to + /// SERVICE_UNKNOWN but will *not* terminate the call. If at some + /// future point, the serving status of the service becomes known, the + /// server will send a new message with the service's serving status. + /// + /// If the call terminates with status UNIMPLEMENTED, then clients + /// should assume this method is not supported and should not retry the + /// call. If the call terminates with any other status (including OK), + /// clients should retry the call with appropriate exponential backoff. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Watch(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Performs a watch for the serving status of the requested service. + /// The server will immediately send back a message indicating the current + /// serving status. It will then subsequently send a new message whenever + /// the service's serving status changes. + /// + /// If the requested service is unknown when the call is received, the + /// server will send a message setting the serving status to + /// SERVICE_UNKNOWN but will *not* terminate the call. If at some + /// future point, the serving status of the service becomes known, the + /// server will send a new message with the service's serving status. + /// + /// If the call terminates with status UNIMPLEMENTED, then clients + /// should assume this method is not supported and should not retry the + /// call. If the call terminates with any other status (including OK), + /// clients should retry the call with appropriate exponential backoff. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_Watch, null, options, request); + } /// Creates a new instance of client from given ClientBaseConfiguration. protected override HealthClient NewInstance(ClientBaseConfiguration configuration) { @@ -107,7 +229,17 @@ namespace Grpc.Health.V1 { public static grpc::ServerServiceDefinition BindService(HealthBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Check, serviceImpl.Check).Build(); + .AddMethod(__Method_Check, serviceImpl.Check) + .AddMethod(__Method_Watch, serviceImpl.Watch).Build(); + } + + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, HealthBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Check, serviceImpl.Check); + serviceBinder.AddMethod(__Method_Watch, serviceImpl.Watch); } } diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index b5738593f2..b4fa16fc35 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -324,6 +324,18 @@ namespace Grpc.Testing { .AddMethod(__Method_StreamingBothWays, serviceImpl.StreamingBothWays).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, BenchmarkServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall); + serviceBinder.AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall); + serviceBinder.AddMethod(__Method_StreamingFromClient, serviceImpl.StreamingFromClient); + serviceBinder.AddMethod(__Method_StreamingFromServer, serviceImpl.StreamingFromServer); + serviceBinder.AddMethod(__Method_StreamingBothWays, serviceImpl.StreamingBothWays); + } + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 6e00348451..368b86659a 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -34,7 +34,7 @@ namespace Grpc.Testing { "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", "X2hvc3Rfb3ZlcnJpZGUYAiABKAkSEQoJY3JlZF90eXBlGAMgASgJIk0KCkNo", "YW5uZWxBcmcSDAoEbmFtZRgBIAEoCRITCglzdHJfdmFsdWUYAiABKAlIABIT", - "CglpbnRfdmFsdWUYAyABKAVIAEIHCgV2YWx1ZSLvBAoMQ2xpZW50Q29uZmln", + "CglpbnRfdmFsdWUYAyABKAVIAEIHCgV2YWx1ZSKiBQoMQ2xpZW50Q29uZmln", "EhYKDnNlcnZlcl90YXJnZXRzGAEgAygJEi0KC2NsaWVudF90eXBlGAIgASgO", "MhguZ3JwYy50ZXN0aW5nLkNsaWVudFR5cGUSNQoPc2VjdXJpdHlfcGFyYW1z", "GAMgASgLMhwuZ3JwYy50ZXN0aW5nLlNlY3VyaXR5UGFyYW1zEiQKHG91dHN0", @@ -48,59 +48,60 @@ namespace Grpc.Testing { "GA4gASgFEhgKEG90aGVyX2NsaWVudF9hcGkYDyABKAkSLgoMY2hhbm5lbF9h", "cmdzGBAgAygLMhguZ3JwYy50ZXN0aW5nLkNoYW5uZWxBcmcSFgoOdGhyZWFk", "c19wZXJfY3EYESABKAUSGwoTbWVzc2FnZXNfcGVyX3N0cmVhbRgSIAEoBRIY", - "ChB1c2VfY29hbGVzY2VfYXBpGBMgASgIIjgKDENsaWVudFN0YXR1cxIoCgVz", - "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr", - "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy", - "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS", - "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSL9AgoMU2VydmVyQ29u", - "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl", - "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n", - "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy", - "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk", - "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK", - "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJEhYK", - "DnRocmVhZHNfcGVyX2NxGAwgASgFEhwKE3Jlc291cmNlX3F1b3RhX3NpemUY", - "6QcgASgFEi8KDGNoYW5uZWxfYXJncxjqByADKAsyGC5ncnBjLnRlc3Rpbmcu", - "Q2hhbm5lbEFyZyJoCgpTZXJ2ZXJBcmdzEisKBXNldHVwGAEgASgLMhouZ3Jw", - "Yy50ZXN0aW5nLlNlcnZlckNvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBj", - "LnRlc3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUiVQoMU2VydmVyU3RhdHVzEigK", - "BXN0YXRzGAEgASgLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXRzEgwKBHBv", - "cnQYAiABKAUSDQoFY29yZXMYAyABKAUiDQoLQ29yZVJlcXVlc3QiHQoMQ29y", - "ZVJlc3BvbnNlEg0KBWNvcmVzGAEgASgFIgYKBFZvaWQi/QEKCFNjZW5hcmlv", - "EgwKBG5hbWUYASABKAkSMQoNY2xpZW50X2NvbmZpZxgCIAEoCzIaLmdycGMu", - "dGVzdGluZy5DbGllbnRDb25maWcSEwoLbnVtX2NsaWVudHMYAyABKAUSMQoN", - "c2VydmVyX2NvbmZpZxgEIAEoCzIaLmdycGMudGVzdGluZy5TZXJ2ZXJDb25m", - "aWcSEwoLbnVtX3NlcnZlcnMYBSABKAUSFgoOd2FybXVwX3NlY29uZHMYBiAB", - "KAUSGQoRYmVuY2htYXJrX3NlY29uZHMYByABKAUSIAoYc3Bhd25fbG9jYWxf", - "d29ya2VyX2NvdW50GAggASgFIjYKCVNjZW5hcmlvcxIpCglzY2VuYXJpb3MY", - "ASADKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8ihAQKFVNjZW5hcmlvUmVz", - "dWx0U3VtbWFyeRILCgNxcHMYASABKAESGwoTcXBzX3Blcl9zZXJ2ZXJfY29y", - "ZRgCIAEoARIaChJzZXJ2ZXJfc3lzdGVtX3RpbWUYAyABKAESGAoQc2VydmVy", - "X3VzZXJfdGltZRgEIAEoARIaChJjbGllbnRfc3lzdGVtX3RpbWUYBSABKAES", - "GAoQY2xpZW50X3VzZXJfdGltZRgGIAEoARISCgpsYXRlbmN5XzUwGAcgASgB", - "EhIKCmxhdGVuY3lfOTAYCCABKAESEgoKbGF0ZW5jeV85NRgJIAEoARISCgps", - "YXRlbmN5Xzk5GAogASgBEhMKC2xhdGVuY3lfOTk5GAsgASgBEhgKEHNlcnZl", - "cl9jcHVfdXNhZ2UYDCABKAESJgoec3VjY2Vzc2Z1bF9yZXF1ZXN0c19wZXJf", - "c2Vjb25kGA0gASgBEiIKGmZhaWxlZF9yZXF1ZXN0c19wZXJfc2Vjb25kGA4g", - "ASgBEiAKGGNsaWVudF9wb2xsc19wZXJfcmVxdWVzdBgPIAEoARIgChhzZXJ2", - "ZXJfcG9sbHNfcGVyX3JlcXVlc3QYECABKAESIgoac2VydmVyX3F1ZXJpZXNf", - "cGVyX2NwdV9zZWMYESABKAESIgoaY2xpZW50X3F1ZXJpZXNfcGVyX2NwdV9z", - "ZWMYEiABKAEigwMKDlNjZW5hcmlvUmVzdWx0EigKCHNjZW5hcmlvGAEgASgL", - "MhYuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvEi4KCWxhdGVuY2llcxgCIAEoCzIb", - "LmdycGMudGVzdGluZy5IaXN0b2dyYW1EYXRhEi8KDGNsaWVudF9zdGF0cxgD", - "IAMoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cxIvCgxzZXJ2ZXJfc3Rh", - "dHMYBCADKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSFAoMc2VydmVy", - "X2NvcmVzGAUgAygFEjQKB3N1bW1hcnkYBiABKAsyIy5ncnBjLnRlc3Rpbmcu", - "U2NlbmFyaW9SZXN1bHRTdW1tYXJ5EhYKDmNsaWVudF9zdWNjZXNzGAcgAygI", - "EhYKDnNlcnZlcl9zdWNjZXNzGAggAygIEjkKD3JlcXVlc3RfcmVzdWx0cxgJ", - "IAMoCzIgLmdycGMudGVzdGluZy5SZXF1ZXN0UmVzdWx0Q291bnQqQQoKQ2xp", - "ZW50VHlwZRIPCgtTWU5DX0NMSUVOVBAAEhAKDEFTWU5DX0NMSUVOVBABEhAK", - "DE9USEVSX0NMSUVOVBACKlsKClNlcnZlclR5cGUSDwoLU1lOQ19TRVJWRVIQ", - "ABIQCgxBU1lOQ19TRVJWRVIQARIYChRBU1lOQ19HRU5FUklDX1NFUlZFUhAC", - "EhAKDE9USEVSX1NFUlZFUhADKnIKB1JwY1R5cGUSCQoFVU5BUlkQABINCglT", - "VFJFQU1JTkcQARIZChVTVFJFQU1JTkdfRlJPTV9DTElFTlQQAhIZChVTVFJF", - "QU1JTkdfRlJPTV9TRVJWRVIQAxIXChNTVFJFQU1JTkdfQk9USF9XQVlTEARi", - "BnByb3RvMw==")); + "ChB1c2VfY29hbGVzY2VfYXBpGBMgASgIEjEKKW1lZGlhbl9sYXRlbmN5X2Nv", + "bGxlY3Rpb25faW50ZXJ2YWxfbWlsbGlzGBQgASgFIjgKDENsaWVudFN0YXR1", + "cxIoCgVzdGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIV", + "CgRNYXJrEg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAY", + "ASABKAsyGi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgC", + "IAEoCzISLmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSL9AgoMU2Vy", + "dmVyQ29uZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5n", + "LlNlcnZlclR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50", + "ZXN0aW5nLlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNf", + "c2VydmVyX3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5w", + "YXlsb2FkX2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29u", + "ZmlnEhEKCWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsg", + "ASgJEhYKDnRocmVhZHNfcGVyX2NxGAwgASgFEhwKE3Jlc291cmNlX3F1b3Rh", + "X3NpemUY6QcgASgFEi8KDGNoYW5uZWxfYXJncxjqByADKAsyGC5ncnBjLnRl", + "c3RpbmcuQ2hhbm5lbEFyZyJoCgpTZXJ2ZXJBcmdzEisKBXNldHVwGAEgASgL", + "MhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZ0gAEiIKBG1hcmsYAiABKAsy", + "Ei5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUiVQoMU2VydmVyU3Rh", + "dHVzEigKBXN0YXRzGAEgASgLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXRz", + "EgwKBHBvcnQYAiABKAUSDQoFY29yZXMYAyABKAUiDQoLQ29yZVJlcXVlc3Qi", + "HQoMQ29yZVJlc3BvbnNlEg0KBWNvcmVzGAEgASgFIgYKBFZvaWQi/QEKCFNj", + "ZW5hcmlvEgwKBG5hbWUYASABKAkSMQoNY2xpZW50X2NvbmZpZxgCIAEoCzIa", + "LmdycGMudGVzdGluZy5DbGllbnRDb25maWcSEwoLbnVtX2NsaWVudHMYAyAB", + "KAUSMQoNc2VydmVyX2NvbmZpZxgEIAEoCzIaLmdycGMudGVzdGluZy5TZXJ2", + "ZXJDb25maWcSEwoLbnVtX3NlcnZlcnMYBSABKAUSFgoOd2FybXVwX3NlY29u", + "ZHMYBiABKAUSGQoRYmVuY2htYXJrX3NlY29uZHMYByABKAUSIAoYc3Bhd25f", + "bG9jYWxfd29ya2VyX2NvdW50GAggASgFIjYKCVNjZW5hcmlvcxIpCglzY2Vu", + "YXJpb3MYASADKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8ihAQKFVNjZW5h", + "cmlvUmVzdWx0U3VtbWFyeRILCgNxcHMYASABKAESGwoTcXBzX3Blcl9zZXJ2", + "ZXJfY29yZRgCIAEoARIaChJzZXJ2ZXJfc3lzdGVtX3RpbWUYAyABKAESGAoQ", + "c2VydmVyX3VzZXJfdGltZRgEIAEoARIaChJjbGllbnRfc3lzdGVtX3RpbWUY", + "BSABKAESGAoQY2xpZW50X3VzZXJfdGltZRgGIAEoARISCgpsYXRlbmN5XzUw", + "GAcgASgBEhIKCmxhdGVuY3lfOTAYCCABKAESEgoKbGF0ZW5jeV85NRgJIAEo", + "ARISCgpsYXRlbmN5Xzk5GAogASgBEhMKC2xhdGVuY3lfOTk5GAsgASgBEhgK", + "EHNlcnZlcl9jcHVfdXNhZ2UYDCABKAESJgoec3VjY2Vzc2Z1bF9yZXF1ZXN0", + "c19wZXJfc2Vjb25kGA0gASgBEiIKGmZhaWxlZF9yZXF1ZXN0c19wZXJfc2Vj", + "b25kGA4gASgBEiAKGGNsaWVudF9wb2xsc19wZXJfcmVxdWVzdBgPIAEoARIg", + "ChhzZXJ2ZXJfcG9sbHNfcGVyX3JlcXVlc3QYECABKAESIgoac2VydmVyX3F1", + "ZXJpZXNfcGVyX2NwdV9zZWMYESABKAESIgoaY2xpZW50X3F1ZXJpZXNfcGVy", + "X2NwdV9zZWMYEiABKAEigwMKDlNjZW5hcmlvUmVzdWx0EigKCHNjZW5hcmlv", + "GAEgASgLMhYuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvEi4KCWxhdGVuY2llcxgC", + "IAEoCzIbLmdycGMudGVzdGluZy5IaXN0b2dyYW1EYXRhEi8KDGNsaWVudF9z", + "dGF0cxgDIAMoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cxIvCgxzZXJ2", + "ZXJfc3RhdHMYBCADKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSFAoM", + "c2VydmVyX2NvcmVzGAUgAygFEjQKB3N1bW1hcnkYBiABKAsyIy5ncnBjLnRl", + "c3RpbmcuU2NlbmFyaW9SZXN1bHRTdW1tYXJ5EhYKDmNsaWVudF9zdWNjZXNz", + "GAcgAygIEhYKDnNlcnZlcl9zdWNjZXNzGAggAygIEjkKD3JlcXVlc3RfcmVz", + "dWx0cxgJIAMoCzIgLmdycGMudGVzdGluZy5SZXF1ZXN0UmVzdWx0Q291bnQq", + "VgoKQ2xpZW50VHlwZRIPCgtTWU5DX0NMSUVOVBAAEhAKDEFTWU5DX0NMSUVO", + "VBABEhAKDE9USEVSX0NMSUVOVBACEhMKD0NBTExCQUNLX0NMSUVOVBADKlsK", + "ClNlcnZlclR5cGUSDwoLU1lOQ19TRVJWRVIQABIQCgxBU1lOQ19TRVJWRVIQ", + "ARIYChRBU1lOQ19HRU5FUklDX1NFUlZFUhACEhAKDE9USEVSX1NFUlZFUhAD", + "KnIKB1JwY1R5cGUSCQoFVU5BUlkQABINCglTVFJFQU1JTkcQARIZChVTVFJF", + "QU1JTkdfRlJPTV9DTElFTlQQAhIZChVTVFJFQU1JTkdfRlJPTV9TRVJWRVIQ", + "AxIXChNTVFJFQU1JTkdfQk9USF9XQVlTEARiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] { @@ -109,7 +110,7 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride", "CredType" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream", "UseCoalesceApi" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream", "UseCoalesceApi", "MedianLatencyCollectionIntervalMillis" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), @@ -140,6 +141,7 @@ namespace Grpc.Testing { /// used for some language-specific variants /// [pbr::OriginalName("OTHER_CLIENT")] OtherClient = 2, + [pbr::OriginalName("CALLBACK_CLIENT")] CallbackClient = 3, } public enum ServerType { @@ -1054,6 +1056,7 @@ namespace Grpc.Testing { threadsPerCq_ = other.threadsPerCq_; messagesPerStream_ = other.messagesPerStream_; useCoalesceApi_ = other.useCoalesceApi_; + medianLatencyCollectionIntervalMillis_ = other.medianLatencyCollectionIntervalMillis_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1278,6 +1281,21 @@ namespace Grpc.Testing { } } + /// Field number for the "median_latency_collection_interval_millis" field. + public const int MedianLatencyCollectionIntervalMillisFieldNumber = 20; + private int medianLatencyCollectionIntervalMillis_; + /// + /// If 0, disabled. Else, specifies the period between gathering latency + /// medians in milliseconds. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int MedianLatencyCollectionIntervalMillis { + get { return medianLatencyCollectionIntervalMillis_; } + set { + medianLatencyCollectionIntervalMillis_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientConfig); @@ -1308,6 +1326,7 @@ namespace Grpc.Testing { if (ThreadsPerCq != other.ThreadsPerCq) return false; if (MessagesPerStream != other.MessagesPerStream) return false; if (UseCoalesceApi != other.UseCoalesceApi) return false; + if (MedianLatencyCollectionIntervalMillis != other.MedianLatencyCollectionIntervalMillis) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1331,6 +1350,7 @@ namespace Grpc.Testing { if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); if (MessagesPerStream != 0) hash ^= MessagesPerStream.GetHashCode(); if (UseCoalesceApi != false) hash ^= UseCoalesceApi.GetHashCode(); + if (MedianLatencyCollectionIntervalMillis != 0) hash ^= MedianLatencyCollectionIntervalMillis.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1403,6 +1423,10 @@ namespace Grpc.Testing { output.WriteRawTag(152, 1); output.WriteBool(UseCoalesceApi); } + if (MedianLatencyCollectionIntervalMillis != 0) { + output.WriteRawTag(160, 1); + output.WriteInt32(MedianLatencyCollectionIntervalMillis); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1456,6 +1480,9 @@ namespace Grpc.Testing { if (UseCoalesceApi != false) { size += 2 + 1; } + if (MedianLatencyCollectionIntervalMillis != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(MedianLatencyCollectionIntervalMillis); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1524,6 +1551,9 @@ namespace Grpc.Testing { if (other.UseCoalesceApi != false) { UseCoalesceApi = other.UseCoalesceApi; } + if (other.MedianLatencyCollectionIntervalMillis != 0) { + MedianLatencyCollectionIntervalMillis = other.MedianLatencyCollectionIntervalMillis; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1616,6 +1646,10 @@ namespace Grpc.Testing { UseCoalesceApi = input.ReadBool(); break; } + case 160: { + MedianLatencyCollectionIntervalMillis = input.ReadInt32(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs index 2d233fbdc0..ee2f0ccff7 100644 --- a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -80,6 +80,13 @@ namespace Grpc.Testing { return grpc::ServerServiceDefinition.CreateBuilder().Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, EmptyServiceBase serviceImpl) + { + } + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 9f16f41ac1..74595ab5dc 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -193,6 +193,15 @@ namespace Grpc.Testing { .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, MetricsServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges); + serviceBinder.AddMethod(__Method_GetGauge, serviceImpl.GetGauge); + } + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index 1da0548cb4..21f4545a86 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -143,6 +143,14 @@ namespace Grpc.Testing { .AddMethod(__Method_ReportScenario, serviceImpl.ReportScenario).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, ReportQpsScenarioServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_ReportScenario, serviceImpl.ReportScenario); + } + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 2176916b43..38d596c750 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -539,6 +539,21 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, TestServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall); + serviceBinder.AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall); + serviceBinder.AddMethod(__Method_CacheableUnaryCall, serviceImpl.CacheableUnaryCall); + serviceBinder.AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall); + serviceBinder.AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall); + serviceBinder.AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall); + serviceBinder.AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall); + serviceBinder.AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall); + } + } /// /// A simple service NOT implemented at servers so clients can test for @@ -661,6 +676,14 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, UnimplementedServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall); + } + } /// /// A service used to control reconnect server. @@ -779,6 +802,15 @@ namespace Grpc.Testing { .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, ReconnectServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Start, serviceImpl.Start); + serviceBinder.AddMethod(__Method_Stop, serviceImpl.Stop); + } + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index b9e8f91231..dd31b08d78 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -321,6 +321,17 @@ namespace Grpc.Testing { .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, WorkerServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_RunServer, serviceImpl.RunServer); + serviceBinder.AddMethod(__Method_RunClient, serviceImpl.RunClient); + serviceBinder.AddMethod(__Method_CoreCount, serviceImpl.CoreCount); + serviceBinder.AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker); + } + } } #endregion diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index c00075b7c6..09b916bf77 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -123,6 +123,14 @@ namespace Grpc.Reflection.V1Alpha { .AddMethod(__Method_ServerReflectionInfo, serviceImpl.ServerReflectionInfo).Build(); } + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, ServerReflectionBase serviceImpl) + { + serviceBinder.AddMethod(__Method_ServerReflectionInfo, serviceImpl.ServerReflectionInfo); + } + } } #endregion -- cgit v1.2.3 From c21393e553e7ab528edb5966c835bc0832ea4edf Mon Sep 17 00:00:00 2001 From: "tongxuan.ltx" Date: Thu, 8 Nov 2018 10:43:18 +0800 Subject: g_default_client_callbacks shouldn't be global variable In tensorflow, RPC client thread doesn't active release, rely on process to cleanup. If process have already cleanup the global variable(g_default_client_callbacks), after that client issue a RPC call which contains the ClientContext, then once ClientContext destructor called, pure virtual functions call error is reported. --- src/cpp/client/client_context.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 50da75f09c..c9ea3e5f83 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -41,9 +41,10 @@ class DefaultGlobalClientCallbacks final }; static internal::GrpcLibraryInitializer g_gli_initializer; -static DefaultGlobalClientCallbacks g_default_client_callbacks; +static DefaultGlobalClientCallbacks* g_default_client_callbacks = + new DefaultGlobalClientCallbacks(); static ClientContext::GlobalCallbacks* g_client_callbacks = - &g_default_client_callbacks; + g_default_client_callbacks; ClientContext::ClientContext() : initial_metadata_received_(false), @@ -139,9 +140,9 @@ grpc::string ClientContext::peer() const { } void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) { - GPR_ASSERT(g_client_callbacks == &g_default_client_callbacks); + GPR_ASSERT(g_client_callbacks == g_default_client_callbacks); GPR_ASSERT(client_callbacks != nullptr); - GPR_ASSERT(client_callbacks != &g_default_client_callbacks); + GPR_ASSERT(client_callbacks != g_default_client_callbacks); g_client_callbacks = client_callbacks; } -- cgit v1.2.3 From 5344c81f3c7701a6b1864faa2da91041c1e29e03 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 16 Aug 2018 17:19:27 +0200 Subject: switch C# to contextual serializer and deserializer internally --- .../Internal/AsyncCallServerTest.cs | 2 +- src/csharp/Grpc.Core.Tests/MarshallerTest.cs | 7 +-- src/csharp/Grpc.Core/DeserializationContext.cs | 7 ++- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 2 +- src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 27 +++++++-- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 2 +- .../Internal/DefaultDeserializationContext.cs | 66 +++++++++++++++++++++ .../Internal/DefaultSerializationContext.cs | 62 ++++++++++++++++++++ src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 16 +++--- src/csharp/Grpc.Core/Marshaller.cs | 67 ++-------------------- src/csharp/Grpc.Core/SerializationContext.cs | 7 ++- 11 files changed, 181 insertions(+), 84 deletions(-) create mode 100644 src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs create mode 100644 src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs index e7d8939978..5c7d48f786 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs @@ -49,7 +49,7 @@ namespace Grpc.Core.Internal.Tests fakeCall = new FakeNativeCall(); asyncCallServer = new AsyncCallServer( - Marshallers.StringMarshaller.Serializer, Marshallers.StringMarshaller.Deserializer, + Marshallers.StringMarshaller.ContextualSerializer, Marshallers.StringMarshaller.ContextualDeserializer, server); asyncCallServer.InitializeForTesting(fakeCall); } diff --git a/src/csharp/Grpc.Core.Tests/MarshallerTest.cs b/src/csharp/Grpc.Core.Tests/MarshallerTest.cs index 97f64a0575..ad3e81d61f 100644 --- a/src/csharp/Grpc.Core.Tests/MarshallerTest.cs +++ b/src/csharp/Grpc.Core.Tests/MarshallerTest.cs @@ -69,11 +69,8 @@ namespace Grpc.Core.Tests Assert.AreSame(contextualSerializer, marshaller.ContextualSerializer); Assert.AreSame(contextualDeserializer, marshaller.ContextualDeserializer); - - // test that emulated serializer and deserializer work - var origMsg = "abc"; - var serialized = marshaller.Serializer(origMsg); - Assert.AreEqual(origMsg, marshaller.Deserializer(serialized)); + Assert.Throws(typeof(NotImplementedException), () => marshaller.Serializer("abc")); + Assert.Throws(typeof(NotImplementedException), () => marshaller.Deserializer(new byte[] {1, 2, 3})); } class FakeSerializationContext : SerializationContext diff --git a/src/csharp/Grpc.Core/DeserializationContext.cs b/src/csharp/Grpc.Core/DeserializationContext.cs index 5b6372ef85..d69e0db5bd 100644 --- a/src/csharp/Grpc.Core/DeserializationContext.cs +++ b/src/csharp/Grpc.Core/DeserializationContext.cs @@ -16,6 +16,8 @@ #endregion +using System; + namespace Grpc.Core { /// @@ -41,6 +43,9 @@ namespace Grpc.Core /// (as there is no practical reason for doing so) and DeserializationContext implementations are free to assume so. /// /// byte array containing the entire payload. - public abstract byte[] PayloadAsNewBuffer(); + public virtual byte[] PayloadAsNewBuffer() + { + throw new NotImplementedException(); + } } } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 4cdf0ee6a7..b6d687f71e 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -54,7 +54,7 @@ namespace Grpc.Core.Internal ClientSideStatus? finishedStatus; public AsyncCall(CallInvocationDetails callDetails) - : base(callDetails.RequestMarshaller.Serializer, callDetails.ResponseMarshaller.Deserializer) + : base(callDetails.RequestMarshaller.ContextualSerializer, callDetails.ResponseMarshaller.ContextualDeserializer) { this.details = callDetails.WithOptions(callDetails.Options.Normalize()); this.initialMetadataSent = true; // we always send metadata at the very beginning of the call. diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index a93dc34620..39c9f7c616 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -40,8 +40,8 @@ namespace Grpc.Core.Internal static readonly ILogger Logger = GrpcEnvironment.Logger.ForType>(); protected static readonly Status DeserializeResponseFailureStatus = new Status(StatusCode.Internal, "Failed to deserialize response message."); - readonly Func serializer; - readonly Func deserializer; + readonly Action serializer; + readonly Func deserializer; protected readonly object myLock = new object(); @@ -63,7 +63,7 @@ namespace Grpc.Core.Internal protected bool initialMetadataSent; protected long streamingWritesCounter; // Number of streaming send operations started so far. - public AsyncCallBase(Func serializer, Func deserializer) + public AsyncCallBase(Action serializer, Func deserializer) { this.serializer = GrpcPreconditions.CheckNotNull(serializer); this.deserializer = GrpcPreconditions.CheckNotNull(deserializer); @@ -215,14 +215,26 @@ namespace Grpc.Core.Internal protected byte[] UnsafeSerialize(TWrite msg) { - return serializer(msg); + DefaultSerializationContext context = null; + try + { + context = DefaultSerializationContext.GetInitializedThreadLocal(); + serializer(msg, context); + return context.GetPayload(); + } + finally + { + context?.Reset(); + } } protected Exception TryDeserialize(byte[] payload, out TRead msg) { + DefaultDeserializationContext context = null; try { - msg = deserializer(payload); + context = DefaultDeserializationContext.GetInitializedThreadLocal(payload); + msg = deserializer(context); return null; } catch (Exception e) @@ -230,6 +242,11 @@ namespace Grpc.Core.Internal msg = default(TRead); return e; } + finally + { + context?.Reset(); + + } } /// diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 0ceca4abb8..0bf1fb3b7d 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -37,7 +37,7 @@ namespace Grpc.Core.Internal readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); readonly Server server; - public AsyncCallServer(Func serializer, Func deserializer, Server server) : base(serializer, deserializer) + public AsyncCallServer(Action serializer, Func deserializer, Server server) : base(serializer, deserializer) { this.server = GrpcPreconditions.CheckNotNull(server); } diff --git a/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs new file mode 100644 index 0000000000..7ace80e8d5 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs @@ -0,0 +1,66 @@ +#region Copyright notice and license + +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using Grpc.Core.Utils; +using System; +using System.Threading; + +namespace Grpc.Core.Internal +{ + internal class DefaultDeserializationContext : DeserializationContext + { + static readonly ThreadLocal threadLocalInstance = + new ThreadLocal(() => new DefaultDeserializationContext(), false); + + byte[] payload; + bool alreadyCalledPayloadAsNewBuffer; + + public DefaultDeserializationContext() + { + Reset(); + } + + public override int PayloadLength => payload.Length; + + public override byte[] PayloadAsNewBuffer() + { + GrpcPreconditions.CheckState(!alreadyCalledPayloadAsNewBuffer); + alreadyCalledPayloadAsNewBuffer = true; + return payload; + } + + public void Initialize(byte[] payload) + { + this.payload = GrpcPreconditions.CheckNotNull(payload); + this.alreadyCalledPayloadAsNewBuffer = false; + } + + public void Reset() + { + this.payload = null; + this.alreadyCalledPayloadAsNewBuffer = true; // mark payload as read + } + + public static DefaultDeserializationContext GetInitializedThreadLocal(byte[] payload) + { + var instance = threadLocalInstance.Value; + instance.Initialize(payload); + return instance; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs new file mode 100644 index 0000000000..cceb194879 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs @@ -0,0 +1,62 @@ +#region Copyright notice and license + +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using Grpc.Core.Utils; +using System.Threading; + +namespace Grpc.Core.Internal +{ + internal class DefaultSerializationContext : SerializationContext + { + static readonly ThreadLocal threadLocalInstance = + new ThreadLocal(() => new DefaultSerializationContext(), false); + + bool isComplete; + byte[] payload; + + public DefaultSerializationContext() + { + Reset(); + } + + public override void Complete(byte[] payload) + { + GrpcPreconditions.CheckState(!isComplete); + this.isComplete = true; + this.payload = payload; + } + + internal byte[] GetPayload() + { + return this.payload; + } + + public void Reset() + { + this.isComplete = false; + this.payload = null; + } + + public static DefaultSerializationContext GetInitializedThreadLocal() + { + var instance = threadLocalInstance.Value; + instance.Reset(); + return instance; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 81522cf8fe..ec732e8c7f 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -52,8 +52,8 @@ namespace Grpc.Core.Internal public async Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( - method.ResponseMarshaller.Serializer, - method.RequestMarshaller.Deserializer, + method.ResponseMarshaller.ContextualSerializer, + method.RequestMarshaller.ContextualDeserializer, newRpc.Server); asyncCall.Initialize(newRpc.Call, cq); @@ -116,8 +116,8 @@ namespace Grpc.Core.Internal public async Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( - method.ResponseMarshaller.Serializer, - method.RequestMarshaller.Deserializer, + method.ResponseMarshaller.ContextualSerializer, + method.RequestMarshaller.ContextualDeserializer, newRpc.Server); asyncCall.Initialize(newRpc.Call, cq); @@ -179,8 +179,8 @@ namespace Grpc.Core.Internal public async Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( - method.ResponseMarshaller.Serializer, - method.RequestMarshaller.Deserializer, + method.ResponseMarshaller.ContextualSerializer, + method.RequestMarshaller.ContextualDeserializer, newRpc.Server); asyncCall.Initialize(newRpc.Call, cq); @@ -242,8 +242,8 @@ namespace Grpc.Core.Internal public async Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( - method.ResponseMarshaller.Serializer, - method.RequestMarshaller.Deserializer, + method.ResponseMarshaller.ContextualSerializer, + method.RequestMarshaller.ContextualDeserializer, newRpc.Server); asyncCall.Initialize(newRpc.Call, cq); diff --git a/src/csharp/Grpc.Core/Marshaller.cs b/src/csharp/Grpc.Core/Marshaller.cs index 0af9aa586b..34a1849cd7 100644 --- a/src/csharp/Grpc.Core/Marshaller.cs +++ b/src/csharp/Grpc.Core/Marshaller.cs @@ -41,6 +41,8 @@ namespace Grpc.Core { this.serializer = GrpcPreconditions.CheckNotNull(serializer, nameof(serializer)); this.deserializer = GrpcPreconditions.CheckNotNull(deserializer, nameof(deserializer)); + // contextual serialization/deserialization is emulated to make the marshaller + // usable with the grpc library (required for backward compatibility). this.contextualSerializer = EmulateContextualSerializer; this.contextualDeserializer = EmulateContextualDeserializer; } @@ -57,10 +59,10 @@ namespace Grpc.Core { this.contextualSerializer = GrpcPreconditions.CheckNotNull(serializer, nameof(serializer)); this.contextualDeserializer = GrpcPreconditions.CheckNotNull(deserializer, nameof(deserializer)); - // TODO(jtattermusch): once gRPC C# library switches to using contextual (de)serializer, - // emulating the simple (de)serializer will become unnecessary. - this.serializer = EmulateSimpleSerializer; - this.deserializer = EmulateSimpleDeserializer; + // gRPC only uses contextual serializer/deserializer internally, so emulating the legacy + // (de)serializer is not necessary. + this.serializer = (msg) => { throw new NotImplementedException(); }; + this.deserializer = (payload) => { throw new NotImplementedException(); }; } /// @@ -85,25 +87,6 @@ namespace Grpc.Core /// public Func ContextualDeserializer => this.contextualDeserializer; - // for backward compatibility, emulate the simple serializer using the contextual one - private byte[] EmulateSimpleSerializer(T msg) - { - // TODO(jtattermusch): avoid the allocation by passing a thread-local instance - // This code will become unnecessary once gRPC C# library switches to using contextual (de)serializer. - var context = new EmulatedSerializationContext(); - this.contextualSerializer(msg, context); - return context.GetPayload(); - } - - // for backward compatibility, emulate the simple deserializer using the contextual one - private T EmulateSimpleDeserializer(byte[] payload) - { - // TODO(jtattermusch): avoid the allocation by passing a thread-local instance - // This code will become unnecessary once gRPC C# library switches to using contextual (de)serializer. - var context = new EmulatedDeserializationContext(payload); - return this.contextualDeserializer(context); - } - // for backward compatibility, emulate the contextual serializer using the simple one private void EmulateContextualSerializer(T message, SerializationContext context) { @@ -116,44 +99,6 @@ namespace Grpc.Core { return this.deserializer(context.PayloadAsNewBuffer()); } - - internal class EmulatedSerializationContext : SerializationContext - { - bool isComplete; - byte[] payload; - - public override void Complete(byte[] payload) - { - GrpcPreconditions.CheckState(!isComplete); - this.isComplete = true; - this.payload = payload; - } - - internal byte[] GetPayload() - { - return this.payload; - } - } - - internal class EmulatedDeserializationContext : DeserializationContext - { - readonly byte[] payload; - bool alreadyCalledPayloadAsNewBuffer; - - public EmulatedDeserializationContext(byte[] payload) - { - this.payload = GrpcPreconditions.CheckNotNull(payload); - } - - public override int PayloadLength => payload.Length; - - public override byte[] PayloadAsNewBuffer() - { - GrpcPreconditions.CheckState(!alreadyCalledPayloadAsNewBuffer); - alreadyCalledPayloadAsNewBuffer = true; - return payload; - } - } } /// diff --git a/src/csharp/Grpc.Core/SerializationContext.cs b/src/csharp/Grpc.Core/SerializationContext.cs index cf4d1595da..9aef2adbcd 100644 --- a/src/csharp/Grpc.Core/SerializationContext.cs +++ b/src/csharp/Grpc.Core/SerializationContext.cs @@ -16,6 +16,8 @@ #endregion +using System; + namespace Grpc.Core { /// @@ -29,6 +31,9 @@ namespace Grpc.Core /// payload which must not be accessed afterwards. /// /// the serialized form of current message - public abstract void Complete(byte[] payload); + public virtual void Complete(byte[] payload) + { + throw new NotImplementedException(); + } } } -- cgit v1.2.3 From 660d478c07151cfdad1b22ed4d1175e690a4c411 Mon Sep 17 00:00:00 2001 From: Derek Date: Sun, 11 Nov 2018 15:53:59 -0800 Subject: Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1960f44137..f00ff29479 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ gRPC - An RPC library and framework =================================== -gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. It enables client and server applications to communicate transparently, and makes it easier to build connected systems. +gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. gRPC enables client and server applications to communicate transparently, and simplifies the building of connected systems. @@ -18,10 +18,10 @@ gRPC is a modern, open source, high-performance remote procedure call (RPC) fram # To start using gRPC -To maximize usability, gRPC supports the standard way of adding dependencies in your language of choice (if there is one). -In most languages, the gRPC runtime comes in form of a package available in your language's package manager. +To maximize usability, gRPC supports the standard method for adding dependencies to a user's chosen language (if there is one). +In most languages, the gRPC runtime comes as a package available in a user's language package manager. -For instructions on how to use the language-specific gRPC runtime in your project, please refer to these documents +For instructions on how to use the language-specific gRPC runtime for a project, please refer to these documents * [C++](src/cpp): follow the instructions under the `src/cpp` directory * [C#](src/csharp): NuGet package `Grpc` @@ -35,7 +35,7 @@ For instructions on how to use the language-specific gRPC runtime in your projec * [Ruby](src/ruby): `gem install grpc` * [WebJS](https://github.com/grpc/grpc-web): follow the grpc-web instructions -You can find per-language quickstart guides and tutorials in [Documentation section on grpc.io website](https://grpc.io/docs/). The code examples are available in the [examples](examples) directory. +Per-language quickstart guides and tutorials can be found in the [documentation section on the grpc.io website](https://grpc.io/docs/). Code examples are available in the [examples](examples) directory. Precompiled bleeding-edge package builds of gRPC `master` branch's `HEAD` are uploaded daily to [packages.grpc.io](https://packages.grpc.io). @@ -43,9 +43,9 @@ Precompiled bleeding-edge package builds of gRPC `master` branch's `HEAD` are up Contributions are welcome! -Please read [How to contribute](CONTRIBUTING.md) which will guide you through the entire workflow of how to build the source code, how to run the tests and how to contribute your changes to +Please read [How to contribute](CONTRIBUTING.md) which will guide you through the entire workflow of how to build the source code, how to run the tests, and how to contribute changes to the gRPC codebase. -The document also contains info on how the contributing process works and contains best practices for creating contributions. +The "How to contribute" document also contains info on how the contribution process works and contains best practices for creating contributions. # Troubleshooting @@ -53,7 +53,7 @@ Sometimes things go wrong. Please check out the [Troubleshooting guide](TROUBLES # Performance -See [Performance dashboard](http://performance-dot-grpc-testing.appspot.com/explore?dashboard=5636470266134528) for the performance numbers for the latest released version. +See the [Performance dashboard](http://performance-dot-grpc-testing.appspot.com/explore?dashboard=5636470266134528) for performance numbers or the latest released version. # Concepts @@ -61,9 +61,9 @@ See [gRPC Concepts](CONCEPTS.md) # About This Repository -This repository contains source code for gRPC libraries for multiple languages written on top of shared C core library [src/core](src/core). +This repository contains source code for gRPC libraries implemented in multiple languages written on top of a shared C core library [src/core](src/core). -Libraries in different languages may be in different states of development. We are seeking contributions for all of these libraries. +Libraries in different languages may be in various states of development. We are seeking contributions for all of these libraries: | Language | Source | |-------------------------|-------------------------------------| -- cgit v1.2.3 From 350a8861ab778192eb65ea1404467d35b5cb3247 Mon Sep 17 00:00:00 2001 From: Srini Polavarapu Date: Tue, 13 Nov 2018 13:59:45 -0800 Subject: Bump version to 1.16.1 --- BUILD | 2 +- build.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index 6a98e3d5e6..040cea037f 100644 --- a/BUILD +++ b/BUILD @@ -68,7 +68,7 @@ g_stands_for = "gao" core_version = "6.0.0" -version = "1.16.1-pre1" +version = "1.16.1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 21ea1a8b5b..f18cd2da2c 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 6.0.0 g_stands_for: gao - version: 1.16.1-pre1 + version: 1.16.1 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From 25cd16ae58a47e9ec608e6b2b704a145585fb80a Mon Sep 17 00:00:00 2001 From: Srini Polavarapu Date: Tue, 13 Nov 2018 14:07:48 -0800 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 28 files changed, 33 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f5f69441c..fc76cf50da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.16.1-pre1") +set(PACKAGE_VERSION "1.16.1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 1f1f4a0671..8469a5fd50 100644 --- a/Makefile +++ b/Makefile @@ -438,8 +438,8 @@ Q = @ endif CORE_VERSION = 6.0.0 -CPP_VERSION = 1.16.1-pre1 -CSHARP_VERSION = 1.16.1-pre1 +CPP_VERSION = 1.16.1 +CSHARP_VERSION = 1.16.1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 959143f76e..a131d66a85 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.16.1-pre1' + # version = '1.16.1' version = '0.0.3' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.16.1-pre1' + grpc_version = '1.16.1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index ad95f2dbfd..6e3709efbb 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.16.1-pre1' + version = '1.16.1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 5fbd6f1983..019a2cc159 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.16.1-pre1' + version = '1.16.1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 3c479c2382..ba960f18d9 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.16.1-pre1' + version = '1.16.1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index f916b6cae0..41f52f9865 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.16.1-pre1' + version = '1.16.1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index d1890e9d2c..0e4fb2594f 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.16.1RC1 - 1.16.1RC1 + 1.16.1 + 1.16.1 - beta - beta + stable + stable Apache 2.0 diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 3c77ac6851..2d60fe82d3 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.16.1-pre1"; } +grpc::string Version() { return "1.16.1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 33b32cca21..5d2c77df59 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.16.1-pre1 + 1.16.1 3.6.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index c7d1bfeb03..0f9fde8b36 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.16.1-pre1"; + public const string CurrentVersion = "1.16.1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index efa9af8cae..0d9a33a8a9 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.1-pre1 +set VERSION=1.16.1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 693a46f146..129cf73b9f 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.16.1-pre1 +set VERSION=1.16.1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 28cabe1596..845224a844 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.16.1-pre1' + v = '1.16.1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 3ea30430f3..24eb706c8f 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.1-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.16.1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 179a3f33af..af984579e7 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.16.1-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.16.1" #define GRPC_C_VERSION_STRING @"6.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 3ac1169214..2fa1de6072 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.16.1RC1" +#define PHP_GRPC_VERSION "1.16.1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 8f3767cb6a..177c9bdcaf 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.16.1rc1""" +__version__ = """1.16.1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index eec2404853..d15b63b062 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 0691206487..ac1402b714 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index ddb294d14e..440427abc2 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index c3bcfec63a..02c6edc113 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 76c62e7640..3c62ae5131 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 7f17c940fd..c6eb4107bc 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.16.1.pre1' + VERSION = '1.16.1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 102e64ee07..2fd7927d96 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.16.1.pre1' + VERSION = '1.16.1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 7b0d362609..c9413a3376 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.16.1rc1' +VERSION = '1.16.1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 158c722b8a..a1743a1d4a 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.1-pre1 +PROJECT_NUMBER = 1.16.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 2acaa0689e..d8fc68c78d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.16.1-pre1 +PROJECT_NUMBER = 1.16.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From a01eeb47d7accb7378075e1128854f917292e6cf Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Mon, 12 Nov 2018 16:56:44 -0800 Subject: re-running tests, squashing commits --- config.m4 | 3 +- src/php/ext/grpc/channel.c | 2 + src/php/ext/grpc/channel.h | 3 ++ src/php/ext/grpc/php_grpc.c | 116 +++++++++++++++++++++++++++++++++++++++++++ templates/config.m4.template | 3 +- 5 files changed, 125 insertions(+), 2 deletions(-) diff --git a/config.m4 b/config.m4 index d0e22a8e43..fadae568ac 100644 --- a/config.m4 +++ b/config.m4 @@ -664,7 +664,8 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/third_party/fiat/curve25519.c \ , $ext_shared, , -fvisibility=hidden \ -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN \ - -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0) + -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 \ + -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1) PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index b17f3d9a61..c06bdea7fe 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -393,6 +393,8 @@ PHP_METHOD(Channel, __construct) { channel->wrapper->target = strdup(target); channel->wrapper->args_hashstr = strdup(sha1str); channel->wrapper->creds_hashstr = NULL; + channel->wrapper->creds = creds; + channel->wrapper->args = args; if (creds != NULL && creds->hashstr != NULL) { php_grpc_int creds_hashstr_len = strlen(creds->hashstr); char *channel_creds_hashstr = malloc(creds_hashstr_len + 1); diff --git a/src/php/ext/grpc/channel.h b/src/php/ext/grpc/channel.h index 27752c9a3f..ce17c4a58a 100644 --- a/src/php/ext/grpc/channel.h +++ b/src/php/ext/grpc/channel.h @@ -19,6 +19,7 @@ #ifndef NET_GRPC_PHP_GRPC_CHANNEL_H_ #define NET_GRPC_PHP_GRPC_CHANNEL_H_ +#include "channel_credentials.h" #include "php_grpc.h" /* Class entry for the PHP Channel class */ @@ -32,6 +33,8 @@ typedef struct _grpc_channel_wrapper { char *creds_hashstr; size_t ref_count; gpr_mu mu; + grpc_channel_args args; + wrapped_grpc_channel_credentials *creds; } grpc_channel_wrapper; /* Wrapper struct for grpc_channel that can be associated with a PHP object */ diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index fabd98975d..89ee9f7f1f 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -26,6 +26,8 @@ #include "call_credentials.h" #include "server_credentials.h" #include "completion_queue.h" +#include +#include ZEND_DECLARE_MODULE_GLOBALS(grpc) static PHP_GINIT_FUNCTION(grpc); @@ -86,6 +88,119 @@ ZEND_GET_MODULE(grpc) } */ /* }}} */ +void create_new_channel( + wrapped_grpc_channel *channel, + char *target, + grpc_channel_args args, + wrapped_grpc_channel_credentials *creds) { + if (creds == NULL) { + channel->wrapper->wrapped = grpc_insecure_channel_create(target, &args, + NULL); + } else { + channel->wrapper->wrapped = + grpc_secure_channel_create(creds->wrapped, target, &args, NULL); + } +} + +void acquire_persistent_locks() { + zval *data; + PHP_GRPC_HASH_FOREACH_VAL_START(&grpc_persistent_list, data) + php_grpc_zend_resource *rsrc = + (php_grpc_zend_resource*) PHP_GRPC_HASH_VALPTR_TO_VAL(data) + if (rsrc == NULL) { + break; + } + channel_persistent_le_t* le = rsrc->ptr; + + gpr_mu_lock(&le->channel->mu); + PHP_GRPC_HASH_FOREACH_END() +} + +void release_persistent_locks() { + zval *data; + PHP_GRPC_HASH_FOREACH_VAL_START(&grpc_persistent_list, data) + php_grpc_zend_resource *rsrc = + (php_grpc_zend_resource*) PHP_GRPC_HASH_VALPTR_TO_VAL(data) + if (rsrc == NULL) { + break; + } + channel_persistent_le_t* le = rsrc->ptr; + + gpr_mu_unlock(&le->channel->mu); + PHP_GRPC_HASH_FOREACH_END() +} + +void destroy_grpc_channels() { + zval *data; + PHP_GRPC_HASH_FOREACH_VAL_START(&grpc_persistent_list, data) + php_grpc_zend_resource *rsrc = + (php_grpc_zend_resource*) PHP_GRPC_HASH_VALPTR_TO_VAL(data) + if (rsrc == NULL) { + break; + } + channel_persistent_le_t* le = rsrc->ptr; + + wrapped_grpc_channel wrapped_channel; + wrapped_channel.wrapper = le->channel; + grpc_channel_wrapper *channel = wrapped_channel.wrapper; + grpc_channel_destroy(channel->wrapped); + PHP_GRPC_HASH_FOREACH_END() +} + +void restart_channels() { + zval *data; + PHP_GRPC_HASH_FOREACH_VAL_START(&grpc_persistent_list, data) + php_grpc_zend_resource *rsrc = + (php_grpc_zend_resource*) PHP_GRPC_HASH_VALPTR_TO_VAL(data) + if (rsrc == NULL) { + break; + } + channel_persistent_le_t* le = rsrc->ptr; + + wrapped_grpc_channel wrapped_channel; + wrapped_channel.wrapper = le->channel; + grpc_channel_wrapper *channel = wrapped_channel.wrapper; + create_new_channel(&wrapped_channel, channel->target, channel->args, + channel->creds); + gpr_mu_unlock(&channel->mu); + PHP_GRPC_HASH_FOREACH_END() +} + +void prefork() { + acquire_persistent_locks(); +} + +void postfork_child() { + // loop through persistant list and destroy all underlying grpc_channel objs + destroy_grpc_channels(); + + // clear completion queue + grpc_php_shutdown_completion_queue(); + + // clean-up grpc_core + grpc_shutdown(); + if (grpc_is_initialized() > 0) { + zend_throw_exception(spl_ce_UnexpectedValueException, + "Oops, failed to shutdown gRPC Core after fork()", + 1 TSRMLS_CC); + } + + // restart grpc_core + grpc_init(); + grpc_php_init_completion_queue(); + + // re-create grpc_channel and point wrapped to it + // unlock wrapped grpc channel mutex + restart_channels(); +} + +void postfork_parent() { + release_persistent_locks(); +} + +void register_fork_handlers() { + pthread_atfork(&prefork, &postfork_parent, &postfork_child); +} /* {{{ PHP_MINIT_FUNCTION */ @@ -265,6 +380,7 @@ PHP_MINFO_FUNCTION(grpc) { PHP_RINIT_FUNCTION(grpc) { if (!GRPC_G(initialized)) { grpc_init(); + register_fork_handlers(); grpc_php_init_completion_queue(TSRMLS_C); GRPC_G(initialized) = 1; } diff --git a/templates/config.m4.template b/templates/config.m4.template index 19f9904911..18378cfc34 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -45,7 +45,8 @@ % endfor , $ext_shared, , -fvisibility=hidden ${"\\"} -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"} - -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0) + -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 ${"\\"} + -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1) PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) <% -- cgit v1.2.3 From b0e5e6414e238400b577aa0af5da4f8a658945eb Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Tue, 13 Nov 2018 16:06:48 -0800 Subject: added check for GRPC_ENABLE_FORK_SUPPORT in register_fork_handlers --- src/php/ext/grpc/php_grpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 89ee9f7f1f..76d3dec814 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -199,7 +199,9 @@ void postfork_parent() { } void register_fork_handlers() { - pthread_atfork(&prefork, &postfork_parent, &postfork_child); + if(getenv("GRPC_ENABLE_FORK_SUPPORT")) { + pthread_atfork(&prefork, &postfork_parent, &postfork_child); + } } /* {{{ PHP_MINIT_FUNCTION -- cgit v1.2.3 From 644f6e28db78574eee6a0d1c8cbd9ae2e0f62aca Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Tue, 13 Nov 2018 17:10:06 -0800 Subject: fixed if --- .gitignore | 10 ++++++++++ src/php/ext/grpc/php_grpc.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cde82bc3d3..5cdcfe05ef 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,13 @@ bm_*.json # cmake build files /cmake/build + +# .vscode +**/.vscode/** + +# example files +examples/** + +third_party/** + +doc/** diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 76d3dec814..cbc7f63be0 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -199,7 +199,7 @@ void postfork_parent() { } void register_fork_handlers() { - if(getenv("GRPC_ENABLE_FORK_SUPPORT")) { + if (getenv("GRPC_ENABLE_FORK_SUPPORT")) { pthread_atfork(&prefork, &postfork_parent, &postfork_child); } } -- cgit v1.2.3 From bff1452e5ed589dde8137f7f0b58db9a5e8eb6e4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 14 Nov 2018 18:15:39 +0100 Subject: mark as experimental --- src/compiler/csharp_generator.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 82deabe064..59ddbd82f6 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -613,7 +613,10 @@ void GenerateBindServiceWithBinderMethod(Printer* out, const ServiceDescriptor* service) { out->Print( "/// Register service method implementations with a service " - "binder. Useful when customizing the service binding logic.\n"); + "binder. Useful when customizing the service binding logic.\n" + "/// Note: this method is part of an experimental API that can change or " + "be " + "removed without any prior notice.\n"); out->Print( "/// Service methods will be bound by " "calling AddMethod on this object." -- cgit v1.2.3 From b343917c5fcee8ab4c9dc615ea82bbbcb1df9983 Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Wed, 14 Nov 2018 09:43:52 -0800 Subject: revert .gitconfig --- .gitignore | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.gitignore b/.gitignore index 5cdcfe05ef..cde82bc3d3 100644 --- a/.gitignore +++ b/.gitignore @@ -134,13 +134,3 @@ bm_*.json # cmake build files /cmake/build - -# .vscode -**/.vscode/** - -# example files -examples/** - -third_party/** - -doc/** -- cgit v1.2.3 From 08980748091bf02db30ee89b6125313e6c9f971e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 14 Nov 2018 18:22:34 +0100 Subject: regenerate protos --- src/csharp/Grpc.Examples/MathGrpc.cs | 3 ++- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 3 ++- src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs | 3 ++- src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs | 3 ++- src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 3 ++- .../Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs | 3 ++- src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 9 ++++++--- src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs | 3 ++- src/csharp/Grpc.Reflection/ReflectionGrpc.cs | 3 ++- 9 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index ec2cfe8b28..e5be387e67 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -287,7 +287,8 @@ namespace Math { .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, MathBase serviceImpl) diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 7bffb7f6cc..51956f2f23 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -233,7 +233,8 @@ namespace Grpc.Health.V1 { .AddMethod(__Method_Watch, serviceImpl.Watch).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, HealthBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index b4fa16fc35..3431b5fa18 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -324,7 +324,8 @@ namespace Grpc.Testing { .AddMethod(__Method_StreamingBothWays, serviceImpl.StreamingBothWays).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, BenchmarkServiceBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs index ee2f0ccff7..7e77f8d114 100644 --- a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -80,7 +80,8 @@ namespace Grpc.Testing { return grpc::ServerServiceDefinition.CreateBuilder().Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, EmptyServiceBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 74595ab5dc..c66a9a9161 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -193,7 +193,8 @@ namespace Grpc.Testing { .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, MetricsServiceBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index 21f4545a86..954c172272 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -143,7 +143,8 @@ namespace Grpc.Testing { .AddMethod(__Method_ReportScenario, serviceImpl.ReportScenario).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, ReportQpsScenarioServiceBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 38d596c750..d125fd5627 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -539,7 +539,8 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, TestServiceBase serviceImpl) @@ -676,7 +677,8 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, UnimplementedServiceBase serviceImpl) @@ -802,7 +804,8 @@ namespace Grpc.Testing { .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, ReconnectServiceBase serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index dd31b08d78..5b22337d53 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -321,7 +321,8 @@ namespace Grpc.Testing { .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, WorkerServiceBase serviceImpl) diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index 09b916bf77..ed55c2f584 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -123,7 +123,8 @@ namespace Grpc.Reflection.V1Alpha { .AddMethod(__Method_ServerReflectionInfo, serviceImpl.ServerReflectionInfo).Build(); } - /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Register service method implementations with a service binder. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. /// Service methods will be bound by calling AddMethod on this object. /// An object implementing the server-side handling logic. public static void BindService(grpc::ServiceBinderBase serviceBinder, ServerReflectionBase serviceImpl) -- cgit v1.2.3 From edab4e773e05f3736133c8ad26afbb3a9bc0a9c0 Mon Sep 17 00:00:00 2001 From: Vishal Powar Date: Wed, 14 Nov 2018 11:07:47 -0800 Subject: Add envoy and its dependent repos as submodules in third_party The basic criteria is to have protoc generate code for envoy api's and this change achieves that. e.g. protoc -I=$PWD -I=$PWD/third_party/data-plane-api -I=$PWD/third_party/googleapis -I=$PWD/third_party/protobuf -I=$PWD/third_party/protoc-gen-validate third_party/data-plane-api/envoy/api/v2/eds.proto --- .gitmodules | 9 +++++++++ third_party/data-plane-api | 1 + third_party/googleapis | 1 + third_party/protoc-gen-validate | 1 + 4 files changed, 12 insertions(+) create mode 160000 third_party/data-plane-api create mode 160000 third_party/googleapis create mode 160000 third_party/protoc-gen-validate diff --git a/.gitmodules b/.gitmodules index afde4d34f3..bb4b749bee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,3 +42,12 @@ path = third_party/libcxx url = https://github.com/llvm-mirror/libcxx.git branch = release_60 +[submodule "third_party/data-plane-api"] + path = third_party/data-plane-api + url = https://github.com/envoyproxy/data-plane-api.git +[submodule "third_party/googleapis"] + path = third_party/googleapis + url = https://github.com/googleapis/googleapis.git +[submodule "third_party/protoc-gen-validate"] + path = third_party/protoc-gen-validate + url = https://github.com/lyft/protoc-gen-validate.git diff --git a/third_party/data-plane-api b/third_party/data-plane-api new file mode 160000 index 0000000000..911001cdca --- /dev/null +++ b/third_party/data-plane-api @@ -0,0 +1 @@ +Subproject commit 911001cdca003337bdb93fab32740cde61bafee3 diff --git a/third_party/googleapis b/third_party/googleapis new file mode 160000 index 0000000000..80ed4d0bbf --- /dev/null +++ b/third_party/googleapis @@ -0,0 +1 @@ +Subproject commit 80ed4d0bbf65d57cc267dfc63bd2584557f11f9b diff --git a/third_party/protoc-gen-validate b/third_party/protoc-gen-validate new file mode 160000 index 0000000000..e143189bf6 --- /dev/null +++ b/third_party/protoc-gen-validate @@ -0,0 +1 @@ +Subproject commit e143189bf6f37b3957fb31743df6a1bcf4a8c685 -- cgit v1.2.3 From 862bba6fb42e06f9fd6651a8fe4202be359ab665 Mon Sep 17 00:00:00 2001 From: Vishal Powar Date: Wed, 14 Nov 2018 11:09:55 -0800 Subject: Updating sanity check for submodules --- tools/run_tests/sanity/check_submodules.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 8ea53dfec5..fa2628f18e 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -32,11 +32,14 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" b29b21a81b32ec273f118f589f46d56ad3332420 third_party/boringssl (remotes/origin/chromium-stable) afc30d43eef92979b05776ec0963c9cede5fb80f third_party/boringssl-with-bazel (fips-20180716-116-gafc30d43e) 3be1924221e1326df520f8498d704a5c4c8d0cce third_party/cares/cares (cares-1_13_0) + 911001cdca003337bdb93fab32740cde61bafee3 third_party/data-plane-api (heads/master) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0-5-g30dbc81) + 80ed4d0bbf65d57cc267dfc63bd2584557f11f9b third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb) ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) 6599cac0965be8e5a835ab7a5684bbef033d5ad0 third_party/libcxx (heads/release_60) 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 48cb18e5c419ddd23d9badcfe4e9df7bde1979b2 third_party/protobuf (v3.6.0.1-37-g48cb18e5) + e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF -- cgit v1.2.3 From a9bee9b7edb4045efd52b0e238d07485a791162f Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 14 Nov 2018 17:48:35 -0800 Subject: Make Pluck use the changes made in FinalizeResult --- include/grpcpp/impl/codegen/completion_queue.h | 3 +-- src/cpp/server/server_cc.cc | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/grpcpp/impl/codegen/completion_queue.h b/include/grpcpp/impl/codegen/completion_queue.h index d603c7c700..fb38788f7d 100644 --- a/include/grpcpp/impl/codegen/completion_queue.h +++ b/include/grpcpp/impl/codegen/completion_queue.h @@ -307,8 +307,7 @@ class CompletionQueue : private GrpcLibraryCodegen { void* ignored = tag; if (tag->FinalizeResult(&ignored, &ok)) { GPR_CODEGEN_ASSERT(ignored == tag); - // Ignore mutations by FinalizeResult: Pluck returns the C API status - return ev.success != 0; + return ok; } } } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 7a98bce507..a703411c2a 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -84,10 +84,7 @@ class ShutdownTag : public internal::CompletionQueueTag { class DummyTag : public internal::CompletionQueueTag { public: - bool FinalizeResult(void** tag, bool* status) { - *status = true; - return true; - } + bool FinalizeResult(void** tag, bool* status) { return true; } }; class UnimplementedAsyncRequestContext { -- cgit v1.2.3 From d18458720c03e13b062d9726561dfbaff33644ab Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 15 Nov 2018 08:27:35 -0800 Subject: Don't reset channel state on resolver failure when LB policy exists. --- .../ext/filters/client_channel/client_channel.cc | 2 ++ .../client_channel/resolver/fake/fake_resolver.cc | 17 +++++++++++++++-- .../client_channel/resolver/fake/fake_resolver.h | 4 ++++ test/cpp/end2end/client_lb_end2end_test.cc | 22 ++++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 8e9ee889e1..38036c9718 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -597,6 +597,8 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) { if (grpc_client_channel_trace.enabled()) { gpr_log(GPR_INFO, "chand=%p: resolver transient failure", chand); } + // Don't override connectivity state if we already have an LB policy. + if (chand->lb_policy != nullptr) set_connectivity_state = false; } else { grpc_core::UniquePtr lb_policy_name = get_lb_policy_name_from_resolver_result_locked(chand); diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc index 144ac24a56..3aa690bea4 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc @@ -103,7 +103,7 @@ void FakeResolver::NextLocked(grpc_channel_args** target_result, } void FakeResolver::RequestReresolutionLocked() { - if (reresolution_results_ != nullptr) { + if (reresolution_results_ != nullptr || return_failure_) { grpc_channel_args_destroy(next_results_); next_results_ = grpc_channel_args_copy(reresolution_results_); MaybeFinishNextLocked(); @@ -141,6 +141,7 @@ struct SetResponseClosureArg { grpc_closure set_response_closure; FakeResolverResponseGenerator* generator; grpc_channel_args* response; + bool immediate = true; }; void FakeResolverResponseGenerator::SetResponseLocked(void* arg, @@ -194,7 +195,7 @@ void FakeResolverResponseGenerator::SetFailureLocked(void* arg, SetResponseClosureArg* closure_arg = static_cast(arg); FakeResolver* resolver = closure_arg->generator->resolver_; resolver->return_failure_ = true; - resolver->MaybeFinishNextLocked(); + if (closure_arg->immediate) resolver->MaybeFinishNextLocked(); Delete(closure_arg); } @@ -209,6 +210,18 @@ void FakeResolverResponseGenerator::SetFailure() { GRPC_ERROR_NONE); } +void FakeResolverResponseGenerator::SetFailureOnReresolution() { + GPR_ASSERT(resolver_ != nullptr); + SetResponseClosureArg* closure_arg = New(); + closure_arg->generator = this; + closure_arg->immediate = false; + GRPC_CLOSURE_SCHED( + GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked, + closure_arg, + grpc_combiner_scheduler(resolver_->combiner())), + GRPC_ERROR_NONE); +} + namespace { static void* response_generator_arg_copy(void* p) { diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h index 74a3062e7f..7f69059351 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h @@ -61,6 +61,10 @@ class FakeResolverResponseGenerator // returning a null result with no error). void SetFailure(); + // Same as SetFailure(), but instead of returning the error + // immediately, waits for the next call to RequestReresolutionLocked(). + void SetFailureOnReresolution(); + // Returns a channel arg containing \a generator. static grpc_arg MakeChannelArg(FakeResolverResponseGenerator* generator); diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index d13fb23796..312065a2df 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -191,6 +191,11 @@ class ClientLbEnd2endTest : public ::testing::Test { grpc_channel_args_destroy(fake_results); } + void SetFailureOnReresolution() { + grpc_core::ExecCtx exec_ctx; + response_generator_->SetFailureOnReresolution(); + } + std::vector GetServersPorts() { std::vector ports; for (const auto& server : servers_) ports.push_back(server->port_); @@ -728,6 +733,23 @@ TEST_F(ClientLbEnd2endTest, PickFirstCheckStateBeforeStartWatch) { EXPECT_EQ("pick_first", channel_2->GetLoadBalancingPolicyName()); } +TEST_F(ClientLbEnd2endTest, PickFirstIdleOnDisconnect) { + // Start server, send RPC, and make sure channel is READY. + const int kNumServers = 1; + StartServers(kNumServers); + auto channel = BuildChannel(""); // pick_first is the default. + auto stub = BuildStub(channel); + SetNextResolution(GetServersPorts()); + CheckRpcSendOk(stub, DEBUG_LOCATION); + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_READY); + // Stop server. Channel should go into state IDLE. + SetFailureOnReresolution(); + servers_[0]->Shutdown(); + EXPECT_TRUE(WaitForChannelNotReady(channel.get())); + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_IDLE); + servers_.clear(); +} + TEST_F(ClientLbEnd2endTest, RoundRobin) { // Start servers and send one RPC per server. const int kNumServers = 3; -- cgit v1.2.3 From c25d2445f77dc0ae585d5ca0c0308c103043335f Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 12 Nov 2018 13:50:32 -0500 Subject: Add grpc_core::RefCount and use it for RefCountedPtr --- src/core/lib/gprpp/ref_counted.h | 73 +++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 16 deletions(-) diff --git a/src/core/lib/gprpp/ref_counted.h b/src/core/lib/gprpp/ref_counted.h index 81772f3403..e366445bff 100644 --- a/src/core/lib/gprpp/ref_counted.h +++ b/src/core/lib/gprpp/ref_counted.h @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include "src/core/lib/debug/trace.h" @@ -42,7 +44,7 @@ class PolymorphicRefCount { protected: GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE - virtual ~PolymorphicRefCount() {} + virtual ~PolymorphicRefCount() = default; }; // NonPolymorphicRefCount does not enforce polymorphic destruction of @@ -55,7 +57,48 @@ class NonPolymorphicRefCount { protected: GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE - ~NonPolymorphicRefCount() {} + ~NonPolymorphicRefCount() = default; +}; + +// RefCount is a simple atomic ref-count. +// +// This is a C++ implementation of gpr_refcount, with inline functions. Due to +// inline functions, this class is significantly more efficient than +// gpr_refcount and should be preferred over gpr_refcount whenever possible. +// +// TODO(soheil): Remove gpr_refcount after submitting the GRFC and the paragraph +// above. +class RefCount { + public: + using Value = intptr_t; + + // `init` is the initial refcount stored in this object. + constexpr explicit RefCount(Value init = 1) : value_(init) {} + + // Increases the ref-count by `n`. + void Ref(Value n = 1) { value_.fetch_add(n, std::memory_order_relaxed); } + + // Similar to Ref() with an assert on the ref-count being non-zero. + void RefNonZero() { +#ifndef NDEBUG + const Value prior = value_.fetch_add(1, std::memory_order_relaxed); + assert(prior > 0); +#else + Ref(); +#endif + } + + // Decrements the ref-count and returns true if the ref-count reaches 0. + bool Unref() { + const Value prior = value_.fetch_sub(1, std::memory_order_acq_rel); + GPR_DEBUG_ASSERT(prior > 0); + return prior == 1; + } + + Value get() const { return value_.load(std::memory_order_relaxed); } + + private: + std::atomic value_; }; // A base class for reference-counted objects. @@ -97,7 +140,7 @@ class RefCounted : public Impl { // private, since it will only be used by RefCountedPtr<>, which is a // friend of this class. void Unref() { - if (gpr_unref(&refs_)) { + if (refs_.Unref()) { Delete(static_cast(this)); } } @@ -111,19 +154,19 @@ class RefCounted : public Impl { protected: GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE - RefCounted() { gpr_ref_init(&refs_, 1); } + RefCounted() = default; // Note: Depending on the Impl used, this dtor can be implicitly virtual. - ~RefCounted() {} + ~RefCounted() = default; private: // Allow RefCountedPtr<> to access IncrementRefCount(). template friend class RefCountedPtr; - void IncrementRefCount() { gpr_ref(&refs_); } + void IncrementRefCount() { refs_.Ref(); } - gpr_refcount refs_; + RefCount refs_; }; // An alternative version of the RefCounted base class that @@ -143,7 +186,7 @@ class RefCountedWithTracing : public Impl { RefCountedPtr Ref(const DebugLocation& location, const char* reason) GRPC_MUST_USE_RESULT { if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { - gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + const RefCount::Value old_refs = refs_.get(); gpr_log(GPR_INFO, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", trace_flag_->name(), this, location.file(), location.line(), old_refs, old_refs + 1, reason); @@ -157,14 +200,14 @@ class RefCountedWithTracing : public Impl { // friend of this class. void Unref() { - if (gpr_unref(&refs_)) { + if (refs_.Unref()) { Delete(static_cast(this)); } } void Unref(const DebugLocation& location, const char* reason) { if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { - gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + const RefCount::Value old_refs = refs_.get(); gpr_log(GPR_INFO, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s", trace_flag_->name(), this, location.file(), location.line(), old_refs, old_refs - 1, reason); @@ -185,9 +228,7 @@ class RefCountedWithTracing : public Impl { : RefCountedWithTracing(static_cast(nullptr)) {} explicit RefCountedWithTracing(TraceFlag* trace_flag) - : trace_flag_(trace_flag) { - gpr_ref_init(&refs_, 1); - } + : trace_flag_(trace_flag) {} #ifdef NDEBUG explicit RefCountedWithTracing(DebugOnlyTraceFlag* trace_flag) @@ -195,17 +236,17 @@ class RefCountedWithTracing : public Impl { #endif // Note: Depending on the Impl used, this dtor can be implicitly virtual. - ~RefCountedWithTracing() {} + ~RefCountedWithTracing() = default; private: // Allow RefCountedPtr<> to access IncrementRefCount(). template friend class RefCountedPtr; - void IncrementRefCount() { gpr_ref(&refs_); } + void IncrementRefCount() { refs_.Ref(); } TraceFlag* trace_flag_ = nullptr; - gpr_refcount refs_; + RefCount refs_; }; } // namespace grpc_core -- cgit v1.2.3 From 8a880801aea7d82a792635c9d26271218efcbad3 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Thu, 15 Nov 2018 13:11:45 -0800 Subject: Add support for LB config in service config --- BUILD | 4 +- CMakeLists.txt | 12 +- Makefile | 12 +- build.yaml | 4 +- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 6 +- grpc.gemspec | 4 +- grpc.gyp | 8 +- package.xml | 4 +- .../ext/filters/client_channel/client_channel.cc | 163 ++------- src/core/ext/filters/client_channel/lb_policy.h | 9 +- .../client_channel/lb_policy/grpclb/grpclb.cc | 7 +- .../lb_policy/pick_first/pick_first.cc | 8 +- .../lb_policy/round_robin/round_robin.cc | 8 +- .../filters/client_channel/lb_policy/xds/xds.cc | 10 +- .../filters/client_channel/lb_policy_registry.cc | 5 + .../filters/client_channel/lb_policy_registry.h | 4 + .../ext/filters/client_channel/method_params.cc | 178 ---------- .../ext/filters/client_channel/method_params.h | 78 ----- .../resolver/dns/c_ares/dns_resolver_ares.cc | 23 +- .../client_channel/resolver_result_parsing.cc | 384 +++++++++++++++++++++ .../client_channel/resolver_result_parsing.h | 146 ++++++++ src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.core.internal | 4 +- tools/run_tests/generated/sources_and_headers.json | 6 +- 27 files changed, 628 insertions(+), 467 deletions(-) delete mode 100644 src/core/ext/filters/client_channel/method_params.cc delete mode 100644 src/core/ext/filters/client_channel/method_params.h create mode 100644 src/core/ext/filters/client_channel/resolver_result_parsing.cc create mode 100644 src/core/ext/filters/client_channel/resolver_result_parsing.h diff --git a/BUILD b/BUILD index d572285233..e4c40ad57b 100644 --- a/BUILD +++ b/BUILD @@ -1048,12 +1048,12 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy.cc", "src/core/ext/filters/client_channel/lb_policy_factory.cc", "src/core/ext/filters/client_channel/lb_policy_registry.cc", - "src/core/ext/filters/client_channel/method_params.cc", "src/core/ext/filters/client_channel/parse_address.cc", "src/core/ext/filters/client_channel/proxy_mapper.cc", "src/core/ext/filters/client_channel/proxy_mapper_registry.cc", "src/core/ext/filters/client_channel/resolver.cc", "src/core/ext/filters/client_channel/resolver_registry.cc", + "src/core/ext/filters/client_channel/resolver_result_parsing.cc", "src/core/ext/filters/client_channel/retry_throttle.cc", "src/core/ext/filters/client_channel/subchannel.cc", "src/core/ext/filters/client_channel/subchannel_index.cc", @@ -1070,13 +1070,13 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy.h", "src/core/ext/filters/client_channel/lb_policy_factory.h", "src/core/ext/filters/client_channel/lb_policy_registry.h", - "src/core/ext/filters/client_channel/method_params.h", "src/core/ext/filters/client_channel/parse_address.h", "src/core/ext/filters/client_channel/proxy_mapper.h", "src/core/ext/filters/client_channel/proxy_mapper_registry.h", "src/core/ext/filters/client_channel/resolver.h", "src/core/ext/filters/client_channel/resolver_factory.h", "src/core/ext/filters/client_channel/resolver_registry.h", + "src/core/ext/filters/client_channel/resolver_result_parsing.h", "src/core/ext/filters/client_channel/retry_throttle.h", "src/core/ext/filters/client_channel/subchannel.h", "src/core/ext/filters/client_channel/subchannel_index.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cf60b1b28..5c2ba2048c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1240,12 +1240,12 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc @@ -1591,12 +1591,12 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc @@ -1962,12 +1962,12 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc @@ -2281,12 +2281,12 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc @@ -2613,12 +2613,12 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc @@ -3464,12 +3464,12 @@ add_library(grpc++_cronet src/core/ext/filters/client_channel/lb_policy.cc src/core/ext/filters/client_channel/lb_policy_factory.cc src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/method_params.cc src/core/ext/filters/client_channel/parse_address.cc src/core/ext/filters/client_channel/proxy_mapper.cc src/core/ext/filters/client_channel/proxy_mapper_registry.cc src/core/ext/filters/client_channel/resolver.cc src/core/ext/filters/client_channel/resolver_registry.cc + src/core/ext/filters/client_channel/resolver_result_parsing.cc src/core/ext/filters/client_channel/retry_throttle.cc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc diff --git a/Makefile b/Makefile index 5ef7e83b11..5aa8d6dd7b 100644 --- a/Makefile +++ b/Makefile @@ -3715,12 +3715,12 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ @@ -4060,12 +4060,12 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ @@ -4424,12 +4424,12 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ @@ -4729,12 +4729,12 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ @@ -5034,12 +5034,12 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ @@ -5860,12 +5860,12 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ diff --git a/build.yaml b/build.yaml index 831aef419e..09acdbe6f1 100644 --- a/build.yaml +++ b/build.yaml @@ -580,13 +580,13 @@ filegroups: - src/core/ext/filters/client_channel/lb_policy.h - src/core/ext/filters/client_channel/lb_policy_factory.h - src/core/ext/filters/client_channel/lb_policy_registry.h - - src/core/ext/filters/client_channel/method_params.h - src/core/ext/filters/client_channel/parse_address.h - src/core/ext/filters/client_channel/proxy_mapper.h - src/core/ext/filters/client_channel/proxy_mapper_registry.h - src/core/ext/filters/client_channel/resolver.h - src/core/ext/filters/client_channel/resolver_factory.h - src/core/ext/filters/client_channel/resolver_registry.h + - src/core/ext/filters/client_channel/resolver_result_parsing.h - src/core/ext/filters/client_channel/retry_throttle.h - src/core/ext/filters/client_channel/subchannel.h - src/core/ext/filters/client_channel/subchannel_index.h @@ -604,12 +604,12 @@ filegroups: - src/core/ext/filters/client_channel/lb_policy.cc - src/core/ext/filters/client_channel/lb_policy_factory.cc - src/core/ext/filters/client_channel/lb_policy_registry.cc - - src/core/ext/filters/client_channel/method_params.cc - src/core/ext/filters/client_channel/parse_address.cc - src/core/ext/filters/client_channel/proxy_mapper.cc - src/core/ext/filters/client_channel/proxy_mapper_registry.cc - src/core/ext/filters/client_channel/resolver.cc - src/core/ext/filters/client_channel/resolver_registry.cc + - src/core/ext/filters/client_channel/resolver_result_parsing.cc - src/core/ext/filters/client_channel/retry_throttle.cc - src/core/ext/filters/client_channel/subchannel.cc - src/core/ext/filters/client_channel/subchannel_index.cc diff --git a/config.m4 b/config.m4 index fadae568ac..a087a6b48b 100644 --- a/config.m4 +++ b/config.m4 @@ -349,12 +349,12 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy.cc \ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/method_params.cc \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/proxy_mapper.cc \ src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ src/core/ext/filters/client_channel/resolver.cc \ src/core/ext/filters/client_channel/resolver_registry.cc \ + src/core/ext/filters/client_channel/resolver_result_parsing.cc \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ diff --git a/config.w32 b/config.w32 index 07473ff5a9..12520fef3b 100644 --- a/config.w32 +++ b/config.w32 @@ -324,12 +324,12 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy_factory.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy_registry.cc " + - "src\\core\\ext\\filters\\client_channel\\method_params.cc " + "src\\core\\ext\\filters\\client_channel\\parse_address.cc " + "src\\core\\ext\\filters\\client_channel\\proxy_mapper.cc " + "src\\core\\ext\\filters\\client_channel\\proxy_mapper_registry.cc " + "src\\core\\ext\\filters\\client_channel\\resolver.cc " + "src\\core\\ext\\filters\\client_channel\\resolver_registry.cc " + + "src\\core\\ext\\filters\\client_channel\\resolver_result_parsing.cc " + "src\\core\\ext\\filters\\client_channel\\retry_throttle.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_index.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index b9f5900751..5fd3945efb 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -347,13 +347,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy.h', 'src/core/ext/filters/client_channel/lb_policy_factory.h', 'src/core/ext/filters/client_channel/lb_policy_registry.h', - 'src/core/ext/filters/client_channel/method_params.h', 'src/core/ext/filters/client_channel/parse_address.h', 'src/core/ext/filters/client_channel/proxy_mapper.h', 'src/core/ext/filters/client_channel/proxy_mapper_registry.h', 'src/core/ext/filters/client_channel/resolver.h', 'src/core/ext/filters/client_channel/resolver_factory.h', 'src/core/ext/filters/client_channel/resolver_registry.h', + 'src/core/ext/filters/client_channel/resolver_result_parsing.h', 'src/core/ext/filters/client_channel/retry_throttle.h', 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 189decc18a..f0a715cb58 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -345,13 +345,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy.h', 'src/core/ext/filters/client_channel/lb_policy_factory.h', 'src/core/ext/filters/client_channel/lb_policy_registry.h', - 'src/core/ext/filters/client_channel/method_params.h', 'src/core/ext/filters/client_channel/parse_address.h', 'src/core/ext/filters/client_channel/proxy_mapper.h', 'src/core/ext/filters/client_channel/proxy_mapper_registry.h', 'src/core/ext/filters/client_channel/resolver.h', 'src/core/ext/filters/client_channel/resolver_factory.h', 'src/core/ext/filters/client_channel/resolver_registry.h', + 'src/core/ext/filters/client_channel/resolver_result_parsing.h', 'src/core/ext/filters/client_channel/retry_throttle.h', 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', @@ -785,12 +785,12 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', @@ -962,13 +962,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy.h', 'src/core/ext/filters/client_channel/lb_policy_factory.h', 'src/core/ext/filters/client_channel/lb_policy_registry.h', - 'src/core/ext/filters/client_channel/method_params.h', 'src/core/ext/filters/client_channel/parse_address.h', 'src/core/ext/filters/client_channel/proxy_mapper.h', 'src/core/ext/filters/client_channel/proxy_mapper_registry.h', 'src/core/ext/filters/client_channel/resolver.h', 'src/core/ext/filters/client_channel/resolver_factory.h', 'src/core/ext/filters/client_channel/resolver_registry.h', + 'src/core/ext/filters/client_channel/resolver_result_parsing.h', 'src/core/ext/filters/client_channel/retry_throttle.h', 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', diff --git a/grpc.gemspec b/grpc.gemspec index d8e5aac13c..04f3066899 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -281,13 +281,13 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy_factory.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy_registry.h ) - s.files += %w( src/core/ext/filters/client_channel/method_params.h ) s.files += %w( src/core/ext/filters/client_channel/parse_address.h ) s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.h ) s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.h ) s.files += %w( src/core/ext/filters/client_channel/resolver.h ) s.files += %w( src/core/ext/filters/client_channel/resolver_factory.h ) s.files += %w( src/core/ext/filters/client_channel/resolver_registry.h ) + s.files += %w( src/core/ext/filters/client_channel/resolver_result_parsing.h ) s.files += %w( src/core/ext/filters/client_channel/retry_throttle.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.h ) @@ -724,12 +724,12 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy_factory.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy_registry.cc ) - s.files += %w( src/core/ext/filters/client_channel/method_params.cc ) s.files += %w( src/core/ext/filters/client_channel/parse_address.cc ) s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.cc ) s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver_registry.cc ) + s.files += %w( src/core/ext/filters/client_channel/resolver_result_parsing.cc ) s.files += %w( src/core/ext/filters/client_channel/retry_throttle.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.cc ) diff --git a/grpc.gyp b/grpc.gyp index ae97b8b0ee..b7352f820a 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -541,12 +541,12 @@ 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', @@ -800,12 +800,12 @@ 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', @@ -1039,12 +1039,12 @@ 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', @@ -1290,12 +1290,12 @@ 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', diff --git a/package.xml b/package.xml index fb41e5f34a..3044cbf862 100644 --- a/package.xml +++ b/package.xml @@ -286,13 +286,13 @@ - + @@ -729,12 +729,12 @@ - + diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 8e9ee889e1..d94e20124e 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -34,9 +34,9 @@ #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/ext/filters/client_channel/http_connect_handshaker.h" #include "src/core/ext/filters/client_channel/lb_policy_registry.h" -#include "src/core/ext/filters/client_channel/method_params.h" #include "src/core/ext/filters/client_channel/proxy_mapper_registry.h" #include "src/core/ext/filters/client_channel/resolver_registry.h" +#include "src/core/ext/filters/client_channel/resolver_result_parsing.h" #include "src/core/ext/filters/client_channel/retry_throttle.h" #include "src/core/ext/filters/client_channel/subchannel.h" #include "src/core/ext/filters/deadline/deadline_filter.h" @@ -63,6 +63,8 @@ #include "src/core/lib/transport/status_metadata.h" using grpc_core::internal::ClientChannelMethodParams; +using grpc_core::internal::ClientChannelMethodParamsTable; +using grpc_core::internal::ProcessedResolverResult; using grpc_core::internal::ServerRetryThrottleData; /* Client channel implementation */ @@ -83,10 +85,6 @@ grpc_core::TraceFlag grpc_client_channel_trace(false, "client_channel"); struct external_connectivity_watcher; -typedef grpc_core::SliceHashTable< - grpc_core::RefCountedPtr> - MethodParamsTable; - typedef struct client_channel_channel_data { grpc_core::OrphanablePtr resolver; bool started_resolving; @@ -102,7 +100,7 @@ typedef struct client_channel_channel_data { /** retry throttle data */ grpc_core::RefCountedPtr retry_throttle_data; /** maps method names to method_parameters structs */ - grpc_core::RefCountedPtr method_params_table; + grpc_core::RefCountedPtr method_params_table; /** incoming resolver result - set by resolver.next() */ grpc_channel_args* resolver_result; /** a list of closures that are all waiting for resolver result to come in */ @@ -251,66 +249,6 @@ static void start_resolving_locked(channel_data* chand) { &chand->on_resolver_result_changed); } -typedef struct { - char* server_name; - grpc_core::RefCountedPtr retry_throttle_data; -} service_config_parsing_state; - -static void parse_retry_throttle_params( - const grpc_json* field, service_config_parsing_state* parsing_state) { - if (strcmp(field->key, "retryThrottling") == 0) { - if (parsing_state->retry_throttle_data != nullptr) return; // Duplicate. - if (field->type != GRPC_JSON_OBJECT) return; - int max_milli_tokens = 0; - int milli_token_ratio = 0; - for (grpc_json* sub_field = field->child; sub_field != nullptr; - sub_field = sub_field->next) { - if (sub_field->key == nullptr) return; - if (strcmp(sub_field->key, "maxTokens") == 0) { - if (max_milli_tokens != 0) return; // Duplicate. - if (sub_field->type != GRPC_JSON_NUMBER) return; - max_milli_tokens = gpr_parse_nonnegative_int(sub_field->value); - if (max_milli_tokens == -1) return; - max_milli_tokens *= 1000; - } else if (strcmp(sub_field->key, "tokenRatio") == 0) { - if (milli_token_ratio != 0) return; // Duplicate. - if (sub_field->type != GRPC_JSON_NUMBER) return; - // We support up to 3 decimal digits. - size_t whole_len = strlen(sub_field->value); - uint32_t multiplier = 1; - uint32_t decimal_value = 0; - const char* decimal_point = strchr(sub_field->value, '.'); - if (decimal_point != nullptr) { - whole_len = static_cast(decimal_point - sub_field->value); - multiplier = 1000; - size_t decimal_len = strlen(decimal_point + 1); - if (decimal_len > 3) decimal_len = 3; - if (!gpr_parse_bytes_to_uint32(decimal_point + 1, decimal_len, - &decimal_value)) { - return; - } - uint32_t decimal_multiplier = 1; - for (size_t i = 0; i < (3 - decimal_len); ++i) { - decimal_multiplier *= 10; - } - decimal_value *= decimal_multiplier; - } - uint32_t whole_value; - if (!gpr_parse_bytes_to_uint32(sub_field->value, whole_len, - &whole_value)) { - return; - } - milli_token_ratio = - static_cast((whole_value * multiplier) + decimal_value); - if (milli_token_ratio <= 0) return; - } - } - parsing_state->retry_throttle_data = - grpc_core::internal::ServerRetryThrottleMap::GetDataForServer( - parsing_state->server_name, max_milli_tokens, milli_token_ratio); - } -} - // Invoked from the resolver NextLocked() callback when the resolver // is shutting down. static void on_resolver_shutdown_locked(channel_data* chand, @@ -352,37 +290,6 @@ static void on_resolver_shutdown_locked(channel_data* chand, GRPC_ERROR_UNREF(error); } -// Returns the LB policy name from the resolver result. -static grpc_core::UniquePtr -get_lb_policy_name_from_resolver_result_locked(channel_data* chand) { - // Find LB policy name in channel args. - const grpc_arg* channel_arg = - grpc_channel_args_find(chand->resolver_result, GRPC_ARG_LB_POLICY_NAME); - const char* lb_policy_name = grpc_channel_arg_get_string(channel_arg); - // Special case: If at least one balancer address is present, we use - // the grpclb policy, regardless of what the resolver actually specified. - channel_arg = - grpc_channel_args_find(chand->resolver_result, GRPC_ARG_LB_ADDRESSES); - if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_POINTER) { - grpc_lb_addresses* addresses = - static_cast(channel_arg->value.pointer.p); - if (grpc_lb_addresses_contains_balancer_address(*addresses)) { - if (lb_policy_name != nullptr && - gpr_stricmp(lb_policy_name, "grpclb") != 0) { - gpr_log(GPR_INFO, - "resolver requested LB policy %s but provided at least one " - "balancer address -- forcing use of grpclb LB policy", - lb_policy_name); - } - lb_policy_name = "grpclb"; - } - } - // Use pick_first if nothing was specified and we didn't select grpclb - // above. - if (lb_policy_name == nullptr) lb_policy_name = "pick_first"; - return grpc_core::UniquePtr(gpr_strdup(lb_policy_name)); -} - static void request_reresolution_locked(void* arg, grpc_error* error) { reresolution_request_args* args = static_cast(arg); @@ -410,13 +317,14 @@ using TraceStringVector = grpc_core::InlinedVector; // *connectivity_error to its initial connectivity state; otherwise, // leaves them unchanged. static void create_new_lb_policy_locked( - channel_data* chand, char* lb_policy_name, + channel_data* chand, char* lb_policy_name, grpc_json* lb_config, grpc_connectivity_state* connectivity_state, grpc_error** connectivity_error, TraceStringVector* trace_strings) { grpc_core::LoadBalancingPolicy::Args lb_policy_args; lb_policy_args.combiner = chand->combiner; lb_policy_args.client_channel_factory = chand->client_channel_factory; lb_policy_args.args = chand->resolver_result; + lb_policy_args.lb_config = lb_config; grpc_core::OrphanablePtr new_lb_policy = grpc_core::LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy( lb_policy_name, lb_policy_args); @@ -473,44 +381,6 @@ static void create_new_lb_policy_locked( } } -// Returns the service config (as a JSON string) from the resolver result. -// Also updates state in chand. -static grpc_core::UniquePtr -get_service_config_from_resolver_result_locked(channel_data* chand) { - const grpc_arg* channel_arg = - grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVICE_CONFIG); - const char* service_config_json = grpc_channel_arg_get_string(channel_arg); - if (service_config_json != nullptr) { - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p: resolver returned service config: \"%s\"", - chand, service_config_json); - } - grpc_core::UniquePtr service_config = - grpc_core::ServiceConfig::Create(service_config_json); - if (service_config != nullptr) { - if (chand->enable_retries) { - channel_arg = - grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVER_URI); - const char* server_uri = grpc_channel_arg_get_string(channel_arg); - GPR_ASSERT(server_uri != nullptr); - grpc_uri* uri = grpc_uri_parse(server_uri, true); - GPR_ASSERT(uri->path[0] != '\0'); - service_config_parsing_state parsing_state; - parsing_state.server_name = - uri->path[0] == '/' ? uri->path + 1 : uri->path; - service_config->ParseGlobalParams(parse_retry_throttle_params, - &parsing_state); - grpc_uri_destroy(uri); - chand->retry_throttle_data = - std::move(parsing_state.retry_throttle_data); - } - chand->method_params_table = service_config->CreateMethodConfigTable( - ClientChannelMethodParams::CreateFromJson); - } - } - return grpc_core::UniquePtr(gpr_strdup(service_config_json)); -} - static void maybe_add_trace_message_for_address_changes_locked( channel_data* chand, TraceStringVector* trace_strings) { int resolution_contains_addresses = false; @@ -598,8 +468,20 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) { gpr_log(GPR_INFO, "chand=%p: resolver transient failure", chand); } } else { + // Parse the resolver result. + ProcessedResolverResult resolver_result(chand->resolver_result, + chand->enable_retries); + chand->retry_throttle_data = resolver_result.retry_throttle_data(); + chand->method_params_table = resolver_result.method_params_table(); + grpc_core::UniquePtr service_config_json = + resolver_result.service_config_json(); + if (service_config_json != nullptr && grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p: resolver returned service config: \"%s\"", + chand, service_config_json.get()); + } grpc_core::UniquePtr lb_policy_name = - get_lb_policy_name_from_resolver_result_locked(chand); + resolver_result.lb_policy_name(); + grpc_json* lb_policy_config = resolver_result.lb_policy_config(); // Check to see if we're already using the right LB policy. // Note: It's safe to use chand->info_lb_policy_name here without // taking a lock on chand->info_mu, because this function is the @@ -614,19 +496,16 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) { gpr_log(GPR_INFO, "chand=%p: updating existing LB policy \"%s\" (%p)", chand, lb_policy_name.get(), chand->lb_policy.get()); } - chand->lb_policy->UpdateLocked(*chand->resolver_result); + chand->lb_policy->UpdateLocked(*chand->resolver_result, lb_policy_config); // No need to set the channel's connectivity state; the existing // watch on the LB policy will take care of that. set_connectivity_state = false; } else { // Instantiate new LB policy. - create_new_lb_policy_locked(chand, lb_policy_name.get(), + create_new_lb_policy_locked(chand, lb_policy_name.get(), lb_policy_config, &connectivity_state, &connectivity_error, &trace_strings); } - // Find service config. - grpc_core::UniquePtr service_config_json = - get_service_config_from_resolver_result_locked(chand); // Note: It's safe to use chand->info_service_config_json here without // taking a lock on chand->info_mu, because this function is the // only thing that modifies its value, and it can only be invoked diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index b0040457a6..6733fdca81 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -58,6 +58,8 @@ class LoadBalancingPolicy /// Note that the LB policy gets the set of addresses from the /// GRPC_ARG_LB_ADDRESSES channel arg. grpc_channel_args* args = nullptr; + /// Load balancing config from the resolver. + grpc_json* lb_config = nullptr; }; /// State used for an LB pick. @@ -92,10 +94,11 @@ class LoadBalancingPolicy LoadBalancingPolicy(const LoadBalancingPolicy&) = delete; LoadBalancingPolicy& operator=(const LoadBalancingPolicy&) = delete; - /// Updates the policy with a new set of \a args from the resolver. - /// Note that the LB policy gets the set of addresses from the + /// Updates the policy with a new set of \a args and a new \a lb_config from + /// the resolver. Note that the LB policy gets the set of addresses from the /// GRPC_ARG_LB_ADDRESSES channel arg. - virtual void UpdateLocked(const grpc_channel_args& args) GRPC_ABSTRACT; + virtual void UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) GRPC_ABSTRACT; /// Finds an appropriate subchannel for a call, based on data in \a pick. /// \a pick must remain alive until the pick is complete. diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index dbb90b438c..dc0e1f89ce 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -123,7 +123,8 @@ class GrpcLb : public LoadBalancingPolicy { public: GrpcLb(const grpc_lb_addresses* addresses, const Args& args); - void UpdateLocked(const grpc_channel_args& args) override; + void UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) override; bool PickLocked(PickState* pick, grpc_error** error) override; void CancelPickLocked(PickState* pick, grpc_error* error) override; void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask, @@ -1331,7 +1332,7 @@ void GrpcLb::ProcessChannelArgsLocked(const grpc_channel_args& args) { grpc_channel_args_destroy(lb_channel_args); } -void GrpcLb::UpdateLocked(const grpc_channel_args& args) { +void GrpcLb::UpdateLocked(const grpc_channel_args& args, grpc_json* lb_config) { ProcessChannelArgsLocked(args); // Update the existing RR policy. if (rr_policy_ != nullptr) CreateOrUpdateRoundRobinPolicyLocked(); @@ -1727,7 +1728,7 @@ void GrpcLb::CreateOrUpdateRoundRobinPolicyLocked() { gpr_log(GPR_INFO, "[grpclb %p] Updating RR policy %p", this, rr_policy_.get()); } - rr_policy_->UpdateLocked(*args); + rr_policy_->UpdateLocked(*args, nullptr); } else { LoadBalancingPolicy::Args lb_policy_args; lb_policy_args.combiner = combiner(); diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index eb494486b9..d454401a66 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -46,7 +46,8 @@ class PickFirst : public LoadBalancingPolicy { public: explicit PickFirst(const Args& args); - void UpdateLocked(const grpc_channel_args& args) override; + void UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) override; bool PickLocked(PickState* pick, grpc_error** error) override; void CancelPickLocked(PickState* pick, grpc_error* error) override; void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask, @@ -159,7 +160,7 @@ PickFirst::PickFirst(const Args& args) : LoadBalancingPolicy(args) { if (grpc_lb_pick_first_trace.enabled()) { gpr_log(GPR_INFO, "Pick First %p created.", this); } - UpdateLocked(*args.args); + UpdateLocked(*args.args, args.lb_config); grpc_subchannel_index_ref(); } @@ -333,7 +334,8 @@ void PickFirst::UpdateChildRefsLocked() { child_subchannels_ = std::move(cs); } -void PickFirst::UpdateLocked(const grpc_channel_args& args) { +void PickFirst::UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) { AutoChildRefsUpdater guard(this); const grpc_arg* arg = grpc_channel_args_find(&args, GRPC_ARG_LB_ADDRESSES); if (arg == nullptr || arg->type != GRPC_ARG_POINTER) { diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index e9ed85cf66..2a16975131 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -57,7 +57,8 @@ class RoundRobin : public LoadBalancingPolicy { public: explicit RoundRobin(const Args& args); - void UpdateLocked(const grpc_channel_args& args) override; + void UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) override; bool PickLocked(PickState* pick, grpc_error** error) override; void CancelPickLocked(PickState* pick, grpc_error* error) override; void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask, @@ -232,7 +233,7 @@ RoundRobin::RoundRobin(const Args& args) : LoadBalancingPolicy(args) { gpr_mu_init(&child_refs_mu_); grpc_connectivity_state_init(&state_tracker_, GRPC_CHANNEL_IDLE, "round_robin"); - UpdateLocked(*args.args); + UpdateLocked(*args.args, args.lb_config); if (grpc_lb_round_robin_trace.enabled()) { gpr_log(GPR_INFO, "[RR %p] Created with %" PRIuPTR " subchannels", this, subchannel_list_->num_subchannels()); @@ -664,7 +665,8 @@ void RoundRobin::NotifyOnStateChangeLocked(grpc_connectivity_state* current, notify); } -void RoundRobin::UpdateLocked(const grpc_channel_args& args) { +void RoundRobin::UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) { const grpc_arg* arg = grpc_channel_args_find(&args, GRPC_ARG_LB_ADDRESSES); AutoChildRefsUpdater guard(this); if (GPR_UNLIKELY(arg == nullptr || arg->type != GRPC_ARG_POINTER)) { diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 59d57295d4..29cd904375 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -118,7 +118,8 @@ class XdsLb : public LoadBalancingPolicy { public: XdsLb(const grpc_lb_addresses* addresses, const Args& args); - void UpdateLocked(const grpc_channel_args& args) override; + void UpdateLocked(const grpc_channel_args& args, + grpc_json* lb_config) override; bool PickLocked(PickState* pick, grpc_error** error) override; void CancelPickLocked(PickState* pick, grpc_error* error) override; void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask, @@ -1010,6 +1011,7 @@ grpc_channel_args* BuildBalancerChannelArgs( // ctor and dtor // +// TODO(vishalpowar): Use lb_config in args to configure LB policy. XdsLb::XdsLb(const grpc_lb_addresses* addresses, const LoadBalancingPolicy::Args& args) : LoadBalancingPolicy(args), @@ -1314,7 +1316,8 @@ void XdsLb::ProcessChannelArgsLocked(const grpc_channel_args& args) { grpc_channel_args_destroy(lb_channel_args); } -void XdsLb::UpdateLocked(const grpc_channel_args& args) { +// TODO(vishalpowar): Use lb_config to configure LB policy. +void XdsLb::UpdateLocked(const grpc_channel_args& args, grpc_json* lb_config) { ProcessChannelArgsLocked(args); // Update the existing child policy. // Note: We have disabled fallback mode in the code, so this child policy must @@ -1672,7 +1675,8 @@ void XdsLb::CreateOrUpdateChildPolicyLocked() { gpr_log(GPR_INFO, "[xdslb %p] Updating the child policy %p", this, child_policy_.get()); } - child_policy_->UpdateLocked(*args); + // TODO(vishalpowar): Pass the correct LB config. + child_policy_->UpdateLocked(*args, nullptr); } else { LoadBalancingPolicy::Args lb_policy_args; lb_policy_args.combiner = combiner(); diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc index d651b1120d..ad459c9c8c 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.cc +++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc @@ -94,4 +94,9 @@ LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy( return factory->CreateLoadBalancingPolicy(args); } +bool LoadBalancingPolicyRegistry::LoadBalancingPolicyExists(const char* name) { + GPR_ASSERT(g_state != nullptr); + return g_state->GetLoadBalancingPolicyFactory(name) != nullptr; +} + } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.h b/src/core/ext/filters/client_channel/lb_policy_registry.h index 2e9bb061ed..338f7c9f69 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.h +++ b/src/core/ext/filters/client_channel/lb_policy_registry.h @@ -47,6 +47,10 @@ class LoadBalancingPolicyRegistry { /// Creates an LB policy of the type specified by \a name. static OrphanablePtr CreateLoadBalancingPolicy( const char* name, const LoadBalancingPolicy::Args& args); + + /// Returns true if the LB policy factory specified by \a name exists in this + /// registry. + static bool LoadBalancingPolicyExists(const char* name); }; } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/method_params.cc b/src/core/ext/filters/client_channel/method_params.cc deleted file mode 100644 index 1f116bb67d..0000000000 --- a/src/core/ext/filters/client_channel/method_params.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include "src/core/ext/filters/client_channel/method_params.h" -#include "src/core/lib/channel/status_util.h" -#include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/memory.h" - -// As per the retry design, we do not allow more than 5 retry attempts. -#define MAX_MAX_RETRY_ATTEMPTS 5 - -namespace grpc_core { -namespace internal { - -namespace { - -bool ParseWaitForReady( - grpc_json* field, ClientChannelMethodParams::WaitForReady* wait_for_ready) { - if (field->type != GRPC_JSON_TRUE && field->type != GRPC_JSON_FALSE) { - return false; - } - *wait_for_ready = field->type == GRPC_JSON_TRUE - ? ClientChannelMethodParams::WAIT_FOR_READY_TRUE - : ClientChannelMethodParams::WAIT_FOR_READY_FALSE; - return true; -} - -// Parses a JSON field of the form generated for a google.proto.Duration -// proto message, as per: -// https://developers.google.com/protocol-buffers/docs/proto3#json -bool ParseDuration(grpc_json* field, grpc_millis* duration) { - if (field->type != GRPC_JSON_STRING) return false; - size_t len = strlen(field->value); - if (field->value[len - 1] != 's') return false; - UniquePtr buf(gpr_strdup(field->value)); - *(buf.get() + len - 1) = '\0'; // Remove trailing 's'. - char* decimal_point = strchr(buf.get(), '.'); - int nanos = 0; - if (decimal_point != nullptr) { - *decimal_point = '\0'; - nanos = gpr_parse_nonnegative_int(decimal_point + 1); - if (nanos == -1) { - return false; - } - int num_digits = static_cast(strlen(decimal_point + 1)); - if (num_digits > 9) { // We don't accept greater precision than nanos. - return false; - } - for (int i = 0; i < (9 - num_digits); ++i) { - nanos *= 10; - } - } - int seconds = - decimal_point == buf.get() ? 0 : gpr_parse_nonnegative_int(buf.get()); - if (seconds == -1) return false; - *duration = seconds * GPR_MS_PER_SEC + nanos / GPR_NS_PER_MS; - return true; -} - -UniquePtr ParseRetryPolicy( - grpc_json* field) { - auto retry_policy = MakeUnique(); - if (field->type != GRPC_JSON_OBJECT) return nullptr; - for (grpc_json* sub_field = field->child; sub_field != nullptr; - sub_field = sub_field->next) { - if (sub_field->key == nullptr) return nullptr; - if (strcmp(sub_field->key, "maxAttempts") == 0) { - if (retry_policy->max_attempts != 0) return nullptr; // Duplicate. - if (sub_field->type != GRPC_JSON_NUMBER) return nullptr; - retry_policy->max_attempts = gpr_parse_nonnegative_int(sub_field->value); - if (retry_policy->max_attempts <= 1) return nullptr; - if (retry_policy->max_attempts > MAX_MAX_RETRY_ATTEMPTS) { - gpr_log(GPR_ERROR, - "service config: clamped retryPolicy.maxAttempts at %d", - MAX_MAX_RETRY_ATTEMPTS); - retry_policy->max_attempts = MAX_MAX_RETRY_ATTEMPTS; - } - } else if (strcmp(sub_field->key, "initialBackoff") == 0) { - if (retry_policy->initial_backoff > 0) return nullptr; // Duplicate. - if (!ParseDuration(sub_field, &retry_policy->initial_backoff)) { - return nullptr; - } - if (retry_policy->initial_backoff == 0) return nullptr; - } else if (strcmp(sub_field->key, "maxBackoff") == 0) { - if (retry_policy->max_backoff > 0) return nullptr; // Duplicate. - if (!ParseDuration(sub_field, &retry_policy->max_backoff)) { - return nullptr; - } - if (retry_policy->max_backoff == 0) return nullptr; - } else if (strcmp(sub_field->key, "backoffMultiplier") == 0) { - if (retry_policy->backoff_multiplier != 0) return nullptr; // Duplicate. - if (sub_field->type != GRPC_JSON_NUMBER) return nullptr; - if (sscanf(sub_field->value, "%f", &retry_policy->backoff_multiplier) != - 1) { - return nullptr; - } - if (retry_policy->backoff_multiplier <= 0) return nullptr; - } else if (strcmp(sub_field->key, "retryableStatusCodes") == 0) { - if (!retry_policy->retryable_status_codes.Empty()) { - return nullptr; // Duplicate. - } - if (sub_field->type != GRPC_JSON_ARRAY) return nullptr; - for (grpc_json* element = sub_field->child; element != nullptr; - element = element->next) { - if (element->type != GRPC_JSON_STRING) return nullptr; - grpc_status_code status; - if (!grpc_status_code_from_string(element->value, &status)) { - return nullptr; - } - retry_policy->retryable_status_codes.Add(status); - } - if (retry_policy->retryable_status_codes.Empty()) return nullptr; - } - } - // Make sure required fields are set. - if (retry_policy->max_attempts == 0 || retry_policy->initial_backoff == 0 || - retry_policy->max_backoff == 0 || retry_policy->backoff_multiplier == 0 || - retry_policy->retryable_status_codes.Empty()) { - return nullptr; - } - return retry_policy; -} - -} // namespace - -RefCountedPtr -ClientChannelMethodParams::CreateFromJson(const grpc_json* json) { - RefCountedPtr method_params = - MakeRefCounted(); - for (grpc_json* field = json->child; field != nullptr; field = field->next) { - if (field->key == nullptr) continue; - if (strcmp(field->key, "waitForReady") == 0) { - if (method_params->wait_for_ready_ != WAIT_FOR_READY_UNSET) { - return nullptr; // Duplicate. - } - if (!ParseWaitForReady(field, &method_params->wait_for_ready_)) { - return nullptr; - } - } else if (strcmp(field->key, "timeout") == 0) { - if (method_params->timeout_ > 0) return nullptr; // Duplicate. - if (!ParseDuration(field, &method_params->timeout_)) return nullptr; - } else if (strcmp(field->key, "retryPolicy") == 0) { - if (method_params->retry_policy_ != nullptr) { - return nullptr; // Duplicate. - } - method_params->retry_policy_ = ParseRetryPolicy(field); - if (method_params->retry_policy_ == nullptr) return nullptr; - } - } - return method_params; -} - -} // namespace internal -} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/method_params.h b/src/core/ext/filters/client_channel/method_params.h deleted file mode 100644 index a31d360f17..0000000000 --- a/src/core/ext/filters/client_channel/method_params.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_METHOD_PARAMS_H -#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_METHOD_PARAMS_H - -#include - -#include "src/core/lib/channel/status_util.h" -#include "src/core/lib/gprpp/ref_counted.h" -#include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis -#include "src/core/lib/json/json.h" - -namespace grpc_core { -namespace internal { - -class ClientChannelMethodParams : public RefCounted { - public: - enum WaitForReady { - WAIT_FOR_READY_UNSET = 0, - WAIT_FOR_READY_FALSE, - WAIT_FOR_READY_TRUE - }; - - struct RetryPolicy { - int max_attempts = 0; - grpc_millis initial_backoff = 0; - grpc_millis max_backoff = 0; - float backoff_multiplier = 0; - StatusCodeSet retryable_status_codes; - }; - - /// Creates a method_parameters object from \a json. - /// Intended for use with ServiceConfig::CreateMethodConfigTable(). - static RefCountedPtr CreateFromJson( - const grpc_json* json); - - grpc_millis timeout() const { return timeout_; } - WaitForReady wait_for_ready() const { return wait_for_ready_; } - const RetryPolicy* retry_policy() const { return retry_policy_.get(); } - - private: - // So New() can call our private ctor. - template - friend T* grpc_core::New(Args&&... args); - - // So Delete() can call our private dtor. - template - friend void grpc_core::Delete(T*); - - ClientChannelMethodParams() {} - virtual ~ClientChannelMethodParams() {} - - grpc_millis timeout_ = 0; - WaitForReady wait_for_ready_ = WAIT_FOR_READY_UNSET; - UniquePtr retry_policy_; -}; - -} // namespace internal -} // namespace grpc_core - -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_METHOD_PARAMS_H */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index 9562a3f893..90bc88961d 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -308,13 +308,12 @@ void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) { gpr_free(r->pending_request_); r->pending_request_ = nullptr; if (r->lb_addresses_ != nullptr) { - static const char* args_to_remove[2]; + static const char* args_to_remove[1]; size_t num_args_to_remove = 0; - grpc_arg new_args[3]; + grpc_arg args_to_add[2]; size_t num_args_to_add = 0; - new_args[num_args_to_add++] = + args_to_add[num_args_to_add++] = grpc_lb_addresses_create_channel_arg(r->lb_addresses_); - grpc_core::UniquePtr service_config; char* service_config_string = nullptr; if (r->service_config_json_ != nullptr) { service_config_string = ChooseServiceConfig(r->service_config_json_); @@ -323,24 +322,12 @@ void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) { gpr_log(GPR_INFO, "selected service config choice: %s", service_config_string); args_to_remove[num_args_to_remove++] = GRPC_ARG_SERVICE_CONFIG; - new_args[num_args_to_add++] = grpc_channel_arg_string_create( + args_to_add[num_args_to_add++] = grpc_channel_arg_string_create( (char*)GRPC_ARG_SERVICE_CONFIG, service_config_string); - service_config = - grpc_core::ServiceConfig::Create(service_config_string); - if (service_config != nullptr) { - const char* lb_policy_name = - service_config->GetLoadBalancingPolicyName(); - if (lb_policy_name != nullptr) { - args_to_remove[num_args_to_remove++] = GRPC_ARG_LB_POLICY_NAME; - new_args[num_args_to_add++] = grpc_channel_arg_string_create( - (char*)GRPC_ARG_LB_POLICY_NAME, - const_cast(lb_policy_name)); - } - } } } result = grpc_channel_args_copy_and_add_and_remove( - r->channel_args_, args_to_remove, num_args_to_remove, new_args, + r->channel_args_, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add); gpr_free(service_config_string); grpc_lb_addresses_destroy(r->lb_addresses_); diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.cc b/src/core/ext/filters/client_channel/resolver_result_parsing.cc new file mode 100644 index 0000000000..82a26ace63 --- /dev/null +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.cc @@ -0,0 +1,384 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include "src/core/ext/filters/client_channel/resolver_result_parsing.h" + +#include +#include +#include + +#include +#include +#include + +#include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/client_channel/lb_policy_registry.h" +#include "src/core/lib/channel/status_util.h" +#include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/memory.h" + +// As per the retry design, we do not allow more than 5 retry attempts. +#define MAX_MAX_RETRY_ATTEMPTS 5 + +namespace grpc_core { +namespace internal { + +namespace { + +// Converts string format from JSON to proto. +grpc_core::UniquePtr ConvertCamelToSnake(const char* camel) { + const size_t size = strlen(camel); + char* snake = static_cast(gpr_malloc(size * 2)); + size_t j = 0; + for (size_t i = 0; i < size; ++i) { + if (isupper(camel[i])) { + snake[j++] = '_'; + snake[j++] = tolower(camel[i]); + } else { + snake[j++] = camel[i]; + } + } + snake[j] = '\0'; + return grpc_core::UniquePtr(snake); +} + +} // namespace + +ProcessedResolverResult::ProcessedResolverResult( + const grpc_channel_args* resolver_result, bool parse_retry) { + ProcessServiceConfig(resolver_result, parse_retry); + // If no LB config was found above, just find the LB policy name then. + if (lb_policy_config_ == nullptr) ProcessLbPolicyName(resolver_result); +} + +void ProcessedResolverResult::ProcessServiceConfig( + const grpc_channel_args* resolver_result, bool parse_retry) { + const grpc_arg* channel_arg = + grpc_channel_args_find(resolver_result, GRPC_ARG_SERVICE_CONFIG); + const char* service_config_json = grpc_channel_arg_get_string(channel_arg); + if (service_config_json != nullptr) { + service_config_json_.reset(gpr_strdup(service_config_json)); + service_config_ = grpc_core::ServiceConfig::Create(service_config_json); + if (service_config_ != nullptr) { + if (parse_retry) { + channel_arg = + grpc_channel_args_find(resolver_result, GRPC_ARG_SERVER_URI); + const char* server_uri = grpc_channel_arg_get_string(channel_arg); + GPR_ASSERT(server_uri != nullptr); + grpc_uri* uri = grpc_uri_parse(server_uri, true); + GPR_ASSERT(uri->path[0] != '\0'); + server_name_ = uri->path[0] == '/' ? uri->path + 1 : uri->path; + service_config_->ParseGlobalParams(ParseServiceConfig, this); + grpc_uri_destroy(uri); + } else { + service_config_->ParseGlobalParams(ParseServiceConfig, this); + } + method_params_table_ = service_config_->CreateMethodConfigTable( + ClientChannelMethodParams::CreateFromJson); + } + } +} + +void ProcessedResolverResult::ProcessLbPolicyName( + const grpc_channel_args* resolver_result) { + const char* lb_policy_name = nullptr; + // Prefer the LB policy name found in the service config. Note that this is + // checking the deprecated loadBalancingPolicy field, rather than the new + // loadBalancingConfig field. + if (service_config_ != nullptr) { + lb_policy_name = service_config_->GetLoadBalancingPolicyName(); + } + // Otherwise, find the LB policy name set by the client API. + if (lb_policy_name == nullptr) { + const grpc_arg* channel_arg = + grpc_channel_args_find(resolver_result, GRPC_ARG_LB_POLICY_NAME); + lb_policy_name = grpc_channel_arg_get_string(channel_arg); + } + // Special case: If at least one balancer address is present, we use + // the grpclb policy, regardless of what the resolver has returned. + const grpc_arg* channel_arg = + grpc_channel_args_find(resolver_result, GRPC_ARG_LB_ADDRESSES); + if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_POINTER) { + grpc_lb_addresses* addresses = + static_cast(channel_arg->value.pointer.p); + if (grpc_lb_addresses_contains_balancer_address(*addresses)) { + if (lb_policy_name != nullptr && + gpr_stricmp(lb_policy_name, "grpclb") != 0) { + gpr_log(GPR_INFO, + "resolver requested LB policy %s but provided at least one " + "balancer address -- forcing use of grpclb LB policy", + lb_policy_name); + } + lb_policy_name = "grpclb"; + } + } + // Use pick_first if nothing was specified and we didn't select grpclb + // above. + if (lb_policy_name == nullptr) lb_policy_name = "pick_first"; + lb_policy_name_.reset(gpr_strdup(lb_policy_name)); +} + +void ProcessedResolverResult::ParseServiceConfig( + const grpc_json* field, ProcessedResolverResult* parsing_state) { + parsing_state->ParseLbConfigFromServiceConfig(field); + if (parsing_state->server_name_ != nullptr) { + parsing_state->ParseRetryThrottleParamsFromServiceConfig(field); + } +} + +void ProcessedResolverResult::ParseLbConfigFromServiceConfig( + const grpc_json* field) { + if (lb_policy_config_ != nullptr) return; // Already found. + // Find the LB config global parameter. + if (field->key == nullptr || strcmp(field->key, "loadBalancingConfig") != 0 || + field->type != GRPC_JSON_ARRAY) { + return; // Not valid lb config array. + } + // Find the first LB policy that this client supports. + for (grpc_json* lb_config = field->child; lb_config != nullptr; + lb_config = lb_config->next) { + if (lb_config->type != GRPC_JSON_OBJECT) return; + // Find the policy object. + grpc_json* policy = nullptr; + for (grpc_json* field = lb_config->child; field != nullptr; + field = field->next) { + if (field->key == nullptr || strcmp(field->key, "policy") != 0 || + field->type != GRPC_JSON_OBJECT) { + return; + } + if (policy != nullptr) return; // Duplicate. + policy = field; + } + // Find the specific policy content since the policy object is of type + // "oneof". + grpc_json* policy_content = nullptr; + for (grpc_json* field = policy->child; field != nullptr; + field = field->next) { + if (field->key == nullptr || field->type != GRPC_JSON_OBJECT) return; + if (policy_content != nullptr) return; // Violate "oneof" type. + policy_content = field; + } + grpc_core::UniquePtr lb_policy_name = + ConvertCamelToSnake(policy_content->key); + if (!grpc_core::LoadBalancingPolicyRegistry::LoadBalancingPolicyExists( + lb_policy_name.get())) { + continue; + } + lb_policy_name_ = std::move(lb_policy_name); + lb_policy_config_ = policy_content->child; + return; + } +} + +void ProcessedResolverResult::ParseRetryThrottleParamsFromServiceConfig( + const grpc_json* field) { + if (strcmp(field->key, "retryThrottling") == 0) { + if (retry_throttle_data_ != nullptr) return; // Duplicate. + if (field->type != GRPC_JSON_OBJECT) return; + int max_milli_tokens = 0; + int milli_token_ratio = 0; + for (grpc_json* sub_field = field->child; sub_field != nullptr; + sub_field = sub_field->next) { + if (sub_field->key == nullptr) return; + if (strcmp(sub_field->key, "maxTokens") == 0) { + if (max_milli_tokens != 0) return; // Duplicate. + if (sub_field->type != GRPC_JSON_NUMBER) return; + max_milli_tokens = gpr_parse_nonnegative_int(sub_field->value); + if (max_milli_tokens == -1) return; + max_milli_tokens *= 1000; + } else if (strcmp(sub_field->key, "tokenRatio") == 0) { + if (milli_token_ratio != 0) return; // Duplicate. + if (sub_field->type != GRPC_JSON_NUMBER) return; + // We support up to 3 decimal digits. + size_t whole_len = strlen(sub_field->value); + uint32_t multiplier = 1; + uint32_t decimal_value = 0; + const char* decimal_point = strchr(sub_field->value, '.'); + if (decimal_point != nullptr) { + whole_len = static_cast(decimal_point - sub_field->value); + multiplier = 1000; + size_t decimal_len = strlen(decimal_point + 1); + if (decimal_len > 3) decimal_len = 3; + if (!gpr_parse_bytes_to_uint32(decimal_point + 1, decimal_len, + &decimal_value)) { + return; + } + uint32_t decimal_multiplier = 1; + for (size_t i = 0; i < (3 - decimal_len); ++i) { + decimal_multiplier *= 10; + } + decimal_value *= decimal_multiplier; + } + uint32_t whole_value; + if (!gpr_parse_bytes_to_uint32(sub_field->value, whole_len, + &whole_value)) { + return; + } + milli_token_ratio = + static_cast((whole_value * multiplier) + decimal_value); + if (milli_token_ratio <= 0) return; + } + } + retry_throttle_data_ = + grpc_core::internal::ServerRetryThrottleMap::GetDataForServer( + server_name_, max_milli_tokens, milli_token_ratio); + } +} + +namespace { + +bool ParseWaitForReady( + grpc_json* field, ClientChannelMethodParams::WaitForReady* wait_for_ready) { + if (field->type != GRPC_JSON_TRUE && field->type != GRPC_JSON_FALSE) { + return false; + } + *wait_for_ready = field->type == GRPC_JSON_TRUE + ? ClientChannelMethodParams::WAIT_FOR_READY_TRUE + : ClientChannelMethodParams::WAIT_FOR_READY_FALSE; + return true; +} + +// Parses a JSON field of the form generated for a google.proto.Duration +// proto message, as per: +// https://developers.google.com/protocol-buffers/docs/proto3#json +bool ParseDuration(grpc_json* field, grpc_millis* duration) { + if (field->type != GRPC_JSON_STRING) return false; + size_t len = strlen(field->value); + if (field->value[len - 1] != 's') return false; + UniquePtr buf(gpr_strdup(field->value)); + *(buf.get() + len - 1) = '\0'; // Remove trailing 's'. + char* decimal_point = strchr(buf.get(), '.'); + int nanos = 0; + if (decimal_point != nullptr) { + *decimal_point = '\0'; + nanos = gpr_parse_nonnegative_int(decimal_point + 1); + if (nanos == -1) { + return false; + } + int num_digits = static_cast(strlen(decimal_point + 1)); + if (num_digits > 9) { // We don't accept greater precision than nanos. + return false; + } + for (int i = 0; i < (9 - num_digits); ++i) { + nanos *= 10; + } + } + int seconds = + decimal_point == buf.get() ? 0 : gpr_parse_nonnegative_int(buf.get()); + if (seconds == -1) return false; + *duration = seconds * GPR_MS_PER_SEC + nanos / GPR_NS_PER_MS; + return true; +} + +UniquePtr ParseRetryPolicy( + grpc_json* field) { + auto retry_policy = MakeUnique(); + if (field->type != GRPC_JSON_OBJECT) return nullptr; + for (grpc_json* sub_field = field->child; sub_field != nullptr; + sub_field = sub_field->next) { + if (sub_field->key == nullptr) return nullptr; + if (strcmp(sub_field->key, "maxAttempts") == 0) { + if (retry_policy->max_attempts != 0) return nullptr; // Duplicate. + if (sub_field->type != GRPC_JSON_NUMBER) return nullptr; + retry_policy->max_attempts = gpr_parse_nonnegative_int(sub_field->value); + if (retry_policy->max_attempts <= 1) return nullptr; + if (retry_policy->max_attempts > MAX_MAX_RETRY_ATTEMPTS) { + gpr_log(GPR_ERROR, + "service config: clamped retryPolicy.maxAttempts at %d", + MAX_MAX_RETRY_ATTEMPTS); + retry_policy->max_attempts = MAX_MAX_RETRY_ATTEMPTS; + } + } else if (strcmp(sub_field->key, "initialBackoff") == 0) { + if (retry_policy->initial_backoff > 0) return nullptr; // Duplicate. + if (!ParseDuration(sub_field, &retry_policy->initial_backoff)) { + return nullptr; + } + if (retry_policy->initial_backoff == 0) return nullptr; + } else if (strcmp(sub_field->key, "maxBackoff") == 0) { + if (retry_policy->max_backoff > 0) return nullptr; // Duplicate. + if (!ParseDuration(sub_field, &retry_policy->max_backoff)) { + return nullptr; + } + if (retry_policy->max_backoff == 0) return nullptr; + } else if (strcmp(sub_field->key, "backoffMultiplier") == 0) { + if (retry_policy->backoff_multiplier != 0) return nullptr; // Duplicate. + if (sub_field->type != GRPC_JSON_NUMBER) return nullptr; + if (sscanf(sub_field->value, "%f", &retry_policy->backoff_multiplier) != + 1) { + return nullptr; + } + if (retry_policy->backoff_multiplier <= 0) return nullptr; + } else if (strcmp(sub_field->key, "retryableStatusCodes") == 0) { + if (!retry_policy->retryable_status_codes.Empty()) { + return nullptr; // Duplicate. + } + if (sub_field->type != GRPC_JSON_ARRAY) return nullptr; + for (grpc_json* element = sub_field->child; element != nullptr; + element = element->next) { + if (element->type != GRPC_JSON_STRING) return nullptr; + grpc_status_code status; + if (!grpc_status_code_from_string(element->value, &status)) { + return nullptr; + } + retry_policy->retryable_status_codes.Add(status); + } + if (retry_policy->retryable_status_codes.Empty()) return nullptr; + } + } + // Make sure required fields are set. + if (retry_policy->max_attempts == 0 || retry_policy->initial_backoff == 0 || + retry_policy->max_backoff == 0 || retry_policy->backoff_multiplier == 0 || + retry_policy->retryable_status_codes.Empty()) { + return nullptr; + } + return retry_policy; +} + +} // namespace + +RefCountedPtr +ClientChannelMethodParams::CreateFromJson(const grpc_json* json) { + RefCountedPtr method_params = + MakeRefCounted(); + for (grpc_json* field = json->child; field != nullptr; field = field->next) { + if (field->key == nullptr) continue; + if (strcmp(field->key, "waitForReady") == 0) { + if (method_params->wait_for_ready_ != WAIT_FOR_READY_UNSET) { + return nullptr; // Duplicate. + } + if (!ParseWaitForReady(field, &method_params->wait_for_ready_)) { + return nullptr; + } + } else if (strcmp(field->key, "timeout") == 0) { + if (method_params->timeout_ > 0) return nullptr; // Duplicate. + if (!ParseDuration(field, &method_params->timeout_)) return nullptr; + } else if (strcmp(field->key, "retryPolicy") == 0) { + if (method_params->retry_policy_ != nullptr) { + return nullptr; // Duplicate. + } + method_params->retry_policy_ = ParseRetryPolicy(field); + if (method_params->retry_policy_ == nullptr) return nullptr; + } + } + return method_params; +} + +} // namespace internal +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.h b/src/core/ext/filters/client_channel/resolver_result_parsing.h new file mode 100644 index 0000000000..f1fb7406bc --- /dev/null +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.h @@ -0,0 +1,146 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H +#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H + +#include + +#include "src/core/ext/filters/client_channel/retry_throttle.h" +#include "src/core/lib/channel/status_util.h" +#include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis +#include "src/core/lib/json/json.h" +#include "src/core/lib/slice/slice_hash_table.h" +#include "src/core/lib/transport/service_config.h" + +namespace grpc_core { +namespace internal { + +class ClientChannelMethodParams; + +// A table mapping from a method name to its method parameters. +typedef grpc_core::SliceHashTable< + grpc_core::RefCountedPtr> + ClientChannelMethodParamsTable; + +// A container of processed fields from the resolver result. Simplifies the +// usage of resolver result. +class ProcessedResolverResult { + public: + // Processes the resolver result and populates the relative members + // for later consumption. Tries to parse retry parameters only if parse_retry + // is true. + ProcessedResolverResult(const grpc_channel_args* resolver_result, + bool parse_retry); + + // Getters. Any managed object's ownership is transferred. + grpc_core::UniquePtr service_config_json() { + return std::move(service_config_json_); + } + grpc_core::RefCountedPtr retry_throttle_data() { + return std::move(retry_throttle_data_); + } + grpc_core::RefCountedPtr + method_params_table() { + return std::move(method_params_table_); + } + grpc_core::UniquePtr lb_policy_name() { + return std::move(lb_policy_name_); + } + grpc_json* lb_policy_config() { return lb_policy_config_; } + + private: + // Finds the service config; extracts LB config and (maybe) retry throttle + // params from it. + void ProcessServiceConfig(const grpc_channel_args* resolver_result, + bool parse_retry); + + // Finds the LB policy name (when no LB config was found). + void ProcessLbPolicyName(const grpc_channel_args* resolver_result); + + // Parses the service config. Intended to be used by + // ServiceConfig::ParseGlobalParams. + static void ParseServiceConfig(const grpc_json* field, + ProcessedResolverResult* parsing_state); + // Parses the LB config from service config. + void ParseLbConfigFromServiceConfig(const grpc_json* field); + // Parses the retry throttle parameters from service config. + void ParseRetryThrottleParamsFromServiceConfig(const grpc_json* field); + + // Service config. + grpc_core::UniquePtr service_config_json_; + grpc_core::UniquePtr service_config_; + // LB policy. + grpc_json* lb_policy_config_ = nullptr; + grpc_core::UniquePtr lb_policy_name_; + // Retry throttle data. + char* server_name_ = nullptr; + grpc_core::RefCountedPtr retry_throttle_data_; + // Method params table. + grpc_core::RefCountedPtr method_params_table_; +}; + +// The parameters of a method. +class ClientChannelMethodParams : public RefCounted { + public: + enum WaitForReady { + WAIT_FOR_READY_UNSET = 0, + WAIT_FOR_READY_FALSE, + WAIT_FOR_READY_TRUE + }; + + struct RetryPolicy { + int max_attempts = 0; + grpc_millis initial_backoff = 0; + grpc_millis max_backoff = 0; + float backoff_multiplier = 0; + StatusCodeSet retryable_status_codes; + }; + + /// Creates a method_parameters object from \a json. + /// Intended for use with ServiceConfig::CreateMethodConfigTable(). + static RefCountedPtr CreateFromJson( + const grpc_json* json); + + grpc_millis timeout() const { return timeout_; } + WaitForReady wait_for_ready() const { return wait_for_ready_; } + const RetryPolicy* retry_policy() const { return retry_policy_.get(); } + + private: + // So New() can call our private ctor. + template + friend T* grpc_core::New(Args&&... args); + + // So Delete() can call our private dtor. + template + friend void grpc_core::Delete(T*); + + ClientChannelMethodParams() {} + virtual ~ClientChannelMethodParams() {} + + grpc_millis timeout_ = 0; + WaitForReady wait_for_ready_ = WAIT_FOR_READY_UNSET; + UniquePtr retry_policy_; +}; + +} // namespace internal +} // namespace grpc_core + +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 53cc0736af..a82d6e1ec7 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -323,12 +323,12 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy.cc', 'src/core/ext/filters/client_channel/lb_policy_factory.cc', 'src/core/ext/filters/client_channel/lb_policy_registry.cc', - 'src/core/ext/filters/client_channel/method_params.cc', 'src/core/ext/filters/client_channel/parse_address.cc', 'src/core/ext/filters/client_channel/proxy_mapper.cc', 'src/core/ext/filters/client_channel/proxy_mapper_registry.cc', 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', + 'src/core/ext/filters/client_channel/resolver_result_parsing.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 67b6cefa09..7d105b32ce 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -926,8 +926,6 @@ src/core/ext/filters/client_channel/lb_policy_factory.cc \ src/core/ext/filters/client_channel/lb_policy_factory.h \ src/core/ext/filters/client_channel/lb_policy_registry.cc \ src/core/ext/filters/client_channel/lb_policy_registry.h \ -src/core/ext/filters/client_channel/method_params.cc \ -src/core/ext/filters/client_channel/method_params.h \ src/core/ext/filters/client_channel/parse_address.cc \ src/core/ext/filters/client_channel/parse_address.h \ src/core/ext/filters/client_channel/proxy_mapper.cc \ @@ -956,6 +954,8 @@ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ src/core/ext/filters/client_channel/resolver_factory.h \ src/core/ext/filters/client_channel/resolver_registry.cc \ src/core/ext/filters/client_channel/resolver_registry.h \ +src/core/ext/filters/client_channel/resolver_result_parsing.cc \ +src/core/ext/filters/client_channel/resolver_result_parsing.h \ src/core/ext/filters/client_channel/retry_throttle.cc \ src/core/ext/filters/client_channel/retry_throttle.h \ src/core/ext/filters/client_channel/subchannel.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 27f15abbef..100eb45ac5 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -10035,13 +10035,13 @@ "src/core/ext/filters/client_channel/lb_policy.h", "src/core/ext/filters/client_channel/lb_policy_factory.h", "src/core/ext/filters/client_channel/lb_policy_registry.h", - "src/core/ext/filters/client_channel/method_params.h", "src/core/ext/filters/client_channel/parse_address.h", "src/core/ext/filters/client_channel/proxy_mapper.h", "src/core/ext/filters/client_channel/proxy_mapper_registry.h", "src/core/ext/filters/client_channel/resolver.h", "src/core/ext/filters/client_channel/resolver_factory.h", "src/core/ext/filters/client_channel/resolver_registry.h", + "src/core/ext/filters/client_channel/resolver_result_parsing.h", "src/core/ext/filters/client_channel/retry_throttle.h", "src/core/ext/filters/client_channel/subchannel.h", "src/core/ext/filters/client_channel/subchannel_index.h" @@ -10074,8 +10074,6 @@ "src/core/ext/filters/client_channel/lb_policy_factory.h", "src/core/ext/filters/client_channel/lb_policy_registry.cc", "src/core/ext/filters/client_channel/lb_policy_registry.h", - "src/core/ext/filters/client_channel/method_params.cc", - "src/core/ext/filters/client_channel/method_params.h", "src/core/ext/filters/client_channel/parse_address.cc", "src/core/ext/filters/client_channel/parse_address.h", "src/core/ext/filters/client_channel/proxy_mapper.cc", @@ -10087,6 +10085,8 @@ "src/core/ext/filters/client_channel/resolver_factory.h", "src/core/ext/filters/client_channel/resolver_registry.cc", "src/core/ext/filters/client_channel/resolver_registry.h", + "src/core/ext/filters/client_channel/resolver_result_parsing.cc", + "src/core/ext/filters/client_channel/resolver_result_parsing.h", "src/core/ext/filters/client_channel/retry_throttle.cc", "src/core/ext/filters/client_channel/retry_throttle.h", "src/core/ext/filters/client_channel/subchannel.cc", -- cgit v1.2.3 From 626f1c9d537de45c6604a1dc7b103933073c4f00 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 15 Nov 2018 16:49:43 -0800 Subject: Remove the std::unique_ptr, instead use move semantics everywhere --- include/grpcpp/channel.h | 8 +- include/grpcpp/create_channel.h | 4 +- include/grpcpp/security/credentials.h | 12 +-- include/grpcpp/server.h | 4 +- src/cpp/client/channel_cc.cc | 8 +- src/cpp/client/create_channel.cc | 36 +++---- src/cpp/client/create_channel_internal.cc | 4 +- src/cpp/client/create_channel_internal.h | 4 +- src/cpp/client/create_channel_posix.cc | 10 +- src/cpp/client/cronet_credentials.cc | 9 +- src/cpp/client/insecure_credentials.cc | 9 +- src/cpp/client/secure_credentials.cc | 9 +- src/cpp/client/secure_credentials.h | 4 +- src/cpp/server/server_cc.cc | 7 +- .../end2end/client_interceptors_end2end_test.cc | 108 ++++++++------------- test/cpp/end2end/interceptors_util.cc | 11 +-- test/cpp/end2end/interceptors_util.h | 3 +- 17 files changed, 118 insertions(+), 132 deletions(-) diff --git a/include/grpcpp/channel.h b/include/grpcpp/channel.h index 4502b94b17..ee83396069 100644 --- a/include/grpcpp/channel.h +++ b/include/grpcpp/channel.h @@ -65,13 +65,13 @@ class Channel final : public ChannelInterface, friend void experimental::ChannelResetConnectionBackoff(Channel* channel); friend std::shared_ptr CreateChannelInternal( const grpc::string& host, grpc_channel* c_channel, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); friend class internal::InterceptedChannel; Channel(const grpc::string& host, grpc_channel* c_channel, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); internal::Call CreateCall(const internal::RpcMethod& method, diff --git a/include/grpcpp/create_channel.h b/include/grpcpp/create_channel.h index 43188d09e7..e8a2a70581 100644 --- a/include/grpcpp/create_channel.h +++ b/include/grpcpp/create_channel.h @@ -70,8 +70,8 @@ std::shared_ptr CreateCustomChannelWithInterceptors( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); } // namespace experimental } // namespace grpc diff --git a/include/grpcpp/security/credentials.h b/include/grpcpp/security/credentials.h index 8dfbdec3e6..d8c9e04d77 100644 --- a/include/grpcpp/security/credentials.h +++ b/include/grpcpp/security/credentials.h @@ -46,8 +46,8 @@ std::shared_ptr CreateCustomChannelWithInterceptors( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); } // namespace experimental @@ -80,8 +80,8 @@ class ChannelCredentials : private GrpcLibraryCodegen { const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); virtual std::shared_ptr CreateChannel( @@ -91,8 +91,8 @@ class ChannelCredentials : private GrpcLibraryCodegen { // implemented as a virtual function so that it does not break API. virtual std::shared_ptr CreateChannelWithInterceptors( const grpc::string& target, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { return nullptr; }; diff --git a/include/grpcpp/server.h b/include/grpcpp/server.h index a14a4da578..cdcac186cb 100644 --- a/include/grpcpp/server.h +++ b/include/grpcpp/server.h @@ -111,8 +111,8 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { /// interceptors std::shared_ptr InProcessChannelWithInterceptors( const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); private: diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 8e1cea0269..d1c55319f7 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -54,13 +54,11 @@ namespace grpc { static internal::GrpcLibraryInitializer g_gli_initializer; Channel::Channel( const grpc::string& host, grpc_channel* channel, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) : host_(host), c_channel_(channel) { - if (interceptor_creators != nullptr) { - interceptor_creators_ = std::move(*interceptor_creators); - } + interceptor_creators_ = std::move(interceptor_creators); g_gli_initializer.summon(); } diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index efdff6c265..457daa674c 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -39,13 +39,14 @@ std::shared_ptr CreateCustomChannel( const std::shared_ptr& creds, const ChannelArguments& args) { GrpcLibraryCodegen init_lib; // We need to call init in case of a bad creds. - return creds - ? creds->CreateChannel(target, args) - : CreateChannelInternal("", - grpc_lame_client_channel_create( - nullptr, GRPC_STATUS_INVALID_ARGUMENT, - "Invalid credentials."), - nullptr); + return creds ? creds->CreateChannel(target, args) + : CreateChannelInternal( + "", + grpc_lame_client_channel_create( + nullptr, GRPC_STATUS_INVALID_ARGUMENT, + "Invalid credentials."), + std::vector>()); } namespace experimental { @@ -64,17 +65,18 @@ std::shared_ptr CreateCustomChannelWithInterceptors( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { - return creds - ? creds->CreateChannelWithInterceptors( - target, args, std::move(interceptor_creators)) - : CreateChannelInternal("", - grpc_lame_client_channel_create( - nullptr, GRPC_STATUS_INVALID_ARGUMENT, - "Invalid credentials."), - nullptr); + return creds ? creds->CreateChannelWithInterceptors( + target, args, std::move(interceptor_creators)) + : CreateChannelInternal( + "", + grpc_lame_client_channel_create( + nullptr, GRPC_STATUS_INVALID_ARGUMENT, + "Invalid credentials."), + std::vector>()); } } // namespace experimental diff --git a/src/cpp/client/create_channel_internal.cc b/src/cpp/client/create_channel_internal.cc index 313d682aae..a0efb97f7e 100644 --- a/src/cpp/client/create_channel_internal.cc +++ b/src/cpp/client/create_channel_internal.cc @@ -26,8 +26,8 @@ namespace grpc { std::shared_ptr CreateChannelInternal( const grpc::string& host, grpc_channel* c_channel, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { return std::shared_ptr( new Channel(host, c_channel, std::move(interceptor_creators))); diff --git a/src/cpp/client/create_channel_internal.h b/src/cpp/client/create_channel_internal.h index 512fc22866..a90c92c518 100644 --- a/src/cpp/client/create_channel_internal.h +++ b/src/cpp/client/create_channel_internal.h @@ -31,8 +31,8 @@ class Channel; std::shared_ptr CreateChannelInternal( const grpc::string& host, grpc_channel* c_channel, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators); } // namespace grpc diff --git a/src/cpp/client/create_channel_posix.cc b/src/cpp/client/create_channel_posix.cc index 8d775e7a87..3affc1ef39 100644 --- a/src/cpp/client/create_channel_posix.cc +++ b/src/cpp/client/create_channel_posix.cc @@ -34,7 +34,8 @@ std::shared_ptr CreateInsecureChannelFromFd(const grpc::string& target, init_lib.init(); return CreateChannelInternal( "", grpc_insecure_channel_create_from_fd(target.c_str(), fd, nullptr), - nullptr); + std::vector< + std::unique_ptr>()); } std::shared_ptr CreateCustomInsecureChannelFromFd( @@ -46,15 +47,16 @@ std::shared_ptr CreateCustomInsecureChannelFromFd( return CreateChannelInternal( "", grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args), - nullptr); + std::vector< + std::unique_ptr>()); } namespace experimental { std::shared_ptr CreateCustomInsecureChannelWithInterceptorsFromFd( const grpc::string& target, int fd, const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { internal::GrpcLibrary init_lib; init_lib.init(); diff --git a/src/cpp/client/cronet_credentials.cc b/src/cpp/client/cronet_credentials.cc index 09a76b428c..b2801764f2 100644 --- a/src/cpp/client/cronet_credentials.cc +++ b/src/cpp/client/cronet_credentials.cc @@ -31,7 +31,10 @@ class CronetChannelCredentialsImpl final : public ChannelCredentials { std::shared_ptr CreateChannel( const string& target, const grpc::ChannelArguments& args) override { - return CreateChannelWithInterceptors(target, args, nullptr); + return CreateChannelWithInterceptors( + target, args, + std::vector>()); } SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } @@ -39,8 +42,8 @@ class CronetChannelCredentialsImpl final : public ChannelCredentials { private: std::shared_ptr CreateChannelWithInterceptors( const string& target, const grpc::ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) override { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index b816e0c59a..241ce91803 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -32,13 +32,16 @@ class InsecureChannelCredentialsImpl final : public ChannelCredentials { public: std::shared_ptr CreateChannel( const string& target, const grpc::ChannelArguments& args) override { - return CreateChannelWithInterceptors(target, args, nullptr); + return CreateChannelWithInterceptors( + target, args, + std::vector>()); } std::shared_ptr CreateChannelWithInterceptors( const string& target, const grpc::ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) override { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 7faaa20e78..d0abe441a6 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -36,14 +36,17 @@ SecureChannelCredentials::SecureChannelCredentials( std::shared_ptr SecureChannelCredentials::CreateChannel( const string& target, const grpc::ChannelArguments& args) { - return CreateChannelWithInterceptors(target, args, nullptr); + return CreateChannelWithInterceptors( + target, args, + std::vector< + std::unique_ptr>()); } std::shared_ptr SecureChannelCredentials::CreateChannelWithInterceptors( const string& target, const grpc::ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index bfb6e17ee9..613f1d6dc2 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -42,8 +42,8 @@ class SecureChannelCredentials final : public ChannelCredentials { private: std::shared_ptr CreateChannelWithInterceptors( const string& target, const grpc::ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) override; grpc_channel_credentials* const c_creds_; }; diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 7a98bce507..72d005f23d 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -732,14 +732,15 @@ std::shared_ptr Server::InProcessChannel( grpc_channel_args channel_args = args.c_channel_args(); return CreateChannelInternal( "inproc", grpc_inproc_channel_create(server_, &channel_args, nullptr), - nullptr); + std::vector< + std::unique_ptr>()); } std::shared_ptr Server::experimental_type::InProcessChannelWithInterceptors( const ChannelArguments& args, - std::unique_ptr>> + std::vector< + std::unique_ptr> interceptor_creators) { grpc_channel_args channel_args = args.c_channel_args(); return CreateChannelInternal( diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc index 0b34ec93ae..60e8b051ab 100644 --- a/test/cpp/end2end/client_interceptors_end2end_test.cc +++ b/test/cpp/end2end/client_interceptors_end2end_test.cc @@ -361,15 +361,13 @@ class ClientInterceptorsEnd2endTest : public ::testing::Test { TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLoggingTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -382,20 +380,18 @@ TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLoggingTest) { TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorHijackingTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 20 dummy interceptors before hijacking interceptor for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new HijackingInterceptorFactory())); // Add 20 dummy interceptors after hijacking interceptor for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -408,13 +404,11 @@ TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorHijackingTest) { TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLogThenHijackTest) { ChannelArguments args; - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new HijackingInterceptorFactory())); auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); @@ -426,21 +420,19 @@ TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorHijackingMakesAnotherCallTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 5 dummy interceptors before hijacking interceptor for (auto i = 0; i < 5; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } - creators->push_back( + creators.push_back( std::unique_ptr( new HijackingInterceptorMakesAnotherCallFactory())); // Add 7 dummy interceptors after hijacking interceptor for (auto i = 0; i < 7; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = server_->experimental().InProcessChannelWithInterceptors( @@ -456,15 +448,13 @@ TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLoggingTestWithCallback) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = server_->experimental().InProcessChannelWithInterceptors( @@ -496,15 +486,13 @@ class ClientInterceptorsStreamingEnd2endTest : public ::testing::Test { TEST_F(ClientInterceptorsStreamingEnd2endTest, ClientStreamingTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -517,15 +505,13 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, ClientStreamingTest) { TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -538,15 +524,13 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingTest) { TEST_F(ClientInterceptorsStreamingEnd2endTest, BidiStreamingTest) { ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); - creators->push_back(std::unique_ptr( + std::vector> + creators; + creators.push_back(std::unique_ptr( new LoggingInterceptorFactory())); // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -583,13 +567,11 @@ TEST_F(ClientGlobalInterceptorEnd2endTest, DummyGlobalInterceptor) { experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -610,13 +592,11 @@ TEST_F(ClientGlobalInterceptorEnd2endTest, LoggingGlobalInterceptor) { experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( @@ -637,13 +617,11 @@ TEST_F(ClientGlobalInterceptorEnd2endTest, HijackingGlobalInterceptor) { experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; DummyInterceptor::Reset(); - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 20 dummy interceptors for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } auto channel = experimental::CreateCustomChannelWithInterceptors( diff --git a/test/cpp/end2end/interceptors_util.cc b/test/cpp/end2end/interceptors_util.cc index 602d1695a3..5d59c1a4b7 100644 --- a/test/cpp/end2end/interceptors_util.cc +++ b/test/cpp/end2end/interceptors_util.cc @@ -132,16 +132,13 @@ bool CheckMetadata(const std::multimap& map, return false; } -std::unique_ptr>> +std::vector> CreateDummyClientInterceptors() { - auto creators = std::unique_ptr>>( - new std::vector< - std::unique_ptr>()); + std::vector> + creators; // Add 20 dummy interceptors before hijacking interceptor for (auto i = 0; i < 20; i++) { - creators->push_back(std::unique_ptr( + creators.push_back(std::unique_ptr( new DummyInterceptorFactory())); } return creators; diff --git a/test/cpp/end2end/interceptors_util.h b/test/cpp/end2end/interceptors_util.h index b4c4791fca..d886e32494 100644 --- a/test/cpp/end2end/interceptors_util.h +++ b/test/cpp/end2end/interceptors_util.h @@ -149,8 +149,7 @@ void MakeCallbackCall(const std::shared_ptr& channel); bool CheckMetadata(const std::multimap& map, const string& key, const string& value); -std::unique_ptr>> +std::vector> CreateDummyClientInterceptors(); inline void* tag(int i) { return (void*)static_cast(i); } -- cgit v1.2.3 From d1776af2ffcb52fddcd112b0e2ce26205a9ed880 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 15 Nov 2018 11:07:14 -0800 Subject: Make docgen.py work * Merge unnecessary arguments * Remove the build command (CI should make sure it works, not this script) * Speed up the GitHub operations with proper flags * Adding Sphinx to setup requirement --- tools/distrib/python/docgen.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/tools/distrib/python/docgen.py b/tools/distrib/python/docgen.py index 732d948bbc..de47c00618 100755 --- a/tools/distrib/python/docgen.py +++ b/tools/distrib/python/docgen.py @@ -32,12 +32,10 @@ parser.add_argument( help='GRPC/GPR libraries build configuration', default='opt') parser.add_argument('--submit', action='store_true') -parser.add_argument('--gh-user', type=str, help='GitHub user to push as.') parser.add_argument( - '--gh-repo-owner', + '--repo-owner', type=str, - help=('Owner of the GitHub repository to be pushed; ' - 'defaults to --gh-user.')) + help=('Owner of the GitHub repository to be pushed')) parser.add_argument('--doc-branch', type=str) args = parser.parse_args() @@ -70,7 +68,7 @@ subprocess_arguments_list = [ 'env': environment }, { - 'args': [VIRTUALENV_PIP_PATH, 'install', '--upgrade', 'pip==10.0.1'], + 'args': [VIRTUALENV_PIP_PATH, 'install', '--upgrade', 'pip==18.1'], 'env': environment }, { @@ -78,7 +76,7 @@ subprocess_arguments_list = [ 'env': environment }, { - 'args': [VIRTUALENV_PYTHON_PATH, SETUP_PATH, 'build'], + 'args': [VIRTUALENV_PIP_PATH, 'install', 'Sphinx~=1.8.1'], 'env': environment }, { @@ -91,12 +89,12 @@ for subprocess_arguments in subprocess_arguments_list: print('Running command: {}'.format(subprocess_arguments['args'])) subprocess.check_call(**subprocess_arguments) -if args.submit: - assert args.gh_user +if not args.submit: + print('Please check generated Python doc inside doc/build') +elif args.submit: + assert args.repo_owner assert args.doc_branch - github_user = args.gh_user - github_repository_owner = (args.gh_repo_owner - if args.gh_repo_owner else args.gh_user) + github_repository_owner = args.repo_owner # Create a temporary directory out of tree, checkout gh-pages from the # specified repository, edit it, and push it. It's up to the user to then go # onto GitHub and make a PR against grpc/grpc:gh-pages. @@ -109,16 +107,19 @@ if args.submit: print('Cloning your repository...') subprocess.check_call( [ - 'git', 'clone', 'https://{}@github.com/{}/grpc'.format( - github_user, github_repository_owner) + 'git', + 'clone', + '--branch', + 'gh-pages', + 'https://github.com/grpc/grpc', ], cwd=repo_parent_dir) + subprocess.check_call(['git', 'checkout', '-b', doc_branch], cwd=repo_dir) subprocess.check_call( - ['git', 'remote', 'add', 'upstream', 'https://github.com/grpc/grpc'], - cwd=repo_dir) - subprocess.check_call(['git', 'fetch', 'upstream'], cwd=repo_dir) - subprocess.check_call( - ['git', 'checkout', 'upstream/gh-pages', '-b', doc_branch], + [ + 'git', 'remote', 'add', 'ssh-origin', + 'git@github.com:%s/grpc.git' % (github_repository_owner) + ], cwd=repo_dir) print('Updating documentation...') shutil.rmtree(python_doc_dir, ignore_errors=True) @@ -130,7 +131,7 @@ if args.submit: ['git', 'commit', '-m', 'Auto-update Python documentation'], cwd=repo_dir) subprocess.check_call( - ['git', 'push', '--set-upstream', 'origin', doc_branch], + ['git', 'push', '--set-upstream', 'ssh-origin', doc_branch], cwd=repo_dir) except subprocess.CalledProcessError: print('Failed to push documentation. Examine this directory and push ' -- cgit v1.2.3 From dd2bdf2ff1781cc00ca1ab7554d42a0330287401 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 15 Nov 2018 20:07:12 -0800 Subject: Enable lcov 1.12 and 1.13 for gRPC PHP --- src/php/ext/grpc/config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index fa54ebd920..9ec2c7cf04 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -103,7 +103,7 @@ if test "$PHP_COVERAGE" = "yes"; then AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi - lcov_version_list="1.5 1.6 1.7 1.9 1.10 1.11" + lcov_version_list="1.5 1.6 1.7 1.9 1.10 1.11 1.12 1.13" AC_CHECK_PROG(LCOV, lcov, lcov) AC_CHECK_PROG(GENHTML, genhtml, genhtml) -- cgit v1.2.3 From a60fd359cb34b186fbc82a0ea061fe3aa299f516 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 16 Nov 2018 11:42:31 -0800 Subject: Modify remaining usecases in test/cpp --- test/cpp/microbenchmarks/bm_call_create.cc | 3 ++- test/cpp/microbenchmarks/fullstack_fixtures.h | 5 ++++- test/cpp/performance/writes_per_rpc_test.cc | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 446dc93edb..8d12606434 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -135,7 +135,8 @@ static void BM_LameChannelCallCreateCpp(benchmark::State& state) { "", grpc_lame_client_channel_create("localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"), - nullptr)); + std::vector>())); grpc::CompletionQueue cq; grpc::testing::EchoRequest send_request; grpc::testing::EchoResponse recv_response; diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index e57eb6ddd1..71e8d9972b 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -218,7 +218,10 @@ class EndpointPairFixture : public BaseFixture { "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport_); grpc_chttp2_transport_start_reading(client_transport_, nullptr, nullptr); - channel_ = CreateChannelInternal("", channel, nullptr); + channel_ = CreateChannelInternal( + "", channel, + std::vector>()); } } diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 32eab1fc44..baeede34ea 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -118,7 +118,10 @@ class EndpointPairFixture { "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); grpc_chttp2_transport_start_reading(transport, nullptr, nullptr); - channel_ = CreateChannelInternal("", channel, nullptr); + channel_ = CreateChannelInternal( + "", channel, + std::vector>()); } } -- cgit v1.2.3 From 44e83d7964aa4dff86c9b26b7809be4e0292303a Mon Sep 17 00:00:00 2001 From: Derek Date: Fri, 16 Nov 2018 13:15:45 -0800 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f00ff29479..b3a4c1f17d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Sometimes things go wrong. Please check out the [Troubleshooting guide](TROUBLES # Performance -See the [Performance dashboard](http://performance-dot-grpc-testing.appspot.com/explore?dashboard=5636470266134528) for performance numbers or the latest released version. +See the [Performance dashboard](http://performance-dot-grpc-testing.appspot.com/explore?dashboard=5636470266134528) for performance numbers of the latest released version. # Concepts -- cgit v1.2.3 From ce4a8a66eeb25b34cdd63305877acb6c40371a8d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Nov 2018 10:37:39 -0800 Subject: Boost C++ version for 1.17.0 --- gRPC-C++.podspec | 2 +- templates/gRPC-C++.podspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 5fd3945efb..fae5ce4a6e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -24,7 +24,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized # version = '1.17.0-dev' - version = '0.0.3' + version = '0.0.4' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index ed69a1ed4c..ab330415af 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -132,7 +132,7 @@ s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized # version = '${settings.version}' - version = '0.0.3' + version = '0.0.4' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' -- cgit v1.2.3 From 0226bbbf528f11ad0ad7c542737605348d65660a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Nov 2018 12:04:01 -0800 Subject: Boost core version in BUILD --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index e4c40ad57b..3627096f2d 100644 --- a/BUILD +++ b/BUILD @@ -66,7 +66,7 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "gizmo" -core_version = "6.0.0-dev" +core_version = "7.0.0-dev" version = "1.17.0-dev" -- cgit v1.2.3 From 50d34c224ab624aad6c7142aa884fdfd674d60bb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Nov 2018 12:16:08 -0800 Subject: Revert python changes --- src/python/grpcio/grpc/_channel.py | 1 - src/python/grpcio/grpc/_common.py | 1 - src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi | 1 - src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 1 - src/python/grpcio/grpc/_plugin_wrapping.py | 1 - src/python/grpcio/grpc/framework/foundation/callable_util.py | 1 - src/python/grpcio/grpc/framework/foundation/logging_pool.py | 1 - src/python/grpcio/grpc/framework/foundation/stream_util.py | 1 - 8 files changed, 8 deletions(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 3ff7658748..ab154d8512 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -25,7 +25,6 @@ from grpc._cython import cygrpc from grpc.framework.foundation import callable_util _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) _USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__) diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index 42f3a4e614..f69127e38e 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -21,7 +21,6 @@ import grpc from grpc._cython import cygrpc _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = { cygrpc.ConnectivityState.idle: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi index fa356d913e..00a1b23a67 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi @@ -15,7 +15,6 @@ import logging _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) # This function will ascii encode unicode string inputs if neccesary. # In Python3, unicode strings are the default str type. diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index f9d1e863ca..ce701724fd 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -19,7 +19,6 @@ import time import grpc _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) cdef class Server: diff --git a/src/python/grpcio/grpc/_plugin_wrapping.py b/src/python/grpcio/grpc/_plugin_wrapping.py index 53af2ff913..916ee080b6 100644 --- a/src/python/grpcio/grpc/_plugin_wrapping.py +++ b/src/python/grpcio/grpc/_plugin_wrapping.py @@ -21,7 +21,6 @@ from grpc import _common from grpc._cython import cygrpc _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) class _AuthMetadataContext( diff --git a/src/python/grpcio/grpc/framework/foundation/callable_util.py b/src/python/grpcio/grpc/framework/foundation/callable_util.py index 36066e19df..24daf3406f 100644 --- a/src/python/grpcio/grpc/framework/foundation/callable_util.py +++ b/src/python/grpcio/grpc/framework/foundation/callable_util.py @@ -22,7 +22,6 @@ import logging import six _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) class Outcome(six.with_metaclass(abc.ABCMeta)): diff --git a/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/src/python/grpcio/grpc/framework/foundation/logging_pool.py index dfb8dbdc30..216e3990db 100644 --- a/src/python/grpcio/grpc/framework/foundation/logging_pool.py +++ b/src/python/grpcio/grpc/framework/foundation/logging_pool.py @@ -18,7 +18,6 @@ import logging from concurrent import futures _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) def _wrap(behavior): diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py index e03130cced..1faaf29bd7 100644 --- a/src/python/grpcio/grpc/framework/foundation/stream_util.py +++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py @@ -20,7 +20,6 @@ from grpc.framework.foundation import stream _NO_VALUE = object() _LOGGER = logging.getLogger(__name__) -_LOGGER.addHandler(logging.NullHandler()) class TransformingConsumer(stream.Consumer): -- cgit v1.2.3 From 667a17c1f36847c74d95e5edb91f6704a50e033f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 19 Nov 2018 22:15:22 +0100 Subject: split up coverage runs by language --- .../test/multilang_jessie_x64/Dockerfile.template | 41 ----- .../test/multilang_jessie_x64/Dockerfile | 170 --------------------- tools/internal_ci/linux/grpc_coverage.sh | 20 ++- tools/run_tests/run_tests.py | 18 +-- 4 files changed, 18 insertions(+), 231 deletions(-) delete mode 100644 templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template delete mode 100644 tools/dockerfile/test/multilang_jessie_x64/Dockerfile diff --git a/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template b/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template deleted file mode 100644 index ac687b710f..0000000000 --- a/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.2 ---- | - # Copyright 2016 gRPC authors. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - - FROM debian:jessie - - <%include file="../../apt_get_basic.include"/> - <%include file="../../gcp_api_libraries.include"/> - <%include file="../../csharp_deps.include"/> - <%include file="../../csharp_dotnetcli_deps.include"/> - <%include file="../../cxx_deps.include"/> - <%include file="../../node_deps.include"/> - <%include file="../../php_deps.include"/> - <%include file="../../ruby_deps.include"/> - <%include file="../../python_deps.include"/> - # Install pip and virtualenv for Python 3.4 - RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 - RUN python3.4 -m pip install virtualenv - - # Install coverage for Python test coverage reporting - RUN pip install coverage - ENV PATH ~/.local/bin:$PATH - - # Install Mako to generate files in grpc/grpc-node - RUN pip install Mako - - <%include file="../../run_tests_addons.include"/> - # Define the default command. - CMD ["bash"] diff --git a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile b/tools/dockerfile/test/multilang_jessie_x64/Dockerfile deleted file mode 100644 index 3c95554b02..0000000000 --- a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright 2016 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM debian:jessie - -# Install Git and basic packages. -RUN apt-get update && apt-get install -y \ - autoconf \ - autotools-dev \ - build-essential \ - bzip2 \ - ccache \ - curl \ - dnsutils \ - gcc \ - gcc-multilib \ - git \ - golang \ - gyp \ - lcov \ - libc6 \ - libc6-dbg \ - libc6-dev \ - libgtest-dev \ - libtool \ - make \ - perl \ - strace \ - python-dev \ - python-setuptools \ - python-yaml \ - telnet \ - unzip \ - wget \ - zip && apt-get clean - -#================ -# Build profiling -RUN apt-get update && apt-get install -y time && apt-get clean - -# Google Cloud platform API libraries -RUN apt-get update && apt-get install -y python-pip && apt-get clean -RUN pip install --upgrade google-api-python-client oauth2client - -#================ -# C# dependencies - -# Update to a newer version of mono -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list - -# Install dependencies -RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ - mono-devel \ - ca-certificates-mono \ - nuget \ - && apt-get clean - -RUN nuget update -self - -#================= -# Use cmake 3.6 from jessie-backports -# needed to build grpc_csharp_ext with cmake - -RUN echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list -RUN apt-get update && apt-get install -t jessie-backports -y cmake && apt-get clean - -# Install dotnet SDK based on https://www.microsoft.com/net/core#debian -RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003131 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 -RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet -# dotnet-dev-1.0.1 -RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 -RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet -RUN ln -s /opt/dotnet/dotnet /usr/local/bin - -# Trigger the population of the local package cache -ENV NUGET_XMLDOC_MODE skip -RUN mkdir warmup \ - && cd warmup \ - && dotnet new \ - && cd .. \ - && rm -rf warmup - -#================= -# C++ dependencies -RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean - -#================== -# Node dependencies - -# Install nvm -RUN touch .profile -RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash -# Install all versions of node that we want to test -RUN /bin/bash -l -c "nvm install 4 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm install 5 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm install 6 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm install 8 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm install 9 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm install 10 && npm config set cache /tmp/npm-cache" -RUN /bin/bash -l -c "nvm alias default 10" -#================= -# PHP dependencies - -# Install dependencies - -RUN apt-get update && apt-get install -y \ - git php5 php5-dev phpunit unzip - -#================== -# Ruby dependencies - -# Install rvm -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -RUN \curl -sSL https://get.rvm.io | bash -s stable - -# Install Ruby 2.1 -RUN /bin/bash -l -c "rvm install ruby-2.1" -RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" -RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" - -#==================== -# Python dependencies - -# Install dependencies - -RUN apt-get update && apt-get install -y \ - python-all-dev \ - python3-all-dev \ - python-pip - -# Install Python packages from PyPI -RUN pip install --upgrade pip==10.0.1 -RUN pip install virtualenv -RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0 - -# Install pip and virtualenv for Python 3.4 -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 -RUN python3.4 -m pip install virtualenv - -# Install coverage for Python test coverage reporting -RUN pip install coverage -ENV PATH ~/.local/bin:$PATH - -# Install Mako to generate files in grpc/grpc-node -RUN pip install Mako - - -RUN mkdir /var/local/jenkins - -# Define the default command. -CMD ["bash"] diff --git a/tools/internal_ci/linux/grpc_coverage.sh b/tools/internal_ci/linux/grpc_coverage.sh index 97166372ab..ae82019337 100755 --- a/tools/internal_ci/linux/grpc_coverage.sh +++ b/tools/internal_ci/linux/grpc_coverage.sh @@ -21,12 +21,20 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc python tools/run_tests/run_tests.py \ - --use_docker \ - -t \ - -l all \ - -c gcov \ - -x sponge_log.xml \ - -j 16 || FAILED="true" + -l c c++ -x coverage_cpp/sponge_log.xml \ + --use_docker -t -c gcov -j 8 || FAILED="true" + +python tools/run_tests/run_tests.py \ + -l python -x coverage_python/sponge_log.xml \ + --use_docker -t -c gcov -j 8 || FAILED="true" + +python tools/run_tests/run_tests.py \ + -l ruby -x coverage_ruby/sponge_log.xml \ + --use_docker -t -c gcov -j 8 || FAILED="true" + +python tools/run_tests/run_tests.py \ + -l php -x coverage_php/sponge_log.xml \ + --use_docker -t -c gcov -j 8 || FAILED="true" # HTML reports can't be easily displayed in GCS, so create a zip archive # and put it under reports directory to get it uploaded as an artifact. diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a1f2aaab2f..4bc7ed907c 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1340,9 +1340,9 @@ argp.add_argument( argp.add_argument( '-l', '--language', - choices=['all'] + sorted(_LANGUAGES.keys()), + choices=sorted(_LANGUAGES.keys()), nargs='+', - default=['all']) + required=True) argp.add_argument( '-S', '--stop_on_failure', default=False, action='store_const', const=True) argp.add_argument( @@ -1513,17 +1513,7 @@ build_config = run_config.build_config if args.travis: _FORCE_ENVIRON_FOR_WRAPPERS = {'GRPC_TRACE': 'api'} -if 'all' in args.language: - lang_list = list(_LANGUAGES.keys()) -else: - lang_list = args.language -# We don't support code coverage on some languages -if 'gcov' in args.config: - for bad in ['csharp', 'grpc-node', 'objc', 'sanity']: - if bad in lang_list: - lang_list.remove(bad) - -languages = set(_LANGUAGES[l] for l in lang_list) +languages = set(_LANGUAGES[l] for l in args.language) for l in languages: l.configure(run_config, args) @@ -1535,7 +1525,7 @@ if any(language.make_options() for language in languages): ) sys.exit(1) else: - # Combining make options is not clean and just happens to work. It allows C/C++ and C# to build + # Combining make options is not clean and just happens to work. It allows C & C++ to build # together, and is only used under gcov. All other configs should build languages individually. language_make_options = list( set([ -- cgit v1.2.3 From f836319f1f0a5ec1786b971c4c33eb40a67371bd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Nov 2018 15:14:44 -0800 Subject: Bump version to v1.18.0-dev --- BUILD | 4 ++-- build.yaml | 4 ++-- doc/g_stands_for.md | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BUILD b/BUILD index 3627096f2d..526307a5e6 100644 --- a/BUILD +++ b/BUILD @@ -64,11 +64,11 @@ config_setting( ) # This should be updated along with build.yaml -g_stands_for = "gizmo" +g_stands_for = "goose" core_version = "7.0.0-dev" -version = "1.17.0-dev" +version = "1.18.0-dev" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 09acdbe6f1..6798538a3c 100644 --- a/build.yaml +++ b/build.yaml @@ -13,8 +13,8 @@ settings: '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here core_version: 7.0.0-dev - g_stands_for: gizmo - version: 1.17.0-dev + g_stands_for: goose + version: 1.18.0-dev filegroups: - name: alts_proto headers: diff --git a/doc/g_stands_for.md b/doc/g_stands_for.md index a5a8efb21c..1e49b4d3f1 100644 --- a/doc/g_stands_for.md +++ b/doc/g_stands_for.md @@ -16,4 +16,5 @@ - 1.14 'g' stands for ['gladiolus'](https://github.com/grpc/grpc/tree/v1.14.x) - 1.15 'g' stands for ['glider'](https://github.com/grpc/grpc/tree/v1.15.x) - 1.16 'g' stands for ['gao'](https://github.com/grpc/grpc/tree/v1.16.x) -- 1.17 'g' stands for ['gizmo'](https://github.com/grpc/grpc/tree/master) +- 1.17 'g' stands for ['gizmo'](https://github.com/grpc/grpc/tree/v1.17.x) +- 1.18 'g' stands for ['goose'](https://github.com/grpc/grpc/tree/master) -- cgit v1.2.3 From f3e4ae633ee4476b1a30c9216f736eb71ffc968c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Nov 2018 15:24:53 -0800 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 30 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c2ba2048c..bea450037d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.17.0-dev") +set(PACKAGE_VERSION "1.18.0-dev") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 12603f1fc8..a6b56bb4f7 100644 --- a/Makefile +++ b/Makefile @@ -438,8 +438,8 @@ Q = @ endif CORE_VERSION = 7.0.0-dev -CPP_VERSION = 1.17.0-dev -CSHARP_VERSION = 1.17.0-dev +CPP_VERSION = 1.18.0-dev +CSHARP_VERSION = 1.18.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index fae5ce4a6e..c59d8fe1a6 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.17.0-dev' + # version = '1.18.0-dev' version = '0.0.4' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.17.0-dev' + grpc_version = '1.18.0-dev' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f0a715cb58..3f04177074 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.17.0-dev' + version = '1.18.0-dev' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 693b873d14..13fe3e0b9c 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.17.0-dev' + version = '1.18.0-dev' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index fd590023e1..e132ad41b4 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.17.0-dev' + version = '1.18.0-dev' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 5e513cb127..940a1ac621 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.17.0-dev' + version = '1.18.0-dev' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 3044cbf862..c5046cd461 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.17.0dev - 1.17.0dev + 1.18.0dev + 1.18.0dev beta diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 66890ce65a..4829cc80a5 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -25,4 +25,4 @@ const char* grpc_version_string(void) { return "7.0.0-dev"; } -const char* grpc_g_stands_for(void) { return "gizmo"; } +const char* grpc_g_stands_for(void) { return "goose"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 8abd45efb7..55da89e6c8 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.17.0-dev"; } +grpc::string Version() { return "1.18.0-dev"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index ed0d884365..4fffe4f644 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.17.0-dev + 1.18.0-dev 3.6.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 14714c8c4a..633880189c 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.17.0.0"; + public const string CurrentAssemblyFileVersion = "1.18.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.17.0-dev"; + public const string CurrentVersion = "1.18.0-dev"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 27688360e9..76d4f14390 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.17.0-dev +set VERSION=1.18.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index dd74de0491..3334d24c11 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.17.0-dev +set VERSION=1.18.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index a95a120d21..55ca6048bc 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.17.0-dev' + v = '1.18.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index d5463c0b4c..0be0e3c9a0 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.17.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.18.0-dev" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index ca27c03b3c..f2fd692070 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.17.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.18.0-dev" #define GRPC_C_VERSION_STRING @"7.0.0-dev" diff --git a/src/php/composer.json b/src/php/composer.json index d54db91b5f..9c298c0e85 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.17.0", + "version": "1.18.0", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 70f8bbbf40..1ddf90a667 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.17.0dev" +#define PHP_GRPC_VERSION "1.18.0dev" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 42b3a1ad49..7a9f173947 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.17.0.dev0""" +__version__ = """1.18.0.dev0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 71113e68d9..2e91818d2c 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index a30aac2e0b..85fa762f7e 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index aafea9fe76..e62ab169a2 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 876acd3142..7b4c1695fa 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index cc9b41587c..2fcd1ad617 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 243d566645..a4ed052d85 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.17.0.dev' + VERSION = '1.18.0.dev' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 92e85eb882..389fb70684 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.17.0.dev' + VERSION = '1.18.0.dev' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 4b775e667e..29b2127960 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.17.0.dev0' +VERSION = '1.18.0.dev0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 392113c284..fbac37e8e7 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.17.0-dev +PROJECT_NUMBER = 1.18.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index a96683883c..f7a9c79620 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.17.0-dev +PROJECT_NUMBER = 1.18.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From 3a0c72ff6b3f57a4f18fea102254f272dcb0593d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Nov 2018 09:43:43 +0100 Subject: remove an unneeded shell script --- tools/run_tests/helper_scripts/run_lcov.sh | 31 ------------------------------ 1 file changed, 31 deletions(-) delete mode 100755 tools/run_tests/helper_scripts/run_lcov.sh diff --git a/tools/run_tests/helper_scripts/run_lcov.sh b/tools/run_tests/helper_scripts/run_lcov.sh deleted file mode 100755 index 9d8b6793fc..0000000000 --- a/tools/run_tests/helper_scripts/run_lcov.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -out=$(readlink -f "${1:-coverage}") - -root=$(readlink -f "$(dirname "$0")/../../..") -shift || true -tmp=$(mktemp) -cd "$root" -tools/run_tests/run_tests.py -c gcov -l c c++ "$@" || true -lcov --capture --directory . --output-file "$tmp" -genhtml "$tmp" --output-directory "$out" -rm "$tmp" -if which xdg-open > /dev/null -then - xdg-open "file://$out/index.html" -fi -- cgit v1.2.3 From cde2cec2795b5475b52195703810e2bf30efc3c3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Nov 2018 09:46:30 +0100 Subject: pip install coverage for python_stretch3.7 image --- .../tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template | 3 +++ tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template index ff342db493..c3602f6c51 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template @@ -18,3 +18,6 @@ RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 + + # for Python test coverage reporting + RUN pip install coverage diff --git a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile index add1cc509d..45291ffdcf 100644 --- a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile @@ -70,3 +70,6 @@ CMD ["bash"] RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 + +# for Python test coverage reporting +RUN pip install coverage -- cgit v1.2.3 From 3543b1b151cb2d0a7155fa39fa51017a9e7c745b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Nov 2018 09:49:41 +0100 Subject: remove broken toplevel index.html file --- tools/run_tests/dockerize/docker_run_tests.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tools/run_tests/dockerize/docker_run_tests.sh b/tools/run_tests/dockerize/docker_run_tests.sh index c41734c92d..b7686e48ba 100755 --- a/tools/run_tests/dockerize/docker_run_tests.sh +++ b/tools/run_tests/dockerize/docker_run_tests.sh @@ -38,16 +38,8 @@ exit_code=0 $RUN_TESTS_COMMAND || exit_code=$? -cd reports -echo '' > index.html -find . -maxdepth 1 -mindepth 1 -type d | sort | while read d ; do - d=${d#*/} - n=${d//_/ } - echo "$n
" >> index.html -done -echo '' >> index.html -cd .. - +# The easiest way to copy all the reports files from inside of +# the docker container is to zip them and then copy the zip. zip -r reports.zip reports find . -name report.xml -print0 | xargs -0 -r zip reports.zip find . -name sponge_log.xml -print0 | xargs -0 -r zip reports.zip -- cgit v1.2.3 From 51e238c2ed02f191aac6e2dbd660cfbd949c73d0 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Nov 2018 12:05:20 +0100 Subject: run_tests.py cleanup: nits in PythonLanguage --- tools/run_tests/run_tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a1f2aaab2f..f00355bafc 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -756,9 +756,10 @@ class PythonLanguage(object): def dockerfile_dir(self): return 'tools/dockerfile/test/python_%s_%s' % ( - self.python_manager_name(), _docker_arch_suffix(self.args.arch)) + self._python_manager_name(), _docker_arch_suffix(self.args.arch)) - def python_manager_name(self): + def _python_manager_name(self): + """Choose the docker image to use based on python version.""" if self.args.compiler in [ 'python2.7', 'python3.5', 'python3.6', 'python3.7' ]: @@ -771,6 +772,7 @@ class PythonLanguage(object): return 'stretch_3.7' def _get_pythons(self, args): + """Get python runtimes to test with, based on current platform, architecture, compiler etc.""" if args.arch == 'x86': bits = '32' else: -- cgit v1.2.3 From 2108c0b6a78170118a542875daa3857b932bb29f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Nov 2018 12:40:16 +0100 Subject: avoid C++ flakes by decreasing coverage parallelism --- tools/internal_ci/linux/grpc_coverage.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/internal_ci/linux/grpc_coverage.sh b/tools/internal_ci/linux/grpc_coverage.sh index ae82019337..a91cffdf98 100755 --- a/tools/internal_ci/linux/grpc_coverage.sh +++ b/tools/internal_ci/linux/grpc_coverage.sh @@ -22,19 +22,19 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc python tools/run_tests/run_tests.py \ -l c c++ -x coverage_cpp/sponge_log.xml \ - --use_docker -t -c gcov -j 8 || FAILED="true" + --use_docker -t -c gcov -j 2 || FAILED="true" python tools/run_tests/run_tests.py \ -l python -x coverage_python/sponge_log.xml \ - --use_docker -t -c gcov -j 8 || FAILED="true" + --use_docker -t -c gcov -j 2 || FAILED="true" python tools/run_tests/run_tests.py \ -l ruby -x coverage_ruby/sponge_log.xml \ - --use_docker -t -c gcov -j 8 || FAILED="true" + --use_docker -t -c gcov -j 2 || FAILED="true" python tools/run_tests/run_tests.py \ -l php -x coverage_php/sponge_log.xml \ - --use_docker -t -c gcov -j 8 || FAILED="true" + --use_docker -t -c gcov -j 2 || FAILED="true" # HTML reports can't be easily displayed in GCS, so create a zip archive # and put it under reports directory to get it uploaded as an artifact. -- cgit v1.2.3 From 3ce9b4fc43be787a548f0398cd0fb348e863a059 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Oct 2018 12:50:49 +0100 Subject: remove remnants of ccache with --use_docker using ccache when building under a docker image isn't useful when building on kokoro as each build runs on a fresh VM. Originally ccache builds were used to speed up jenkins builds, now removing to guarantee build isolation and simplify stuff. --- tools/dockerfile/test/python_alpine_x64/Dockerfile | 8 +------- tools/run_tests/dockerize/build_docker_and_run_tests.sh | 5 ----- tools/run_tests/dockerize/build_interop_image.sh | 4 ---- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/tools/dockerfile/test/python_alpine_x64/Dockerfile b/tools/dockerfile/test/python_alpine_x64/Dockerfile index 6e06e2d52c..3001bf43ff 100644 --- a/tools/dockerfile/test/python_alpine_x64/Dockerfile +++ b/tools/dockerfile/test/python_alpine_x64/Dockerfile @@ -42,13 +42,7 @@ RUN pip install virtualenv RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.0.post1 six==1.10.0 # Google Cloud platform API libraries -RUN pip install --upgrade google-api-python-client - -# Prepare ccache -RUN ln -s /usr/bin/ccache /usr/local/bin/gcc -RUN ln -s /usr/bin/ccache /usr/local/bin/g++ -RUN ln -s /usr/bin/ccache /usr/local/bin/cc -RUN ln -s /usr/bin/ccache /usr/local/bin/c++ +RUN pip install --upgrade google-api-python-client oauth2client RUN mkdir -p /var/local/jenkins diff --git a/tools/run_tests/dockerize/build_docker_and_run_tests.sh b/tools/run_tests/dockerize/build_docker_and_run_tests.sh index 614049cae5..1741b3268b 100755 --- a/tools/run_tests/dockerize/build_docker_and_run_tests.sh +++ b/tools/run_tests/dockerize/build_docker_and_run_tests.sh @@ -22,9 +22,6 @@ cd "$(dirname "$0")/../../.." git_root=$(pwd) cd - -# Ensure existence of ccache directory -mkdir -p /tmp/ccache - # Inputs # DOCKERFILE_DIR - Directory in which Dockerfile file is located. # DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root) @@ -57,7 +54,6 @@ docker run \ -e "RUN_TESTS_COMMAND=$RUN_TESTS_COMMAND" \ -e "config=$config" \ -e "arch=$arch" \ - -e CCACHE_DIR=/tmp/ccache \ -e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \ -e HOST_GIT_ROOT="$git_root" \ -e LOCAL_GIT_ROOT=$docker_instance_git_root \ @@ -73,7 +69,6 @@ docker run \ --sysctl net.ipv6.conf.all.disable_ipv6=0 \ -v ~/.config/gcloud:/root/.config/gcloud \ -v "$git_root:$docker_instance_git_root" \ - -v /tmp/ccache:/tmp/ccache \ -v /tmp/npm-cache:/tmp/npm-cache \ -w /var/local/git/grpc \ --name="$CONTAINER_NAME" \ diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh index fcfcdeb4e4..126dd4065e 100755 --- a/tools/run_tests/dockerize/build_interop_image.sh +++ b/tools/run_tests/dockerize/build_interop_image.sh @@ -64,8 +64,6 @@ else echo "WARNING: grpc-node not found, it won't be mounted to the docker container." fi -mkdir -p /tmp/ccache - # Mount service account dir if available. # If service_directory does not contain the service account JSON file, # some of the tests will fail. @@ -105,14 +103,12 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)" # shellcheck disable=SC2086 (docker run \ --cap-add SYS_PTRACE \ - -e CCACHE_DIR=/tmp/ccache \ -e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \ -e THIS_IS_REALLY_NEEDED_ONCE_AGAIN='For issue 4835. See https://github.com/docker/docker/issues/14203 for why docker is awful' \ -i \ $TTY_FLAG \ $MOUNT_ARGS \ $BUILD_INTEROP_DOCKER_EXTRA_ARGS \ - -v /tmp/ccache:/tmp/ccache \ --name="$CONTAINER_NAME" \ "$BASE_IMAGE" \ bash -l "/var/local/jenkins/grpc/tools/dockerfile/interoptest/$BASE_NAME/build_interop.sh" \ -- cgit v1.2.3 From b0417a59bf98b27eb16cec7289a3dbb7a70729d9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 4 Jun 2018 11:25:46 +0200 Subject: Revert "pin google-api-python-client to 1.6.7 to avoid breakage" --- tools/internal_ci/helper_scripts/prepare_build_macos_rc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 24a3545ded..62e75b84a2 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -28,8 +28,7 @@ sudo systemsetup -setusingnetworktime on date # Add GCP credentials for BQ access -# pin google-api-python-client to avoid https://github.com/grpc/grpc/issues/15600 -pip install google-api-python-client==1.6.7 --user python +pip install google-api-python-client --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -- cgit v1.2.3 From b654c8d279667c63cbb5725a70f72576d5d305e1 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Tue, 20 Nov 2018 12:54:31 -0800 Subject: python: close channels in _server_ssl_cert_config_test --- .../tests/unit/_server_ssl_cert_config_test.py | 51 ++++++++++------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py b/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py index e733a59a5b..9e4bd61816 100644 --- a/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_ssl_cert_config_test.py @@ -70,18 +70,11 @@ SERVER_CERT_CHAIN_2_PEM = (resources.cert_hier_2_server_1_cert() + Call = collections.namedtuple('Call', ['did_raise', 'returned_cert_config']) -def _create_client_stub( - port, - expect_success, - root_certificates=None, - private_key=None, - certificate_chain=None, -): - channel = grpc.secure_channel('localhost:{}'.format(port), - grpc.ssl_channel_credentials( - root_certificates=root_certificates, - private_key=private_key, - certificate_chain=certificate_chain)) +def _create_channel(port, credentials): + return grpc.secure_channel('localhost:{}'.format(port), credentials) + + +def _create_client_stub(channel, expect_success): if expect_success: # per Nathaniel: there's some robustness issue if we start # using a channel without waiting for it to be actually ready @@ -176,14 +169,13 @@ class _ServerSSLCertReloadTest( root_certificates=None, private_key=None, certificate_chain=None): - client_stub = _create_client_stub( - self.port, - expect_success, + credentials = grpc.ssl_channel_credentials( root_certificates=root_certificates, private_key=private_key, certificate_chain=certificate_chain) - self._perform_rpc(client_stub, expect_success) - del client_stub + with _create_channel(self.port, credentials) as client_channel: + client_stub = _create_client_stub(client_channel, expect_success) + self._perform_rpc(client_stub, expect_success) def _test(self): # things should work... @@ -259,12 +251,13 @@ class _ServerSSLCertReloadTest( # now create the "persistent" clients self.cert_config_fetcher.reset() self.cert_config_fetcher.configure(False, None) - persistent_client_stub_A = _create_client_stub( + channel_A = _create_channel( self.port, - True, - root_certificates=CA_1_PEM, - private_key=CLIENT_KEY_2_PEM, - certificate_chain=CLIENT_CERT_CHAIN_2_PEM) + grpc.ssl_channel_credentials( + root_certificates=CA_1_PEM, + private_key=CLIENT_KEY_2_PEM, + certificate_chain=CLIENT_CERT_CHAIN_2_PEM)) + persistent_client_stub_A = _create_client_stub(channel_A, True) self._perform_rpc(persistent_client_stub_A, True) actual_calls = self.cert_config_fetcher.getCalls() self.assertEqual(len(actual_calls), 1) @@ -273,12 +266,13 @@ class _ServerSSLCertReloadTest( self.cert_config_fetcher.reset() self.cert_config_fetcher.configure(False, None) - persistent_client_stub_B = _create_client_stub( + channel_B = _create_channel( self.port, - True, - root_certificates=CA_1_PEM, - private_key=CLIENT_KEY_2_PEM, - certificate_chain=CLIENT_CERT_CHAIN_2_PEM) + grpc.ssl_channel_credentials( + root_certificates=CA_1_PEM, + private_key=CLIENT_KEY_2_PEM, + certificate_chain=CLIENT_CERT_CHAIN_2_PEM)) + persistent_client_stub_B = _create_client_stub(channel_B, True) self._perform_rpc(persistent_client_stub_B, True) actual_calls = self.cert_config_fetcher.getCalls() self.assertEqual(len(actual_calls), 1) @@ -359,6 +353,9 @@ class _ServerSSLCertReloadTest( actual_calls = self.cert_config_fetcher.getCalls() self.assertEqual(len(actual_calls), 0) + channel_A.close() + channel_B.close() + class ServerSSLCertConfigFetcherParamsChecks(unittest.TestCase): -- cgit v1.2.3 From c51d9c169e248d4231805f93ee32393974ac44d0 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 20 Nov 2018 15:21:29 -0800 Subject: Wrap pthread_atwork call --- src/php/ext/grpc/php_grpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index cbc7f63be0..492325b1e8 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -200,7 +200,9 @@ void postfork_parent() { void register_fork_handlers() { if (getenv("GRPC_ENABLE_FORK_SUPPORT")) { +#ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK pthread_atfork(&prefork, &postfork_parent, &postfork_child); +#endif // GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK } } -- cgit v1.2.3 From 609cb8daa047833dc7062bd749a24b9a85359151 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 21 Nov 2018 12:47:31 +0100 Subject: Revert "Revert "pin google-api-python-client to 1.6.7 to avoid breakage"" --- tools/internal_ci/helper_scripts/prepare_build_macos_rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 62e75b84a2..24a3545ded 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -28,7 +28,8 @@ sudo systemsetup -setusingnetworktime on date # Add GCP credentials for BQ access -pip install google-api-python-client --user python +# pin google-api-python-client to avoid https://github.com/grpc/grpc/issues/15600 +pip install google-api-python-client==1.6.7 --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -- cgit v1.2.3