1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-04-19 21:02:17 +03:00

252 Commits

Author SHA1 Message Date
Teemu Ollakka
28e52c8412 Added runtime_error overload with const char* argument
Needed to add new overload to get code compiled with
AppleClang 10.0.
2019-01-23 11:41:34 +02:00
Teemu Ollakka
a6b38d2428 codership/wsrep-lib#54 Service call to recover streaming appliers
Introduced server_service recover_streaming_appliers() interface
call which will be called in total order whenever streaming appliers
must be recovered. The call comes with two overloads, one which
can be called from client context (e.g. after SST has been received)
and the other from high priority context (e.g. view event handling).

The client context overload should be eventually be deprecated once
there is a mechanism to make provider signal that it has joined to
the cluster and will start applying events.
2019-01-21 17:00:08 +02: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
aeb5990642 Define undefined id and gtid as const static member variables.
Use default seqno and id constructors in default gtid ctor
instead of calls to static undefined to initialize.
2019-01-18 23:57:24 +02:00
Teemu Ollakka
55f6c63328 codership/wsrep-lib#52 Removed client_service do_2pc() 2019-01-16 19:33:32 +02:00
Teemu Ollakka
89b3561ad8 Read recovered position from sst_received() after initialization
In general the position where the storage recovers after a SST
cannot be known untile the recovery process is over. This in turn
means that the position cannot be known when the server_state
sst_received() method is called. Worked around the problem by
introducing get_position() method into server service which
can be used to get the position from stable storage after SST
has completed and the state has been recovered.
2019-01-15 12:35:06 +02:00
Daniele Sciascia
17fc8c16de Turn "Enabling/Disabling streaming" into debug messages 2019-01-15 11:05:07 +01:00
mkaruza
a3a632cafe Added method to check if provider is loaded 2019-01-10 10:04:58 +01:00
Daniele Sciascia
4ac15e4349 Fix attempt to replicate empty fragments
* Adds method wsrep::transaction::streaming_step() so that there is a
  single place where streaming context unit counter is udpated.
  The method also checks that some data has been generated before
  attempting fragment replication.
* Emit a warning if there is an attempt to replicate a fragment and
  there is no data to replicate.
2019-01-07 16:33:32 +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
Teemu Ollakka
e9bb552096 codership/wsrep-lib#34 Provided a method to interrupt state waiters
Intruduced server_state::interrupt_state_waiters() to interrupt
all waiters inside server_state::wait_until_state(). This mechanism
is needed when an error is encountered during state change processing
and waiting threads may need to be interrupted to check and handle
the error condition.

Made server_state::wait_until_state() to throw exception if the
wait was interrupted and the new server state is either disconnecting
or disconnected, which usually indicates error condition.
2018-12-20 19:35:31 +02:00
Teemu Ollakka
e81c66cd59 Fixed assertion on server_state connected - disconnecting transition
Transition from server_state connected state to disconnecting must
be allowed to deal with errors during server startup.

Added SST first test cases for server_state transitions:
* Successful join via SST
* Error in connect state
* Error in joiner state
2018-12-20 19:35:31 +02:00
Teemu Ollakka
ae0109f9b3 codership/wsrep-lib#34 Refactored view handling
Extracted on_primary_view(), on_non_primary_view() out of on_view().
2018-12-20 19:35:31 +02:00
Teemu Ollakka
76424ad515 codership/wsrep-lib#34 Unit test for sync-disconnect-sync
Added unit test for sync-disconnect-sync transition without SST.
2018-12-20 19:35:31 +02:00
Daniele Sciascia
1be3ef9529 Expose to_c_string() function for wsrep::view::status 2018-12-20 11:27:49 +01:00
Alexey Yurchenko
05013c8d44 Support for UPDATE certification key type. 2018-12-15 19:59:11 +02:00
Teemu Ollakka
36dbb37645 codership/wsrep-lib#35 Rewrote member_index() to use iterators
Use iterators for scanning members vector in order to avoid
issues with integer signedness and range checks. The vector is
usually rather small and not in hot codepath, so performance
is here not an issue.

Added unit test for member_index() method.
2018-12-15 13:46:42 +00:00
Teemu Ollakka
256cd6ae60 codership/wsrep-lib#32 Allow transient desync errors in desync_and_pause()
Provider desync may return an error if the provider cannot communicate
with rest of the cluster. However, this is acceptable for example
if the node has dropped from primary view. Instead of returning
error immediately after failed desync(), attempt to pause the provider
regardless of the error. If pause operation fails, error is returned.
In order to avoid resync in resume_and_resync() in the case desync
failed in desync_and_pause(), new member variable desynced_on_pause_
was introduced to decide whether to resync or not in resume_and_resync().
This variable is protected by pause()/resume() calls since they do
not allow concurrent pause/resume operations.
2018-12-13 13:04:41 +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
sjaakola
cfcf34e70f codership/wsrep-lib#23 before_command() wait for ongoing rollbacks leaks
Storing information that background rollbacker in ongoing in client state has_rollback_
This can be used for detecting if there is ongoing background rollback,
and client should keep waiting in before_command() entry to avoid conflicts
in accessing client state during background rollbacking.

transaction::bf_abort() is modified to set has_rollback_ flag when
backgroung rollbacking has been assigned for the client

sync_rollback_complete() method has been modified to reset the backround
rollbacker flag
2018-11-27 12:26:14 +02:00
Alexey Yurchenko
3950ea3027 Refs codership/wsrep-lib#18 Small fixups
- fixed node ID assertion in on_connect() method,
   fixed "sanity checks" to allow reconnection to primary component
 - fixed code duplication in on_view() method
2018-11-23 23:27:09 +02: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
Alexey Yurchenko
ea9971d54b - Initialize member cluster ID only on connection to cluster and forget
it on disconnect.
 - Don't rely on own index from the view because the view may come from
   another member (IST/SST), instead always determine own index from own ID.

Refs codership/wsrep-lib#13
2018-11-09 00:42:05 +02:00
Teemu Ollakka
a942811ce7 User defined logger callback implementation
Added static wsrep::log::logger_fn() method to allow user to
provide logger callback.
2018-11-07 21:45:52 +02:00
Teemu Ollakka
d4efa598bb Added is_empty() method to transaction class
Method is_empty() can be determined if there have no been changes
to the transaction.
2018-10-26 11:48:59 +03:00
Teemu Ollakka
5391de0474 Relaxed assertion in sr_key_set::insert()
There are some corner cases where keys with two parts are needed
for a transaction. Relaxed the assertion and sanity check so that
at least two key parts are needed for each key which is assigned
to a transaction.
2018-10-25 13:57:57 +03:00
Daniele Sciascia
1c0a82f5b1 Typo fixes in server_state.hpp 2018-10-24 11:35:28 +03:00
Daniele Sciascia
ed7c4d7410 Add prepare flag to wsrep::provider::flag 2018-10-24 11:35:28 +03:00
sjaakola
435b589ff5 Merge branch 'master' into deadlock-warnings 2018-10-17 17:09:05 +03:00
Teemu Ollakka
a9abb3a80a Extracted mock_server_service out of mock_server_state. 2018-10-17 12:07:41 +03:00
Teemu Ollakka
7c6ee3f61f In order to avoid potential deadlocks, release client_state lock when
calling server state methods which may acquire server_state mutex.

Fixed compilation errors in release mode.
2018-10-15 16:35:19 +03:00
Teemu Ollakka
c0c977f9ab Added GPLv2 licence and copyright headers. 2018-10-15 15:14:22 +03:00
Teemu Ollakka
5e5906d598 Prefixed cmake WITH_ definitions with WSREP_LIB_ to avoid collisions
with superproject definitions.

Avoid using client_service::do_2pc() in before_commit() to
determine if 2pc is actually happening, will use transaction
states to deduce that. client_service::do_2pc() should be deprecated.

Fixed a compiler warning in db_high_priority_service.cpp.
2018-10-12 16:04:52 +03:00
Alexey Yurchenko
31f244c3b3 Fixed compilation on Ubuntu 18.04 / GCC 7.3.0 2018-10-02 21:41:14 +03:00
Teemu Ollakka
5bf8ad1294 Close SR transactions when disconnecting from the group.
Moved SR fragment removal for total order BFd SR transactions
into after_rollback() call to avoid deadlocking while trying
to access storage before rolling back the transaction.
2018-07-19 15:13:27 +03:00
Teemu Ollakka
61e0e30687 Remove fragments in before rollback for streaming transactions
which got BF aborted in total order.
2018-07-19 13:52:12 +03:00
Teemu Ollakka
b02200b1ef Fixes to streaming rollback
* Check fragment removal error code in prepare phase. It is possible
  that the transaction gets BF aborted during fragment removal.
* Mark fragment certified in certify_fragment() even if the provider
  returns cert failed error. With current wsrep-API error codes
  it may not be possible to distinquish certification failure
  and BF abort during fragment replication. This may also be a
  provider bug. As a result rollback fragment may sometimes be
  replicated when it would not be necessary.
2018-07-17 14:34:24 +03:00
Teemu Ollakka
b054c7320c Assert that fragmen seqno is not undefined. Added debug crash points. 2018-07-16 16:50:49 +03:00
Teemu Ollakka
0efec1b8bd Added debug_crash() method to high priority service interface. 2018-07-16 12:45:53 +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
21ae2c849e Pass pointer to high priority service as a parameter for log_view()
The pointer will pass applier context to log_view(), where it
can be used for stable storage access.
2018-07-15 19:00:10 +03:00
Teemu Ollakka
86472ee420 Implemented SR transaction rollbacking during configuration changes.
SR tranasctions are BF aborted or rolled back on primary view
changes according to the following rules:
* Ongoing local SR transactions are BF aborted if the processing
  server is not found from the current view.
* All remote SR transactions whose origin server is not included in the
  current view are rolled back.
2018-07-14 16:11:13 +03:00
Teemu Ollakka
13487781d8 Total order BF abort client_state method to differentiate BF
aborts caused by conflicts between transactions and conflicts
between TOI operations and transactions.
2018-07-13 18:33:22 +03:00
Teemu Ollakka
4cfb9b6413 Introduced adopt_transaction() for storage_service interface
A SR transaction must be adopted by a storage service instance
running in background rollbacker thread while it is aborting a
SR transaction.
2018-07-13 15:36:27 +03:00
Teemu Ollakka
22d7a31d81 Fixes to SR rollback:
* Enable codepath to BF abort high priority SR applier
* Pass ws_handle, ws_meta to high priority service rollback
  call to allow total ordering of rollback process
2018-07-12 18:00:52 +03:00
Teemu Ollakka
3f4e5dea3b Revised logic to handle SR replaying
* Added server_id into transaction in order to be able to stop
  streaming applier during high priority BF abort
* Added missing commit fragment applying
* Don't clear fragments for replaying SR transaction
2018-07-12 13:36:45 +03:00
Teemu Ollakka
ddc6c6495b Made client_id, transaction_id constructors explicit. 2018-07-11 15:00:31 +03:00