1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-13 04:01:32 +03:00

Return error codes instead of throwing exception

Changed server_state public methods sst_received() and wait_until_state()
to report errors as return value instead of throwing exceptions.
This was done to gradually get rid of public methods which report
errors via exceptions.

This change was part of MDEV-30419.
This commit is contained in:
Teemu Ollakka
2023-01-16 17:34:47 +02:00
parent de3d7b63ea
commit 275a0af8c5
4 changed files with 60 additions and 23 deletions

View File

@ -369,12 +369,11 @@ namespace wsrep
/**
* Wait until server reaches given state.
*
* @return Zero in case of success, non-zero if the
* wait was interrupted.
*/
void wait_until_state(enum state state) const
{
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
wait_until_state(lock, state);
}
int wait_until_state(enum state state) const;
/**
* Return GTID at the position when server connected to
@ -509,8 +508,10 @@ namespace wsrep
*
* @param client_service
* @param error code of the SST operation
*
* @return Zero in case of success, non-zero on error.
*/
void sst_received(wsrep::client_service& cs, int error);
int sst_received(wsrep::client_service& cs, int error);
/**
* This method must be called after the server initialization
@ -644,7 +645,8 @@ namespace wsrep
int desync(wsrep::unique_lock<wsrep::mutex>&);
void resync(wsrep::unique_lock<wsrep::mutex>&);
void state(wsrep::unique_lock<wsrep::mutex>&, enum state);
void wait_until_state(wsrep::unique_lock<wsrep::mutex>&, enum state) const;
void wait_until_state(wsrep::unique_lock<wsrep::mutex>&,
enum state) const;
// Interrupt all threads which are waiting for state
void interrupt_state_waiters(wsrep::unique_lock<wsrep::mutex>&);