mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-04-19 21:02:17 +03:00
commit 3b419aa6e2cced92c07c571116aad3d55cd1e7e4 Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun Feb 19 10:29:34 2023 +0200 Skip fetching config options if provider not loaded via wsrep-API commit 044220cc067cbf74a956fa1a4476f6d873a78210 Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed Jul 13 10:31:03 2022 +0300 Operation context pointer for client state commit eeb05a92384933dd026d5ca3c6f854510bb76eed Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Mon Jul 4 09:03:23 2022 +0300 Add unit test log in gitignore commit 92a04070fc0dc4f55dc0415442ed9003c29a9cf6 Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun May 8 12:45:36 2022 +0300 Added convenience method prev() to seqno commit f83ca1917e50bfe29c3912ccd3a9989ead68378a Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun May 1 16:37:24 2022 +0300 Pass victim context for provider on BF abort This change is needed for custom provider implementations to have a way to access the victim in the application context. Helper interface operation_context to pass caller context for service/provider callbacks in more type safe way. commit 244eabe8cfcc86ca49981b0d8d081b740a967bda Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed May 25 07:39:43 2022 +0300 Handle disconnecting state in on_sync() When disconnecting from the group, the sync event from the provider must not change the state back to synced. commit ba8e23df0dfec71427aac0d35036f26d908b4995 Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Tue Mar 22 17:43:52 2022 +0200 Add provider position field to ws_meta and view Provider position is needed in coordinated recovery between application and provider. Pass the position info from provider to application to allow making it durable. commit 53e60f64c953b252a47bc91e87b4131465b5f15f Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sat Mar 19 14:45:57 2022 +0200 Reset TOI meta after releasing total order in provider This is to keep the TOI meta available in case the provider implementation needs it. commit bccb9997f29e94a2d5160d388454ace5f89efb6c Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Mon Jan 3 11:19:58 2022 +0200 Fixed id ostream operator to print human readable ids commit 6d0b37daafdb87975931b0bd95bb8ea821a4071e Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed Dec 15 16:37:45 2021 +0200 Silence unused variable warning commit 4b8616f3d13137d992b8b994baa48f2981238352 Author: Denis Protivensky <denis.protivensky@galeracluster.com> Date: Wed Dec 15 16:43:31 2021 +0300 Fix provider loading in test for release builds commit 6df17812d945a07a6f199e6fe83e287afbc28ed9 Author: Denis Protivensky <denis.protivensky@galeracluster.com> Date: Tue Dec 14 20:28:56 2021 +0300 Introduce set_provider_factory() method for server_state This allows injecting an application allocated provider into server_state. After this virtual provider getter is unnecessary. Made the getter normal method and fixed unit tests accordingly.
171 lines
4.4 KiB
C++
171 lines
4.4 KiB
C++
/*
|
|
* Copyright (C) 2018 Codership Oy <info@codership.com>
|
|
*
|
|
* This file is part of wsrep-lib.
|
|
*
|
|
* Wsrep-lib is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Wsrep-lib is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with wsrep-lib. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "db_server_service.hpp"
|
|
#include "db_server.hpp"
|
|
#include "db_storage_service.hpp"
|
|
|
|
#include "wsrep/logger.hpp"
|
|
#include "wsrep/high_priority_service.hpp"
|
|
|
|
db::server_service::server_service(db::server& server)
|
|
: server_(server)
|
|
{ }
|
|
|
|
wsrep::storage_service* db::server_service::storage_service(
|
|
wsrep::client_service&)
|
|
{
|
|
return new db::storage_service();
|
|
}
|
|
|
|
wsrep::storage_service* db::server_service::storage_service(
|
|
wsrep::high_priority_service&)
|
|
{
|
|
return new db::storage_service();
|
|
}
|
|
|
|
void db::server_service::release_storage_service(
|
|
wsrep::storage_service* storage_service)
|
|
{
|
|
delete storage_service;
|
|
}
|
|
|
|
wsrep::high_priority_service* db::server_service::streaming_applier_service(
|
|
wsrep::client_service&)
|
|
{
|
|
return server_.streaming_applier_service();
|
|
}
|
|
|
|
wsrep::high_priority_service* db::server_service::streaming_applier_service(
|
|
wsrep::high_priority_service&)
|
|
{
|
|
return server_.streaming_applier_service();
|
|
}
|
|
|
|
void db::server_service::release_high_priority_service(
|
|
wsrep::high_priority_service *high_priority_service)
|
|
{
|
|
delete high_priority_service;
|
|
}
|
|
|
|
bool db::server_service::sst_before_init() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
std::string db::server_service::sst_request()
|
|
{
|
|
std::ostringstream os;
|
|
os << server_.server_state().name();
|
|
wsrep::log_info() << "SST request: "
|
|
<< server_.server_state().name();
|
|
|
|
return os.str();
|
|
}
|
|
|
|
int db::server_service::start_sst(
|
|
const std::string& request, const wsrep::gtid& gtid, bool bypass)
|
|
{
|
|
server_.donate_sst(request, gtid, bypass);
|
|
return 0;
|
|
}
|
|
|
|
void db::server_service::background_rollback(wsrep::unique_lock<wsrep::mutex>&,
|
|
wsrep::client_state&)
|
|
{
|
|
}
|
|
|
|
void db::server_service::bootstrap()
|
|
{
|
|
}
|
|
|
|
void db::server_service::log_message(enum wsrep::log::level level,
|
|
const char* message)
|
|
{
|
|
wsrep::log(level, server_.server_state().name().c_str()) << message;
|
|
}
|
|
void db::server_service::log_dummy_write_set(
|
|
wsrep::client_state&, const wsrep::ws_meta& meta)
|
|
{
|
|
wsrep::log_info() << "Dummy write set: " << meta.seqno();
|
|
}
|
|
|
|
void db::server_service::log_view(wsrep::high_priority_service*,
|
|
const wsrep::view& v)
|
|
{
|
|
wsrep::log_info() << "View:\n" << v;
|
|
server_.storage_engine().store_view(v);
|
|
}
|
|
|
|
void db::server_service::recover_streaming_appliers(
|
|
wsrep::client_service&)
|
|
{
|
|
}
|
|
|
|
void db::server_service::recover_streaming_appliers(
|
|
wsrep::high_priority_service&)
|
|
{
|
|
}
|
|
|
|
wsrep::view db::server_service::get_view(wsrep::client_service&,
|
|
const wsrep::id& own_id)
|
|
{
|
|
wsrep::view stored_view(server_.storage_engine().get_view());
|
|
int const my_idx(stored_view.member_index(own_id));
|
|
wsrep::view my_view(
|
|
stored_view.state_id(),
|
|
stored_view.view_seqno(),
|
|
stored_view.status(),
|
|
stored_view.capabilities(),
|
|
my_idx,
|
|
stored_view.protocol_version(),
|
|
stored_view.members(),
|
|
0
|
|
);
|
|
return my_view;
|
|
}
|
|
|
|
wsrep::gtid db::server_service::get_position(wsrep::client_service&)
|
|
{
|
|
return server_.storage_engine().get_position();
|
|
}
|
|
|
|
void db::server_service::set_position(wsrep::client_service&,
|
|
const wsrep::gtid& gtid)
|
|
{
|
|
return server_.storage_engine().store_position(gtid);
|
|
}
|
|
|
|
void db::server_service::log_state_change(
|
|
enum wsrep::server_state::state prev_state,
|
|
enum wsrep::server_state::state current_state)
|
|
{
|
|
server_.log_state_change(prev_state, current_state);
|
|
}
|
|
|
|
int db::server_service::wait_committing_transactions(int)
|
|
{
|
|
throw wsrep::not_implemented_error();
|
|
}
|
|
|
|
void db::server_service::debug_sync(const char*)
|
|
{
|
|
|
|
}
|