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

476 Commits

Author SHA1 Message Date
Teemu Ollakka
a4ea80e11a Added test cases for error/shutdown in joined and donor states. 2018-12-20 19:35:31 +02:00
Teemu Ollakka
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
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
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
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
Teemu Ollakka
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
Daniele Sciascia
1be3ef9529 Expose to_c_string() function for wsrep::view::status 2018-12-20 11:27:49 +01:00
mkaruza
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
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
80dcf4b6d2 codership/wsrep-lib#35 Fixed compilation on 32-bit platform 2018-12-15 12:49:10 +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
21781f6644 Improved SST diagnostic logging 2018-12-06 23:26:19 +02:00
Alexey Yurchenko
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
Daniele Sciascia
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
Daniele Sciascia
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
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
8ffad51822 Fixed the definition of the encryption callback 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
Daniele Sciascia
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
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
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
Daniele Sciascia
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
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
Teemu Ollakka
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
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
Teemu Ollakka
4ee624cfbc Tweaks to travis configuration and cmake
Travis:
* Don't install all g++ versions on all build targets.
* Install addons per target to have finer control on what is needed
* Use WSREP_STRICT_BUILD_FLAGS on other targets than GCC 4.8

cmake:
* Fixed CMakeLists.txt to check only boost libraries which are
  actually needed
2018-10-24 19:15:52 +03:00
Teemu Ollakka
b322a3a45c Cleaned up obsolete methods 2018-10-24 19:15:52 +03:00
Teemu Ollakka
9fccd8e1ee Travis CI configuration file
In order to make build successful on wider number of platforms,
removed -Weffc++ from default build options. Added a new cmake
option WSREP_LIB_STRICT_BUILD_FLAGS to enable it.
2018-10-24 19:15:52 +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
Daniele Sciascia
cf434f3da5 Fix make test
Fixed `make test` so that it runs unit tests.

codership/wsrep-lib#7
2018-10-19 12:13:10 +03:00
sjaakola
435b589ff5 Merge branch 'master' into deadlock-warnings 2018-10-17 17:09:05 +03:00
Teemu Ollakka
cb1ca4e66e Rollback and release streaming appliers in unit tests
Unit tests which cause streaming rollback leaked memory because
the streaming applier handle which was created for rollback
fragment handling was not released. Roll back a streaming transaction
and release applier handle appropriately in corresponding tests.
2018-10-17 12:51:01 +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
2f8b0cdac4 Cleaned up README to contain only introduction and build instructions. 2018-10-15 12:28:23 +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
mkaruza
94174b06e6 codership/galera-bugs#165 Update to wsrep encryption API
Update wsrep-API/v26 submodule. Cleanup. Empty callback handler for encrypt.
2018-10-11 20:40:13 +03:00
Teemu Ollakka
272de0c6af Removed dead code 2018-10-03 13:13:06 +03:00
Alexey Yurchenko
31f244c3b3 Fixed compilation on Ubuntu 18.04 / GCC 7.3.0 2018-10-02 21:41:14 +03:00
Alexey Yurchenko
0d2a265edc
Update README.md 2018-10-02 19:53:04 +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
0410deee3a Fixes to streaming rollback.
* Check error code from fragment release
* Always call streaming rollback from must abort if the
  transaction is in executing phase. This is needed to ensure
  that rollback fragment replication happens before rollback starts
* Initiate streaming rollback from certify fragment if BF abort
  happens after fragment certification.
2018-07-19 01:11:02 +03:00