Merge pull request #11118 from muxi/backward-compat-dev

Add Backward compatibility API to C++
pull/11199/head
Muxi Yan 8 years ago committed by GitHub
commit eb9b82b7e1
  1. 19
      doc/workarounds.md
  2. 6
      include/grpc++/server_builder.h
  3. 2
      include/grpc/support/workaround_list.h
  4. 10
      src/cpp/server/server_builder.cc
  5. 1
      tools/doxygen/Doxyfile.c++
  6. 1
      tools/doxygen/Doxyfile.c++.internal
  7. 1
      tools/doxygen/Doxyfile.core
  8. 1
      tools/doxygen/Doxyfile.core.internal

@ -0,0 +1,19 @@
# gRPC Server Backward Compatibility Issues and Workarounds Manageent
## Introduction
This document lists the workarounds implemented on gRPC servers for record and reference when users need to enable a certain workaround.
## Workaround List
### Cronet Compression
**Workaround ID:** WORKAROUND\_ID\_CRONET\_COMPRESSION
**Date added:** May 06, 2017
**Status:** Implemented in C core and C++
**Issue:** Before version v1.3.0-dev, gRPC iOS client's Cronet transport did not implement compression. However the clients still claim to support compression. As a result, a client fails to parse received message when the message is compressed.
The problem above was resolved in gRPC v1.3.0-dev. For backward compatibility, a server must forcingly disable compression for gRPC clients of version lower than or equal to v1.3.0-dev.
**Workaround Description:** Implemented as a server channel filter in C core. The filter identifies the version of peer client with incoming `user-agent` header of each call. If the client's gRPC version is lower that or equal to v1.3.x, a flag GRPC_WRITE_NO_COMPRESS is marked for all send_message ops which prevents compression of the messages to be sent out.

@ -46,6 +46,7 @@
#include <grpc/compression.h>
#include <grpc/support/cpu.h>
#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
struct grpc_resource_quota;
@ -184,6 +185,11 @@ class ServerBuilder {
static void InternalAddPluginFactory(
std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)());
/// Enable a server workaround. Do not use unless you know what the workaround
/// does. For explanation and detailed descriptions of workarounds, see
/// doc/workarounds.md.
ServerBuilder& EnableWorkaround(grpc_workaround_list id);
private:
friend class ::grpc::testing::ServerBuilderPluginTest;

@ -36,7 +36,7 @@
/* The list of IDs of server workarounds currently maintained by gRPC. For
* explanation and detailed descriptions of workarounds, see
* /docs/workarounds.md
* /doc/workarounds.md
*/
typedef enum {
GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0,

@ -358,4 +358,14 @@ void ServerBuilder::InternalAddPluginFactory(
(*g_plugin_factory_list).push_back(CreatePlugin);
}
ServerBuilder& ServerBuilder::EnableWorkaround(grpc_workaround_list id) {
switch (id) {
case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
return AddChannelArgument(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION, 1);
default:
gpr_log(GPR_ERROR, "Workaround %u does not exist or is obsolete.", id);
return *this;
}
}
} // namespace grpc

@ -794,6 +794,7 @@ doc/statuscodes.md \
doc/stress_test_framework.md \
doc/unit_testing.md \
doc/wait-for-ready.md \
doc/workarounds.md \
include/grpc++/alarm.h \
include/grpc++/channel.h \
include/grpc++/client_context.h \

@ -794,6 +794,7 @@ doc/statuscodes.md \
doc/stress_test_framework.md \
doc/unit_testing.md \
doc/wait-for-ready.md \
doc/workarounds.md \
include/grpc++/alarm.h \
include/grpc++/channel.h \
include/grpc++/client_context.h \

@ -794,6 +794,7 @@ doc/statuscodes.md \
doc/stress_test_framework.md \
doc/unit_testing.md \
doc/wait-for-ready.md \
doc/workarounds.md \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/census.h \

@ -794,6 +794,7 @@ doc/statuscodes.md \
doc/stress_test_framework.md \
doc/unit_testing.md \
doc/wait-for-ready.md \
doc/workarounds.md \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/census.h \

Loading…
Cancel
Save