From 2f40ff423ece50964d1041a4ad68939260da9fe6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 16:01:19 -0700 Subject: [PATCH 01/18] Support making hybrid cqs in core --- src/core/lib/surface/completion_queue.c | 167 +++++++++++++++++++++--- src/core/lib/surface/completion_queue.h | 1 - 2 files changed, 149 insertions(+), 19 deletions(-) diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 35e9f7eb308..e17f094837e 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -60,13 +60,145 @@ typedef struct { void *tag; } plucker; +typedef struct { + size_t (*size)(void); + void (*init)(grpc_pollset *pollset, gpr_mu **mu); + grpc_error *(*kick)(grpc_pollset *pollset, + grpc_pollset_worker *specific_worker); + grpc_error *(*work)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, + grpc_pollset_worker **worker, gpr_timespec now, + gpr_timespec deadline); + void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, + grpc_closure *closure); + void (*destroy)(grpc_pollset *pollset); +} cq_poller_vtable; + +typedef struct non_polling_worker { + gpr_cv cv; + bool kicked; + struct non_polling_worker *next; + struct non_polling_worker *prev; +} non_polling_worker; + +typedef struct { + gpr_mu mu; + non_polling_worker *root; + grpc_closure *shutdown; +} non_polling_poller; + +static size_t non_polling_poller_size(void) { + return sizeof(non_polling_poller); +} + +static void non_polling_poller_init(grpc_pollset *pollset, gpr_mu **mu) { + non_polling_poller *npp = (non_polling_poller *)pollset; + gpr_mu_init(&npp->mu); + *mu = &npp->mu; +} + +static void non_polling_poller_destroy(grpc_pollset *pollset) { + non_polling_poller *npp = (non_polling_poller *)pollset; + gpr_mu_destroy(&npp->mu); +} + +static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx, + grpc_pollset *pollset, + grpc_pollset_worker **worker, + gpr_timespec now, + gpr_timespec deadline) { + non_polling_poller *npp = (non_polling_poller *)pollset; + non_polling_worker w; + gpr_cv_init(&w.cv); + *worker = (grpc_pollset_worker *)&w; + if (npp->root == NULL) { + npp->root = w.next = w.prev = &w; + } else { + w.next = npp->root; + w.prev = w.next->prev; + w.next->prev = w.prev->next = &w; + } + w.kicked = false; + while (!npp->shutdown && !w.kicked && !gpr_cv_wait(&w.cv, &npp->mu, deadline)) + ; + if (&w == npp->root) { + npp->root = w.next; + if (&w == npp->root) { + if (npp->shutdown) { + grpc_closure_sched(exec_ctx, npp->shutdown, GRPC_ERROR_NONE); + } + npp->root = NULL; + } + w.next->prev = w.prev; + w.prev->next = w.next; + } + gpr_cv_destroy(&w.cv); + *worker = NULL; + return GRPC_ERROR_NONE; +} + +static grpc_error *non_polling_poller_kick( + grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { + non_polling_poller *p = (non_polling_poller *)pollset; + if (specific_worker == NULL) specific_worker = (grpc_pollset_worker *)p->root; + if (specific_worker != NULL) { + non_polling_worker *w = (non_polling_worker *)specific_worker; + if (!w->kicked) { + w->kicked = true; + gpr_cv_signal(&w->cv); + } + } + return GRPC_ERROR_NONE; +} + +static void non_polling_poller_shutdown(grpc_exec_ctx *exec_ctx, + grpc_pollset *pollset, + grpc_closure *closure) { + non_polling_poller *p = (non_polling_poller *)pollset; + GPR_ASSERT(closure != NULL); + p->shutdown = closure; + if (p->root == NULL) { + grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + } else { + non_polling_worker *w = p->root; + do { + gpr_cv_signal(&w->cv); + w = w->next; + } while (w != p->root); + } +} + +static const cq_poller_vtable g_poller_vtable_by_poller_type[] = { + /* GRPC_CQ_DEFAULT_POLLING */ + {.size = grpc_pollset_size, + .init = grpc_pollset_init, + .kick = grpc_pollset_kick, + .work = grpc_pollset_work, + .shutdown = grpc_pollset_shutdown, + .destroy = grpc_pollset_destroy}, + /* GRPC_CQ_NON_LISTENING */ + {.size = grpc_pollset_size, + .init = grpc_pollset_init, + .kick = grpc_pollset_kick, + .work = grpc_pollset_work, + .shutdown = grpc_pollset_shutdown, + .destroy = grpc_pollset_destroy}, + /* GRPC_CQ_NON_POLLING */ + {.size = non_polling_poller_size, + .init = non_polling_poller_init, + .kick = non_polling_poller_kick, + .work = non_polling_poller_work, + .shutdown = non_polling_poller_shutdown, + .destroy = non_polling_poller_destroy}, +}; + /* Completion queue structure */ struct grpc_completion_queue { /** owned by pollset */ gpr_mu *mu; grpc_cq_completion_type completion_type; - grpc_cq_polling_type polling_type; + + const cq_poller_vtable *poller_vtable; /** completed events */ grpc_cq_completion completed_head; @@ -127,15 +259,18 @@ grpc_completion_queue *grpc_completion_queue_create_internal( "polling_type=%d)", 2, (completion_type, polling_type)); - cc = gpr_zalloc(sizeof(grpc_completion_queue) + grpc_pollset_size()); - grpc_pollset_init(POLLSET_FROM_CQ(cc), &cc->mu); + const cq_poller_vtable *poller_vtable = + &g_poller_vtable_by_poller_type[polling_type]; + + cc = gpr_zalloc(sizeof(grpc_completion_queue) + poller_vtable->size()); + poller_vtable->init(POLLSET_FROM_CQ(cc), &cc->mu); #ifndef NDEBUG cc->outstanding_tags = NULL; cc->outstanding_tag_capacity = 0; #endif cc->completion_type = completion_type; - cc->polling_type = polling_type; + cc->poller_vtable = poller_vtable; /* Initial ref is dropped by grpc_completion_queue_shutdown */ gpr_ref_init(&cc->pending_events, 1); @@ -164,10 +299,6 @@ grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc) { return cc->completion_type; } -grpc_cq_polling_type grpc_get_cq_polling_type(grpc_completion_queue *cc) { - return cc->polling_type; -} - #ifdef GRPC_CQ_REF_COUNT_DEBUG void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, const char *file, int line) { @@ -195,7 +326,7 @@ void grpc_cq_internal_unref(grpc_completion_queue *cc) { #endif if (gpr_unref(&cc->owning_refs)) { GPR_ASSERT(cc->completed_head.next == (uintptr_t)&cc->completed_head); - grpc_pollset_destroy(POLLSET_FROM_CQ(cc)); + cc->poller_vtable->destroy(POLLSET_FROM_CQ(cc)); #ifndef NDEBUG gpr_free(cc->outstanding_tags); #endif @@ -280,7 +411,7 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, } } grpc_error *kick_error = - grpc_pollset_kick(POLLSET_FROM_CQ(cc), pluck_worker); + cc->poller_vtable->kick(POLLSET_FROM_CQ(cc), pluck_worker); gpr_mu_unlock(cc->mu); if (kick_error != GRPC_ERROR_NONE) { const char *msg = grpc_error_string(kick_error); @@ -295,8 +426,8 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, GPR_ASSERT(!cc->shutdown); GPR_ASSERT(cc->shutdown_called); cc->shutdown = 1; - grpc_pollset_shutdown(exec_ctx, POLLSET_FROM_CQ(cc), - &cc->pollset_shutdown_done); + cc->poller_vtable->shutdown(exec_ctx, POLLSET_FROM_CQ(cc), + &cc->pollset_shutdown_done); gpr_mu_unlock(cc->mu); } @@ -452,8 +583,8 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, gpr_mu_lock(cc->mu); continue; } else { - grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc), NULL, - now, iteration_deadline); + grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc), + NULL, now, iteration_deadline); if (err != GRPC_ERROR_NONE) { gpr_mu_unlock(cc->mu); const char *msg = grpc_error_string(err); @@ -644,8 +775,8 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(cc->mu); } else { - grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc), - &worker, now, iteration_deadline); + grpc_error *err = cc->poller_vtable->work( + &exec_ctx, POLLSET_FROM_CQ(cc), &worker, now, iteration_deadline); if (err != GRPC_ERROR_NONE) { del_plucker(cc, tag, &worker); gpr_mu_unlock(cc->mu); @@ -689,8 +820,8 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cc) { if (gpr_unref(&cc->pending_events)) { GPR_ASSERT(!cc->shutdown); cc->shutdown = 1; - grpc_pollset_shutdown(&exec_ctx, POLLSET_FROM_CQ(cc), - &cc->pollset_shutdown_done); + cc->poller_vtable->shutdown(&exec_ctx, POLLSET_FROM_CQ(cc), + &cc->pollset_shutdown_done); } gpr_mu_unlock(cc->mu); grpc_exec_ctx_finish(&exec_ctx); diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 1ff3d64293a..0995a56889b 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -100,7 +100,6 @@ void grpc_cq_mark_server_cq(grpc_completion_queue *cc); int grpc_cq_is_server_cq(grpc_completion_queue *cc); grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc); -grpc_cq_polling_type grpc_get_cq_polling_type(grpc_completion_queue *cc); grpc_completion_queue *grpc_completion_queue_create_internal( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type); From 334c4678a326284c17254e91a4498728a9c67f69 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 16:26:07 -0700 Subject: [PATCH 02/18] Start building out C++ interface --- .../grpc++/impl/codegen/completion_queue.h | 12 ++++++--- include/grpc/grpc.h | 26 ------------------- include/grpc/impl/codegen/grpc_types.h | 26 +++++++++++++++++++ src/cpp/server/server_builder.cc | 8 ++++-- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 61617f2bdc9..906a64693e1 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -289,17 +289,21 @@ class CompletionQueue : private GrpcLibraryCodegen { /// by servers. Instantiated by \a ServerBuilder. class ServerCompletionQueue : public CompletionQueue { public: - bool IsFrequentlyPolled() { return is_frequently_polled_; } + bool IsFrequentlyPolled() { return polling_type_ != GRPC_CQ_NON_LISTENING; } private: - bool is_frequently_polled_; + grpc_cq_polling_type polling_type_; friend class ServerBuilder; /// \param is_frequently_polled Informs the GRPC library about whether the /// server completion queue would be actively polled (by calling Next() or /// AsyncNext()). By default all server completion queues are assumed to be /// frequently polled. - ServerCompletionQueue(bool is_frequently_polled = true) - : is_frequently_polled_(is_frequently_polled) {} + ServerCompletionQueue(grpc_cq_polling_type polling_type) + : CompletionQueue(MakeCompletionQueue(polling_type)), + polling_type_(polling_type) {} + + static grpc_completion_queue* MakeCompletionQueue( + grpc_cq_polling_type polling_type); }; } // namespace grpc diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 42cf201da44..f3201edad29 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -102,32 +102,6 @@ typedef enum { GRPC_CQ_PLUCK } grpc_cq_completion_type; -/** Completion queues internally MAY maintain a set of file descriptors in a - structure called 'pollset'. This enum specifies if a completion queue has an - associated pollset and any restrictions on the type of file descriptors that - can be present in the pollset. - - I/O progress can only be made when grpc_completion_queue_next() or - grpc_completion_queue_pluck() are called on the completion queue (unless the - grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important - to actively call these APIs */ -typedef enum { - /** The completion queue will have an associated pollset and there is no - restriction on the type of file descriptors the pollset may contain */ - GRPC_CQ_DEFAULT_POLLING, - - /** Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will - not contain any 'listening file descriptors' (i.e file descriptors used to - listen to incoming channels) */ - GRPC_CQ_NON_LISTENING, - - /** The completion queue will not have an associated pollset. Note that - grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still - be called to pop events from the completion queue; it is not required to - call them actively to make I/O progress */ - GRPC_CQ_NON_POLLING -} grpc_cq_polling_type; - #define GRPC_CQ_CURRENT_VERSION 1 typedef struct grpc_completion_queue_attributes { /* The version number of this structure. More fields might be added to this diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 4383691a837..02732205f5f 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -543,6 +543,32 @@ typedef struct { typedef struct grpc_resource_quota grpc_resource_quota; +/** Completion queues internally MAY maintain a set of file descriptors in a + structure called 'pollset'. This enum specifies if a completion queue has an + associated pollset and any restrictions on the type of file descriptors that + can be present in the pollset. + + I/O progress can only be made when grpc_completion_queue_next() or + grpc_completion_queue_pluck() are called on the completion queue (unless the + grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important + to actively call these APIs */ +typedef enum { + /** The completion queue will have an associated pollset and there is no + restriction on the type of file descriptors the pollset may contain */ + GRPC_CQ_DEFAULT_POLLING, + + /** Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will + not contain any 'listening file descriptors' (i.e file descriptors used to + listen to incoming channels) */ + GRPC_CQ_NON_LISTENING, + + /** The completion queue will not have an associated pollset. Note that + grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still + be called to pop events from the completion queue; it is not required to + call them actively to make I/O progress */ + GRPC_CQ_NON_POLLING +} grpc_cq_polling_type; + #ifdef __cplusplus } #endif diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 4eb4b5a1b21..c6784ea1593 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -83,7 +83,8 @@ ServerBuilder::~ServerBuilder() { std::unique_ptr ServerBuilder::AddCompletionQueue( bool is_frequently_polled) { - ServerCompletionQueue* cq = new ServerCompletionQueue(is_frequently_polled); + ServerCompletionQueue* cq = new ServerCompletionQueue( + is_frequently_polled ? GRPC_CQ_DEFAULT_POLLING : GRPC_CQ_NON_LISTENING); cqs_.push_back(cq); return std::unique_ptr(cq); } @@ -251,9 +252,12 @@ std::unique_ptr ServerBuilder::BuildAndStart() { sync_server_settings_.max_pollers, sync_server_settings_.cq_timeout_msec); + grpc_cq_polling_type polling_type = + cqs_.empty() ? GRPC_CQ_DEFAULT_POLLING : GRPC_CQ_NON_POLLING; + // Create completion queues to listen to incoming rpc requests for (int i = 0; i < sync_server_settings_.num_cqs; i++) { - sync_server_cqs->emplace_back(new ServerCompletionQueue()); + sync_server_cqs->emplace_back(new ServerCompletionQueue(polling_type)); } } From 75bfb9754827ef63ede77e27ad901e3355536419 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 17:55:12 -0700 Subject: [PATCH 03/18] Finish hybrid server stuff, ensure it gets tested --- .../grpc++/impl/codegen/client_unary_call.h | 4 ++- .../grpc++/impl/codegen/completion_queue.h | 32 +++++++++---------- include/grpc++/impl/codegen/core_codegen.h | 9 +++++- .../impl/codegen/core_codegen_interface.h | 6 ++++ include/grpc++/impl/codegen/sync_stream.h | 12 +++++-- include/grpc/grpc.h | 23 ------------- include/grpc/impl/codegen/grpc_types.h | 23 +++++++++++++ src/core/lib/surface/completion_queue.c | 21 +++++++----- src/core/lib/surface/server.c | 7 ++-- src/cpp/common/core_codegen.cc | 12 +++++++ src/cpp/server/server_builder.cc | 26 +++++++++++---- test/cpp/end2end/async_end2end_test.cc | 28 ++++++++++++---- 12 files changed, 134 insertions(+), 69 deletions(-) diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index a5a4f3d7398..4bf35ae7785 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -52,7 +52,9 @@ template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { - CompletionQueue cq(true); // Pluckable completion queue + CompletionQueue cq(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING}); // Pluckable completion queue Call call(channel->CreateCall(method, context, &cq)); CallOpSet, diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 906a64693e1..c8ab726b0f4 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -102,7 +102,9 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() : CompletionQueue(false) {} + CompletionQueue() + : CompletionQueue(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING}) {} /// Wrap \a take, taking ownership of the instance. /// @@ -182,6 +184,16 @@ class CompletionQueue : private GrpcLibraryCodegen { }; void CompleteAvalanching(); + protected: + /// Private constructor of CompletionQueue only visible to friend classes + CompletionQueue(const grpc_completion_queue_attributes& attributes) { + cq_ = g_core_codegen_interface->grpc_completion_queue_create( + g_core_codegen_interface->grpc_completion_queue_factory_lookup( + &attributes), + &attributes, NULL); + InitialAvalanching(); // reserve this for the future shutdown + } + private: // Friend synchronous wrappers so that they can access Pluck(), which is // a semi-private API geared towards the synchronous implementation. @@ -215,18 +227,6 @@ class CompletionQueue : private GrpcLibraryCodegen { const InputMessage& request, OutputMessage* result); - /// Private constructor of CompletionQueue only visible to friend classes - CompletionQueue(bool is_pluck) { - if (is_pluck) { - cq_ = g_core_codegen_interface->grpc_completion_queue_create_for_pluck( - nullptr); - } else { - cq_ = g_core_codegen_interface->grpc_completion_queue_create_for_next( - nullptr); - } - InitialAvalanching(); // reserve this for the future shutdown - } - NextStatus AsyncNextInternal(void** tag, bool* ok, gpr_timespec deadline); /// Wraps \a grpc_completion_queue_pluck. @@ -299,11 +299,9 @@ class ServerCompletionQueue : public CompletionQueue { /// AsyncNext()). By default all server completion queues are assumed to be /// frequently polled. ServerCompletionQueue(grpc_cq_polling_type polling_type) - : CompletionQueue(MakeCompletionQueue(polling_type)), + : CompletionQueue(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_NEXT, polling_type}), polling_type_(polling_type) {} - - static grpc_completion_queue* MakeCompletionQueue( - grpc_cq_polling_type polling_type); }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 65151590b25..3cb7da8ef6c 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -44,8 +44,15 @@ namespace grpc { /// Implementation of the core codegen interface. -class CoreCodegen : public CoreCodegenInterface { +class CoreCodegen final : public CoreCodegenInterface { private: + virtual const grpc_completion_queue_factory* + grpc_completion_queue_factory_lookup( + const grpc_completion_queue_attributes* attributes) override; + virtual grpc_completion_queue* grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attributes, + void* reserved) override; grpc_completion_queue* grpc_completion_queue_create_for_next( void* reserved) override; grpc_completion_queue* grpc_completion_queue_create_for_pluck( diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 529bef687bb..a1a0aaf3cad 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -59,6 +59,12 @@ class CoreCodegenInterface { virtual void assert_fail(const char* failed_assertion, const char* file, int line) = 0; + virtual const grpc_completion_queue_factory* + grpc_completion_queue_factory_lookup( + const grpc_completion_queue_attributes* attributes) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attributes, void* reserved) = 0; virtual grpc_completion_queue* grpc_completion_queue_create_for_next( void* reserved) = 0; virtual grpc_completion_queue* grpc_completion_queue_create_for_pluck( diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 328d5cb1e83..a010924cefe 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -156,7 +156,9 @@ class ClientReader final : public ClientReaderInterface { ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), - cq_(true), // Pluckable cq + cq_(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { CallOpSet @@ -230,7 +232,9 @@ class ClientWriter : public ClientWriterInterface { ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), - cq_(true), // Pluckable cq + cq_(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); @@ -330,7 +334,9 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) : context_(context), - cq_(true), // Pluckable cq + cq_(grpc_completion_queue_attributes{ + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { if (!context_->initial_metadata_corked_) { CallOpSet ops; diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index f3201edad29..1a7d0120bfa 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -93,29 +93,6 @@ GRPCAPI const char *grpc_version_string(void); /** Return a string specifying what the 'g' in gRPC stands for */ GRPCAPI const char *grpc_g_stands_for(void); -/** Specifies the type of APIs to use to pop events from the completion queue */ -typedef enum { - /** Events are popped out by calling grpc_completion_queue_next() API ONLY */ - GRPC_CQ_NEXT = 1, - - /** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/ - GRPC_CQ_PLUCK -} grpc_cq_completion_type; - -#define GRPC_CQ_CURRENT_VERSION 1 -typedef struct grpc_completion_queue_attributes { - /* The version number of this structure. More fields might be added to this - structure in future. */ - int version; /* Set to GRPC_CQ_CURRENT_VERSION */ - - grpc_cq_completion_type cq_completion_type; - - grpc_cq_polling_type cq_polling_type; -} grpc_completion_queue_attributes; - -/** The completion queue factory structure is opaque to the callers of grpc */ -typedef struct grpc_completion_queue_factory grpc_completion_queue_factory; - /** Returns the completion queue factory based on the attributes. MAY return a NULL if no factory can be found */ GRPCAPI const grpc_completion_queue_factory * diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 02732205f5f..a8eda739bf6 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -569,6 +569,29 @@ typedef enum { GRPC_CQ_NON_POLLING } grpc_cq_polling_type; +/** Specifies the type of APIs to use to pop events from the completion queue */ +typedef enum { + /** Events are popped out by calling grpc_completion_queue_next() API ONLY */ + GRPC_CQ_NEXT = 1, + + /** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/ + GRPC_CQ_PLUCK +} grpc_cq_completion_type; + +#define GRPC_CQ_CURRENT_VERSION 1 +typedef struct grpc_completion_queue_attributes { + /* The version number of this structure. More fields might be added to this + structure in future. */ + int version; /* Set to GRPC_CQ_CURRENT_VERSION */ + + grpc_cq_completion_type cq_completion_type; + + grpc_cq_polling_type cq_polling_type; +} grpc_completion_queue_attributes; + +/** The completion queue factory structure is opaque to the callers of grpc */ +typedef struct grpc_completion_queue_factory grpc_completion_queue_factory; + #ifdef __cplusplus } #endif diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index e17f094837e..ea97a6f374b 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -61,6 +61,7 @@ typedef struct { } plucker; typedef struct { + bool can_get_pollset; size_t (*size)(void); void (*init)(grpc_pollset *pollset, gpr_mu **mu); grpc_error *(*kick)(grpc_pollset *pollset, @@ -107,9 +108,10 @@ static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx, gpr_timespec now, gpr_timespec deadline) { non_polling_poller *npp = (non_polling_poller *)pollset; + if (npp->shutdown) return GRPC_ERROR_NONE; non_polling_worker w; gpr_cv_init(&w.cv); - *worker = (grpc_pollset_worker *)&w; + if (worker != NULL) *worker = (grpc_pollset_worker *)&w; if (npp->root == NULL) { npp->root = w.next = w.prev = &w; } else { @@ -128,11 +130,11 @@ static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx, } npp->root = NULL; } - w.next->prev = w.prev; - w.prev->next = w.next; } + w.next->prev = w.prev; + w.prev->next = w.next; gpr_cv_destroy(&w.cv); - *worker = NULL; + if (worker != NULL) *worker = NULL; return GRPC_ERROR_NONE; } @@ -169,21 +171,24 @@ static void non_polling_poller_shutdown(grpc_exec_ctx *exec_ctx, static const cq_poller_vtable g_poller_vtable_by_poller_type[] = { /* GRPC_CQ_DEFAULT_POLLING */ - {.size = grpc_pollset_size, + {.can_get_pollset = true, + .size = grpc_pollset_size, .init = grpc_pollset_init, .kick = grpc_pollset_kick, .work = grpc_pollset_work, .shutdown = grpc_pollset_shutdown, .destroy = grpc_pollset_destroy}, /* GRPC_CQ_NON_LISTENING */ - {.size = grpc_pollset_size, + {.can_get_pollset = true, + .size = grpc_pollset_size, .init = grpc_pollset_init, .kick = grpc_pollset_kick, .work = grpc_pollset_work, .shutdown = grpc_pollset_shutdown, .destroy = grpc_pollset_destroy}, /* GRPC_CQ_NON_POLLING */ - {.size = non_polling_poller_size, + {.can_get_pollset = false, + .size = non_polling_poller_size, .init = non_polling_poller_init, .kick = non_polling_poller_kick, .work = non_polling_poller_work, @@ -837,7 +842,7 @@ void grpc_completion_queue_destroy(grpc_completion_queue *cc) { } grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { - return POLLSET_FROM_CQ(cc); + return cc->poller_vtable->can_get_pollset ? POLLSET_FROM_CQ(cc) : NULL; } grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) { diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 9496f90390d..767c91a5ec5 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1009,6 +1009,8 @@ void grpc_server_register_completion_queue(grpc_server *server, calls grpc_completion_queue_pluck() on server completion queues */ } + GPR_ASSERT(grpc_cq_pollset(cq)); + register_completion_queue(server, cq, false, reserved); } @@ -1102,8 +1104,9 @@ void grpc_server_start(grpc_server *server) { gpr_malloc(sizeof(*server->requested_calls_per_cq) * server->cq_count); for (i = 0; i < server->cq_count; i++) { if (!grpc_cq_is_non_listening_server_cq(server->cqs[i])) { - server->pollsets[server->pollset_count++] = - grpc_cq_pollset(server->cqs[i]); + grpc_pollset *pollset = grpc_cq_pollset(server->cqs[i]); + GPR_ASSERT(pollset); + server->pollsets[server->pollset_count++] = pollset; } server->request_freelist_per_cq[i] = gpr_stack_lockfree_create((size_t)server->max_requested_calls_per_cq); diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 0dd758ec4e5..8f1de222fb8 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -54,6 +54,18 @@ struct grpc_byte_buffer; namespace grpc { +const grpc_completion_queue_factory* +CoreCodegen::grpc_completion_queue_factory_lookup( + const grpc_completion_queue_attributes* attributes) { + return ::grpc_completion_queue_factory_lookup(attributes); +} + +grpc_completion_queue* CoreCodegen::grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attributes, void* reserved) { + return ::grpc_completion_queue_create(factory, attributes, reserved); +} + grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_next( void* reserved) { return ::grpc_completion_queue_create_for_next(reserved); diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index c6784ea1593..6687fe78b92 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -243,6 +243,16 @@ std::unique_ptr ServerBuilder::BuildAndStart() { sync_server_cqs(std::make_shared< std::vector>>()); + int num_frequently_polled_cqs = 0; + for (auto it = cqs_.begin(); it != cqs_.end(); ++it) { + if ((*it)->IsFrequentlyPolled()) { + num_frequently_polled_cqs++; + } + } + + const bool is_hybrid_server = + has_sync_methods && num_frequently_polled_cqs > 0; + if (has_sync_methods) { // This is a Sync server gpr_log(GPR_INFO, @@ -253,7 +263,7 @@ std::unique_ptr ServerBuilder::BuildAndStart() { sync_server_settings_.cq_timeout_msec); grpc_cq_polling_type polling_type = - cqs_.empty() ? GRPC_CQ_DEFAULT_POLLING : GRPC_CQ_NON_POLLING; + is_hybrid_server ? GRPC_CQ_NON_POLLING : GRPC_CQ_DEFAULT_POLLING; // Create completion queues to listen to incoming rpc requests for (int i = 0; i < sync_server_settings_.num_cqs; i++) { @@ -273,12 +283,15 @@ std::unique_ptr ServerBuilder::BuildAndStart() { // server // 2. cqs_: Completion queues added via AddCompletionQueue() call - // All sync cqs (if any) are frequently polled by ThreadManager - int num_frequently_polled_cqs = sync_server_cqs->size(); - for (auto it = sync_server_cqs->begin(); it != sync_server_cqs->end(); ++it) { - grpc_server_register_completion_queue(server->server_, (*it)->cq(), - nullptr); + if (is_hybrid_server) { + grpc_server_register_non_listening_completion_queue(server->server_, + (*it)->cq(), nullptr); + } else { + grpc_server_register_completion_queue(server->server_, (*it)->cq(), + nullptr); + } + num_frequently_polled_cqs++; } // cqs_ contains the completion queue added by calling the ServerBuilder's @@ -290,7 +303,6 @@ std::unique_ptr ServerBuilder::BuildAndStart() { if ((*it)->IsFrequentlyPolled()) { grpc_server_register_completion_queue(server->server_, (*it)->cq(), nullptr); - num_frequently_polled_cqs++; } else { grpc_server_register_non_listening_completion_queue(server->server_, (*it)->cq(), nullptr); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 0b5215ef8e4..cc3958bf13c 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include "src/core/lib/iomgr/port.h" +#include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -224,13 +226,15 @@ class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { class TestScenario { public: - TestScenario(bool non_block, const grpc::string& creds_type, + TestScenario(bool non_block, const grpc::string& creds_type, bool hcs, const grpc::string& content) : disable_blocking(non_block), + health_check_service(hcs), credentials_type(creds_type), message_content(content) {} void Log() const; bool disable_blocking; + bool health_check_service; // Although the below grpc::string's are logically const, we can't declare // them const because of a limitation in the way old compilers (e.g., gcc-4.4) // manage vector insertion using a copy constructor @@ -243,6 +247,8 @@ static std::ostream& operator<<(std::ostream& out, return out << "TestScenario{disable_blocking=" << (scenario.disable_blocking ? "true" : "false") << ", credentials='" << scenario.credentials_type + << ", health_check_service=" + << (scenario.health_check_service ? "true" : "false") << "', message_size=" << scenario.message_content.size() << "}"; } @@ -252,6 +258,8 @@ void TestScenario::Log() const { gpr_log(GPR_DEBUG, "%s", out.str().c_str()); } +class HealthCheck : public health::v1::Health::Service {}; + class AsyncEnd2endTest : public ::testing::TestWithParam { protected: AsyncEnd2endTest() { GetParam().Log(); } @@ -268,6 +276,9 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { GetParam().credentials_type); builder.AddListeningPort(server_address_.str(), server_creds); builder.RegisterService(&service_); + if (GetParam().health_check_service) { + builder.RegisterService(&health_check_); + } cq_ = builder.AddCompletionQueue(); // TODO(zyc): make a test option to choose wheather sync plugins should be @@ -340,6 +351,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { std::unique_ptr stub_; std::unique_ptr server_; grpc::testing::EchoTestService::AsyncService service_; + HealthCheck health_check_; std::ostringstream server_address_; int port_; @@ -1754,12 +1766,14 @@ std::vector CreateTestScenarios(bool test_disable_blocking, messages.push_back(big_msg); } - for (auto cred = credentials_types.begin(); cred != credentials_types.end(); - ++cred) { - for (auto msg = messages.begin(); msg != messages.end(); msg++) { - scenarios.emplace_back(false, *cred, *msg); - if (test_disable_blocking) { - scenarios.emplace_back(true, *cred, *msg); + for (auto health_check_service : {false, true}) { + for (auto cred = credentials_types.begin(); cred != credentials_types.end(); + ++cred) { + for (auto msg = messages.begin(); msg != messages.end(); msg++) { + scenarios.emplace_back(false, *cred, health_check_service, *msg); + if (test_disable_blocking) { + scenarios.emplace_back(true, *cred, health_check_service, *msg); + } } } } From 58aa706aaf1c39e092f246202b18e6a2931dc664 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 08:10:58 -0700 Subject: [PATCH 04/18] Fix registration --- src/core/lib/surface/server.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 767c91a5ec5..1680085f67b 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1009,8 +1009,6 @@ void grpc_server_register_completion_queue(grpc_server *server, calls grpc_completion_queue_pluck() on server completion queues */ } - GPR_ASSERT(grpc_cq_pollset(cq)); - register_completion_queue(server, cq, false, reserved); } @@ -1105,8 +1103,7 @@ void grpc_server_start(grpc_server *server) { for (i = 0; i < server->cq_count; i++) { if (!grpc_cq_is_non_listening_server_cq(server->cqs[i])) { grpc_pollset *pollset = grpc_cq_pollset(server->cqs[i]); - GPR_ASSERT(pollset); - server->pollsets[server->pollset_count++] = pollset; + if (pollset != NULL) server->pollsets[server->pollset_count++] = pollset; } server->request_freelist_per_cq[i] = gpr_stack_lockfree_create((size_t)server->max_requested_calls_per_cq); From 11c5832b3e8be35f16465d8ef38a1d0ba033a822 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 08:21:17 -0700 Subject: [PATCH 05/18] Get rid of second api for marking non-listening cqs --- include/grpc/grpc.h | 9 --------- src/core/lib/surface/completion_queue.c | 12 +++++++++++- src/core/lib/surface/completion_queue.h | 5 ++--- src/core/lib/surface/server.c | 23 +++++------------------ src/cpp/server/server_builder.cc | 18 ++++-------------- 5 files changed, 22 insertions(+), 45 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 1a7d0120bfa..7b37f34acc4 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -376,15 +376,6 @@ GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved); -/** Register a non-listening completion queue with the server. This API is - similar to grpc_server_register_completion_queue except that the server will - not use this completion_queue to listen to any incoming channels. - - Registering a non-listening completion queue will have negative performance - impact and hence this API is not recommended for production use cases. */ -GRPCAPI void grpc_server_register_non_listening_completion_queue( - grpc_server *server, grpc_completion_queue *q, void *reserved); - /** Add a HTTP2 over plaintext over tcp listener. Returns bound port number on success, 0 on failure. REQUIRES: server not started */ diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index ea97a6f374b..eae3f103b12 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -62,6 +62,7 @@ typedef struct { typedef struct { bool can_get_pollset; + bool can_listen; size_t (*size)(void); void (*init)(grpc_pollset *pollset, gpr_mu **mu); grpc_error *(*kick)(grpc_pollset *pollset, @@ -172,6 +173,7 @@ static void non_polling_poller_shutdown(grpc_exec_ctx *exec_ctx, static const cq_poller_vtable g_poller_vtable_by_poller_type[] = { /* GRPC_CQ_DEFAULT_POLLING */ {.can_get_pollset = true, + .can_listen = true, .size = grpc_pollset_size, .init = grpc_pollset_init, .kick = grpc_pollset_kick, @@ -180,6 +182,7 @@ static const cq_poller_vtable g_poller_vtable_by_poller_type[] = { .destroy = grpc_pollset_destroy}, /* GRPC_CQ_NON_LISTENING */ {.can_get_pollset = true, + .can_listen = false, .size = grpc_pollset_size, .init = grpc_pollset_init, .kick = grpc_pollset_kick, @@ -188,6 +191,7 @@ static const cq_poller_vtable g_poller_vtable_by_poller_type[] = { .destroy = grpc_pollset_destroy}, /* GRPC_CQ_NON_POLLING */ {.can_get_pollset = false, + .can_listen = false, .size = non_polling_poller_size, .init = non_polling_poller_init, .kick = non_polling_poller_kick, @@ -863,4 +867,10 @@ bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc) { void grpc_cq_mark_server_cq(grpc_completion_queue *cc) { cc->is_server_cq = 1; } -int grpc_cq_is_server_cq(grpc_completion_queue *cc) { return cc->is_server_cq; } +bool grpc_cq_is_server_cq(grpc_completion_queue *cc) { + return cc->is_server_cq; +} + +bool grpc_cq_can_listen(grpc_completion_queue *cc) { + return cc->poller_vtable->can_listen; +} diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 0995a56889b..a932087939d 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -94,10 +94,9 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc); grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps); -void grpc_cq_mark_non_listening_server_cq(grpc_completion_queue *cc); -bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc); void grpc_cq_mark_server_cq(grpc_completion_queue *cc); -int grpc_cq_is_server_cq(grpc_completion_queue *cc); +bool grpc_cq_is_server_cq(grpc_completion_queue *cc); +bool grpc_cq_can_listen(grpc_completion_queue *cc); grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc); diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 1680085f67b..da8b6339b2b 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -974,7 +974,7 @@ const grpc_channel_filter grpc_server_top_filter = { static void register_completion_queue(grpc_server *server, grpc_completion_queue *cq, - bool is_non_listening, void *reserved) { + void *reserved) { size_t i, n; GPR_ASSERT(!reserved); for (i = 0; i < server->cq_count; i++) { @@ -983,10 +983,6 @@ static void register_completion_queue(grpc_server *server, grpc_cq_mark_server_cq(cq); - if (is_non_listening) { - grpc_cq_mark_non_listening_server_cq(cq); - } - GRPC_CQ_INTERNAL_REF(cq, "server"); n = server->cq_count++; server->cqs = gpr_realloc(server->cqs, @@ -1009,16 +1005,7 @@ void grpc_server_register_completion_queue(grpc_server *server, calls grpc_completion_queue_pluck() on server completion queues */ } - register_completion_queue(server, cq, false, reserved); -} - -void grpc_server_register_non_listening_completion_queue( - grpc_server *server, grpc_completion_queue *cq, void *reserved) { - GRPC_API_TRACE( - "grpc_server_register_non_listening_completion_queue(server=%p, cq=%p, " - "reserved=%p)", - 3, (server, cq, reserved)); - register_completion_queue(server, cq, true, reserved); + register_completion_queue(server, cq, reserved); } grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) { @@ -1101,9 +1088,9 @@ void grpc_server_start(grpc_server *server) { server->requested_calls_per_cq = gpr_malloc(sizeof(*server->requested_calls_per_cq) * server->cq_count); for (i = 0; i < server->cq_count; i++) { - if (!grpc_cq_is_non_listening_server_cq(server->cqs[i])) { - grpc_pollset *pollset = grpc_cq_pollset(server->cqs[i]); - if (pollset != NULL) server->pollsets[server->pollset_count++] = pollset; + if (grpc_cq_can_listen(server->cqs[i])) { + server->pollsets[server->pollset_count++] = + grpc_cq_pollset(server->cqs[i]); } server->request_freelist_per_cq[i] = gpr_stack_lockfree_create((size_t)server->max_requested_calls_per_cq); diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 6687fe78b92..a92cec643ce 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -284,13 +284,8 @@ std::unique_ptr ServerBuilder::BuildAndStart() { // 2. cqs_: Completion queues added via AddCompletionQueue() call for (auto it = sync_server_cqs->begin(); it != sync_server_cqs->end(); ++it) { - if (is_hybrid_server) { - grpc_server_register_non_listening_completion_queue(server->server_, - (*it)->cq(), nullptr); - } else { - grpc_server_register_completion_queue(server->server_, (*it)->cq(), - nullptr); - } + grpc_server_register_completion_queue(server->server_, (*it)->cq(), + nullptr); num_frequently_polled_cqs++; } @@ -300,13 +295,8 @@ std::unique_ptr ServerBuilder::BuildAndStart() { // listening to incoming channels. Such completion queues must be registered // as non-listening queues for (auto it = cqs_.begin(); it != cqs_.end(); ++it) { - if ((*it)->IsFrequentlyPolled()) { - grpc_server_register_completion_queue(server->server_, (*it)->cq(), - nullptr); - } else { - grpc_server_register_non_listening_completion_queue(server->server_, - (*it)->cq(), nullptr); - } + grpc_server_register_completion_queue(server->server_, (*it)->cq(), + nullptr); } if (num_frequently_polled_cqs == 0) { From b3612d3cd409c421065e9faf53dae507f5fc6d7b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 14:02:13 -0700 Subject: [PATCH 06/18] Remove API --- grpc.def | 1 - include/grpc/grpc.h | 9 --------- src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 -- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 --- 4 files changed, 15 deletions(-) diff --git a/grpc.def b/grpc.def index 1589316a588..da42d736980 100644 --- a/grpc.def +++ b/grpc.def @@ -88,7 +88,6 @@ EXPORTS grpc_server_request_registered_call grpc_server_create grpc_server_register_completion_queue - grpc_server_register_non_listening_completion_queue grpc_server_add_insecure_http2_port grpc_server_start grpc_server_shutdown_and_notify diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index f3201edad29..4da43706655 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -399,15 +399,6 @@ GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved); -/** Register a non-listening completion queue with the server. This API is - similar to grpc_server_register_completion_queue except that the server will - not use this completion_queue to listen to any incoming channels. - - Registering a non-listening completion queue will have negative performance - impact and hence this API is not recommended for production use cases. */ -GRPCAPI void grpc_server_register_non_listening_completion_queue( - grpc_server *server, grpc_completion_queue *q, void *reserved); - /** Add a HTTP2 over plaintext over tcp listener. Returns bound port number on success, 0 on failure. REQUIRES: server not started */ diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 063f92114c0..fd4fb9ea4d3 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -126,7 +126,6 @@ grpc_server_register_method_type grpc_server_register_method_import; grpc_server_request_registered_call_type grpc_server_request_registered_call_import; grpc_server_create_type grpc_server_create_import; grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import; -grpc_server_register_non_listening_completion_queue_type grpc_server_register_non_listening_completion_queue_import; grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import; grpc_server_start_type grpc_server_start_import; grpc_server_shutdown_and_notify_type grpc_server_shutdown_and_notify_import; @@ -423,7 +422,6 @@ void grpc_rb_load_imports(HMODULE library) { grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call"); grpc_server_create_import = (grpc_server_create_type) GetProcAddress(library, "grpc_server_create"); grpc_server_register_completion_queue_import = (grpc_server_register_completion_queue_type) GetProcAddress(library, "grpc_server_register_completion_queue"); - grpc_server_register_non_listening_completion_queue_import = (grpc_server_register_non_listening_completion_queue_type) GetProcAddress(library, "grpc_server_register_non_listening_completion_queue"); grpc_server_add_insecure_http2_port_import = (grpc_server_add_insecure_http2_port_type) GetProcAddress(library, "grpc_server_add_insecure_http2_port"); grpc_server_start_import = (grpc_server_start_type) GetProcAddress(library, "grpc_server_start"); grpc_server_shutdown_and_notify_import = (grpc_server_shutdown_and_notify_type) GetProcAddress(library, "grpc_server_shutdown_and_notify"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index e036ff7bd63..7289ae3a352 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -329,9 +329,6 @@ extern grpc_server_create_type grpc_server_create_import; typedef void(*grpc_server_register_completion_queue_type)(grpc_server *server, grpc_completion_queue *cq, void *reserved); extern grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import; #define grpc_server_register_completion_queue grpc_server_register_completion_queue_import -typedef void(*grpc_server_register_non_listening_completion_queue_type)(grpc_server *server, grpc_completion_queue *q, void *reserved); -extern grpc_server_register_non_listening_completion_queue_type grpc_server_register_non_listening_completion_queue_import; -#define grpc_server_register_non_listening_completion_queue grpc_server_register_non_listening_completion_queue_import typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server *server, const char *addr); extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import; #define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import From cd3ae4f33b6d657b211d3cc186120dd3a297d212 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 14:19:23 -0700 Subject: [PATCH 07/18] Remove API --- src/node/ext/server_generic.cc | 8 +++++--- src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 3 --- src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 11 +---------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/node/ext/server_generic.cc b/src/node/ext/server_generic.cc index 24573bd52f5..a25b2f1ca74 100644 --- a/src/node/ext/server_generic.cc +++ b/src/node/ext/server_generic.cc @@ -44,9 +44,11 @@ namespace grpc { namespace node { Server::Server(grpc_server *server) : wrapped_server(server) { - shutdown_queue = grpc_completion_queue_create_for_pluck(NULL); - grpc_server_register_non_listening_completion_queue(server, shutdown_queue, - NULL); + grpc_completion_queue_attributes attrs = { + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_NON_LISTENING}; + shutdown_queue = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attrs), &attrs, NULL); + grpc_server_completion_queue(server, shutdown_queue, NULL); } Server::~Server() { diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 0b2bdef48be..74e4bc6a69c 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -356,8 +356,6 @@ cdef extern from "grpc/grpc.h": void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved) nogil - void grpc_server_register_non_listening_completion_queue( - grpc_server *server, grpc_completion_queue *cq, void *reserved) nogil int grpc_server_add_insecure_http2_port( grpc_server *server, const char *addr) nogil void grpc_server_start(grpc_server *server) nogil @@ -502,4 +500,3 @@ cdef extern from "grpc/compression.h": int grpc_compression_options_is_algorithm_enabled( const grpc_compression_options *opts, grpc_compression_algorithm algorithm) nogil - diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 18db38b6861..97192efda74 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -82,20 +82,11 @@ cdef class Server: self.c_server, queue.c_completion_queue, NULL) self.registered_completion_queues.append(queue) - def register_non_listening_completion_queue( - self, CompletionQueue queue not None): - if self.is_started: - raise ValueError("cannot register completion queues after start") - with nogil: - grpc_server_register_non_listening_completion_queue( - self.c_server, queue.c_completion_queue, NULL) - self.registered_completion_queues.append(queue) - def start(self): if self.is_started: raise ValueError("the server has already started") self.backup_shutdown_queue = CompletionQueue() - self.register_non_listening_completion_queue(self.backup_shutdown_queue) + self.register_completion_queue(self.backup_shutdown_queue) self.is_started = True with nogil: grpc_server_start(self.c_server) From 3512ec926b09099b30ea7b496c15dcb559ace7a3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 13:26:32 -0700 Subject: [PATCH 08/18] Fix typo --- src/node/ext/server_generic.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/ext/server_generic.cc b/src/node/ext/server_generic.cc index a25b2f1ca74..088273d527c 100644 --- a/src/node/ext/server_generic.cc +++ b/src/node/ext/server_generic.cc @@ -48,7 +48,7 @@ Server::Server(grpc_server *server) : wrapped_server(server) { GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_NON_LISTENING}; shutdown_queue = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attrs), &attrs, NULL); - grpc_server_completion_queue(server, shutdown_queue, NULL); + grpc_server_register_completion_queue(server, shutdown_queue, NULL); } Server::~Server() { From 0a458b599e723bfcd22cf92755059ac4de0a1489 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 06:35:16 -0700 Subject: [PATCH 09/18] Fix Bazel build --- src/proto/grpc/health/v1/BUILD | 39 ++++++++++++++++++++++++++++++++++ test/cpp/end2end/BUILD | 1 + 2 files changed, 40 insertions(+) create mode 100644 src/proto/grpc/health/v1/BUILD diff --git a/src/proto/grpc/health/v1/BUILD b/src/proto/grpc/health/v1/BUILD new file mode 100644 index 00000000000..dbb91d91392 --- /dev/null +++ b/src/proto/grpc/health/v1/BUILD @@ -0,0 +1,39 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +licenses(["notice"]) # 3-clause BSD + +package(default_visibility = ["//visibility:public"]) + +load("//bazel:grpc_build_system.bzl", "grpc_proto_library") + +grpc_proto_library( + name = "health_proto", + srcs = ["health.proto"], +) diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 0bf7948fcfe..a74a123aef3 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -156,6 +156,7 @@ cc_test( "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", + "//src/proto/grpc/health/v1:health_proto", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", From ae1e29eed96798cadfed15b2e1e63e92dcf6d36e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 09:07:23 -0700 Subject: [PATCH 10/18] Get dep in the right place --- test/cpp/end2end/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index a74a123aef3..f1212e15c77 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -51,6 +51,7 @@ cc_test( "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", + "//src/proto/grpc/health/v1:health_proto", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", @@ -156,7 +157,6 @@ cc_test( "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", - "//src/proto/grpc/health/v1:health_proto", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", From e6f6a09c171cba7398d04c293763b7593ab853e8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Apr 2017 16:50:00 +0000 Subject: [PATCH 11/18] Eliminate gtest splitting: hopefully allows tuning cpu cost better --- build.yaml | 42 ++-------------- tools/run_tests/generated/tests.json | 74 ++++++++++++++-------------- 2 files changed, 42 insertions(+), 74 deletions(-) diff --git a/build.yaml b/build.yaml index f23de87d11c..8c27c8e3da2 100644 --- a/build.yaml +++ b/build.yaml @@ -3114,7 +3114,7 @@ targets: - linux - posix - name: alarm_cpp_test - gtest: true + cpu_cost: 0.1 build: test language: c++ src: @@ -3127,7 +3127,7 @@ targets: - gpr_test_util - gpr - name: async_end2end_test - gtest: true + cpu_cost: 0.8 build: test language: c++ src: @@ -3140,7 +3140,6 @@ targets: - gpr_test_util - gpr - name: auth_property_iterator_test - gtest: true build: test language: c++ src: @@ -3442,6 +3441,7 @@ targets: - linux - posix - name: bm_pollset + cpu_cost: 0.5 build: test language: c++ src: @@ -3463,7 +3463,6 @@ targets: - linux - posix - name: channel_arguments_test - gtest: true build: test language: c++ src: @@ -3473,7 +3472,6 @@ targets: - grpc - gpr - name: channel_filter_test - gtest: true build: test language: c++ src: @@ -3483,7 +3481,6 @@ targets: - grpc - gpr - name: cli_call_test - gtest: true build: test language: c++ src: @@ -3497,7 +3494,6 @@ targets: - gpr_test_util - gpr - name: client_crash_test - gtest: true cpu_cost: 0.1 build: test language: c++ @@ -3528,7 +3524,6 @@ targets: - gpr_test_util - gpr - name: codegen_test_full - gtest: true build: test language: c++ src: @@ -3545,7 +3540,6 @@ targets: filegroups: - grpc++_codegen_base - name: codegen_test_minimal - gtest: true build: test language: c++ src: @@ -3559,7 +3553,6 @@ targets: - grpc++_codegen_base - grpc++_codegen_base_src - name: credentials_test - gtest: true build: test language: c++ src: @@ -3569,7 +3562,6 @@ targets: - grpc - gpr - name: cxx_byte_buffer_test - gtest: true build: test language: c++ src: @@ -3581,7 +3573,6 @@ targets: - gpr_test_util - gpr - name: cxx_slice_test - gtest: true build: test language: c++ src: @@ -3593,7 +3584,6 @@ targets: - gpr_test_util - gpr - name: cxx_string_ref_test - gtest: true build: test language: c++ src: @@ -3601,7 +3591,6 @@ targets: deps: - grpc++ - name: cxx_time_test - gtest: true build: test language: c++ src: @@ -3613,8 +3602,7 @@ targets: - gpr_test_util - gpr - name: end2end_test - gtest: true - cpu_cost: 0.5 + cpu_cost: 1.0 build: test language: c++ src: @@ -3627,7 +3615,6 @@ targets: - gpr_test_util - gpr - name: error_details_test - gtest: true build: test language: c++ src: @@ -3637,7 +3624,6 @@ targets: - grpc++_error_details - grpc++ - name: filter_end2end_test - gtest: true build: test language: c++ src: @@ -3650,7 +3636,6 @@ targets: - gpr_test_util - gpr - name: generic_end2end_test - gtest: true build: test language: c++ src: @@ -3663,7 +3648,6 @@ targets: - gpr_test_util - gpr - name: golden_file_test - gtest: true build: test language: c++ src: @@ -3757,7 +3741,6 @@ targets: vs_config_type: Application vs_project_guid: '{069E9D05-B78B-4751-9252-D21EBAE7DE8E}' - name: grpc_tool_test - gtest: true build: test language: c++ src: @@ -3777,7 +3760,6 @@ targets: filegroups: - grpc++_codegen_proto - name: grpclb_api_test - gtest: true build: test language: c++ src: @@ -3789,9 +3771,9 @@ targets: - grpc++ - grpc - name: grpclb_test - gtest: false build: test language: c++ + cpu_cost: 0.1 src: - src/proto/grpc/lb/v1/load_balancer.proto - test/cpp/grpclb/grpclb_test.cc @@ -3803,7 +3785,6 @@ targets: - gpr_test_util - gpr - name: health_service_end2end_test - gtest: true build: test language: c++ src: @@ -3932,7 +3913,6 @@ targets: - gpr - grpc++_test_config - name: mock_test - gtest: true build: test language: c++ src: @@ -3953,7 +3933,6 @@ targets: - benchmark defaults: benchmark - name: proto_server_reflection_test - gtest: true build: test language: c++ src: @@ -3968,7 +3947,6 @@ targets: - gpr_test_util - gpr - name: proto_utils_test - gtest: true build: test language: c++ src: @@ -4086,7 +4064,6 @@ targets: - gpr - grpc++_test_config - name: round_robin_end2end_test - gtest: true build: test language: c++ src: @@ -4099,7 +4076,6 @@ targets: - gpr_test_util - gpr - name: secure_auth_context_test - gtest: true build: test language: c++ src: @@ -4129,7 +4105,6 @@ targets: - linux - posix - name: server_builder_plugin_test - gtest: true build: test language: c++ src: @@ -4142,7 +4117,6 @@ targets: - gpr_test_util - gpr - name: server_builder_test - gtest: true build: test language: c++ src: @@ -4157,7 +4131,6 @@ targets: - grpc - gpr - name: server_context_test_spouse_test - gtest: true build: test language: c++ src: @@ -4171,7 +4144,6 @@ targets: uses: - grpc++_test - name: server_crash_test - gtest: true cpu_cost: 0.1 build: test language: c++ @@ -4202,7 +4174,6 @@ targets: - gpr_test_util - gpr - name: shutdown_test - gtest: true build: test language: c++ src: @@ -4226,7 +4197,6 @@ targets: - gpr_test_util - gpr - name: streaming_throughput_test - gtest: true build: test language: c++ src: @@ -4280,7 +4250,6 @@ targets: - gpr - grpc++_test_config - name: thread_stress_test - gtest: true cpu_cost: 100 build: test language: c++ @@ -4294,7 +4263,6 @@ targets: - gpr_test_util - gpr - name: writes_per_rpc_test - gtest: true cpu_cost: 0.5 build: test language: c++ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6338ea70127..9b48d85970c 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2591,11 +2591,11 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "alarm_cpp_test", "platforms": [ @@ -2613,11 +2613,11 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.6, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "async_end2end_test", "platforms": [ @@ -2639,7 +2639,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "auth_property_iterator_test", "platforms": [ @@ -2989,7 +2989,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "channel_arguments_test", "platforms": [ @@ -3011,7 +3011,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "channel_filter_test", "platforms": [ @@ -3033,7 +3033,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "cli_call_test", "platforms": [ @@ -3054,7 +3054,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "client_crash_test", "platforms": [ @@ -3075,7 +3075,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "codegen_test_full", "platforms": [ @@ -3097,7 +3097,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "codegen_test_minimal", "platforms": [ @@ -3119,7 +3119,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "credentials_test", "platforms": [ @@ -3141,7 +3141,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "cxx_byte_buffer_test", "platforms": [ @@ -3163,7 +3163,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "cxx_slice_test", "platforms": [ @@ -3185,7 +3185,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "cxx_string_ref_test", "platforms": [ @@ -3207,7 +3207,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "cxx_time_test", "platforms": [ @@ -3229,7 +3229,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "end2end_test", "platforms": [ @@ -3251,7 +3251,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "error_details_test", "platforms": [ @@ -3273,7 +3273,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "filter_end2end_test", "platforms": [ @@ -3295,7 +3295,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "generic_end2end_test", "platforms": [ @@ -3319,7 +3319,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "golden_file_test", "platforms": [ @@ -3341,7 +3341,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "grpc_tool_test", "platforms": [ @@ -3363,7 +3363,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "grpclb_api_test", "platforms": [ @@ -3407,7 +3407,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "health_service_end2end_test", "platforms": [ @@ -3471,7 +3471,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "mock_test", "platforms": [ @@ -3515,7 +3515,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "proto_server_reflection_test", "platforms": [ @@ -3537,7 +3537,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "proto_utils_test", "platforms": [ @@ -3579,7 +3579,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "round_robin_end2end_test", "platforms": [ @@ -3601,7 +3601,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "secure_auth_context_test", "platforms": [ @@ -3643,7 +3643,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "server_builder_plugin_test", "platforms": [ @@ -3665,7 +3665,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "server_builder_test", "platforms": [ @@ -3687,7 +3687,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "server_context_test_spouse_test", "platforms": [ @@ -3708,7 +3708,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "server_crash_test", "platforms": [ @@ -3729,7 +3729,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "shutdown_test", "platforms": [ @@ -3772,7 +3772,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "streaming_throughput_test", "platforms": [ @@ -3815,7 +3815,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "thread_stress_test", "platforms": [ @@ -3836,7 +3836,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": true, + "gtest": false, "language": "c++", "name": "writes_per_rpc_test", "platforms": [ From 41fdf7d6ade3987e44213e591a1c67fee81e12a2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 18:55:46 +0000 Subject: [PATCH 12/18] Better cost estimation --- test/cpp/qps/gen_build_yaml.py | 1 + tools/run_tests/generated/tests.json | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 2f035abeddc..805b0faeece 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -66,6 +66,7 @@ def _scenario_json_string(scenario_json, is_tsan): def threads_required(scenario_json, where, is_tsan): scenario_json = mutate_scenario(scenario_json, is_tsan) if scenario_json['%s_config' % where]['%s_type' % where] == 'ASYNC_%s' % where.upper(): + if scenario_json['client_config']['client_channels'] == 1: return 1 return scenario_json['%s_config' % where].get('async_%s_threads' % where, 0) return scenario_json['client_config']['outstanding_rpcs_per_channel'] * scenario_json['client_config']['client_channels'] diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 9b48d85970c..a5bc8fa0ea5 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -41374,7 +41374,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 100, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41476,7 +41476,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41528,7 +41528,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41953,7 +41953,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 100, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42055,7 +42055,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42107,7 +42107,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42580,7 +42580,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 100, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42730,7 +42730,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42806,7 +42806,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43435,7 +43435,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 100, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43585,7 +43585,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43661,7 +43661,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": "capacity", + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", From dbc12105a3e9266dde57647ccc6340ea9c50fd2c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Apr 2017 17:08:39 +0000 Subject: [PATCH 13/18] Refine ping-pong cpu requirement estimations; sort tests by cpu cost to get better bin packing --- build.yaml | 6 ++- test/cpp/qps/gen_build_yaml.py | 2 + tools/run_tests/generated/tests.json | 66 ++++++++++++++-------------- tools/run_tests/run_tests.py | 2 +- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/build.yaml b/build.yaml index 8c27c8e3da2..a2bbcaf41db 100644 --- a/build.yaml +++ b/build.yaml @@ -3638,6 +3638,7 @@ targets: - name: generic_end2end_test build: test language: c++ + cpu_cost: 0.1 src: - test/cpp/end2end/generic_end2end_test.cc deps: @@ -3743,6 +3744,7 @@ targets: - name: grpc_tool_test build: test language: c++ + cpu_cost: 0.2 src: - src/proto/grpc/testing/echo.proto - src/proto/grpc/testing/echo_messages.proto @@ -3771,9 +3773,9 @@ targets: - grpc++ - grpc - name: grpclb_test + cpu_cost: 0.1 build: test language: c++ - cpu_cost: 0.1 src: - src/proto/grpc/lb/v1/load_balancer.proto - test/cpp/grpclb/grpclb_test.cc @@ -4263,7 +4265,7 @@ targets: - gpr_test_util - gpr - name: writes_per_rpc_test - cpu_cost: 0.5 + cpu_cost: 0.8 build: test language: c++ src: diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 805b0faeece..2edcb86a684 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -65,6 +65,8 @@ def _scenario_json_string(scenario_json, is_tsan): def threads_required(scenario_json, where, is_tsan): scenario_json = mutate_scenario(scenario_json, is_tsan) + if scenario_json['client_config']['outstanding_rpcs_per_channel'] == 1 and scenario_json['client_config']['client_channels'] == 1: + return 0.4 if scenario_json['%s_config' % where]['%s_type' % where] == 'ASYNC_%s' % where.upper(): if scenario_json['client_config']['client_channels'] == 1: return 1 return scenario_json['%s_config' % where].get('async_%s_threads' % where, 0) diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index a5bc8fa0ea5..daa9f5b0e66 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2613,7 +2613,7 @@ "posix", "windows" ], - "cpu_cost": 0.6, + "cpu_cost": 0.8, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -2964,7 +2964,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.5, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -3225,7 +3225,7 @@ "posix", "windows" ], - "cpu_cost": 0.5, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -3381,7 +3381,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -3832,7 +3832,7 @@ "mac", "posix" ], - "cpu_cost": 0.5, + "cpu_cost": 0.8, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -41274,7 +41274,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41476,7 +41476,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41528,7 +41528,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41553,7 +41553,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41603,7 +41603,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41653,7 +41653,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41753,7 +41753,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41853,7 +41853,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42055,7 +42055,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42107,7 +42107,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42132,7 +42132,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42182,7 +42182,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42232,7 +42232,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42332,7 +42332,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42432,7 +42432,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42730,7 +42730,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42806,7 +42806,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42843,7 +42843,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42917,7 +42917,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42991,7 +42991,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43139,7 +43139,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43287,7 +43287,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43585,7 +43585,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43661,7 +43661,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43698,7 +43698,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43772,7 +43772,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43846,7 +43846,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43994,7 +43994,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": 0.8, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cfa7071e002..32da7fb02a2 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1466,7 +1466,7 @@ def _build_and_run( # When running on travis, we want out test runs to be as similar as possible # for reproducibility purposes. if args.travis: - massaged_one_run = sorted(one_run, key=lambda x: x.shortname) + massaged_one_run = sorted(one_run, key=lambda x: (x.cpu_cost, x.shortname)) else: # whereas otherwise, we want to shuffle things up to give all tests a # chance to run. From 26f6c1b2390deab5f891003b448793a63bd09130 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 21 Apr 2017 06:40:29 -0700 Subject: [PATCH 14/18] regen projects --- build.yaml | 4 ++-- tools/run_tests/generated/tests.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.yaml b/build.yaml index a8ba1c8e84c..2ffba8cfa9e 100644 --- a/build.yaml +++ b/build.yaml @@ -3643,9 +3643,9 @@ targets: - gpr_test_util - gpr - name: generic_end2end_test + cpu_cost: 0.1 build: test language: c++ - cpu_cost: 0.1 src: - test/cpp/end2end/generic_end2end_test.cc deps: @@ -3749,9 +3749,9 @@ targets: vs_config_type: Application vs_project_guid: '{069E9D05-B78B-4751-9252-D21EBAE7DE8E}' - name: grpc_tool_test + cpu_cost: 0.2 build: test language: c++ - cpu_cost: 0.2 src: - src/proto/grpc/testing/echo.proto - src/proto/grpc/testing/echo_messages.proto diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index ce4684b286d..38bfb2fcdbb 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3291,7 +3291,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -3337,7 +3337,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.2, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, From ab424e8702242c36ee1702d87a11520304e4bb80 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 21 Apr 2017 08:05:40 -0700 Subject: [PATCH 15/18] Back out some bad changes --- Makefile | 9 -- build.yaml | 50 +++++++--- tools/run_tests/generated/configs.json | 3 - tools/run_tests/generated/tests.json | 132 ++++++++----------------- tools/run_tests/run_tests.py | 2 +- 5 files changed, 82 insertions(+), 114 deletions(-) diff --git a/Makefile b/Makefile index 36f2f8ee1d0..31953041d19 100644 --- a/Makefile +++ b/Makefile @@ -157,15 +157,6 @@ LDXX_asan-noleaks = clang++ CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan-noleaks = -fsanitize=address -VALID_CONFIG_c++-compat = 1 -CC_c++-compat = $(DEFAULT_CC) -CXX_c++-compat = $(DEFAULT_CXX) -LD_c++-compat = $(DEFAULT_CC) -LDXX_c++-compat = $(DEFAULT_CXX) -CFLAGS_c++-compat = -Wc++-compat -CPPFLAGS_c++-compat = -O0 -DEFINES_c++-compat = _DEBUG DEBUG - VALID_CONFIG_ubsan = 1 REQUIRE_CUSTOM_LIBRARIES_ubsan = 1 CC_ubsan = clang diff --git a/build.yaml b/build.yaml index 2ffba8cfa9e..045eb6be3b4 100644 --- a/build.yaml +++ b/build.yaml @@ -3118,7 +3118,7 @@ targets: - linux - posix - name: alarm_cpp_test - cpu_cost: 0.1 + gtest: true build: test language: c++ src: @@ -3131,7 +3131,7 @@ targets: - gpr_test_util - gpr - name: async_end2end_test - cpu_cost: 0.8 + gtest: true build: test language: c++ src: @@ -3144,6 +3144,7 @@ targets: - gpr_test_util - gpr - name: auth_property_iterator_test + gtest: true build: test language: c++ src: @@ -3445,7 +3446,6 @@ targets: - linux - posix - name: bm_pollset - cpu_cost: 0.5 build: test language: c++ src: @@ -3467,6 +3467,7 @@ targets: - linux - posix - name: channel_arguments_test + gtest: true build: test language: c++ src: @@ -3476,6 +3477,7 @@ targets: - grpc - gpr - name: channel_filter_test + gtest: true build: test language: c++ src: @@ -3485,6 +3487,7 @@ targets: - grpc - gpr - name: cli_call_test + gtest: true build: test language: c++ src: @@ -3498,6 +3501,7 @@ targets: - gpr_test_util - gpr - name: client_crash_test + gtest: true cpu_cost: 0.1 build: test language: c++ @@ -3528,6 +3532,7 @@ targets: - gpr_test_util - gpr - name: codegen_test_full + gtest: true build: test language: c++ src: @@ -3544,6 +3549,7 @@ targets: filegroups: - grpc++_codegen_base - name: codegen_test_minimal + gtest: true build: test language: c++ src: @@ -3560,6 +3566,7 @@ targets: - grpc++_codegen_base - grpc++_codegen_base_src - name: credentials_test + gtest: true build: test language: c++ src: @@ -3569,6 +3576,7 @@ targets: - grpc - gpr - name: cxx_byte_buffer_test + gtest: true build: test language: c++ src: @@ -3580,6 +3588,7 @@ targets: - gpr_test_util - gpr - name: cxx_slice_test + gtest: true build: test language: c++ src: @@ -3591,6 +3600,7 @@ targets: - gpr_test_util - gpr - name: cxx_string_ref_test + gtest: true build: test language: c++ src: @@ -3598,6 +3608,7 @@ targets: deps: - grpc++ - name: cxx_time_test + gtest: true build: test language: c++ src: @@ -3609,7 +3620,8 @@ targets: - gpr_test_util - gpr - name: end2end_test - cpu_cost: 1.0 + gtest: true + cpu_cost: 0.5 build: test language: c++ src: @@ -3622,6 +3634,7 @@ targets: - gpr_test_util - gpr - name: error_details_test + gtest: true build: test language: c++ src: @@ -3631,6 +3644,7 @@ targets: - grpc++_error_details - grpc++ - name: filter_end2end_test + gtest: true build: test language: c++ src: @@ -3643,7 +3657,7 @@ targets: - gpr_test_util - gpr - name: generic_end2end_test - cpu_cost: 0.1 + gtest: true build: test language: c++ src: @@ -3656,6 +3670,7 @@ targets: - gpr_test_util - gpr - name: golden_file_test + gtest: true build: test language: c++ src: @@ -3749,7 +3764,7 @@ targets: vs_config_type: Application vs_project_guid: '{069E9D05-B78B-4751-9252-D21EBAE7DE8E}' - name: grpc_tool_test - cpu_cost: 0.2 + gtest: true build: test language: c++ src: @@ -3769,6 +3784,7 @@ targets: filegroups: - grpc++_codegen_proto - name: grpclb_api_test + gtest: true build: test language: c++ src: @@ -3780,7 +3796,7 @@ targets: - grpc++ - grpc - name: grpclb_test - cpu_cost: 0.1 + gtest: false build: test language: c++ src: @@ -3794,6 +3810,7 @@ targets: - gpr_test_util - gpr - name: health_service_end2end_test + gtest: true build: test language: c++ src: @@ -3922,6 +3939,7 @@ targets: - gpr - grpc++_test_config - name: mock_test + gtest: true build: test language: c++ src: @@ -3942,6 +3960,7 @@ targets: - benchmark defaults: benchmark - name: proto_server_reflection_test + gtest: true build: test language: c++ src: @@ -3956,6 +3975,7 @@ targets: - gpr_test_util - gpr - name: proto_utils_test + gtest: true build: test language: c++ src: @@ -4073,6 +4093,7 @@ targets: - gpr - grpc++_test_config - name: round_robin_end2end_test + gtest: true build: test language: c++ src: @@ -4085,6 +4106,7 @@ targets: - gpr_test_util - gpr - name: secure_auth_context_test + gtest: true build: test language: c++ src: @@ -4114,6 +4136,7 @@ targets: - linux - posix - name: server_builder_plugin_test + gtest: true build: test language: c++ src: @@ -4126,6 +4149,7 @@ targets: - gpr_test_util - gpr - name: server_builder_test + gtest: true build: test language: c++ src: @@ -4140,6 +4164,7 @@ targets: - grpc - gpr - name: server_context_test_spouse_test + gtest: true build: test language: c++ src: @@ -4153,6 +4178,7 @@ targets: uses: - grpc++_test - name: server_crash_test + gtest: true cpu_cost: 0.1 build: test language: c++ @@ -4183,6 +4209,7 @@ targets: - gpr_test_util - gpr - name: shutdown_test + gtest: true build: test language: c++ src: @@ -4206,6 +4233,7 @@ targets: - gpr_test_util - gpr - name: streaming_throughput_test + gtest: true build: test language: c++ src: @@ -4259,6 +4287,7 @@ targets: - gpr - grpc++_test_config - name: thread_stress_test + gtest: true cpu_cost: 100 build: test language: c++ @@ -4272,7 +4301,8 @@ targets: - gpr_test_util - gpr - name: writes_per_rpc_test - cpu_cost: 0.8 + gtest: true + cpu_cost: 0.5 build: test language: c++ src: @@ -4354,10 +4384,6 @@ configs: basicprof: CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC DEFINES: NDEBUG - c++-compat: - CFLAGS: -Wc++-compat - CPPFLAGS: -O0 - DEFINES: _DEBUG DEBUG counters: CPPFLAGS: -O2 -DGPR_LOW_LEVEL_COUNTERS DEFINES: NDEBUG diff --git a/tools/run_tests/generated/configs.json b/tools/run_tests/generated/configs.json index abbe76d60c2..93dd6fb3d43 100644 --- a/tools/run_tests/generated/configs.json +++ b/tools/run_tests/generated/configs.json @@ -38,9 +38,6 @@ "ASAN_OPTIONS": "detect_leaks=0:color=always" } }, - { - "config": "c++-compat" - }, { "config": "ubsan", "environ": { diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 27b7c0a8da7..cd7be31edb8 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2591,11 +2591,11 @@ "posix", "windows" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "alarm_cpp_test", "platforms": [ @@ -2613,11 +2613,11 @@ "posix", "windows" ], - "cpu_cost": 0.8, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "async_end2end_test", "platforms": [ @@ -2639,7 +2639,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "auth_property_iterator_test", "platforms": [ @@ -2964,7 +2964,7 @@ "mac", "posix" ], - "cpu_cost": 0.5, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -2989,7 +2989,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "channel_arguments_test", "platforms": [ @@ -3011,7 +3011,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "channel_filter_test", "platforms": [ @@ -3033,7 +3033,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "cli_call_test", "platforms": [ @@ -3054,7 +3054,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "client_crash_test", "platforms": [ @@ -3075,7 +3075,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "codegen_test_full", "platforms": [ @@ -3097,7 +3097,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "codegen_test_minimal", "platforms": [ @@ -3119,7 +3119,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "credentials_test", "platforms": [ @@ -3141,7 +3141,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "cxx_byte_buffer_test", "platforms": [ @@ -3163,7 +3163,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "cxx_slice_test", "platforms": [ @@ -3185,7 +3185,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "cxx_string_ref_test", "platforms": [ @@ -3207,7 +3207,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "cxx_time_test", "platforms": [ @@ -3225,11 +3225,11 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.5, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "end2end_test", "platforms": [ @@ -3251,7 +3251,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "error_details_test", "platforms": [ @@ -3273,7 +3273,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "filter_end2end_test", "platforms": [ @@ -3291,11 +3291,11 @@ "posix", "windows" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "generic_end2end_test", "platforms": [ @@ -3319,7 +3319,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "golden_file_test", "platforms": [ @@ -3337,11 +3337,11 @@ "posix", "windows" ], - "cpu_cost": 0.2, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "grpc_tool_test", "platforms": [ @@ -3363,7 +3363,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "grpclb_api_test", "platforms": [ @@ -3381,7 +3381,7 @@ "posix", "windows" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -3407,7 +3407,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "health_service_end2end_test", "platforms": [ @@ -3471,7 +3471,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "mock_test", "platforms": [ @@ -3515,7 +3515,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "proto_server_reflection_test", "platforms": [ @@ -3537,7 +3537,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "proto_utils_test", "platforms": [ @@ -3579,7 +3579,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "round_robin_end2end_test", "platforms": [ @@ -3601,7 +3601,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "secure_auth_context_test", "platforms": [ @@ -3643,7 +3643,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "server_builder_plugin_test", "platforms": [ @@ -3665,7 +3665,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "server_builder_test", "platforms": [ @@ -3687,7 +3687,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "server_context_test_spouse_test", "platforms": [ @@ -3708,7 +3708,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "server_crash_test", "platforms": [ @@ -3729,7 +3729,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "shutdown_test", "platforms": [ @@ -3772,7 +3772,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "streaming_throughput_test", "platforms": [ @@ -3815,7 +3815,7 @@ "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "thread_stress_test", "platforms": [ @@ -3832,11 +3832,11 @@ "mac", "posix" ], - "cpu_cost": 0.8, + "cpu_cost": 0.5, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", "name": "writes_per_rpc_test", "platforms": [ @@ -42392,7 +42392,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42430,7 +42429,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42468,7 +42466,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42506,7 +42503,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42544,7 +42540,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42582,7 +42577,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42620,7 +42614,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42658,7 +42651,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42698,7 +42690,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42736,7 +42727,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42776,7 +42766,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42814,7 +42803,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42852,7 +42840,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42890,7 +42877,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42928,7 +42914,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -42966,7 +42951,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43004,7 +42988,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43042,7 +43025,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43080,7 +43062,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43118,7 +43099,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43156,7 +43136,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43194,7 +43173,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43232,7 +43210,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43270,7 +43247,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43308,7 +43284,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43346,7 +43321,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43384,7 +43358,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43422,7 +43395,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43460,7 +43432,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43498,7 +43469,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43536,7 +43506,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43576,7 +43545,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43614,7 +43582,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43654,7 +43621,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43692,7 +43658,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43730,7 +43695,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43768,7 +43732,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43806,7 +43769,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43844,7 +43806,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43882,7 +43843,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43920,7 +43880,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43958,7 +43917,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -43996,7 +43954,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -44034,7 +43991,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -44072,7 +44028,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", @@ -44110,7 +44065,6 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", - "c++-compat", "counters", "dbg", "gcov", diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index d3e9803a34a..8173cc805c7 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1467,7 +1467,7 @@ def _build_and_run( # When running on travis, we want out test runs to be as similar as possible # for reproducibility purposes. if args.travis: - massaged_one_run = sorted(one_run, key=lambda x: (x.cpu_cost, x.shortname)) + massaged_one_run = sorted(one_run, key=lambda x: x.shortname) else: # whereas otherwise, we want to shuffle things up to give all tests a # chance to run. From 243a12e87a77801ecd21078da52071de9c63d479 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 21 Apr 2017 08:07:14 -0700 Subject: [PATCH 16/18] Reinstate c++-compat --- Makefile | 9 +++++ build.yaml | 4 +++ tools/run_tests/generated/configs.json | 3 ++ tools/run_tests/generated/tests.json | 46 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) diff --git a/Makefile b/Makefile index 31953041d19..36f2f8ee1d0 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,15 @@ LDXX_asan-noleaks = clang++ CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan-noleaks = -fsanitize=address +VALID_CONFIG_c++-compat = 1 +CC_c++-compat = $(DEFAULT_CC) +CXX_c++-compat = $(DEFAULT_CXX) +LD_c++-compat = $(DEFAULT_CC) +LDXX_c++-compat = $(DEFAULT_CXX) +CFLAGS_c++-compat = -Wc++-compat +CPPFLAGS_c++-compat = -O0 +DEFINES_c++-compat = _DEBUG DEBUG + VALID_CONFIG_ubsan = 1 REQUIRE_CUSTOM_LIBRARIES_ubsan = 1 CC_ubsan = clang diff --git a/build.yaml b/build.yaml index 045eb6be3b4..ed7f4cce649 100644 --- a/build.yaml +++ b/build.yaml @@ -4384,6 +4384,10 @@ configs: basicprof: CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC DEFINES: NDEBUG + c++-compat: + CFLAGS: -Wc++-compat + CPPFLAGS: -O0 + DEFINES: _DEBUG DEBUG counters: CPPFLAGS: -O2 -DGPR_LOW_LEVEL_COUNTERS DEFINES: NDEBUG diff --git a/tools/run_tests/generated/configs.json b/tools/run_tests/generated/configs.json index 93dd6fb3d43..abbe76d60c2 100644 --- a/tools/run_tests/generated/configs.json +++ b/tools/run_tests/generated/configs.json @@ -38,6 +38,9 @@ "ASAN_OPTIONS": "detect_leaks=0:color=always" } }, + { + "config": "c++-compat" + }, { "config": "ubsan", "environ": { diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index cd7be31edb8..53460fb47af 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -42392,6 +42392,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42429,6 +42430,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42466,6 +42468,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42503,6 +42506,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42540,6 +42544,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42577,6 +42582,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42614,6 +42620,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42651,6 +42658,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42690,6 +42698,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42727,6 +42736,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42766,6 +42776,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42803,6 +42814,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42840,6 +42852,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42877,6 +42890,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42914,6 +42928,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42951,6 +42966,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42988,6 +43004,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43025,6 +43042,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43062,6 +43080,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43099,6 +43118,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43136,6 +43156,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43173,6 +43194,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43210,6 +43232,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43247,6 +43270,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43284,6 +43308,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43321,6 +43346,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43358,6 +43384,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43395,6 +43422,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43432,6 +43460,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43469,6 +43498,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43506,6 +43536,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43545,6 +43576,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43582,6 +43614,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43621,6 +43654,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43658,6 +43692,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43695,6 +43730,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43732,6 +43768,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43769,6 +43806,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43806,6 +43844,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43843,6 +43882,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43880,6 +43920,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43917,6 +43958,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43954,6 +43996,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43991,6 +44034,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -44028,6 +44072,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -44065,6 +44110,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", From 0d4628479995be4e310f55683f1ebaae2a879e4d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 24 Apr 2017 08:24:21 -0700 Subject: [PATCH 17/18] Rollback some changes --- build.yaml | 2 +- test/cpp/qps/gen_build_yaml.py | 2 - tools/run_tests/generated/tests.json | 58 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/build.yaml b/build.yaml index 58a474aabf1..f2af370522e 100644 --- a/build.yaml +++ b/build.yaml @@ -3806,7 +3806,7 @@ targets: - grpc++ - grpc - name: grpclb_test - gtest: false + cpu_cost: 0.1 build: test language: c++ src: diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 2edcb86a684..805b0faeece 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -65,8 +65,6 @@ def _scenario_json_string(scenario_json, is_tsan): def threads_required(scenario_json, where, is_tsan): scenario_json = mutate_scenario(scenario_json, is_tsan) - if scenario_json['client_config']['outstanding_rpcs_per_channel'] == 1 and scenario_json['client_config']['client_channels'] == 1: - return 0.4 if scenario_json['%s_config' % where]['%s_type' % where] == 'ASYNC_%s' % where.upper(): if scenario_json['client_config']['client_channels'] == 1: return 1 return scenario_json['%s_config' % where].get('async_%s_threads' % where, 0) diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 203f51b6b89..cb918a0830a 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3403,7 +3403,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -41250,7 +41250,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41452,7 +41452,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41504,7 +41504,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41529,7 +41529,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41579,7 +41579,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41629,7 +41629,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41729,7 +41729,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41829,7 +41829,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42031,7 +42031,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42083,7 +42083,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42108,7 +42108,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42158,7 +42158,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42208,7 +42208,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42308,7 +42308,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42408,7 +42408,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42714,7 +42714,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42792,7 +42792,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42830,7 +42830,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42906,7 +42906,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42982,7 +42982,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43134,7 +43134,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43286,7 +43286,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43592,7 +43592,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43670,7 +43670,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43708,7 +43708,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43784,7 +43784,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43860,7 +43860,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -44012,7 +44012,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.8, + "cpu_cost": 2, "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", From c6f6663fb7b8c4b1614b6f881abf966d48cb87c4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 24 Apr 2017 08:29:39 -0700 Subject: [PATCH 18/18] Rollback some changes --- build.yaml | 2 +- test/cpp/qps/gen_build_yaml.py | 1 - tools/run_tests/generated/tests.json | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/build.yaml b/build.yaml index f2af370522e..58a474aabf1 100644 --- a/build.yaml +++ b/build.yaml @@ -3806,7 +3806,7 @@ targets: - grpc++ - grpc - name: grpclb_test - cpu_cost: 0.1 + gtest: false build: test language: c++ src: diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 805b0faeece..2f035abeddc 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -66,7 +66,6 @@ def _scenario_json_string(scenario_json, is_tsan): def threads_required(scenario_json, where, is_tsan): scenario_json = mutate_scenario(scenario_json, is_tsan) if scenario_json['%s_config' % where]['%s_type' % where] == 'ASYNC_%s' % where.upper(): - if scenario_json['client_config']['client_channels'] == 1: return 1 return scenario_json['%s_config' % where].get('async_%s_threads' % where, 0) return scenario_json['client_config']['outstanding_rpcs_per_channel'] * scenario_json['client_config']['client_channels'] diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index cb918a0830a..120a84e8a4b 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3403,7 +3403,7 @@ "posix", "windows" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -41350,7 +41350,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 100, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41452,7 +41452,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41504,7 +41504,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -41929,7 +41929,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 100, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42031,7 +42031,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42083,7 +42083,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "tsan", @@ -42560,7 +42560,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 100, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42714,7 +42714,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -42792,7 +42792,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43438,7 +43438,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 100, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43592,7 +43592,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks", @@ -43670,7 +43670,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 2, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [ "asan-noleaks",