1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-21 12:22:06 +03:00
Commit Graph

399 Commits

Author SHA1 Message Date
e0f9550967 handle certification error explicitly when entering TOI 2019-12-08 12:52:36 +02:00
922ce579c7 Clear NBO meta on failure, reset current error status after command. 2019-12-08 12:52:36 +02:00
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
750052b640 Fixed timeout condition in poll_enter_toi() 2019-12-08 12:52:36 +02:00
3a1b194741 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-12-08 12:52:36 +02:00
58cea10577 Release TOI critical section in poll_enter_toi() in case of error. 2019-12-08 12:52:36 +02:00
4ff55088b1 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-12-08 12:52:36 +02:00
e700ce8c79 Added short sleep between calls to enter_toi(). 2019-12-08 12:52:36 +02:00
aaa92e130b Made gcc 4.4 work. 2019-12-08 12:52:36 +02:00
b05abb005f Chrono definitions to work around g++ 4.4 C++11 incompatibilities. 2019-12-08 12:52:36 +02:00
55fdbb7a05 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-12-08 12:52:36 +02:00
b46f89f4ce Fixed unused variable warning. 2019-12-08 12:52:36 +02:00
0683654e53 Include <chrono> to check if it compiles with all required compilers. 2019-12-08 12:52:36 +02:00
594e34052d handle nbo apply eror
also, remove outdated comment
2019-12-08 12:52:36 +02:00
5298d2340e 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-12-08 12:52:36 +02:00
0b12869715 NBO begin error handling, unit test 2019-12-08 12:52:36 +02:00
e9bd950ee6 Fixed nbo_meta handling, release commit order for NBO begin. 2019-12-08 12:52:36 +02:00
c7a25b15db Ingnore NBO end event in applier, it will be handled via local TOI 2019-12-08 12:52:36 +02:00
24ad144db3 - Remove unneeded keys from nbo phase two begin.
- Save nbo meta for phase two
- Assign trx_meta in mutable_ws_meta
2019-12-08 12:52:36 +02:00
6291f1bf16 Squashed memory leaks to get clean test run with ASAN enabled. 2019-12-08 12:52:36 +02:00
85a03394cc 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-12-08 12:52:36 +02:00
1267e29b8f 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-12-08 12:52:36 +02:00
45c64735d6 Added unit test for TOI operations 2019-12-08 12:52:36 +02:00
9b25cebdf1 codership/wsrep-lib#117 Fixed empty vector access.
Access to empty vector by using operator[] may cause stdlib++
assertions to fail. Replaced the vector data access to use data()
method which is valid operation even if the vector is empty.

Added unit test to reproduce assertion with empty mutable_buffer access.

Added -D_GLIBCXX_ASSERTIONS preprocessor option to debug builds
to catch standard library misuse.

Added gcc 8 and gcc9 into travis build matrix.
2019-12-05 14:27:35 +02:00
c9513bd2e4 Fixed compilation errors with GCC 4.7
- Do not use [[noreturn]] with GCC older than 4.8.
- Use if/else instead of ternary operator in transaction
  commit_or_rollback_by_xid() to avoid debug build failure with
  GCC 4.7.
2019-10-28 17:22:09 +02:00
5ca8e4780e Added GCC 4.7 to travis build matrix. 2019-10-28 17:22:00 +02:00
66ee7bed1b Add type wsrep::xid
Create type `wsrep::xid`, and change all signatures that take
`std::string xid` to take `wsrep::xid xid`.
2019-10-18 09:36:18 +02:00
682d1b2034 Split commit_or_rollback_by_xid() in two methods
Split `client_state::commit_or_rollback_by_xid()` into
`client_state::commit_by_xid()` and `client_state::rollback_by_xid()`.
2019-10-16 11:42:44 +02:00
725f148ddb Remove query() method from wsrep::client_service interface 2019-10-16 10:16:39 +02:00
5d18ce3e75 Minimize client_service interface for XA
Remove methods `is_xa()`, `is_xa_prepare()`, and `xid()` from
client_service interface. Instead, transactions are explicitly
assigned their xid, through at start of XA.
2019-10-16 10:16:39 +02:00
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
98af85498b removing bytes_certified 2019-10-16 10:16:39 +02:00
d9ada0226f use log_position when calculating bytes_to_replicate
`bytes_certified` includes XA events which are not written to the
binlog. Thus, we need to use `log_position` instead.
2019-10-16 10:16:39 +02:00
a9987aa970 s_prepared state for XA transactions
After the XA PREPARE, the XA transactions stay s_prepared until
commit/rollback
2019-10-16 10:15:55 +02:00
b73df49cff basic XA unit tests 2019-10-16 10:15:55 +02:00
e02f617d5f Document log_position param in client_service::prepare_data_for_replication() 2019-10-16 10:15:55 +02:00
68adbe35f6 Fixup unused parameter position in prepare_fragment_for_replication() 2019-10-16 10:15:55 +02:00
b614822f08 Fixup to previous commit
Fix client_service in test mock and dbsim to update signature of
method prepare_fragment_for_replication().
2019-10-16 10:15:55 +02:00
f80f97db2f Record database log_postion for streaming
Class streaming_context can now keep track of database specific log
position for streaming. Previously, it  was assumed that the log
position was based of off the buffer size which was filled in
client_service::prepare_fragment_for_replication(). However, for XA
the buffer may contain data that is not in the log. Therefore,
subsequent calls to prepare_fragment_for_replication() could not find
the appropriate log_position based on the certified_bytes(), which
would returns the total number of bytes return in the buffers that
were certified.
2019-10-16 10:15:55 +02:00
24cd49b23f Improved logging output of ws_meta 2019-10-16 10:15:55 +02:00
e0118c1378 removing assertion about current thread in next_fragment
next_fragment is called outside the scope of a high_priority_switch,
and we may be in a different thread context then the streaming applier
was created in
2019-10-16 10:15:55 +02:00
3389074e24 comments and style fixes 2019-10-16 10:15:55 +02:00
36346beab4 Fixes for XA transactions with streaming enabled
Changes mostly related to handling of XA PREPARE fragments
2019-10-16 10:15:55 +02:00
54b0eeee45 Add is_query() and is_xa() to dbsim/test client service implementations 2019-10-16 10:15:55 +02:00
9c9323e2a5 Initial support for XA
Force fragment replication when XA transaction is prepared, with
prepare fragment. Commit fragment happens in before_commit().
Adjusted fragment removal, which cannot happen in atomically with the
executing transaction.
2019-10-16 10:15:55 +02:00
5c27d6dafa Removed unneeded provider version probe. 2019-10-15 11:47:35 +03:00
54ad9d94f5 Use v26 provider implementation by default if dummy provider is
loaded.
2019-10-14 15:52:24 +03:00
613b55a007 Fixes to make code backwards compatible. 2019-10-14 09:58:20 +03:00
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
477a71dd46 Updated wsrep-API, added -Wconversion to compiler flags, fixed errors. 2019-10-11 09:56:07 +03:00