Merge branch 'direct-calls' into buffer_pools_for_realsies

reviewable/pr8239/r2
Craig Tiller 9 years ago
commit d29a351dff
  1. 2
      src/compiler/cpp_generator.h
  2. 6
      src/core/ext/client_config/client_config_plugin.c
  3. 45
      src/core/ext/client_config/resolver_registry.c
  4. 5
      src/core/ext/client_config/resolver_registry.h
  5. 6
      src/core/ext/lb_policy/grpclb/grpclb.c
  6. 12
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  7. 2
      test/core/surface/channel_create_test.c
  8. 2
      test/core/surface/secure_channel_create_test.c
  9. 5
      test/cpp/qps/gen_build_yaml.py
  10. 2
      test/cpp/util/byte_buffer_proto_helper.cc
  11. 2
      test/cpp/util/byte_buffer_test.cc
  12. 2
      test/cpp/util/cli_call.cc
  13. 10182
      tools/run_tests/tests.json

@ -41,6 +41,8 @@
#include <memory>
#include <vector>
#include "src/compiler/config.h"
#ifndef GRPC_CUSTOM_STRING
#include <string>
#define GRPC_CUSTOM_STRING std::string

@ -43,10 +43,6 @@
#include "src/core/ext/client_config/subchannel_index.h"
#include "src/core/lib/surface/channel_init.h"
#ifndef GRPC_DEFAULT_NAME_PREFIX
#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
#endif
static bool append_filter(grpc_channel_stack_builder *builder, void *arg) {
return grpc_channel_stack_builder_append_filter(
builder, (const grpc_channel_filter *)arg, NULL, NULL);
@ -79,7 +75,7 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
void grpc_client_config_init(void) {
grpc_lb_policy_registry_init();
grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX);
grpc_resolver_registry_init();
grpc_subchannel_index_init();
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MIN,
set_default_host_if_unset, NULL);

@ -40,22 +40,20 @@
#include <grpc/support/string_util.h>
#define MAX_RESOLVERS 10
#define DEFAULT_RESOLVER_PREFIX_MAX_LENGTH 32
static grpc_resolver_factory *g_all_of_the_resolvers[MAX_RESOLVERS];
static int g_number_of_resolvers = 0;
static char *g_default_resolver_prefix;
static char g_default_resolver_prefix[DEFAULT_RESOLVER_PREFIX_MAX_LENGTH] =
"dns:///";
void grpc_resolver_registry_init(const char *default_resolver_prefix) {
g_default_resolver_prefix = gpr_strdup(default_resolver_prefix);
}
void grpc_resolver_registry_init() {}
void grpc_resolver_registry_shutdown(void) {
int i;
for (i = 0; i < g_number_of_resolvers; i++) {
for (int i = 0; i < g_number_of_resolvers; i++) {
grpc_resolver_factory_unref(g_all_of_the_resolvers[i]);
}
gpr_free(g_default_resolver_prefix);
// FIXME(ctiller): this should live in grpc_resolver_registry_init,
// however that would have the client_config plugin call this AFTER we start
// registering resolvers from third party plugins, and so they'd never show
@ -65,6 +63,17 @@ void grpc_resolver_registry_shutdown(void) {
g_number_of_resolvers = 0;
}
void grpc_resolver_registry_set_default_prefix(
const char *default_resolver_prefix) {
const size_t len = strlen(default_resolver_prefix);
GPR_ASSERT(len < DEFAULT_RESOLVER_PREFIX_MAX_LENGTH &&
"default resolver prefix too long");
GPR_ASSERT(len > 0 && "default resolver prefix can't be empty");
// By the previous assert, default_resolver_prefix is safe to be copied with a
// plain strcpy.
strcpy(g_default_resolver_prefix, default_resolver_prefix);
}
void grpc_register_resolver_type(grpc_resolver_factory *factory) {
int i;
for (i = 0; i < g_number_of_resolvers; i++) {
@ -108,22 +117,16 @@ static grpc_resolver_factory *resolve_factory(const char *target,
*uri = grpc_uri_parse(target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == NULL) {
if (g_default_resolver_prefix != NULL) {
grpc_uri_destroy(*uri);
gpr_asprintf(&tmp, "%s%s", g_default_resolver_prefix, target);
*uri = grpc_uri_parse(tmp, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == NULL) {
grpc_uri_destroy(grpc_uri_parse(target, 0));
grpc_uri_destroy(grpc_uri_parse(tmp, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
tmp);
}
gpr_free(tmp);
} else {
grpc_uri_destroy(*uri);
gpr_asprintf(&tmp, "%s%s", g_default_resolver_prefix, target);
*uri = grpc_uri_parse(tmp, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == NULL) {
grpc_uri_destroy(grpc_uri_parse(target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s'", target);
grpc_uri_destroy(grpc_uri_parse(tmp, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target, tmp);
}
gpr_free(tmp);
}
return factory;
}

@ -36,9 +36,12 @@
#include "src/core/ext/client_config/resolver_factory.h"
void grpc_resolver_registry_init(const char *default_prefix);
void grpc_resolver_registry_init();
void grpc_resolver_registry_shutdown(void);
/** Set the default URI prefix to \a default_prefix. */
void grpc_resolver_registry_set_default_prefix(const char *default_prefix);
/** Register a resolver type.
URI's of \a scheme will be resolved with the given resolver.
If \a priority is greater than zero, then the resolver will be eligible

@ -926,10 +926,8 @@ static lb_client_data *lb_client_data_create(glb_lb_policy *glb_policy) {
grpc_closure_init(&lb_client->close_sent, close_sent_cb, lb_client);
grpc_closure_init(&lb_client->srv_status_rcvd, srv_status_rcvd_cb, lb_client);
/* TODO(dgq): get the deadline from the client config instead of fabricating
* one here. */
lb_client->deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(3, GPR_TIMESPAN));
/* TODO(dgq): get the deadline from the parent channel. */
lb_client->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
/* Note the following LB call progresses every time there's activity in \a
* glb_policy->base.interested_parties, which is comprised of the polling

@ -933,7 +933,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
if (grpc_http_trace) {
char *str = grpc_transport_stream_op_string(op);
gpr_log(GPR_DEBUG, "perform_stream_op_locked: %s", str);
gpr_log(GPR_DEBUG, "perform_stream_op_locked: %s; on_complete = %p", str,
op->on_complete);
gpr_free(str);
}
@ -942,10 +943,6 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
on_complete = grpc_closure_create(do_nothing, NULL);
}
if (grpc_http_trace) {
gpr_log(GPR_DEBUG, " on_complete = %p", on_complete);
}
/* use final_data as a barrier until enqueue time; the inital counter is
dropped at the end of this function */
on_complete->next_data.scratch = CLOSURE_BARRIER_FIRST_REF_BIT;
@ -1038,6 +1035,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
(ssize_t)s->flow_controlled_buffer.length + (ssize_t)len;
s->complete_fetch_covered_by_poller = op->covered_by_poller;
if (flags & GRPC_WRITE_BUFFER_HINT) {
/* allow up to 64kb to be buffered */
/* TODO(ctiller): make this configurable */
s->fetching_slice_end_offset -= 65536;
}
continue_fetching_send_locked(exec_ctx, t, s);
@ -1264,7 +1263,6 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx,
if (s->seen_error) {
while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) !=
NULL) {
gpr_log(GPR_DEBUG, "discard %p", bs);
incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE);
}
}
@ -1283,7 +1281,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx,
while (s->final_metadata_requested && s->seen_error &&
(bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) !=
NULL) {
gpr_log(GPR_DEBUG, "discard %p", bs);
incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE);
}
if (s->incoming_frames.head != NULL) {
@ -1308,7 +1305,6 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx,
if (s->seen_error) {
while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) !=
NULL) {
gpr_log(GPR_DEBUG, "discard %p", bs);
incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE);
}
}

@ -40,7 +40,7 @@ void test_unknown_scheme_target(void) {
grpc_channel *chan;
/* avoid default prefix */
grpc_resolver_registry_shutdown();
grpc_resolver_registry_init("");
grpc_resolver_registry_init();
chan = grpc_insecure_channel_create("blah://blah", NULL, NULL);
GPR_ASSERT(chan != NULL);

@ -46,7 +46,7 @@ void test_unknown_scheme_target(void) {
grpc_channel *chan;
grpc_channel_credentials *creds;
grpc_resolver_registry_shutdown();
grpc_resolver_registry_init("");
grpc_resolver_registry_init();
creds = grpc_fake_transport_security_credentials_create();
chan = grpc_secure_channel_create(creds, "blah://blah", NULL, NULL);

@ -74,8 +74,8 @@ print yaml.dump({
'name': 'json_run_localhost',
'shortname': 'json_run_localhost:%s' % scenario_json['name'],
'args': ['--scenarios_json', _scenario_json_string(scenario_json)],
'ci_platforms': ['linux', 'mac', 'posix', 'windows'],
'platforms': ['linux', 'mac', 'posix', 'windows'],
'ci_platforms': ['linux'],
'platforms': ['linux'],
'flaky': False,
'language': 'c++',
'boringssl': True,
@ -85,5 +85,6 @@ print yaml.dump({
'timeout_seconds': 3*60
}
for scenario_json in scenario_config.CXXLanguage().scenarios()
if 'scalable' in scenario_json.get('CATEGORIES', [])
]
})

@ -38,7 +38,7 @@ namespace testing {
bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) {
std::vector<Slice> slices;
buffer->Dump(&slices);
(void)buffer->Dump(&slices);
grpc::string buf;
buf.reserve(buffer->Length());
for (auto s = slices.begin(); s != slices.end(); s++) {

@ -100,7 +100,7 @@ TEST_F(ByteBufferTest, Dump) {
slices.push_back(Slice(world, Slice::STEAL_REF));
ByteBuffer buffer(&slices[0], 2);
slices.clear();
buffer.Dump(&slices);
(void)buffer.Dump(&slices);
EXPECT_TRUE(SliceEqual(slices[0], hello));
EXPECT_TRUE(SliceEqual(slices[1], world));
}

@ -94,7 +94,7 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel,
if (status.ok()) {
std::vector<grpc::Slice> slices;
recv_buffer.Dump(&slices);
(void)recv_buffer.Dump(&slices);
response->clear();
for (size_t i = 0; i < slices.size(); i++) {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save