From 09a64753f1724e83e827d82c9644a207f422883f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 24 Sep 2018 13:25:11 +0300 Subject: [PATCH] MXS-2068: Move RWBackend into mysqlcommon This cleanly allows multiple modules to use it. --- .../maxscale/protocol}/rwbackend.hh | 3 +-- .../maxscale}/response_stat.hh | 0 server/core/CMakeLists.txt | 3 ++- .../readwritesplit => core}/response_stat.cc | 2 +- server/modules/protocol/MySQL/CMakeLists.txt | 2 +- .../MySQL}/rwbackend.cc | 15 ++++++++++++++- server/modules/routing/cat/CMakeLists.txt | 2 +- server/modules/routing/cat/catsession.hh | 2 +- .../modules/routing/readwritesplit/CMakeLists.txt | 2 -- .../routing/readwritesplit/readwritesplit.hh | 3 +-- .../routing/readwritesplit/rwsplitsession.hh | 2 +- 11 files changed, 23 insertions(+), 13 deletions(-) rename {server/modules/routing/readwritesplit => include/maxscale/protocol}/rwbackend.hh (99%) rename {server/modules/routing/readwritesplit => include/maxscale}/response_stat.hh (100%) rename server/{modules/routing/readwritesplit => core}/response_stat.cc (98%) rename server/modules/{routing/readwritesplit => protocol/MySQL}/rwbackend.cc (94%) diff --git a/server/modules/routing/readwritesplit/rwbackend.hh b/include/maxscale/protocol/rwbackend.hh similarity index 99% rename from server/modules/routing/readwritesplit/rwbackend.hh rename to include/maxscale/protocol/rwbackend.hh index ae59623c3..2946012b0 100644 --- a/server/modules/routing/readwritesplit/rwbackend.hh +++ b/include/maxscale/protocol/rwbackend.hh @@ -12,13 +12,12 @@ */ #pragma once -#include "response_stat.hh" - #include #include #include #include +#include namespace maxscale { diff --git a/server/modules/routing/readwritesplit/response_stat.hh b/include/maxscale/response_stat.hh similarity index 100% rename from server/modules/routing/readwritesplit/response_stat.hh rename to include/maxscale/response_stat.hh diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index bfbb61cb9..8b66db098 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -33,8 +33,9 @@ add_library(maxscale-common SHARED queryclassifier.cc query_classifier.cc random.cc - resultset.cc resource.cc + response_stat.cc + resultset.cc router.cc routingworker.cc secrets.cc diff --git a/server/modules/routing/readwritesplit/response_stat.cc b/server/core/response_stat.cc similarity index 98% rename from server/modules/routing/readwritesplit/response_stat.cc rename to server/core/response_stat.cc index abb05fdf4..a198da64d 100644 --- a/server/modules/routing/readwritesplit/response_stat.cc +++ b/server/core/response_stat.cc @@ -10,7 +10,7 @@ * of this software will be governed by version 2 or later of the General * Public License. */ -#include "response_stat.hh" +#include #include diff --git a/server/modules/protocol/MySQL/CMakeLists.txt b/server/modules/protocol/MySQL/CMakeLists.txt index a9ceabada..0d435b098 100644 --- a/server/modules/protocol/MySQL/CMakeLists.txt +++ b/server/modules/protocol/MySQL/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(mysqlcommon SHARED mysql_common.cc mariadb_client.cc) +add_library(mysqlcommon SHARED mysql_common.cc mariadb_client.cc rwbackend.cc) target_link_libraries(mysqlcommon maxscale-common) set_target_properties(mysqlcommon PROPERTIES VERSION "2.0.0") install_module(mysqlcommon core) diff --git a/server/modules/routing/readwritesplit/rwbackend.cc b/server/modules/protocol/MySQL/rwbackend.cc similarity index 94% rename from server/modules/routing/readwritesplit/rwbackend.cc rename to server/modules/protocol/MySQL/rwbackend.cc index 3209c3266..e57b811fc 100644 --- a/server/modules/routing/readwritesplit/rwbackend.cc +++ b/server/modules/protocol/MySQL/rwbackend.cc @@ -1,4 +1,17 @@ -#include "rwbackend.hh" +/* + * Copyright (c) 2016 MariaDB Corporation Ab + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file and at www.mariadb.com/bsl11. + * + * Change Date: 2022-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2 or later of the General + * Public License. + */ + +#include #include #include diff --git a/server/modules/routing/cat/CMakeLists.txt b/server/modules/routing/cat/CMakeLists.txt index 72106aa56..571486f6d 100644 --- a/server/modules/routing/cat/CMakeLists.txt +++ b/server/modules/routing/cat/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(cat SHARED cat.cc catsession.cc ../readwritesplit/rwbackend.cc ../readwritesplit/response_stat.cc) +add_library(cat SHARED cat.cc catsession.cc) target_link_libraries(cat maxscale-common mysqlcommon) set_target_properties(cat PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) install_module(cat experimental) diff --git a/server/modules/routing/cat/catsession.hh b/server/modules/routing/cat/catsession.hh index 7e4e8878a..17456c6e7 100644 --- a/server/modules/routing/cat/catsession.hh +++ b/server/modules/routing/cat/catsession.hh @@ -14,7 +14,7 @@ #include "cat.hh" -#include "../readwritesplit/rwbackend.hh" +#include class Cat; diff --git a/server/modules/routing/readwritesplit/CMakeLists.txt b/server/modules/routing/readwritesplit/CMakeLists.txt index 53b583ae8..abbaea39c 100644 --- a/server/modules/routing/readwritesplit/CMakeLists.txt +++ b/server/modules/routing/readwritesplit/CMakeLists.txt @@ -5,8 +5,6 @@ rwsplit_mysql.cc rwsplit_route_stmt.cc rwsplit_select_backends.cc rwsplit_session_cmd.cc -rwbackend.cc -response_stat.cc ) target_link_libraries(readwritesplit maxscale-common mysqlcommon) set_target_properties(readwritesplit PROPERTIES VERSION "1.0.2" LINK_FLAGS -Wl,-z,defs) diff --git a/server/modules/routing/readwritesplit/readwritesplit.hh b/server/modules/routing/readwritesplit/readwritesplit.hh index 2386b60b1..46d95003c 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.hh +++ b/server/modules/routing/readwritesplit/readwritesplit.hh @@ -35,8 +35,7 @@ #include #include #include - -#include "rwbackend.hh" +#include enum backend_type_t { diff --git a/server/modules/routing/readwritesplit/rwsplitsession.hh b/server/modules/routing/readwritesplit/rwsplitsession.hh index bab403ee4..6cc37ad39 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.hh +++ b/server/modules/routing/readwritesplit/rwsplitsession.hh @@ -13,7 +13,6 @@ #pragma once #include "readwritesplit.hh" -#include "rwbackend.hh" #include "trx.hh" #include @@ -21,6 +20,7 @@ #include #include #include +#include #define TARGET_IS_MASTER(t) maxscale::QueryClassifier::target_is_master(t) #define TARGET_IS_SLAVE(t) maxscale::QueryClassifier::target_is_slave(t)