1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-24 10:42:31 +03:00
Commit Graph

399 Commits

Author SHA1 Message Date
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
ae734a33f8 Fixed compilation errors picked up by travis clang builds 2019-01-19 18:08:49 +02:00
869a706fa1 Added clang 3.8, 4.0, 5.0 and 7.0 build to travis build matrix 2019-01-19 18:08:10 +02:00
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
55f6c63328 codership/wsrep-lib#52 Removed client_service do_2pc() 2019-01-16 19:33:32 +02:00
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
17fc8c16de Turn "Enabling/Disabling streaming" into debug messages 2019-01-15 11:05:07 +01:00
1e9325197a Turn "Could not find applier context" into debug message
Remove warning "Could not find applier context" when no applier
context is found while applying rollback fragment.
2019-01-15 10:57:39 +01:00
1402cb3701 Added debug sync point before entering commit order 2019-01-11 18:30:30 +02:00
fccdad6ee9 Changed certification to happen in before_prepare()
Certification for commit fragments was changed to happen in
before_prepare in order to make GTID available for storage
engines in prepare phase.

Removed unused file src/wsrep-lib_test.cpp
2019-01-11 18:30:30 +02:00
a3a632cafe Added method to check if provider is loaded 2019-01-10 10:04:58 +01:00
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
a9e2fdccfc Disable streaming on client_state::close() 2019-01-03 12:18:34 +01:00
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
cc67313515 Check if client was interrupted before fragment replication 2018-12-24 09:25:21 +01:00
653d2526eb codership/wsrep-lib#34 Changed flow of control in sst_received()
Instead of handling error case at the beginning, execute the middle
of method body in case of success, leaving only single call to
provider().sst_received() at the end.
2018-12-21 15:11:41 +02:00
4f88e9aea6 codership/wsrep-lib#34 Fixed non-debug compilation error 2018-12-20 19:35:31 +02:00
ba02e7525b codership/wsrep-lib#34 Unit tests for initialization errors
Unit test for server initialization state errors.
2018-12-20 19:35:31 +02:00
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
ac5a4cde0d codership/wsrep-lib#34 Fixed init first IST processing
Init first join crashed in

  server: s1 unallowed state transition: joined -> joined

This was due to missing state check for state in on_primary_view()
before changing to joined state. Added appropriate check.

Implemented unit tests for simple IST scenarios.
2018-12-20 19:35:31 +02:00
76335a3042 Added test case for desync-pause-resume-resync. 2018-12-20 19:35:31 +02:00
728eaa80b5 Added test cases for donor transitions.
Replaced all references to provider_ in server_state methods to
provider() call which is virtual and can be overridden by test classes.
Provider pointer may not be initialized during unit tests yet.
2018-12-20 19:35:31 +02:00
e5e5d409ed Test case for init first succesfull SST. 2018-12-20 19:35:31 +02:00
a4ea80e11a Added test cases for error/shutdown in joined and donor states. 2018-12-20 19:35:31 +02:00
7cd0656990 Allow server_state joiner - disconnecting transition.
Transition joiner - disconnecting may happen when the joiner failed
to receive SST succesfully. Because the system is at undefined state
at this point, skip most of the processing in sst_received()
and return control to caller after notifying the provider about
failure.
2018-12-20 19:35:31 +02:00
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
1776537765 codership/wsrep-lib#34 Handle sync-disconnected-sync for init first
Handle init first case where state is cycled from synced to
disconnected and back synced without SST.
2018-12-20 19:35:31 +02:00
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
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
bf83907f38 codership/wsrep-lib#34 Moved cluster_id, bootstrap_view into base fixture
Made cluster_id, bootstrap_view members of server_fixture_base and
initialize them in serveri_fixture_base constructor to reduce typing
in test cases.
2018-12-20 19:35:31 +02:00
1be3ef9529 Expose to_c_string() function for wsrep::view::status 2018-12-20 11:27:49 +01:00
452da3da8c Removed GTID stdout output
Removed GTID stdout output because it causes a few native suites to fail.
2018-12-20 08:49:56 +01:00
05013c8d44 Support for UPDATE certification key type. 2018-12-15 19:59:11 +02:00
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
80dcf4b6d2 codership/wsrep-lib#35 Fixed compilation on 32-bit platform 2018-12-15 12:49:10 +00:00
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
21781f6644 Improved SST diagnostic logging 2018-12-06 23:26:19 +02:00
0f77323d0e Refs codership/wsrep-lib#18 Don't recover view from state if SST failed.
It is pointless and most likely will result in an unnecessary error
message logged.
2018-12-06 23:26:19 +02:00
cb93aaa77b Lost e_error_during_commit if fragment size exceeds maximum size
If the size of a SR fragment exceeds the maximum size that the
replication provider allows us to replicate, then we are expected to
set the client error code to e_error_during_commit.
However, client_state::after_statement() unconditionally overrides it
to error e_deadlock_error.
Fixes client_state::after_statement() so that it overrided the error
only if noerror has been set yet.
2018-12-05 16:47:56 +01:00
8f490d431a Undefined server id in convert_streaming_client_to_applier()
Method wsrep::server_state::convert_streaming_client_to_applier() may
insert an entry in streaming_appliers_ map which contains undefined
server_id. This happens if the method is called while in non-primary
state, and server_state::id_ is undefined.
The fix is to use the server_id which is recorded in client's
tansaction object.
2018-12-03 22:36:24 +01:00
fd07ff12e4 Refs codership/wsrep-API#21 added support for the IMPLICIT_DEPS WS flag 2018-11-28 18:07:08 +01:00
8ffad51822 Fixed the definition of the encryption callback 2018-11-28 18:07:08 +01:00
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
31f09ca4aa Refs codership/wsrep-lib#18 Fix compile warning
Fixes unused parameter `view` in server_state::go_final() when
compiled without assert()s.
2018-11-24 13:42:53 +01:00
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
d95ec7ed99 Refs codership/wsrep-lib#18: Fixup to proper view from SST processing.
Added a call to log_view() to do the internal initializations that
need to be done on receiveing a new view. Note however that it is not
a view *event*. Here we only need to configure the application to
comply with a new state that it has received, so that it can go on
to apply replication events and catch up with the cluster.
2018-11-23 13:11:20 +02:00
a7a6441ee9 Avoid client_state locking while in storage service scope
This patch changes wsrep::transaction::after_rollback() and
wsrep::transaction::certify_fragment() so that no client state locking
is performed while in storage service scope.
The reason for this change is to not confuse the application as to
which client context locks/unlocks a mutex. More specifically, this
caused MariaDB's safe_mutex to report "Wrong usage of mutex" warnings
as the underlying THD context was switched while using storage service.
2018-11-21 10:46:01 +01:00
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
c7e8bfbdb5 codership/wsrep-lib#13 Fix dbsim to deal with provider generated server id
Dbsim has internal map of server objects for SST simulation.
This was mapped using server_id, which is not available
anymore when server object is constructed. Changed the dbsim to
use server name instead for internal mapping.
2018-11-09 00:42:05 +02:00
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