Merge pull request #15349 from AspirinSJL/load_reporting_bazel_only

Remove load data store targets from build.yaml
diff --git a/CONCEPTS.md b/CONCEPTS.md
index 6855d43..034d58e 100644
--- a/CONCEPTS.md
+++ b/CONCEPTS.md
@@ -9,8 +9,9 @@
 
 ## Interface
 
-Developers using gRPC start with the description of an RPC service (a collection
-of methods), and generate client and server side interfaces. The server implements
+Developers using gRPC start with a language agnostic description of an RPC service (a collection
+of methods). From this description, gRPC will generate client and server side interfaces
+in any of the supported languages. The server implements
 the service interface, which can be remotely invoked by the client interface.
 
 By default, gRPC uses [Protocol Buffers](https://github.com/google/protobuf) as the
@@ -41,7 +42,7 @@
 
 gRPC supports streaming semantics, where either the client or the server (or both)
 send a stream of messages on a single RPC call. The most general case is
-Bidirectional Streaming where a single gRPC call establishes a stream where both
+Bidirectional Streaming where a single gRPC call establishes a stream in which both
 the client and the server can send a stream of messages to each other. The streamed
 messages are delivered in the order they were sent.
 
diff --git a/config.m4 b/config.m4
index 2704c42..99c4a85 100644
--- a/config.m4
+++ b/config.m4
@@ -9,11 +9,12 @@
   PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
   PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include)
   PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include)
+  PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb)
 
   LIBS="-lpthread $LIBS"
 
-  CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_16BIT=1"
-  CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_16BIT=1"
+  CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1"
+  CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1"
   GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
   PHP_REQUIRE_CXX()
   PHP_ADD_LIBRARY(pthread)
diff --git a/config.w32 b/config.w32
index e960c28..b8be238 100644
--- a/config.w32
+++ b/config.w32
@@ -639,13 +639,14 @@
   EXTENSION("grpc", grpc_source, null,
     "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+
     "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+
-    "/DPB_FIELD_16BIT "+
+    "/DPB_FIELD_32BIT "+
     "/I"+configure_module_dirname+" "+
     "/I"+configure_module_dirname+"\\include "+
     "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+
     "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+
     "/I"+configure_module_dirname+"\\third_party\\zlib "+
-    "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include");
+    "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+
+    "/I"+configure_module_dirname+"\\third_party\\nanopb");
 
   base_dir = get_define('BUILD_DIR');
   FSO.CreateFolder(base_dir+"\\ext");
diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h
index e324f6b..a5e930a 100644
--- a/include/grpcpp/impl/codegen/call.h
+++ b/include/grpcpp/impl/codegen/call.h
@@ -171,8 +171,8 @@
     return *this;
   }
 
-  /// Guarantee that all bytes have been written to the wire before completing
-  /// this write (usually writes are completed when they pass flow control)
+  /// Guarantee that all bytes have been written to the socket before completing
+  /// this write (usually writes are completed when they pass flow control).
   inline WriteOptions& set_write_through() {
     SetBit(GRPC_WRITE_THROUGH);
     return *this;
diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h
index cf1a7be..14bb081 100644
--- a/src/core/lib/iomgr/socket_utils.h
+++ b/src/core/lib/iomgr/socket_utils.h
@@ -23,12 +23,21 @@
 
 #include <stddef.h>
 
+// TODO(juanlishen): The following functions might be simple enough to implement
+// ourselves, so that they don't cause any portability hassle.
+
 /* A wrapper for htons on POSIX and Windows */
 uint16_t grpc_htons(uint16_t hostshort);
 
 /* A wrapper for ntohs on POSIX and WINDOWS */
 uint16_t grpc_ntohs(uint16_t netshort);
 
+/* A wrapper for htonl on POSIX and Windows */
+uint32_t grpc_htonl(uint32_t hostlong);
+
+/* A wrapper for ntohl on POSIX and WINDOWS */
+uint32_t grpc_ntohl(uint32_t netlong);
+
 /* A wrapper for inet_pton on POSIX and WINDOWS */
 int grpc_inet_pton(int af, const char* src, void* dst);
 
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc
index caee652..c4b991c 100644
--- a/src/core/lib/iomgr/socket_utils_common_posix.cc
+++ b/src/core/lib/iomgr/socket_utils_common_posix.cc
@@ -339,6 +339,10 @@
 
 uint16_t grpc_ntohs(uint16_t netshort) { return ntohs(netshort); }
 
+uint32_t grpc_htonl(uint32_t hostlong) { return htonl(hostlong); }
+
+uint32_t grpc_ntohl(uint32_t netlong) { return ntohl(netlong); }
+
 int grpc_inet_pton(int af, const char* src, void* dst) {
   return inet_pton(af, src, dst);
 }
diff --git a/src/core/lib/iomgr/socket_utils_uv.cc b/src/core/lib/iomgr/socket_utils_uv.cc
index 7eba40c..b5f96b5 100644
--- a/src/core/lib/iomgr/socket_utils_uv.cc
+++ b/src/core/lib/iomgr/socket_utils_uv.cc
@@ -33,6 +33,10 @@
 
 uint16_t grpc_ntohs(uint16_t netshort) { return ntohs(netshort); }
 
+uint32_t grpc_htonl(uint32_t hostlong) { return htonl(hostlong); }
+
+uint32_t grpc_ntohl(uint32_t netlong) { return ntohl(netlong); }
+
 int grpc_inet_pton(int af, const char* src, void* dst) {
   return inet_pton(af, src, dst);
 }
diff --git a/src/core/lib/iomgr/socket_utils_windows.cc b/src/core/lib/iomgr/socket_utils_windows.cc
index 3e7b5b8..9137ab9 100644
--- a/src/core/lib/iomgr/socket_utils_windows.cc
+++ b/src/core/lib/iomgr/socket_utils_windows.cc
@@ -31,6 +31,10 @@
 
 uint16_t grpc_ntohs(uint16_t netshort) { return ntohs(netshort); }
 
+uint32_t grpc_htonl(uint32_t hostlong) { return htonl(hostlong); }
+
+uint32_t grpc_ntohl(uint32_t netlong) { return ntohl(netlong); }
+
 int grpc_inet_pton(int af, const char* src, void* dst) {
   return inet_pton(af, src, dst);
 }
diff --git a/src/python/grpcio_testing/MANIFEST.in b/src/python/grpcio_testing/MANIFEST.in
new file mode 100644
index 0000000..39b3565
--- /dev/null
+++ b/src/python/grpcio_testing/MANIFEST.in
@@ -0,0 +1,3 @@
+include grpc_version.py
+recursive-include grpc_testing *.py
+global-exclude *.pyc
diff --git a/src/python/grpcio_testing/README.rst b/src/python/grpcio_testing/README.rst
new file mode 100644
index 0000000..c699b80
--- /dev/null
+++ b/src/python/grpcio_testing/README.rst
@@ -0,0 +1,10 @@
+gRPC Python Testing Package
+===========================
+
+Testing utilities for gRPC Python
+
+Dependencies
+------------
+
+Depends on the `grpcio` package, available from PyPI via `pip install grpcio`.
+
diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb
index 8624081..6e601bd 100644
--- a/src/ruby/lib/grpc/generic/active_call.rb
+++ b/src/ruby/lib/grpc/generic/active_call.rb
@@ -120,7 +120,7 @@
       @send_initial_md_mutex.synchronize do
         return if @metadata_sent
         @metadata_to_send.merge!(new_metadata)
-        @metadata_tag = ActiveCall.client_invoke(@call, @metadata_to_send)
+        ActiveCall.client_invoke(@call, @metadata_to_send)
         @metadata_sent = true
       end
     end
diff --git a/templates/config.m4.template b/templates/config.m4.template
index cc19d98..19f9904 100644
--- a/templates/config.m4.template
+++ b/templates/config.m4.template
@@ -11,11 +11,12 @@
     PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
     PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include)
     PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include)
+    PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb)
 
     LIBS="-lpthread $LIBS"
 
-    CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_16BIT=1"
-    CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_16BIT=1"
+    CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1"
+    CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1"
     GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
     PHP_REQUIRE_CXX()
     PHP_ADD_LIBRARY(pthread)
diff --git a/templates/config.w32.template b/templates/config.w32.template
index ef25e55..5e37cf5 100644
--- a/templates/config.w32.template
+++ b/templates/config.w32.template
@@ -23,13 +23,14 @@
     EXTENSION("grpc", grpc_source, null,
       "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+
       "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+
-      "/DPB_FIELD_16BIT "+
+      "/DPB_FIELD_32BIT "+
       "/I"+configure_module_dirname+" "+
       "/I"+configure_module_dirname+"\\include "+
       "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+
       "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+
       "/I"+configure_module_dirname+"\\third_party\\zlib "+
-      "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include");
+      "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+
+      "/I"+configure_module_dirname+"\\third_party\\nanopb");
   <%
     dirs = {}
     for lib in libs:
diff --git a/test/distrib/python/test_packages.sh b/test/distrib/python/test_packages.sh
index 6bf49d4..755daa1 100755
--- a/test/distrib/python/test_packages.sh
+++ b/test/distrib/python/test_packages.sh
@@ -28,10 +28,12 @@
   echo "Testing Python source distribution"
   ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-[0-9]*.tar.gz)
   TOOLS_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-tools-[0-9]*.tar.gz)
-  HEALTH_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-health-checking-[0-9]*.tar.gz)
-  REFLECTION_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-reflection-[0-9]*.tar.gz)
 fi
 
+HEALTH_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-health-checking-[0-9]*.tar.gz)
+REFLECTION_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-reflection-[0-9]*.tar.gz)
+TESTING_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-testing-[0-9]*.tar.gz)
+
 VIRTUAL_ENV=$(mktemp -d)
 virtualenv "$VIRTUAL_ENV"
 PYTHON=$VIRTUAL_ENV/bin/python
@@ -53,13 +55,9 @@
 
 at_least_one_installs "${ARCHIVES[@]}"
 at_least_one_installs "${TOOLS_ARCHIVES[@]}"
-
-if [[ "$1" == "source" ]]
-then
-  echo "Testing Python health and reflection packages"
-  at_least_one_installs "${HEALTH_ARCHIVES[@]}"
-  at_least_one_installs "${REFLECTION_ARCHIVES[@]}"
-fi
+at_least_one_installs "${HEALTH_ARCHIVES[@]}"
+at_least_one_installs "${REFLECTION_ARCHIVES[@]}"
+at_least_one_installs "${TESTING_ARCHIVES[@]}"
 
 
 #
diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh
index 846a415..2878005 100755
--- a/tools/run_tests/artifacts/build_artifact_python.sh
+++ b/tools/run_tests/artifacts/build_artifact_python.sh
@@ -99,12 +99,16 @@
   "${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/"
   "${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"
 
-  # Build gRPC health-checking source distribution
+  # Build grpcio_testing source distribution
+  ${SETARCH_CMD} "${PYTHON}" src/python/grpcio_testing/setup.py sdist
+  cp -r src/python/grpcio_testing/dist/* "$ARTIFACT_DIR"
+
+  # Build grpcio_health_checking source distribution
   ${SETARCH_CMD} "${PYTHON}" src/python/grpcio_health_checking/setup.py \
       preprocess build_package_protos sdist
   cp -r src/python/grpcio_health_checking/dist/* "$ARTIFACT_DIR"
 
-  # Build gRPC reflection source distribution
+  # Build grpcio_reflection source distribution
   ${SETARCH_CMD} "${PYTHON}" src/python/grpcio_reflection/setup.py \
       preprocess build_package_protos sdist
   cp -r src/python/grpcio_reflection/dist/* "$ARTIFACT_DIR"