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

Squashed memory leaks to get clean test run with ASAN enabled.

This commit is contained in:
Teemu Ollakka
2019-06-25 16:35:21 +03:00
parent 85a03394cc
commit 6291f1bf16
4 changed files with 38 additions and 0 deletions

View File

@ -43,3 +43,28 @@ void wsrep_test::bf_abort_provider(wsrep::mock_server_state& sc,
sc.provider().bf_abort(bf_seqno, tc.id(), victim_seqno);
(void)victim_seqno;
}
void wsrep_test::terminate_streaming_applier(
wsrep::mock_server_state& sc,
const wsrep::id& server_id,
wsrep::transaction_id transaction_id)
{
// Note that all other arguments than server_id and
// transaction_id are chosen arbitrarily and it is hoped
// that the mock implementation does not freak out about it.
wsrep::mock_client mc(sc, wsrep::client_id(10),
wsrep::client_state::m_high_priority);
mc.open(wsrep::client_id(10));
mc.before_command();
wsrep::mock_high_priority_service hps(sc, &mc, false);
wsrep::ws_handle ws_handle(transaction_id, (void*)(1));
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"),
wsrep::seqno(100)),
wsrep::stid(server_id,
transaction_id,
wsrep::client_id(1)),
wsrep::seqno(0),
wsrep::provider::flag::rollback);
wsrep::const_buffer data(0, 0);
sc.on_apply(hps, ws_handle, ws_meta, data);
}

View File

@ -43,4 +43,10 @@ namespace wsrep_test
void bf_abort_provider(wsrep::mock_server_state& sc,
const wsrep::transaction& tc,
wsrep::seqno bf_seqno);
// Terminate streaming applier by applying rollback fragment.
void terminate_streaming_applier(
wsrep::mock_server_state& sc,
const wsrep::id& server_id,
wsrep::transaction_id transaction_id);
}

View File

@ -1112,6 +1112,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_1pc_bf_abort_during_fragment_remov
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
BOOST_REQUIRE(cc.after_statement());
BOOST_REQUIRE(tc.active() == false);
wsrep_test::terminate_streaming_applier(sc, sc.id(),
wsrep::transaction_id(1));
}
//
@ -1154,6 +1156,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_executing,
BOOST_REQUIRE(cc.before_rollback() == 0);
BOOST_REQUIRE(cc.after_rollback() == 0);
BOOST_REQUIRE(cc.after_statement());
wsrep_test::terminate_streaming_applier(sc, sc.id(),
wsrep::transaction_id(1));
}
//
// Test streaming certification failure during fragment replication

View File

@ -258,6 +258,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_bf_abort_during_fragment_remov
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
BOOST_REQUIRE(cc.after_statement());
BOOST_REQUIRE(tc.active() == false);
wsrep_test::terminate_streaming_applier(sc, sc.id(),
wsrep::transaction_id(1));
}
///////////////////////////////////////////////////////////////////////////////