mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-06-10 05:41:42 +03:00
Rollback and release streaming appliers in unit tests
Unit tests which cause streaming rollback leaked memory because the streaming applier handle which was created for rollback fragment handling was not released. Roll back a streaming transaction and release applier handle appropriately in corresponding tests.
This commit is contained in:
@ -203,6 +203,7 @@ namespace
|
|||||||
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
|
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
|
||||||
cc.enable_streaming(wsrep::streaming_context::row, 1);
|
cc.enable_streaming(wsrep::streaming_context::row, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wsrep::mock_server_service server_service;
|
wsrep::mock_server_service server_service;
|
||||||
wsrep::mock_server_state sc;
|
wsrep::mock_server_state sc;
|
||||||
wsrep::mock_client cc;
|
wsrep::mock_client cc;
|
||||||
|
@ -115,8 +115,9 @@ namespace wsrep
|
|||||||
WSREP_OVERRIDE
|
WSREP_OVERRIDE
|
||||||
{
|
{
|
||||||
mock_high_priority_service* mhps(
|
mock_high_priority_service* mhps(
|
||||||
reinterpret_cast<mock_high_priority_service*>(high_priority_service));
|
static_cast<mock_high_priority_service*>(high_priority_service));
|
||||||
wsrep::client_state* cs(mhps->client_state());
|
wsrep::mock_client* cs(static_cast<wsrep::mock_client*>(
|
||||||
|
mhps->client_state()));
|
||||||
cs->after_command_before_result();
|
cs->after_command_before_result();
|
||||||
cs->after_command_after_result();
|
cs->after_command_after_result();
|
||||||
cs->close();
|
cs->close();
|
||||||
|
@ -1067,6 +1067,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_rollback,
|
|||||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||||
|
|
||||||
|
wsrep::high_priority_service* hps(
|
||||||
|
sc.find_streaming_applier(
|
||||||
|
sc.id(), wsrep::transaction_id(1)));
|
||||||
|
BOOST_REQUIRE(hps);
|
||||||
|
hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
|
||||||
|
hps->after_apply();
|
||||||
|
sc.stop_streaming_applier(sc.id(), wsrep::transaction_id(1));
|
||||||
|
server_service.release_high_priority_service(hps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1087,6 +1096,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_non_commit,
|
|||||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||||
|
|
||||||
|
wsrep::high_priority_service* hps(
|
||||||
|
sc.find_streaming_applier(
|
||||||
|
sc.id(), wsrep::transaction_id(1)));
|
||||||
|
BOOST_REQUIRE(hps);
|
||||||
|
hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
|
||||||
|
hps->after_apply();
|
||||||
|
sc.stop_streaming_applier(sc.id(), wsrep::transaction_id(1));
|
||||||
|
server_service.release_high_priority_service(hps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1109,6 +1127,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit,
|
|||||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||||
|
|
||||||
|
wsrep::high_priority_service* hps(
|
||||||
|
sc.find_streaming_applier(
|
||||||
|
sc.id(), wsrep::transaction_id(1)));
|
||||||
|
BOOST_REQUIRE(hps);
|
||||||
|
hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
|
||||||
|
hps->after_apply();
|
||||||
|
sc.stop_streaming_applier(sc.id(), wsrep::transaction_id(1));
|
||||||
|
server_service.release_high_priority_service(hps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1243,6 +1270,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
|
|||||||
BOOST_REQUIRE(sc.provider().fragments() == 1);
|
BOOST_REQUIRE(sc.provider().fragments() == 1);
|
||||||
BOOST_REQUIRE(sc.provider().start_fragments() == 0);
|
BOOST_REQUIRE(sc.provider().start_fragments() == 0);
|
||||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||||
|
|
||||||
|
wsrep::high_priority_service* hps(
|
||||||
|
sc.find_streaming_applier(
|
||||||
|
sc.id(), wsrep::transaction_id(1)));
|
||||||
|
BOOST_REQUIRE(hps);
|
||||||
|
hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
|
||||||
|
hps->after_apply();
|
||||||
|
sc.stop_streaming_applier(sc.id(), wsrep::transaction_id(1));
|
||||||
|
server_service.release_high_priority_service(hps);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user