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

Add support for custom provider implementation

- Add a set_provider_factory() method to server_state to allow
  injecting provider factory which will be called when the
  provider is loaded.

Other related changes:
- Implement to_string() helper method for id class.
- Fix id ostream operator human readable id printing.
- Pass victim client_service as an argument to provider::bf_abort()
  to allow passing victim context to custom provider.
- Implement prev() helper method for seqno class.
- Make server_state recover_streaming_appliers_if_not_recovered()
  public. In some recovery scenarios the method must be called outside
  of server_state internal code paths.
- Add storage_service requires_globals() method. The storage service
  implementation may override this to return false if changing to
  storage service context does not require store/reset globals.
- Change view final() to also require that the view status is not
  primary for the view to be final. Also change the method name to
  is_final() to avoid confusion with C++ final identifier.
- Fixes to server state handling in disconnecting and disconnected
  states.
- Keep TOI meta data over whole TOI critical section.

Co-authored-by: Denis Protivensky <denis.protivensky@galeracluster.com>
This commit is contained in:
Teemu Ollakka
2025-01-13 16:06:28 +02:00
parent 51a0b0ab4f
commit 5ea78de6c2
26 changed files with 242 additions and 131 deletions

View File

@ -117,9 +117,8 @@ namespace wsrep
{
++group_seqno_;
wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
ws_meta = wsrep::ws_meta(gtid, stid,
wsrep::seqno(group_seqno_ - 1),
flags);
ws_meta = wsrep::ws_meta(
gtid, stid, wsrep::seqno(group_seqno_ - 1), flags);
return wsrep::provider::success;
}
else
@ -135,9 +134,8 @@ namespace wsrep
{
++group_seqno_;
wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
ws_meta = wsrep::ws_meta(gtid, stid,
wsrep::seqno(group_seqno_ - 1),
flags);
ws_meta = wsrep::ws_meta(
gtid, stid, wsrep::seqno(group_seqno_ - 1), flags);
ret = wsrep::provider::error_bf_abort;
}
bf_abort_map_.erase(it);
@ -215,8 +213,8 @@ namespace wsrep
wsrep::gtid(group_id_, wsrep::seqno(group_seqno_)),
wsrep::stid(server_id_, tc.id(), cc.id()),
wsrep::seqno(group_seqno_ - 1),
wsrep::provider::flag::start_transaction |
wsrep::provider::flag::commit);
wsrep::provider::flag::start_transaction
| wsrep::provider::flag::commit);
}
else
{
@ -245,12 +243,10 @@ namespace wsrep
{
++group_seqno_;
wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
wsrep::stid stid(server_id_,
wsrep::transaction_id::undefined(),
wsrep::stid stid(server_id_, wsrep::transaction_id::undefined(),
client_id);
toi_meta = wsrep::ws_meta(gtid, stid,
wsrep::seqno(group_seqno_ - 1),
flags);
wsrep::seqno(group_seqno_ - 1), flags);
++toi_write_sets_;
if (flags & wsrep::provider::flag::start_transaction)
++toi_start_transaction_;
@ -260,6 +256,7 @@ namespace wsrep
}
enum wsrep::provider::status leave_toi(wsrep::client_id,
const wsrep::ws_meta&,
const wsrep::mutable_buffer&)
WSREP_OVERRIDE
{ return wsrep::provider::success; }
@ -315,6 +312,7 @@ namespace wsrep
enum wsrep::provider::status
bf_abort(wsrep::seqno bf_seqno,
wsrep::transaction_id trx_id,
wsrep::client_service&,
wsrep::seqno& victim_seqno)
WSREP_OVERRIDE
{