1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-31 18:24:25 +03:00

Added open(), close(), cleanup() methods to client_state.

Depending on the DBMS client session allocation strategy the
client id may or may not be available when the client_session
is constructed, therefore there should be a method to assign
an id after construction. Close/cleanup methods were added to
clean up open transactions appropriately.
This commit is contained in:
Teemu Ollakka
2018-06-20 10:07:55 +03:00
parent 779f84e5df
commit bf7dad6815
9 changed files with 120 additions and 21 deletions

View File

@ -21,6 +21,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state
@ -40,6 +41,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state
@ -59,6 +61,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
cc.do_2pc_ = true;
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
@ -79,6 +82,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
cc.is_autocommit_ = true;
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
@ -101,6 +105,7 @@ namespace
wsrep::client_state::m_high_priority)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
wsrep::ws_handle ws_handle(1, (void*)1);
@ -129,6 +134,7 @@ namespace
wsrep::client_state::m_high_priority)
, tc(cc.transaction())
{
cc.open(cc.id());
cc.do_2pc_ = true;
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
@ -157,6 +163,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state
@ -178,6 +185,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state
@ -199,6 +207,7 @@ namespace
wsrep::client_state::m_replicating)
, tc(cc.transaction())
{
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state