From 2e226600fa486a8be9dab0847524a522d6d3f1ae Mon Sep 17 00:00:00 2001 From: Pekka Lampio Date: Fri, 22 Oct 2021 15:08:19 +0300 Subject: [PATCH] Removed debug code (Code behind #ifdef DEBUG_SR_SPEEDUP). --- src/server_state.cpp | 33 ----------- src/transaction.cpp | 138 ------------------------------------------- 2 files changed, 171 deletions(-) diff --git a/src/server_state.cpp b/src/server_state.cpp index 7f4421c..5e29c42 100644 --- a/src/server_state.cpp +++ b/src/server_state.cpp @@ -96,20 +96,10 @@ static int apply_fragment(wsrep::server_state& server_state, int sr_store = streaming_applier->transaction().streaming_context(). get_sr_store(); #endif /* WITH_WSREP_SR_SPEEDUP */ -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "server_state: apply_fragment, line = " << line; -#endif /* DEBUG_SR_SPEEDUP */ { wsrep::high_priority_switch sw(high_priority_service, *streaming_applier); apply_err = streaming_applier->apply_write_set(ws_meta, data, err); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "server_state: apply_fragment, line = " - << __LINE__ << ", apply_err = " << apply_err - << ", sr_store = " - << streaming_applier->transaction( - ).streaming_context().get_sr_store(); -#endif /* DEBUG_SR_SPEEDUP */ if (!apply_err) { assert(err.size() == 0); @@ -138,10 +128,6 @@ static int apply_fragment(wsrep::server_state& server_state, } } } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "server_state: apply_fragment, line = " - << __LINE__ << ", ret = " << ret; -#endif /* DEBUG_SR_SPEEDUP */ if (!ret) { if (!apply_err) @@ -685,9 +671,6 @@ int wsrep::server_state::start_sst(const std::string& sst_request, state(lock, s_donor); int ret(0); lock.unlock(); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << "(" << __LINE__ << ")"; -#endif /* DEBUG_SR_SPEEDUP */ if (server_service_.start_sst(sst_request, gtid, bypass)) { lock.lock(); @@ -1169,10 +1152,6 @@ void wsrep::server_state::start_streaming_client( WSREP_LOG_DEBUG(wsrep::log::debug_log_level(), wsrep::log::debug_level_server_state, "Start streaming client: " << client_state->id()); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "server_state: start_streaming_client"; -#endif /* DEBUG_SR_SPEEDUP */ - if (streaming_clients_.insert( std::make_pair(client_state->id(), client_state)).second == false) { @@ -1274,10 +1253,6 @@ void wsrep::server_state::start_streaming_applier( wsrep::high_priority_service* sa) { wsrep::unique_lock lock(mutex_); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "start_streaming_applier: wsrep_trx_id = " - << transaction_id; -#endif /* DEBUG_SR_SPEEDUP */ if (streaming_appliers_.insert( std::make_pair(std::make_pair(server_id, transaction_id), sa)).second == false) @@ -1591,9 +1566,6 @@ void wsrep::server_state::close_orphaned_sr_transactions( void wsrep::server_state::close_transactions_at_disconnect( wsrep::high_priority_service& high_priority_service) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << "(" << __LINE__ << ")"; -#endif /* DEBUG_SR_SPEEDUP */ // Close streaming applier without removing fragments // from fragment storage. When the server is started again, // it must be able to recover ongoing streaming transactions. @@ -1604,11 +1576,6 @@ void wsrep::server_state::close_transactions_at_disconnect( { wsrep::high_priority_switch sw(high_priority_service, *streaming_applier); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << "(" << __LINE__ - << ") skipped rollback for wsrep::trx = " - << streaming_applier->transaction().id(); -#endif /* DEBUG_SR_SPEEDUP */ #ifdef WITH_WSREP_SR_SPEEDUP streaming_applier->rollback( wsrep::ws_handle(), wsrep::ws_meta(), true); diff --git a/src/transaction.cpp b/src/transaction.cpp index 0622622..2434ee1 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -138,11 +138,6 @@ int wsrep::transaction::start_transaction( state_hist_.clear(); ws_handle_ = wsrep::ws_handle(id); flags(wsrep::provider::flag::start_transaction); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "wsrep::transaction::" << __FUNCTION__ - << ": id = " << id.get() - << ", opaque = " << (void *)ws_handle_.opaque(); -#endif /* DEBUG_SR_SPEEDUP */ switch (client_state_.mode()) { case wsrep::client_state::m_high_priority: @@ -189,11 +184,6 @@ int wsrep::transaction::start_transaction( certified_ = true; } debug_log_state("start_transaction leave"); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "wsrep::transaction::" << __FUNCTION__ - << ": id = " << id().get() - << ", opaque = " << (void *)ws_handle_.opaque(); -#endif /* DEBUG_SR_SPEEDUP */ return 0; } @@ -221,12 +211,6 @@ void wsrep::transaction::fragment_applied(wsrep::seqno seqno) { assert(active()); streaming_context_.applied(seqno); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "wsrep::transaction::fragment_applied: " - << "SR context = " << (void *)&streaming_context_ - << ", size = " << streaming_context_.fragments_stored() - << ", seqno = " << seqno.get(); -#endif /* DEBUG_SR_SPEEDUP */ } int wsrep::transaction::prepare_for_ordering( @@ -275,10 +259,6 @@ int wsrep::transaction::append_key(const wsrep::key& key) int wsrep::transaction::append_data(const wsrep::const_buffer& data) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << ": size = " << data.size(); -#endif /* DEBUG_SR_SPEEDUP */ - return provider().append_data(ws_handle_, data); } @@ -290,9 +270,6 @@ int wsrep::transaction::after_row() if (streaming_context_.fragment_size() && streaming_context_.fragment_unit() != streaming_context::statement) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__; -#endif /* DEBUG_SR_SPEEDUP */ ret = streaming_step(lock); } debug_log_state("after_row_leave"); @@ -335,10 +312,6 @@ int wsrep::transaction::before_prepare( // Note: we can't remove fragments here for XA, // the transaction has already issued XA END and // is in IDLE state, no more changes allowed! -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "before remove_fragments, line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ ret = client_service_.remove_fragments(); if (ret) { @@ -364,9 +337,6 @@ int wsrep::transaction::before_prepare( flags(flags() | wsrep::provider::flag::pa_unsafe); append_sr_keys_for_commit(); const bool force_streaming_step = true; -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << ", line = " << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ ret = streaming_step(lock, force_streaming_step); if (ret == 0) { @@ -377,10 +347,6 @@ int wsrep::transaction::before_prepare( else { ret = certify_commit(lock); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "after certify_commit(): line = " - << __LINE__ << ", ret = " << ret; -#endif /* DEBUG_SR_SPEEDUP */ } assert((ret == 0 && state() == s_preparing) || @@ -480,11 +446,6 @@ int wsrep::transaction::before_commit() { int ret(1); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << "(" << __LINE__ - << "): trx_id = " << ws_handle_.transaction_id().get() - << ", opaque = " << ws_handle_.opaque(); -#endif /* DEBUG_SR_SPEEDUP */ wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("before_commit_enter"); assert(client_state_.mode() != wsrep::client_state::m_toi); @@ -532,10 +493,6 @@ int wsrep::transaction::before_commit() if (ret == 0 && state() == s_prepared) { ret = certify_commit(lock); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "after certify_commit(): line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ assert((ret == 0 && state() == s_committing) || (state() == s_must_abort || state() == s_must_replay || @@ -640,10 +597,6 @@ int wsrep::transaction::ordered_commit() { state(lock, s_ordered_commit); } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "wsrep::transaction::" << __FUNCTION__ - << ": id = " << id().get() << ", --> " << ret; -#endif /* DEBUG_SR_SPEEDUP */ debug_log_state("ordered_commit_leave"); return ret; } @@ -674,10 +627,6 @@ int wsrep::transaction::after_commit() wsrep::storage_service& storage_service( sr_scope.storage_service()); storage_service.adopt_transaction(*this); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "before remove_fragments, line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ storage_service.remove_fragments(); storage_service.commit(wsrep::ws_handle(), wsrep::ws_meta()); lock.lock(); @@ -713,10 +662,6 @@ int wsrep::transaction::after_commit() int wsrep::transaction::before_rollback() { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "BEGIN: wsrep::transaction::before_rollback: id = " - << id().get(); -#endif /* DEBUG_SR_SPEEDUP */ wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("before_rollback_enter"); assert(state() == s_executing || @@ -799,18 +744,11 @@ int wsrep::transaction::before_rollback() } debug_log_state("before_rollback_leave"); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END: wsrep::transaction::before_rollback"; -#endif /* DEBUG_SR_SPEEDUP */ return 0; } int wsrep::transaction::after_rollback() { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "BEGIN: wsrep::transaction::after_rollback: id = " - << id().get(); -#endif /* DEBUG_SR_SPEEDUP */ wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("after_rollback_enter"); assert(state() == s_aborting || @@ -829,10 +767,6 @@ int wsrep::transaction::after_rollback() wsrep::storage_service& storage_service( sr_scope.storage_service()); storage_service.adopt_transaction(*this); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "before remove_fragments, line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ storage_service.remove_fragments(); storage_service.commit(wsrep::ws_handle(), wsrep::ws_meta()); } @@ -857,9 +791,6 @@ int wsrep::transaction::after_rollback() // releasing the commit ordering critical section should be // also postponed until all resources have been released. debug_log_state("after_rollback_leave"); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END: wsrep::transaction::after_rollback"; -#endif /* DEBUG_SR_SPEEDUP */ return 0; } @@ -896,9 +827,6 @@ int wsrep::transaction::after_statement() streaming_context_.fragment_size() && streaming_context_.fragment_unit() == streaming_context::statement) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << ", line = " << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ ret = streaming_step(lock); } @@ -1453,14 +1381,6 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock& lock, assert(lock.owns_lock()); assert(streaming_context_.fragment_size() || is_xa()); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ - << ": bytes_generated = " - << client_service_.bytes_generated() - << ", log_position = " - << streaming_context_.log_position(); - -#endif /* DEBUG_SR_SPEEDUP */ if (client_service_.bytes_generated() < streaming_context_.log_position()) { @@ -1504,10 +1424,6 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock& lock, if (streaming_context_.fragment_size_exceeded() || force) { streaming_context_.reset_unit_counter(); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << __FUNCTION__ << ": bytes_to_replicate = " - << bytes_to_replicate; -#endif /* DEBUG_SR_SPEEDUP */ ret = certify_fragment(lock); } @@ -1517,9 +1433,6 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock& lock, int wsrep::transaction::certify_fragment( wsrep::unique_lock& lock) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "BEGIN certify_fragment"; -#endif /* DEBUG_SR_SPEEDUP */ assert(lock.owns_lock()); assert(client_state_.mode() == wsrep::client_state::m_local); @@ -1547,15 +1460,6 @@ int wsrep::transaction::certify_fragment( } streaming_context_.set_log_position(log_position); -#ifdef WITH_WSREP_SR_SPEEDUP -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "certify_fragment, line = " << __LINE__ - << ", log_position = " << log_position - << ", data size = " << data.size() - << ", wsrep_get_current_thd() = " - << wsrep_get_current_thd(); -#endif /* DEBUG_SR_SPEEDUP */ -#endif /* WITH_WSREP_SR_SPEEDUP */ if (data.size() == 0) { wsrep::log_warning() << "Attempt to replicate empty data buffer"; @@ -1564,9 +1468,6 @@ int wsrep::transaction::certify_fragment( return 0; } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "certify_fragment, line = " << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ if (provider().append_data(ws_handle_, wsrep::const_buffer(data.data(), data.size()))) { @@ -1575,10 +1476,6 @@ int wsrep::transaction::certify_fragment( client_state_.override_error(wsrep::e_error_during_commit); return 1; } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "certify_fragment, line = " << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ - if (is_xa()) { // One more check to see if the transaction @@ -1639,9 +1536,6 @@ int wsrep::transaction::certify_fragment( ret = 1; error = wsrep::e_append_fragment_error; } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "certify_fragment, line = " << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ if (ret == 0) { client_service_.debug_crash( @@ -1766,12 +1660,6 @@ int wsrep::transaction::certify_fragment( state(lock, s_executing); flags(flags() & ~wsrep::provider::flag::start_transaction); } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END certify_fragment: " - << "wsrep_get_current_thd() = " - << wsrep_get_current_thd() - << ", sr_state = " << (int)sr_state(); -#endif /* DEBUG_SR_SPEEDUP */ #ifdef WITH_WSREP_SR_SPEEDUP require_sr_xid(); #endif /* WITH_WSREP_SR_SPEEDUP */ @@ -1785,9 +1673,6 @@ int wsrep::transaction::certify_commit( assert(active()); client_service_.wait_for_replayers(lock); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "BEGIN certify_commit"; -#endif /* DEBUG_SR_SPEEDUP */ assert(lock.owns_lock()); if (abort_or_interrupt(lock)) @@ -1963,11 +1848,6 @@ int wsrep::transaction::certify_commit( break; } -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END certify_commit: trx_id = " - << id().get() - << ", cert_ret = " << cert_ret; -#endif /* DEBUG_SR_SPEEDUP */ return ret; } @@ -1994,9 +1874,6 @@ int wsrep::transaction::append_sr_keys_for_commit() void wsrep::transaction::streaming_rollback(wsrep::unique_lock& lock) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "BEGIN: wsrep::transaction::streaming_rollback"; -#endif /* DEBUG_SR_SPEEDUP */ debug_log_state("streaming_rollback enter"); assert(state_ != s_must_replay); assert(is_streaming()); @@ -2040,9 +1917,6 @@ void wsrep::transaction::streaming_rollback(wsrep::unique_lock& lo } } debug_log_state("streaming_rollback leave"); -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END: wsrep::transaction::streaming_rollback"; -#endif /* DEBUG_SR_SPEEDUP */ } int wsrep::transaction::replay(wsrep::unique_lock& lock) @@ -2073,10 +1947,6 @@ int wsrep::transaction::replay(wsrep::unique_lock& lock) } if (is_streaming()) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "before clear_fragments, line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ clear_fragments(); } provider().release(ws_handle_); @@ -2086,10 +1956,6 @@ int wsrep::transaction::replay(wsrep::unique_lock& lock) wsrep::e_deadlock_error); if (is_streaming()) { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "before remove_fragments, line = " - << __LINE__; -#endif /* DEBUG_SR_SPEEDUP */ client_service_.remove_fragments(); clear_fragments(); } @@ -2109,10 +1975,6 @@ int wsrep::transaction::replay(wsrep::unique_lock& lock) void wsrep::transaction::clear_fragments() { -#ifdef DEBUG_SR_SPEEDUP - wsrep::log_info() << "END: wsrep::transaction::clear_fragments: id = " - << id_ << ", server = |" << server_id_ << "|"; -#endif /* DEBUG_SR_SPEEDUP */ streaming_context_.cleanup(); #ifdef WITH_WSREP_SR_SPEEDUP fragment_cache_remove_transaction(server_id_, id_);