diff --git a/router/src/routing/CMakeLists.txt b/router/src/routing/CMakeLists.txt index 252b3de6db55..1fadb3fb3e05 100644 --- a/router/src/routing/CMakeLists.txt +++ b/router/src/routing/CMakeLists.txt @@ -20,6 +20,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +IF (NOT PROTOBUF_LITE_LIBRARY) + MESSAGE(FATAL_ERROR "Routing plugin requires protobuf-lite library") +ENDIF() + SET(ROUTING_SOURCE_FILES_X_PROTOCOL ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol/x_protocol.cc ) @@ -55,7 +59,7 @@ SET(include_dirs SET(system_include_dirs ${PROTOBUF_INCLUDE_DIR} - ${MYSQLX_GENERATE_DIR}/protobuf + ${MYSQLX_GENERATE_DIR}/protobuf_lite ) # link_directories(${PROJECT_BINARY_DIR}/ext/protobuf/protobuf-3.0.0/cmake/) @@ -68,7 +72,7 @@ add_harness_plugin(routing TARGET_INCLUDE_DIRECTORIES(routing PRIVATE ${include_dirs}) TARGET_INCLUDE_DIRECTORIES(routing SYSTEM PRIVATE ${system_include_dirs}) -TARGET_LINK_LIBRARIES(routing PRIVATE mysqlxmessages ${PROTOBUF_LIBRARY}) +TARGET_LINK_LIBRARIES(routing PRIVATE mysqlxmessages_lite ${PROTOBUF_LITE_LIBRARY}) IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") TARGET_LINK_LIBRARIES(routing PRIVATE -lnsl PRIVATE -lsocket) diff --git a/router/src/routing/src/protocol/x_protocol.cc b/router/src/routing/src/protocol/x_protocol.cc index 0eb1b6926123..00b5299f505f 100644 --- a/router/src/routing/src/protocol/x_protocol.cc +++ b/router/src/routing/src/protocol/x_protocol.cc @@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -using ProtobufMessage = google::protobuf::Message; +using ProtobufMessage = google::protobuf::MessageLite; IMPORT_LOG_FUNCTIONS() constexpr size_t kMessageHeaderSize = 5; @@ -75,7 +75,7 @@ static bool send_message(const std::string &log_prefix, int destination, static bool message_valid(const void *message_buffer, const int8_t message_type, const uint32_t message_size) { - std::unique_ptr msg; + std::unique_ptr msg; assert(message_type == Mysqlx::ClientMessages::SESS_AUTHENTICATE_START || message_type == Mysqlx::ClientMessages::CON_CAPABILITIES_GET || diff --git a/router/src/routing/tests/CMakeLists.txt b/router/src/routing/tests/CMakeLists.txt index a659adc6c02c..582cb9c34773 100644 --- a/router/src/routing/tests/CMakeLists.txt +++ b/router/src/routing/tests/CMakeLists.txt @@ -30,14 +30,14 @@ INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(SYSTEM ${PROTOBUF_INCLUDE_DIR} - ${MYSQLX_GENERATE_DIR}/protobuf + ${MYSQLX_GENERATE_DIR}/protobuf_lite ) # link_directories(${PROJECT_BINARY_DIR}/ext/protobuf/protobuf-3.0.0/cmake/) ADD_LIBRARY(routing_tests STATIC ${ROUTING_SOURCE_FILES}) TARGET_LINK_LIBRARIES(routing_tests routertest_helpers router_lib metadata_cache_static mysql_protocol_static - mysqlxmessages ${PROTOBUF_LIBRARY}) + mysqlxmessages_lite ${PROTOBUF_LITE_LIBRARY}) TARGET_COMPILE_DEFINITIONS(routing_tests PRIVATE -Dmetadata_cache_DEFINE_STATIC=1) TARGET_COMPILE_DEFINITIONS(routing_tests PRIVATE -Dmysql_protocol_DEFINE_STATIC=1) TARGET_INCLUDE_DIRECTORIES(routing PRIVATE ${include_dirs}) diff --git a/router/src/routing/tests/test_x_protocol.cc b/router/src/routing/tests/test_x_protocol.cc index 9d5c5da610dc..971d5baa999b 100644 --- a/router/src/routing/tests/test_x_protocol.cc +++ b/router/src/routing/tests/test_x_protocol.cc @@ -61,7 +61,7 @@ class XProtocolTest : public ::testing::Test { void serialize_protobuf_msg_to_buffer(RoutingProtocolBuffer &buffer, size_t &buffer_offset, - google::protobuf::Message &msg, + google::protobuf::MessageLite &msg, unsigned char type) { size_t msg_size = msg.ByteSize(); google::protobuf::io::CodedOutputStream::WriteLittleEndian32ToArray(