1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-04-25 17:42:30 +03:00

56 Commits

Author SHA1 Message Date
Daniele Sciascia
db41d67c9c Retrieve provider options before provider is initialized
Change provider_options so that it does not depend on provider.
Call into config_service when provider is created, i.e. after
library is loaded, before it is initialized, so that we can
inject additional options at startup.
Change the signature of the call provider options callback to
take provider_options object as parameter.
2025-04-04 14:39:11 +02:00
Teemu Ollakka
97b0da6704 Pass callback to get provider options to provider_v26 constructor
Passing a callback allows constructing the options string using
config service after loading the provider but before initializing
the provider.
2025-04-03 10:14:21 +02:00
Jan Lindström
b8e0540e7a MDEV-26851 : Add interface to monitor connections in Galera 2025-02-21 11:36:34 +02:00
Teemu Ollakka
5ea78de6c2 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>
2025-01-14 16:51:26 +02:00
Teemu Ollakka
3de594b662 Add application defined sequential consistency for certification
Client state methods before_prepare() and before_commit() accept
a callback which is called by the provider after it can guarantee
sequential consistency. This allows application threads which wish to
maintain sequential consistency to enter before_prepare() and
before_commit() calls concurrently without waiting the prior call
to finish.
2024-11-28 13:10:16 +02:00
Teemu Ollakka
31db847676 MDEV-32363 Add interface to set node isolation mode in provider 2024-05-21 12:38:34 +03:00
Teemu Ollakka
53638a8384 Removing assert() calls from public headers
Removed calls to assert() from public headers to have
full control when assertions are enabled in wsrep-lib
code regardless of parent project build configuration.
Moved methods containing assertions and non-trivial
code from headers into compilation units.
2023-02-26 10:12:49 +02:00
Alexey Yurchenko
4565f7232f Define event consumption interface for the application side event service
implementation.
Implement event pass-through to the applicaiton.

Refs codership/wsrep-lib#174
2021-12-10 20:54:57 +02:00
mkaruza
14b3612a30 Initial allowlist support 2021-12-06 14:23:40 +01:00
Teemu Ollakka
9318a50d18 Wsrep TLS service
This commit defines a TLS service interface. If the implementation is
provided by the application when the provider is loaded, appropriate
hooks are probed from the provider and the provider side hooks are
initialized after the provider is loaded.

A sample implementation to demostrate the use of TLS interface
is provided in dbsim/db_tls.cpp.

Also contains a change to thread service interface: The
thread exit virtual method was changed to function pointer
to allow thread exit path which does not involve C++.
2021-02-24 11:14:21 +02:00
Alexey Yurchenko
daae4a9c35 Some methods in wsrep-lib still hide/ignore return codes from provider
which complicates diagnostics and debugging.

Don't ignore provider return codes and more verbose error logging for
sst_sent(), sst_received(), set_encryption_key() methods

Refs codership/wsrep-lib#127
2020-07-14 12:50:04 +03:00
Teemu Ollakka
086c466637 - Added wait-until parameter for begin_nbo_phase_two().
- Retry enter_toi() in poll_enter_toi() also for error_connection_failed
  which means that the connectivity to the cluster has been lost,
  a.k.a non-prim.
2019-12-08 12:52:36 +02:00
Daniele Sciascia
052247144f Support recovery of XA transactions
* Add method `restore_prepared_transaction` to `client_state` class
  which restores a transaction state from storage given its xid.
* Add method `commit_or_rollback_by_xid` to terminate prepared XA
  transactions by xid.
* Make sure that transactions in prepared state are not rolled back
  when their master fails/partitions away.
2019-10-16 10:16:39 +02:00
Daniele Sciascia
24cd49b23f Improved logging output of ws_meta 2019-10-16 10:15:55 +02:00
Teemu Ollakka
eb4cf86c1e Implemented thread service support.
Added a wsrep::thread_service interface to allow application to
inject instrumented thread, mutex and condition variable implementation
for provider.

The interface is defined in include/wsrep/thread_service.hpp.
Sample implementation is provided in dbsim/db_threads.[h|c]pp.

This patch will also clean up some remaining dependencies to
wsrep-API compilation units so that the dependency to wsrep-API
is header only. This will extending the provider support to
later wsrep-API versions.
2019-10-14 09:30:15 +03:00
Alexey Yurchenko
0f676bd893 codership/wsrep-lib#104 Error voting support
- populate and pass real error description buffer to provider in case
   of applying error
 - return 0 from server_state::on_apply() if error voting confirmed
   consistency
 - remove fragments and rollback after fragment applying failure
 - always release streaming applier on commit or rollback
2019-07-15 03:48:55 +03:00
Alexey Yurchenko
4285ff99ea codership/wsrep-lib#100 Support for assign_read_view() wsrep API call
Marshall the call from the `client_state` interface down to provider.
2019-05-08 15:07:45 +03:00
mkaruza
e7d72ae7f6 codership/mariadb-wsrep#27 Galera cache encryption
* Created interface class for encryption support
* Implemented function for setting enc key to provider, callback function for encryption/decryption
2019-02-01 16:57:34 +01:00
Teemu Ollakka
47263df442 Revert "codership/mariadb-wsrep#27 Galera cache encryption"
This reverts commit 7e9419e8111c3ca37d5e484282fe11a690eb2c6a.
2019-01-21 14:12:28 +02:00
Teemu Ollakka
476bcdb41e Revert "codership/mariadb-wsrep#27 Galera cache encryption fixup"
This reverts commit 043e8bc2ea782b973a5982a8980473cd51e4c574.
2019-01-21 14:12:10 +02:00
Alexey Yurchenko
043e8bc2ea codership/mariadb-wsrep#27 Galera cache encryption fixup
Fixup to enable/disable encryption on provider loading
2019-01-20 15:20:52 +02:00
mkaruza
7e9419e811 codership/mariadb-wsrep#27 Galera cache encryption
* Implemented encryption callback and enc_set_key
* Added pure virtual functions for encryption functionality
* Set enc key if provider was not loaded on time
2019-01-19 23:58:20 +01:00
Teemu Ollakka
0441746368 codership/wsrep-lib#44 Provider name, version and vendor getters
Added methods to get provider name, version and vendor strings
into wsrep::provider interface. Implementations for v26 and mock
providers.
2019-01-02 12:11:26 +02:00
Alexey Yurchenko
fd07ff12e4 Refs codership/wsrep-API#21 added support for the IMPLICIT_DEPS WS flag 2018-11-28 18:07:08 +01:00
Alexey Yurchenko
fb14883547 Recover current view from state after SST.
When member joins the group and needs to receive an SST it won't
receive the corresponding menbership view event because the SST
happens after the event and will already include the effects of
all events ordered before it. The view then must be recovered from
the received state.

Minor renames and cleanups.

References codership/wsrep-lib#18
2018-11-12 12:47:42 +02:00
Daniele Sciascia
ed7c4d7410 Add prepare flag to wsrep::provider::flag 2018-10-24 11:35:28 +03:00
Teemu Ollakka
c0c977f9ab Added GPLv2 licence and copyright headers. 2018-10-15 15:14:22 +03:00
Teemu Ollakka
9f153be277 Fixes to streaming rollback processing
* Count separately fragments certified and fragments stored in
  streaming context. Storing the fragment may ultimately fail
  due to BF abort even if the fragment was succesfully certified.
  Therefore we need to have separate counter for certified fragments
  to determine if the transaction is streaming and seqnos of fragments
  which have been succesfully stored.
* Provider release is called only after succesful fragment certification
  and fragment store.
* Fixed handling of write sets with rollback flag set in apply_write_set()
2018-07-16 10:07:46 +03:00
Teemu Ollakka
80ca03daaf Implemented SR transaction rollback. 2018-07-10 14:01:41 +03:00
Teemu Ollakka
b9532e6497 Return provider status from set options. 2018-07-03 16:33:14 +03:00
Teemu Ollakka
3632e7823c Pass high_priority_service instead of void ptr for provider methods. 2018-07-03 07:48:35 +03:00
Teemu Ollakka
db18e91c42 Implemented client last_written_gtid, sync_wait 2018-06-30 07:44:09 +03:00
Teemu Ollakka
0851970c53 Bootstrap server service, fixes to server state management
* Added bootstrap service call to do DBMS side bootstrap operations
  during the cluster bootstrap.
* Added last_committed_gtid() to provider interface
* Implemented wait_for_gtid() provider call
* Pass initial position to the server state
2018-06-29 11:54:33 +03:00
Teemu Ollakka
fd9cf87141 * Return provider status from provider connect
* Call to get server status variables along with provider variables
* Deal with intermediate non-prims
2018-06-27 15:36:52 +03:00
Teemu Ollakka
cad9176474 TOI replicating and applying codepaths 2018-06-25 09:28:51 +03:00
Teemu Ollakka
8f0e112c47 Renamed invalid to undefined. More utility functions. 2018-06-21 16:50:44 +03:00
Teemu Ollakka
81ac78913a Initial implementation of client_state TOI mode. 2018-06-21 11:45:18 +03:00
Teemu Ollakka
3a8861b26b * Moved causal reads/gtid wait into server state interface
* Changed undefined seqno to be defined as -1
2018-06-21 10:37:55 +03:00
Teemu Ollakka
ef0fb72b73 * Added size exceeded error code
* Return provider status from selected client_state calls
* Added more methods to provider interface
2018-06-20 19:44:20 +03:00
Teemu Ollakka
5c3c972947 Provide access to native wsrep API handle. 2018-06-19 09:41:04 +03:00
Teemu Ollakka
0e4c7f16a9 Pass ws_handle as const reference to provider replay() 2018-06-19 09:36:15 +03:00
Teemu Ollakka
d1a1e298e9 Removed wsrep_api.h dependency from view.hpp 2018-06-18 20:39:25 +03:00
Teemu Ollakka
af3119a58b Removed ostream include from public API headers. 2018-06-17 13:55:37 +03:00
Teemu Ollakka
ef4baa9f9d Renamed server_context to server_state. 2018-06-17 10:07:48 +03:00
Teemu Ollakka
ad0617c660 Using javadoc style for doc comments 2018-06-16 15:23:14 +03:00
Teemu Ollakka
256000f934 Refactored client_service interface out of client_context 2018-06-14 19:44:38 +03:00
Teemu Ollakka
0b6e49474f Tests and fixes for replaying. 2018-06-14 15:00:40 +03:00
Teemu Ollakka
9e8e6d47ba * Unit test for SR 2PC
* Removed redundant data class
* Introduced const_buffer and mutable_buffer
* Transaction context and client context interface refactoring
2018-06-12 18:04:32 +03:00
Teemu Ollakka
0186342092 Initial replicating side implementation of streaming replication 2018-06-12 15:44:20 +03:00
Teemu Ollakka
3456a8b953 Unit tests for identifier class. 2018-06-12 11:22:02 +03:00