MXS-2609: Store history size in Backend
When a connection is created, the size of the history that is about to be replayed is known. Storing this and decrementing it each time a session command is completed tells us when the Backend has finished replaying the session command history. This can then be used to distinguish whether a session command executed on a master should be retried or whether to simply discard the connection.
This commit is contained in:
@ -303,6 +303,16 @@ public:
|
||||
return m_state & FATAL_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the backend replaying session command history
|
||||
*
|
||||
* @return If a list of session commands was provided at connect time, the function returns true as long
|
||||
* as the backend has not completed those session commands.
|
||||
*/
|
||||
inline bool is_replaying_history() const
|
||||
{
|
||||
return m_history_size > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the object name of this server
|
||||
@ -389,7 +399,8 @@ private:
|
||||
|
||||
maxbase::StopWatch m_session_timer;
|
||||
maxbase::IntervalTimer m_select_timer;
|
||||
int64_t m_num_selects = 0;
|
||||
int64_t m_num_selects {0};
|
||||
int64_t m_history_size {0};
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Backend> SBackend;
|
||||
|
||||
Reference in New Issue
Block a user