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

335 Commits

Author SHA1 Message Date
Leandro Pacheco
23b2b9d3ee enter_toi polling fix 2019-09-19 10:05:24 -03:00
Teemu Ollakka
ac9f13b05f Removed extra line. 2019-09-19 14:15:27 +03:00
Teemu Ollakka
fb2b8d3e51 Fixes to review comments
- Increased loop sleep in poll_enter_toi()
- Fixed typos in comments
- Got rid of unnecessary ostringstreams
2019-09-19 14:08:27 +03:00
Teemu Ollakka
d81adc945c Fixed compilation for gcc 4.4 2019-09-19 10:02:58 +03:00
Leandro Pacheco
eae18a1bca remove has_error arg from begin_nbo_phase_two 2019-09-17 16:52:29 -03:00
Leandro Pacheco
decaa9b8f9 fix compilation of unit tests 2019-09-17 11:39:10 -03:00
Leandro Pacheco
03e7bdd457 better error handling for NBO failures
when losing error voting:
- if NBO has failed locally (DBMS side), don't override original DBMS
  error so it gets reported to the client
- otherwise, report "query interrupted" instead of "error during commit"
2019-09-17 11:06:36 -03:00
Leandro Pacheco
4fb2ac8f7d removed unnecessary leave_toi and related TODO 2019-09-16 10:42:26 -03:00
Leandro Pacheco
e70957cc16 poll_enter_toi timeout handlign 2019-09-13 18:52:17 -03:00
Teemu Ollakka
1bff5bed63 Fixed NBO unit tests. 2019-09-13 12:48:21 +03:00
Leandro Pacheco
0abcb5994c handle certification error explicitly when entering TOI 2019-09-11 10:11:08 -03:00
Teemu Ollakka
446e31c86a Clear NBO meta on failure, reset current error status after command. 2019-09-11 12:17:15 +03:00
Teemu Ollakka
dda2d83f23 - 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-09-09 17:38:39 +03:00
Teemu Ollakka
13a4c7b024 Fixed timeout condition in poll_enter_toi() 2019-09-06 17:03:27 +03:00
Teemu Ollakka
bf64c2dd01 Pass certification keys also for NBO end.
Certification keys are needed for NBO end to resolve dependencies
for the write sets which follow NBO end. Without keys the following
write sets do not detect dependency to NBO event and may start applying
too early.
2019-09-06 11:57:56 +03:00
Teemu Ollakka
38bff4b68f Release TOI critical section in poll_enter_toi() in case of error. 2019-09-05 16:34:13 +03:00
Teemu Ollakka
31e0476dae Fix NBO error handling
- Set both current error and current error status if provider enter_toi()
  or leave_toi() fails.
- Leave NBO mode if TOI cannot be entered in begin_nbo_phase_two().
2019-09-05 15:15:30 +03:00
Teemu Ollakka
93c7d5e86a Added short sleep between calls to enter_toi(). 2019-09-04 16:43:01 +03:00
Teemu Ollakka
8f8f3d9210 Made gcc 4.4 work. 2019-09-04 16:25:57 +03:00
Teemu Ollakka
20ef502dd6 Chrono definitions to work around g++ 4.4 C++11 incompatibilities. 2019-09-04 15:50:44 +03:00
Teemu Ollakka
db87cf7d9c Added timeout option to enter_toi_local() and begin_nbo_phase_one()
If timeout option is give, enter_toi_local() and begin_nbo_phase_one()
retry provider::enter_toi() as long as return status indicates
certification failure, given timeout expires or the client is interrupted.
2019-09-04 15:38:02 +03:00
Teemu Ollakka
1d51996981 Fixed unused variable warning. 2019-09-04 15:00:57 +03:00
Teemu Ollakka
e34a522918 Include <chrono> to check if it compiles with all required compilers. 2019-09-04 14:56:43 +03:00
Leandro Pacheco
256b935bc0 handle nbo apply eror
also, remove outdated comment
2019-09-04 14:56:43 +03:00
Leandro Pacheco
7082d8f104 error parameter to nbo calls and m_undefined for toi_mode
toi_mode is set only when actually inside phase one and two.
In between it goes back to m_undefined.
2019-09-04 14:56:43 +03:00
Teemu Ollakka
74e2641e1e NBO begin error handling, unit test 2019-09-04 14:56:43 +03:00
Teemu Ollakka
f22308192d Fixed nbo_meta handling, release commit order for NBO begin. 2019-09-04 14:56:43 +03:00
Teemu Ollakka
5417ecd6aa Ingnore NBO end event in applier, it will be handled via local TOI 2019-09-04 14:56:43 +03:00
Teemu Ollakka
23adb8f9f8 - Remove unneeded keys from nbo phase two begin.
- Save nbo meta for phase two
- Assign trx_meta in mutable_ws_meta
2019-09-04 14:56:43 +03:00
Teemu Ollakka
8c4b395d25 Squashed memory leaks to get clean test run with ASAN enabled. 2019-09-04 14:56:43 +03:00
Teemu Ollakka
395f716014 NBO applying
- High priority interface method to apply NBO begin, separate from
  apply_toi() in order to avoid implementation to force interpreting
  ws_meta flags.
- Method to put client_state into NBO mode when applying NBO begin.
  The client_state will process in m_local mode.
- Unit tests for applying NBO
2019-09-04 14:56:43 +03:00
Teemu Ollakka
3879d6962f Fix 2019-09-04 14:56:43 +03:00
Teemu Ollakka
ef448e2f63 save 2019-09-04 14:56:43 +03:00
Teemu Ollakka
946eb4121d Implementation of client_state NBO operations.
- Implemented calls to enter and leave NBO phase one and two
- Extended client_state mode checking to include m_nbo
- Changed client_state state and mode change sanity checks to
  print a warning and assert() instead of throwing exceptions
  to be more graceful in release builds.
2019-09-04 14:56:43 +03:00
Teemu Ollakka
53d71b29ea Save 2019-09-04 14:56:43 +03:00
Teemu Ollakka
795469401c Added unit test for TOI operations 2019-09-04 14:56:43 +03:00
Teemu Ollakka
58aa3e821f Updated travis definitions
- Xenial is now default build environment
- Use Trusty for older compilers
2019-08-29 15:58:38 +03:00
Teemu Ollakka
20128556d6 Restore original thread local storage after releasing streaming applier.
In convert_streaming_client_to_applier() the new streaming applier
is created and deleted if the server has been disconnected. However,
releasing streaming applier may modify thread local storage. Call
store_globals() to restore thread local storage before returning.
2019-08-29 14:56:21 +03:00
Leandro Pacheco
55427188c1 avoid holding server_state lock when creating streaming applier
This fix avoids creating a lock cycle in MariaDB, between
LOCK_global_system_variables, LOCK_wsrep_cluster_config and
LOCK_wsrep_server_state.
2019-08-07 16:39:03 -03:00
Teemu Ollakka
0c54cbd3f8 codership/wsrep-lib#106 Relaxed assumptions about threading model
Sanity checks to detect concurrency bugs were assuming a threading
model where each client state would always be processed within
single thread of execution. This however may be too strong assumption
if the application uses some kind of thread pooling.

This patch relaxes those assumptions by removing current_thread_id_
from client_state and relaxing assertions against owning_thread_id_.

This patch also adds a new method
wait_rollback_complete_and_acquire_ownership() into
client_state. This method is idempotent and can be used to gain
control to client_state before before_command() is called.
The method will wait until possible background rollback process is
over and marks the state to s_exec to protect the state against
new background rollbacks.

Other fixes/improvements:
- High priority globals state is restored after discarding streaming.
- Allowed server_state transition donor -> synced.
- Client state method store_globals() was renamed to acquire_ownership()
  to better describe the intent. Method store_globals() was left for
  backwards compatibility and marked deprecated.
2019-08-05 15:12:44 +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
Teemu Ollakka
fd66bdef0b codership/wsrep-lib#107 Replace exceptions with assertions
Replaced exceptions thrown on debug level sanity checks with
assertions to be more graceful with release builds.
2019-07-12 16:15:13 +03:00
Teemu Ollakka
eba8a8f35d Added version header, handle version in top level CMakeLists.txt
Added version header which contains definitions for major, minor
and patch version numbers, as well as for lowest and highest supported
wsrep-API versions. The library versioning follows Semantic Versioning.

Handle CMake policy CMP0048 in top level CMakeLists.txt.
2019-06-10 12:27:09 +03:00
Teemu Ollakka
503d4e7ab4 GCC 4.4 build for Travis 2019-06-07 14:16:40 +03:00
Teemu Ollakka
edcfcaf8a2 Write wsrep-lib log from unit tests into file
Write wsrep-lib logging facility output from unit tests into file.
The argument --wsrep-log-file can be controlled where the
log from wsrep-lib is written during unit tests. The default is
'wsrep-lib_test.log' in the working directory. In order to
get the log written into stdout, use empty value,
i.e. --wsrep-log-file=''.

Made travis test run a bit more verbose.
2019-06-06 18:38:10 +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
Teemu Ollakka
e9dafb7373 Provided methods to clone subset of transaction state for replay. 2019-04-03 18:51:27 +03:00
Leandro Pacheco
ae746fb289 fixing reviewer comments
- style fixes
- small improvement to avoid unnecessary search on close_orphaned_sr
2019-03-05 10:53:21 +01:00
Leandro Pacheco
5ef5becea6 removing previous_primary_view from public iface and style fixes 2019-03-05 10:34:30 +01:00
Leandro Pacheco
71f3fb2d01 close SR transacions on equal consecutive views
Fixes a bug where the fact that an SR master leaves the primary view
gets missed. When two consecutive primary views have the same
membership we now assume that every SR needs to be rolled back, as the
system may have been through a state of only non-primary components.
2019-03-05 09:41:48 +01:00