1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

codership/mariadb-wsrep#27 Galera cache encryption fixup

Fixup to enable/disable encryption on provider loading
This commit is contained in:
Alexey Yurchenko
2019-01-20 14:38:07 +02:00
parent 7e9419e811
commit 043e8bc2ea
7 changed files with 15 additions and 10 deletions

View File

@ -137,7 +137,7 @@ void db::simulator::start()
std::string server_options(params_.wsrep_provider_options); std::string server_options(params_.wsrep_provider_options);
if (server.server_state().load_provider( if (server.server_state().load_provider(
params_.wsrep_provider, server_options)) params_.wsrep_provider, server_options, false))
{ {
throw wsrep::runtime_error("Failed to load provider"); throw wsrep::runtime_error("Failed to load provider");
} }

View File

@ -384,7 +384,8 @@ namespace wsrep
static provider* make_provider( static provider* make_provider(
wsrep::server_state&, wsrep::server_state&,
const std::string& provider_spec, const std::string& provider_spec,
const std::string& provider_options); const std::string& provider_options,
bool encrypt);
protected: protected:
wsrep::server_state& server_state_; wsrep::server_state& server_state_;
}; };

View File

@ -261,7 +261,8 @@ namespace wsrep
* @return Zero on success, non-zero on error. * @return Zero on success, non-zero on error.
*/ */
int load_provider(const std::string& provider, int load_provider(const std::string& provider,
const std::string& provider_options); const std::string& provider_options,
bool encrypt);
void unload_provider(); void unload_provider();

View File

@ -25,12 +25,13 @@
wsrep::provider* wsrep::provider::make_provider( wsrep::provider* wsrep::provider::make_provider(
wsrep::server_state& server_state, wsrep::server_state& server_state,
const std::string& provider_spec, const std::string& provider_spec,
const std::string& provider_options) const std::string& provider_options,
bool const encrypt)
{ {
try try
{ {
return new wsrep::wsrep_provider_v26( return new wsrep::wsrep_provider_v26(
server_state, provider_options, provider_spec); server_state, provider_options, provider_spec, encrypt);
} }
catch (const wsrep::runtime_error& e) catch (const wsrep::runtime_error& e)
{ {

View File

@ -335,14 +335,15 @@ static int apply_toi(wsrep::provider& provider,
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
int wsrep::server_state::load_provider(const std::string& provider_spec, int wsrep::server_state::load_provider(const std::string& provider_spec,
const std::string& provider_options) const std::string& provider_options,
bool const encrypt)
{ {
wsrep::log_info() << "Loading provider " wsrep::log_info() << "Loading provider "
<< provider_spec << provider_spec
<< "initial position: " << "initial position: "
<< initial_position_; << initial_position_;
provider_ = wsrep::provider::make_provider( provider_ = wsrep::provider::make_provider(
*this, provider_spec, provider_options); *this, provider_spec, provider_options, encrypt);
return (provider_ ? 0 : 1); return (provider_ ? 0 : 1);
} }

View File

@ -567,7 +567,8 @@ namespace
wsrep::wsrep_provider_v26::wsrep_provider_v26( wsrep::wsrep_provider_v26::wsrep_provider_v26(
wsrep::server_state& server_state, wsrep::server_state& server_state,
const std::string& provider_options, const std::string& provider_options,
const std::string& provider_spec) const std::string& provider_spec,
bool const encrypt)
: provider(server_state) : provider(server_state)
, wsrep_() , wsrep_()
{ {
@ -591,7 +592,7 @@ wsrep::wsrep_provider_v26::wsrep_provider_v26(
init_args.connected_cb = &connected_cb; init_args.connected_cb = &connected_cb;
init_args.view_cb = &view_cb; init_args.view_cb = &view_cb;
init_args.sst_request_cb = &sst_request_cb; init_args.sst_request_cb = &sst_request_cb;
init_args.encrypt_cb = &encrypt_cb; init_args.encrypt_cb = encrypt ? &encrypt_cb : NULL;
init_args.apply_cb = &apply_cb; init_args.apply_cb = &apply_cb;
init_args.unordered_cb = 0; init_args.unordered_cb = 0;
init_args.sst_donate_cb = &sst_donate_cb; init_args.sst_donate_cb = &sst_donate_cb;

View File

@ -31,7 +31,7 @@ namespace wsrep
public: public:
wsrep_provider_v26(wsrep::server_state&, const std::string&, wsrep_provider_v26(wsrep::server_state&, const std::string&,
const std::string&); const std::string&, bool encrypt);
~wsrep_provider_v26(); ~wsrep_provider_v26();
enum wsrep::provider::status enum wsrep::provider::status
connect(const std::string&, const std::string&, const std::string&, connect(const std::string&, const std::string&, const std::string&,