diff options
-rw-r--r-- | examples/csharp/route_guide/RouteGuide/route_guide_db.json | 2 | ||||
-rw-r--r-- | src/core/ext/filters/client_channel/client_channel_channelz.cc | 4 | ||||
-rw-r--r-- | src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc | 26 | ||||
-rw-r--r-- | src/csharp/doc/docfx.json | 2 | ||||
-rw-r--r-- | tools/internal_ci/linux/grpc_publish_packages.cfg | 26 | ||||
-rw-r--r-- | tools/internal_ci/linux/grpc_publish_packages.sh | 110 | ||||
-rwxr-xr-x | tools/profiling/ios_bin/binary_size.py | 2 |
7 files changed, 165 insertions, 7 deletions
diff --git a/examples/csharp/route_guide/RouteGuide/route_guide_db.json b/examples/csharp/route_guide/RouteGuide/route_guide_db.json index 209f016259..9342beb579 100644 --- a/examples/csharp/route_guide/RouteGuide/route_guide_db.json +++ b/examples/csharp/route_guide/RouteGuide/route_guide_db.json @@ -1,4 +1,4 @@ -[{ +[{ "location": { "latitude": 407838351, "longitude": -746143763 diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.cc b/src/core/ext/filters/client_channel/client_channel_channelz.cc index d43e9ea67a..4c9c9a6bd6 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.cc +++ b/src/core/ext/filters/client_channel/client_channel_channelz.cc @@ -85,12 +85,12 @@ void ClientChannelNode::PopulateChildRefs(grpc_json* json) { grpc_json* array_parent = grpc_json_create_child( nullptr, json, "channelRef", nullptr, GRPC_JSON_ARRAY, false); json_iterator = nullptr; - for (size_t i = 0; i < child_subchannels.size(); ++i) { + for (size_t i = 0; i < child_channels.size(); ++i) { json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false); grpc_json_add_number_string_child(json_iterator, nullptr, "channelId", - child_subchannels[i]); + child_channels[i]); } } } 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 85534412cf..959c7441a3 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 @@ -135,9 +135,8 @@ class GrpcLb : public LoadBalancingPolicy { void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override; void PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) override; void ExitIdleLocked() override; - // TODO(ncteisen): implement this in a follow up PR void FillChildRefsForChannelz(ChildRefsList* child_subchannels, - ChildRefsList* child_channels) override {} + ChildRefsList* child_channels) override; private: /// Linked list of pending pick requests. It stores all information needed to @@ -301,6 +300,9 @@ class GrpcLb : public LoadBalancingPolicy { // The channel for communicating with the LB server. grpc_channel* lb_channel_ = nullptr; + // Mutex to protect the channel to the LB server. This is used when + // processing a channelz request. + gpr_mu lb_channel_mu_; grpc_connectivity_state lb_channel_connectivity_; grpc_closure lb_channel_on_connectivity_changed_; // Are we already watching the LB channel's connectivity? @@ -1040,6 +1042,7 @@ GrpcLb::GrpcLb(const grpc_lb_addresses* addresses, .set_max_backoff(GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) { // Initialization. + gpr_mu_init(&lb_channel_mu_); grpc_subchannel_index_ref(); GRPC_CLOSURE_INIT(&lb_channel_on_connectivity_changed_, &GrpcLb::OnBalancerChannelConnectivityChangedLocked, this, @@ -1078,6 +1081,7 @@ GrpcLb::GrpcLb(const grpc_lb_addresses* addresses, GrpcLb::~GrpcLb() { GPR_ASSERT(pending_picks_ == nullptr); GPR_ASSERT(pending_pings_ == nullptr); + gpr_mu_destroy(&lb_channel_mu_); gpr_free((void*)server_name_); grpc_channel_args_destroy(args_); grpc_connectivity_state_destroy(&state_tracker_); @@ -1107,8 +1111,10 @@ void GrpcLb::ShutdownLocked() { // OnBalancerChannelConnectivityChangedLocked(), and we need to be // alive when that callback is invoked. if (lb_channel_ != nullptr) { + gpr_mu_lock(&lb_channel_mu_); grpc_channel_destroy(lb_channel_); lb_channel_ = nullptr; + gpr_mu_unlock(&lb_channel_mu_); } grpc_connectivity_state_set(&state_tracker_, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), "grpclb_shutdown"); @@ -1279,6 +1285,20 @@ void GrpcLb::PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) { } } +void GrpcLb::FillChildRefsForChannelz(ChildRefsList* child_subchannels, + ChildRefsList* child_channels) { + // delegate to the RoundRobin to fill the children subchannels. + rr_policy_->FillChildRefsForChannelz(child_subchannels, child_channels); + mu_guard guard(&lb_channel_mu_); + if (lb_channel_ != nullptr) { + grpc_core::channelz::ChannelNode* channel_node = + grpc_channel_get_channelz_node(lb_channel_); + if (channel_node != nullptr) { + child_channels->push_back(channel_node->channel_uuid()); + } + } +} + grpc_connectivity_state GrpcLb::CheckConnectivityLocked( grpc_error** connectivity_error) { return grpc_connectivity_state_get(&state_tracker_, connectivity_error); @@ -1322,9 +1342,11 @@ void GrpcLb::ProcessChannelArgsLocked(const grpc_channel_args& args) { if (lb_channel_ == nullptr) { char* uri_str; gpr_asprintf(&uri_str, "fake:///%s", server_name_); + gpr_mu_lock(&lb_channel_mu_); lb_channel_ = grpc_client_channel_factory_create_channel( client_channel_factory(), uri_str, GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, lb_channel_args); + gpr_mu_unlock(&lb_channel_mu_); GPR_ASSERT(lb_channel_ != nullptr); gpr_free(uri_str); } diff --git a/src/csharp/doc/docfx.json b/src/csharp/doc/docfx.json index 7219d0e7a6..0ce5f7262a 100644 --- a/src/csharp/doc/docfx.json +++ b/src/csharp/doc/docfx.json @@ -24,7 +24,7 @@ "dest": "api" }, { - "files": [ "toc.yml"], + "files": [ "toc.yml"] } ], "globalMetadata": { diff --git a/tools/internal_ci/linux/grpc_publish_packages.cfg b/tools/internal_ci/linux/grpc_publish_packages.cfg new file mode 100644 index 0000000000..82d571d642 --- /dev/null +++ b/tools/internal_ci/linux/grpc_publish_packages.cfg @@ -0,0 +1,26 @@ +# 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_publish_packages.sh" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "github/grpc/reports/**" + regex: "github/grpc/artifacts/**" + } +} diff --git a/tools/internal_ci/linux/grpc_publish_packages.sh b/tools/internal_ci/linux/grpc_publish_packages.sh new file mode 100644 index 0000000000..89da36987e --- /dev/null +++ b/tools/internal_ci/linux/grpc_publish_packages.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# 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. + +set -ex + +shopt -s nullglob + +export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json + +GCS_ROOT=gs://packages.grpc.io +MANIFEST_FILE=index.xml +ARCHIVE_UUID=${KOKORO_BUILD_ID:-$(uuidgen)} +GIT_BRANCH_NAME=master #${KOKORO_GITHUB_COMMIT:-master} +GIT_COMMIT=${KOKORO_GIT_COMMIT:-unknown} +ARCHIVE_TIMESTAMP=$(date -Iseconds) +TARGET_DIR=$(mktemp -d grpc_publish_packages.sh.XXXX) +YEAR_MONTH_PREFIX=$(date "+%Y/%m") +YEAR_PREFIX=${YEAR_MONTH_PREFIX%%/*} +UPLOAD_ROOT=$TARGET_DIR/$YEAR_PREFIX +RELATIVE_PATH=$YEAR_MONTH_PREFIX/$ARCHIVE_UUID +BUILD_ROOT=$TARGET_DIR/$RELATIVE_PATH + +LINUX_PACKAGES=$KOKORO_GFILE_DIR/github/grpc/artifacts +WINDOWS_PACKAGES=$KOKORO_GFILE_DIR/github/grpc/artifacts +# TODO(mmx): enable linux_extra +# LINUX_EXTRA_PACKAGES=$KOKORO_GFILE_DIR/github/grpc/artifacts + +PYTHON_PACKAGES=( + "$LINUX_PACKAGES"/grpcio-[0-9]*.whl + "$LINUX_PACKAGES"/grpcio-[0-9]*.tar.gz + "$LINUX_PACKAGES"/grpcio_tools-[0-9]*.whl + "$LINUX_PACKAGES"/grpcio-tools-[0-9]*.tar.gz + "$LINUX_PACKAGES"/grpcio-health-checking-[0-9]*.tar.gz + "$LINUX_PACKAGES"/grpcio-reflection-[0-9]*.tar.gz + "$LINUX_PACKAGES"/grpcio-testing-[0-9]*.tar.gz + #"$LINUX_EXTRA_PACKAGES"/grpcio-[0-9]*.whl + #"$LINUX_EXTRA_PACKAGES"/grpcio_tools-[0-9]*.whl +) + +PHP_PACKAGES=( + "$LINUX_PACKAGES"/grpc-[0-9]*.tgz +) + +RUBY_PACKAGES=( + "$LINUX_PACKAGES"/grpc-[0-9]*.gem + "$LINUX_PACKAGES"/grpc-tools-[0-9]*.gem +) + +CSHARP_PACKAGES=( + "$WINDOWS_PACKAGES"/csharp_nugets_windows_dotnetcli.zip +) + +function add_to_manifest() { + local xml_type=$1 + local xml_name + xml_name=$(basename "$2") + local xml_sha256 + xml_sha256=$(openssl sha256 -r "$2" | cut -d " " -f 1) + cp "$2" "$BUILD_ROOT" + echo "<artifact type='$xml_type' name='$xml_name' sha256='$xml_sha256' />" +} + +mkdir -p "$BUILD_ROOT" + +{ + cat <<EOF +<?xml version="1.0"?> +<?xml-stylesheet href="/web-assets/build.xsl" type="text/xsl"?> +EOF + echo "<build id='$ARCHIVE_UUID' timestamp='$ARCHIVE_TIMESTAMP'>" + echo "<metadata>" + echo "<branch>$GIT_BRANCH_NAME</branch>" + echo "<commit>$GIT_COMMIT</commit>" + echo "</metadata><artifacts>" + + for pkg in "${PYTHON_PACKAGES[@]}"; do add_to_manifest python "$pkg"; done + for pkg in "${CSHARP_PACKAGES[@]}"; do add_to_manifest csharp "$pkg"; done + for pkg in "${PHP_PACKAGES[@]}"; do add_to_manifest php "$pkg"; done + for pkg in "${RUBY_PACKAGES[@]}"; do add_to_manifest ruby "$pkg"; done + + echo "</artifacts></build>" +}> "$BUILD_ROOT/$MANIFEST_FILE" + +BUILD_XML_SHA=$(openssl sha256 -r "$BUILD_ROOT/$MANIFEST_FILE" | cut -d " " -f 1) + +PREV_HOME=$(mktemp old-XXXXX-$MANIFEST_FILE) +NEW_HOME=$(mktemp new-XXXXX-$MANIFEST_FILE) +gsutil cp "$GCS_ROOT/$MANIFEST_FILE" "$PREV_HOME" + +{ + head --lines=4 "$PREV_HOME" + echo "<build id='$ARCHIVE_UUID' timestamp='$ARCHIVE_TIMESTAMP' branch='$GIT_BRANCH_NAME' commit='$GIT_COMMIT' manifest='archive/$RELATIVE_PATH/$MANIFEST_FILE' manifest-sha256='$BUILD_XML_SHA' />" + tail --lines=+5 "$PREV_HOME" +}> "$NEW_HOME" + +gsutil -m cp -r "$UPLOAD_ROOT" "$GCS_ROOT/archive" +gsutil -h "Content-Type:application/xml" cp "$NEW_HOME" "$GCS_ROOT/$MANIFEST_FILE" + diff --git a/tools/profiling/ios_bin/binary_size.py b/tools/profiling/ios_bin/binary_size.py index cde09023f2..b07adb5734 100755 --- a/tools/profiling/ios_bin/binary_size.py +++ b/tools/profiling/ios_bin/binary_size.py @@ -86,7 +86,7 @@ def build(where, frameworks): 'src/objective-c/examples/Sample/Build-%s' % where) -text = '' +text = 'Objective-C binary sizes\n' for frameworks in [False, True]: build('new', frameworks) new_size = get_size('new', frameworks) |