mirror of
				https://github.com/codership/wsrep-lib.git
				synced 2025-11-03 05:33:11 +03:00 
			
		
		
		
	Squashed commit of the following:
commit3b419aa6e2Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun Feb 19 10:29:34 2023 +0200 Skip fetching config options if provider not loaded via wsrep-API commit044220cc06Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed Jul 13 10:31:03 2022 +0300 Operation context pointer for client state commiteeb05a9238Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Mon Jul 4 09:03:23 2022 +0300 Add unit test log in gitignore commit92a04070fcAuthor: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun May 8 12:45:36 2022 +0300 Added convenience method prev() to seqno commitf83ca1917eAuthor: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sun May 1 16:37:24 2022 +0300 Pass victim context for provider on BF abort This change is needed for custom provider implementations to have a way to access the victim in the application context. Helper interface operation_context to pass caller context for service/provider callbacks in more type safe way. commit244eabe8cfAuthor: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed May 25 07:39:43 2022 +0300 Handle disconnecting state in on_sync() When disconnecting from the group, the sync event from the provider must not change the state back to synced. commitba8e23df0dAuthor: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Tue Mar 22 17:43:52 2022 +0200 Add provider position field to ws_meta and view Provider position is needed in coordinated recovery between application and provider. Pass the position info from provider to application to allow making it durable. commit53e60f64c9Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Sat Mar 19 14:45:57 2022 +0200 Reset TOI meta after releasing total order in provider This is to keep the TOI meta available in case the provider implementation needs it. commitbccb9997f2Author: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Mon Jan 3 11:19:58 2022 +0200 Fixed id ostream operator to print human readable ids commit6d0b37daafAuthor: Teemu Ollakka <teemu.ollakka@galeracluster.com> Date: Wed Dec 15 16:37:45 2021 +0200 Silence unused variable warning commit4b8616f3d1Author: Denis Protivensky <denis.protivensky@galeracluster.com> Date: Wed Dec 15 16:43:31 2021 +0300 Fix provider loading in test for release builds commit6df17812d9Author: Denis Protivensky <denis.protivensky@galeracluster.com> Date: Tue Dec 14 20:28:56 2021 +0300 Introduce set_provider_factory() method for server_state This allows injecting an application allocated provider into server_state. After this virtual provider getter is unnecessary. Made the getter normal method and fixed unit tests accordingly.
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -13,3 +13,6 @@ wsrep-API/libwsrep_api_v26.a
 | 
			
		||||
 | 
			
		||||
# Gcov generated files
 | 
			
		||||
*.dgcov
 | 
			
		||||
 | 
			
		||||
# Test logs
 | 
			
		||||
wsrep-lib_test.log
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,8 @@ wsrep::view db::server_service::get_view(wsrep::client_service&,
 | 
			
		||||
        stored_view.capabilities(),
 | 
			
		||||
        my_idx,
 | 
			
		||||
        stored_view.protocol_version(),
 | 
			
		||||
        stored_view.members()
 | 
			
		||||
        stored_view.members(),
 | 
			
		||||
        0
 | 
			
		||||
    );
 | 
			
		||||
    return my_view;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@
 | 
			
		||||
#include "thread.hpp"
 | 
			
		||||
#include "xid.hpp"
 | 
			
		||||
#include "chrono.hpp"
 | 
			
		||||
#include "operation_context.hpp"
 | 
			
		||||
 | 
			
		||||
namespace wsrep
 | 
			
		||||
{
 | 
			
		||||
@@ -544,7 +545,9 @@ namespace wsrep
 | 
			
		||||
         * @param lock Lock to protect client state.
 | 
			
		||||
         * @param bf_seqno Seqno of the BF aborter.
 | 
			
		||||
         */
 | 
			
		||||
        int bf_abort(wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno);
 | 
			
		||||
        int bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
                     wsrep::seqno bf_seqno,
 | 
			
		||||
                     wsrep::operation_context& victim_ctx);
 | 
			
		||||
        /**
 | 
			
		||||
         * Wrapper to bf_abort() call, grabs lock internally.
 | 
			
		||||
         */
 | 
			
		||||
@@ -555,7 +558,9 @@ namespace wsrep
 | 
			
		||||
         * should be called by the TOI operation which needs to
 | 
			
		||||
         * BF abort a transaction.
 | 
			
		||||
         */
 | 
			
		||||
        int total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno);
 | 
			
		||||
        int total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
                                 wsrep::seqno bf_seqno,
 | 
			
		||||
                                 wsrep::operation_context& victim_ctx);
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Wrapper to total_order_bf_abort(), grabs lock internally.
 | 
			
		||||
@@ -911,6 +916,9 @@ namespace wsrep
 | 
			
		||||
        {
 | 
			
		||||
            return rollbacker_active_;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void set_operation_context(wsrep::operation_context* context);
 | 
			
		||||
        wsrep::operation_context* operation_context();
 | 
			
		||||
    protected:
 | 
			
		||||
        /**
 | 
			
		||||
         * Client context constuctor. This is protected so that it
 | 
			
		||||
@@ -923,6 +931,7 @@ namespace wsrep
 | 
			
		||||
                     const client_id& id,
 | 
			
		||||
                     enum mode mode)
 | 
			
		||||
            : owning_thread_id_(wsrep::this_thread::get_id())
 | 
			
		||||
            , current_context_()
 | 
			
		||||
            , rollbacker_active_(false)
 | 
			
		||||
            , mutex_(mutex)
 | 
			
		||||
            , cond_(cond)
 | 
			
		||||
@@ -986,6 +995,7 @@ namespace wsrep
 | 
			
		||||
        void leave_toi_common();
 | 
			
		||||
 | 
			
		||||
        wsrep::thread::id owning_thread_id_;
 | 
			
		||||
        wsrep::operation_context* current_context_;
 | 
			
		||||
        bool rollbacker_active_;
 | 
			
		||||
        wsrep::mutex& mutex_;
 | 
			
		||||
        wsrep::condition_variable& cond_;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								include/wsrep/operation_context.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								include/wsrep/operation_context.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 Codership Oy <info@codership.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of wsrep-lib.
 | 
			
		||||
 *
 | 
			
		||||
 * Wsrep-lib is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * Wsrep-lib is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with wsrep-lib.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** @file operation_context.hpp
 | 
			
		||||
 *
 | 
			
		||||
 * A slightly more type safe way compared to void pointers to
 | 
			
		||||
 * pass operation contexts through wsrep-lib to callbacks.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef WSREP_OPERATION_CONTEXT_HPP
 | 
			
		||||
#define WSREP_OPERATION_CONTEXT_HPP
 | 
			
		||||
 | 
			
		||||
namespace wsrep
 | 
			
		||||
{
 | 
			
		||||
    struct operation_context
 | 
			
		||||
    {
 | 
			
		||||
        virtual ~operation_context() = default;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct null_operation_context : operation_context
 | 
			
		||||
    {
 | 
			
		||||
    };
 | 
			
		||||
} // namespace wsrep
 | 
			
		||||
 | 
			
		||||
#endif /* WSREP_OPERATION_CONTEXT_HPP */
 | 
			
		||||
@@ -26,9 +26,11 @@
 | 
			
		||||
#include "client_id.hpp"
 | 
			
		||||
#include "transaction_id.hpp"
 | 
			
		||||
#include "compiler.hpp"
 | 
			
		||||
#include "operation_context.hpp"
 | 
			
		||||
 | 
			
		||||
#include <cstring>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <ostream>
 | 
			
		||||
@@ -123,21 +125,25 @@ namespace wsrep
 | 
			
		||||
            , stid_()
 | 
			
		||||
            , depends_on_()
 | 
			
		||||
            , flags_()
 | 
			
		||||
            , provider_position_()
 | 
			
		||||
        { }
 | 
			
		||||
        ws_meta(const wsrep::gtid& gtid,
 | 
			
		||||
                const wsrep::stid& stid,
 | 
			
		||||
                wsrep::seqno depends_on,
 | 
			
		||||
                int flags)
 | 
			
		||||
                int flags,
 | 
			
		||||
                int64_t provider_position)
 | 
			
		||||
            : gtid_(gtid)
 | 
			
		||||
            , stid_(stid)
 | 
			
		||||
            , depends_on_(depends_on)
 | 
			
		||||
            , flags_(flags)
 | 
			
		||||
            , provider_position_(provider_position)
 | 
			
		||||
        { }
 | 
			
		||||
        ws_meta(const wsrep::stid& stid)
 | 
			
		||||
            : gtid_()
 | 
			
		||||
            , stid_(stid)
 | 
			
		||||
            , depends_on_()
 | 
			
		||||
            , flags_()
 | 
			
		||||
            , provider_position_()
 | 
			
		||||
        { }
 | 
			
		||||
        const wsrep::gtid& gtid() const { return gtid_; }
 | 
			
		||||
        const wsrep::id& group_id() const
 | 
			
		||||
@@ -169,6 +175,8 @@ namespace wsrep
 | 
			
		||||
 | 
			
		||||
        wsrep::seqno depends_on() const { return depends_on_; }
 | 
			
		||||
 | 
			
		||||
        int64_t provider_position() const { return provider_position_; }
 | 
			
		||||
 | 
			
		||||
        int flags() const { return flags_; }
 | 
			
		||||
 | 
			
		||||
        bool operator==(const ws_meta& other) const
 | 
			
		||||
@@ -185,6 +193,8 @@ namespace wsrep
 | 
			
		||||
        wsrep::stid stid_;
 | 
			
		||||
        wsrep::seqno depends_on_;
 | 
			
		||||
        int flags_;
 | 
			
		||||
        /** Field reserved for provider to report its internal position. */
 | 
			
		||||
        int64_t provider_position_;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    std::string flags_to_string(int flags);
 | 
			
		||||
@@ -333,6 +343,7 @@ namespace wsrep
 | 
			
		||||
         */
 | 
			
		||||
        virtual enum status bf_abort(wsrep::seqno bf_seqno,
 | 
			
		||||
                                     wsrep::transaction_id victim_trx,
 | 
			
		||||
                                     wsrep::operation_context& victim_ctx,
 | 
			
		||||
                                     wsrep::seqno& victim_seqno) = 0;
 | 
			
		||||
        virtual enum status rollback(wsrep::transaction_id) = 0;
 | 
			
		||||
        virtual enum status commit_order_enter(const wsrep::ws_handle&,
 | 
			
		||||
@@ -365,6 +376,7 @@ namespace wsrep
 | 
			
		||||
         * Leave total order isolation critical section
 | 
			
		||||
         */
 | 
			
		||||
        virtual enum status leave_toi(wsrep::client_id,
 | 
			
		||||
                                      const wsrep::ws_meta& ws_meta,
 | 
			
		||||
                                      const wsrep::mutable_buffer& err) = 0;
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
@@ -457,7 +469,8 @@ namespace wsrep
 | 
			
		||||
         * @param provider_options Initial options to provider
 | 
			
		||||
         * @param thread_service Optional thread service implementation.
 | 
			
		||||
         */
 | 
			
		||||
        static provider* make_provider(wsrep::server_state&,
 | 
			
		||||
        static std::unique_ptr<provider> make_provider(
 | 
			
		||||
            wsrep::server_state&,
 | 
			
		||||
            const std::string& provider_spec,
 | 
			
		||||
            const std::string& provider_options,
 | 
			
		||||
            const wsrep::provider::services& services
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,11 @@ namespace wsrep
 | 
			
		||||
            return (seqno_ == -1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        wsrep::seqno prev() const
 | 
			
		||||
        {
 | 
			
		||||
            return seqno{seqno_ - 1};
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        bool operator<(seqno other) const
 | 
			
		||||
        {
 | 
			
		||||
            return (seqno_ < other.seqno_);
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,9 @@
 | 
			
		||||
#include "compiler.hpp"
 | 
			
		||||
#include "xid.hpp"
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <deque>
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <map>
 | 
			
		||||
@@ -188,8 +190,6 @@ namespace wsrep
 | 
			
		||||
            rm_sync
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        virtual ~server_state();
 | 
			
		||||
 | 
			
		||||
        wsrep::encryption_service* encryption_service()
 | 
			
		||||
        { return encryption_service_; }
 | 
			
		||||
 | 
			
		||||
@@ -299,6 +299,17 @@ namespace wsrep
 | 
			
		||||
                          const wsrep::provider::services& services
 | 
			
		||||
                          = wsrep::provider::services());
 | 
			
		||||
 | 
			
		||||
        using provider_factory_func =
 | 
			
		||||
            std::function<decltype(wsrep::provider::make_provider)>;
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Set provider factory method.
 | 
			
		||||
         *
 | 
			
		||||
         * @param Factory method to create a provider.
 | 
			
		||||
         */
 | 
			
		||||
        void set_provider_factory(const provider_factory_func&);
 | 
			
		||||
 | 
			
		||||
        /** Unload/unset provider. */
 | 
			
		||||
        void unload_provider();
 | 
			
		||||
 | 
			
		||||
        bool is_provider_loaded() const { return provider_ != 0; }
 | 
			
		||||
@@ -310,12 +321,8 @@ namespace wsrep
 | 
			
		||||
         *
 | 
			
		||||
         * @throw wsrep::runtime_error if provider has not been loaded
 | 
			
		||||
         *
 | 
			
		||||
         * @todo This should not be virtual. However, currently there
 | 
			
		||||
         *       is no mechanism for tests and integrations to provide
 | 
			
		||||
         *       their own provider implementations, so this is kept virtual
 | 
			
		||||
         *       for time being.
 | 
			
		||||
         */
 | 
			
		||||
        virtual wsrep::provider& provider() const
 | 
			
		||||
        wsrep::provider& provider() const
 | 
			
		||||
        {
 | 
			
		||||
            if (provider_ == 0)
 | 
			
		||||
            {
 | 
			
		||||
@@ -618,6 +625,7 @@ namespace wsrep
 | 
			
		||||
            , streaming_appliers_()
 | 
			
		||||
            , streaming_appliers_recovered_()
 | 
			
		||||
            , provider_()
 | 
			
		||||
            , provider_factory_(wsrep::provider::make_provider)
 | 
			
		||||
            , name_(name)
 | 
			
		||||
            , id_(wsrep::id::undefined())
 | 
			
		||||
            , incoming_address_(incoming_address)
 | 
			
		||||
@@ -702,7 +710,8 @@ namespace wsrep
 | 
			
		||||
                         wsrep::high_priority_service*> streaming_appliers_map;
 | 
			
		||||
        streaming_appliers_map streaming_appliers_;
 | 
			
		||||
        bool streaming_appliers_recovered_;
 | 
			
		||||
        wsrep::provider* provider_;
 | 
			
		||||
        std::unique_ptr<wsrep::provider> provider_;
 | 
			
		||||
        provider_factory_func provider_factory_;
 | 
			
		||||
        std::string name_;
 | 
			
		||||
        wsrep::id id_;
 | 
			
		||||
        std::string incoming_address_;
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
#include "sr_key_set.hpp"
 | 
			
		||||
#include "buffer.hpp"
 | 
			
		||||
#include "xid.hpp"
 | 
			
		||||
#include "operation_context.hpp"
 | 
			
		||||
 | 
			
		||||
#include <iosfwd>
 | 
			
		||||
#include <vector>
 | 
			
		||||
@@ -199,9 +200,11 @@ namespace wsrep
 | 
			
		||||
        void after_applying();
 | 
			
		||||
 | 
			
		||||
        bool bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
                      wsrep::seqno bf_seqno);
 | 
			
		||||
                      wsrep::seqno bf_seqno,
 | 
			
		||||
                      wsrep::operation_context&);
 | 
			
		||||
        bool total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>&,
 | 
			
		||||
                                  wsrep::seqno bf_seqno);
 | 
			
		||||
                                  wsrep::seqno bf_seqno,
 | 
			
		||||
                                  wsrep::operation_context&);
 | 
			
		||||
 | 
			
		||||
        void clone_for_replay(const wsrep::transaction& other);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -70,6 +70,7 @@ namespace wsrep
 | 
			
		||||
            , capabilities_()
 | 
			
		||||
            , own_index_(-1)
 | 
			
		||||
            , protocol_version_(0)
 | 
			
		||||
            , provider_position_()
 | 
			
		||||
            , members_()
 | 
			
		||||
        { }
 | 
			
		||||
        view(const wsrep::gtid& state_id,
 | 
			
		||||
@@ -78,13 +79,15 @@ namespace wsrep
 | 
			
		||||
             int capabilities,
 | 
			
		||||
             ssize_t own_index,
 | 
			
		||||
             int protocol_version,
 | 
			
		||||
             const std::vector<wsrep::view::member>& members)
 | 
			
		||||
             const std::vector<wsrep::view::member>& members,
 | 
			
		||||
             int64_t provider_position)
 | 
			
		||||
            : state_id_(state_id)
 | 
			
		||||
            , view_seqno_(view_seqno)
 | 
			
		||||
            , status_(status)
 | 
			
		||||
            , capabilities_(capabilities)
 | 
			
		||||
            , own_index_(own_index)
 | 
			
		||||
            , protocol_version_(protocol_version)
 | 
			
		||||
            , provider_position_(provider_position)
 | 
			
		||||
            , members_(members)
 | 
			
		||||
        { }
 | 
			
		||||
 | 
			
		||||
@@ -111,6 +114,9 @@ namespace wsrep
 | 
			
		||||
        int protocol_version() const
 | 
			
		||||
        { return protocol_version_; }
 | 
			
		||||
 | 
			
		||||
        int64_t provider_position() const
 | 
			
		||||
        { return provider_position_; }
 | 
			
		||||
 | 
			
		||||
        const std::vector<member>& members() const
 | 
			
		||||
        { return members_; }
 | 
			
		||||
 | 
			
		||||
@@ -147,6 +153,8 @@ namespace wsrep
 | 
			
		||||
        int capabilities_;
 | 
			
		||||
        ssize_t own_index_;
 | 
			
		||||
        int protocol_version_;
 | 
			
		||||
        /** Field reserved for provider to report its internal position. */
 | 
			
		||||
        int64_t provider_position_;
 | 
			
		||||
        std::vector<wsrep::view::member> members_;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -507,11 +507,12 @@ void wsrep::client_state::xa_replay()
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
int wsrep::client_state::bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
                                  wsrep::seqno bf_seqno)
 | 
			
		||||
                                  wsrep::seqno bf_seqno,
 | 
			
		||||
                                  wsrep::operation_context& victim_ctx)
 | 
			
		||||
{
 | 
			
		||||
    assert(lock.owns_lock());
 | 
			
		||||
    assert(mode_ == m_local || transaction_.is_streaming());
 | 
			
		||||
    auto ret = transaction_.bf_abort(lock, bf_seqno);
 | 
			
		||||
    auto ret = transaction_.bf_abort(lock, bf_seqno, victim_ctx);
 | 
			
		||||
    assert(lock.owns_lock());
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
@@ -519,11 +520,13 @@ int wsrep::client_state::bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
int wsrep::client_state::bf_abort(wsrep::seqno bf_seqno)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex> lock(mutex_);
 | 
			
		||||
    return bf_abort(lock, bf_seqno);
 | 
			
		||||
    wsrep::null_operation_context victim_ctx;
 | 
			
		||||
    return bf_abort(lock, bf_seqno, victim_ctx);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int wsrep::client_state::total_order_bf_abort(
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno)
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno,
 | 
			
		||||
    wsrep::operation_context& victim_ctx)
 | 
			
		||||
{
 | 
			
		||||
    assert(lock.owns_lock());
 | 
			
		||||
    assert(mode_ == m_local || transaction_.is_streaming());
 | 
			
		||||
@@ -535,7 +538,8 @@ int wsrep::client_state::total_order_bf_abort(
 | 
			
		||||
int wsrep::client_state::total_order_bf_abort(wsrep::seqno bf_seqno)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex> lock(mutex_);
 | 
			
		||||
    return total_order_bf_abort(lock, bf_seqno);
 | 
			
		||||
    wsrep::null_operation_context victim_ctx;
 | 
			
		||||
    return total_order_bf_abort(lock, bf_seqno, victim_ctx);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wsrep::client_state::adopt_transaction(
 | 
			
		||||
@@ -585,7 +589,7 @@ wsrep::client_state::poll_enter_toi(
 | 
			
		||||
            // Successfully entered TOI, but the provider reported failure.
 | 
			
		||||
            // This may happen for example if certification fails.
 | 
			
		||||
            // Leave TOI before proceeding.
 | 
			
		||||
            if (provider().leave_toi(id_, wsrep::mutable_buffer()))
 | 
			
		||||
            if (provider().leave_toi(id_, poll_meta, wsrep::mutable_buffer()))
 | 
			
		||||
            {
 | 
			
		||||
                wsrep::log_warning()
 | 
			
		||||
                    << "Failed to leave TOI after failure in "
 | 
			
		||||
@@ -689,10 +693,12 @@ int wsrep::client_state::leave_toi_local(const wsrep::mutable_buffer& err)
 | 
			
		||||
{
 | 
			
		||||
    debug_log_state("leave_toi_local: enter");
 | 
			
		||||
    assert(toi_mode_ == m_local);
 | 
			
		||||
    leave_toi_common();
 | 
			
		||||
 | 
			
		||||
    auto ret = (provider().leave_toi(id_, toi_meta_, err) == provider::success ? 0 : 1);
 | 
			
		||||
    leave_toi_common();
 | 
			
		||||
    debug_log_state("leave_toi_local: leave");
 | 
			
		||||
    return (provider().leave_toi(id_, err) == provider::success ? 0 : 1);
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wsrep::client_state::leave_toi_mode()
 | 
			
		||||
@@ -809,7 +815,7 @@ int wsrep::client_state::end_nbo_phase_one(const wsrep::mutable_buffer& err)
 | 
			
		||||
    assert(mode_ == m_nbo);
 | 
			
		||||
    assert(in_toi());
 | 
			
		||||
 | 
			
		||||
    enum wsrep::provider::status status(provider().leave_toi(id_, err));
 | 
			
		||||
    enum wsrep::provider::status status(provider().leave_toi(id_, toi_meta_, err));
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex> lock(mutex_);
 | 
			
		||||
    int ret;
 | 
			
		||||
    switch (status)
 | 
			
		||||
@@ -910,7 +916,7 @@ int wsrep::client_state::end_nbo_phase_two(const wsrep::mutable_buffer& err)
 | 
			
		||||
    assert(toi_mode_ == m_local);
 | 
			
		||||
    assert(in_toi());
 | 
			
		||||
    enum wsrep::provider::status status(
 | 
			
		||||
        provider().leave_toi(id_, err));
 | 
			
		||||
        provider().leave_toi(id_, toi_meta_, err));
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex> lock(mutex_);
 | 
			
		||||
    int ret;
 | 
			
		||||
    switch (status)
 | 
			
		||||
@@ -955,6 +961,17 @@ int wsrep::client_state::sync_wait(int timeout)
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wsrep::client_state::set_operation_context(
 | 
			
		||||
    wsrep::operation_context* context)
 | 
			
		||||
{
 | 
			
		||||
    current_context_ = context;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
wsrep::operation_context* wsrep::client_state::operation_context()
 | 
			
		||||
{
 | 
			
		||||
    return current_context_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//                               Private                                     //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -151,6 +151,11 @@ int wsrep::config_service_v1_fetch(wsrep::provider& provider,
 | 
			
		||||
                                   wsrep::provider_options* options)
 | 
			
		||||
{
 | 
			
		||||
    struct wsrep_st* wsrep = (struct wsrep_st*)provider.native();
 | 
			
		||||
    if (wsrep == nullptr)
 | 
			
		||||
    {
 | 
			
		||||
        // Not a provider which was loaded via wsrep-API
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (config_service_v1_probe(wsrep->dlh))
 | 
			
		||||
    {
 | 
			
		||||
        wsrep::log_warning() << "Provider does not support config service v1";
 | 
			
		||||
 
 | 
			
		||||
@@ -54,9 +54,12 @@ std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::id& id)
 | 
			
		||||
{
 | 
			
		||||
    const char* ptr(static_cast<const char*>(id.data()));
 | 
			
		||||
    size_t size(id.size());
 | 
			
		||||
    if (static_cast<size_t>(std::count_if(ptr, ptr + size, ::isalnum)) == size)
 | 
			
		||||
    if (static_cast<size_t>(
 | 
			
		||||
            std::count_if(ptr, ptr + size,
 | 
			
		||||
                          [](char c) { return (::isalnum(c) || c == '\0'); }))
 | 
			
		||||
        == size)
 | 
			
		||||
    {
 | 
			
		||||
        return (os << std::string(ptr, size));
 | 
			
		||||
        return (os << std::string(ptr, ::strnlen(ptr, size)));
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
#include <cassert>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
wsrep::provider* wsrep::provider::make_provider(
 | 
			
		||||
std::unique_ptr<wsrep::provider> wsrep::provider::make_provider(
 | 
			
		||||
    wsrep::server_state& server_state,
 | 
			
		||||
    const std::string& provider_spec,
 | 
			
		||||
    const std::string& provider_options,
 | 
			
		||||
@@ -34,8 +34,8 @@ wsrep::provider* wsrep::provider::make_provider(
 | 
			
		||||
{
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        return new wsrep::wsrep_provider_v26(
 | 
			
		||||
            server_state, provider_options, provider_spec, services);
 | 
			
		||||
        return std::unique_ptr<wsrep::provider>(new wsrep::wsrep_provider_v26(
 | 
			
		||||
            server_state, provider_options, provider_spec, services));
 | 
			
		||||
    }
 | 
			
		||||
    catch (const wsrep::runtime_error& e)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -502,17 +502,23 @@ int wsrep::server_state::load_provider(
 | 
			
		||||
    wsrep::log_info() << "Loading provider " << provider_spec
 | 
			
		||||
                      << " initial position: " << initial_position_;
 | 
			
		||||
 | 
			
		||||
    provider_ = wsrep::provider::make_provider(*this,
 | 
			
		||||
    provider_ = provider_factory_(*this,
 | 
			
		||||
                                  provider_spec,
 | 
			
		||||
                                  provider_options,
 | 
			
		||||
                                  services);
 | 
			
		||||
    return (provider_ ? 0 : 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wsrep::server_state::set_provider_factory(
 | 
			
		||||
    const provider_factory_func& provider_factory)
 | 
			
		||||
{
 | 
			
		||||
    assert(provider_factory);
 | 
			
		||||
    provider_factory_ = provider_factory;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wsrep::server_state::unload_provider()
 | 
			
		||||
{
 | 
			
		||||
    delete provider_;
 | 
			
		||||
    provider_ = 0;
 | 
			
		||||
    provider_.reset();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int wsrep::server_state::connect(const std::string& cluster_name,
 | 
			
		||||
@@ -545,11 +551,6 @@ int wsrep::server_state::disconnect()
 | 
			
		||||
    return provider().disconnect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
wsrep::server_state::~server_state()
 | 
			
		||||
{
 | 
			
		||||
    delete provider_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<wsrep::provider::status_variable>
 | 
			
		||||
wsrep::server_state::status() const
 | 
			
		||||
{
 | 
			
		||||
@@ -1064,6 +1065,8 @@ void wsrep::server_state::on_sync()
 | 
			
		||||
    {
 | 
			
		||||
        switch (state_)
 | 
			
		||||
        {
 | 
			
		||||
        case s_disconnecting:
 | 
			
		||||
            break;
 | 
			
		||||
        case s_synced:
 | 
			
		||||
            break;
 | 
			
		||||
        case s_connected:                 // Seed node path: provider becomes
 | 
			
		||||
@@ -1090,7 +1093,7 @@ void wsrep::server_state::on_sync()
 | 
			
		||||
        // Calls to on_sync() in synced state are possible if
 | 
			
		||||
        // server desyncs itself from the group. Provider does not
 | 
			
		||||
        // inform about this through callbacks.
 | 
			
		||||
        if (state_ != s_synced)
 | 
			
		||||
        if (state_ != s_synced && state_ != s_disconnecting)
 | 
			
		||||
        {
 | 
			
		||||
            state(lock, s_synced);
 | 
			
		||||
        }
 | 
			
		||||
@@ -1551,7 +1554,7 @@ void wsrep::server_state::close_orphaned_sr_transactions(
 | 
			
		||||
            wsrep::ws_meta ws_meta(
 | 
			
		||||
                wsrep::gtid(),
 | 
			
		||||
                wsrep::stid(server_id, transaction_id, wsrep::client_id()),
 | 
			
		||||
                wsrep::seqno::undefined(), 0);
 | 
			
		||||
                wsrep::seqno::undefined(), 0, 0);
 | 
			
		||||
            lock.unlock();
 | 
			
		||||
            if (adopt_error == 0)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -984,7 +984,8 @@ void wsrep::transaction::after_applying()
 | 
			
		||||
 | 
			
		||||
bool wsrep::transaction::bf_abort(
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex>& lock,
 | 
			
		||||
    wsrep::seqno bf_seqno)
 | 
			
		||||
    wsrep::seqno bf_seqno,
 | 
			
		||||
    wsrep::operation_context& victim_ctx)
 | 
			
		||||
{
 | 
			
		||||
    bool ret(false);
 | 
			
		||||
    const enum wsrep::transaction::state state_at_enter(state());
 | 
			
		||||
@@ -1015,7 +1016,7 @@ bool wsrep::transaction::bf_abort(
 | 
			
		||||
            wsrep::seqno victim_seqno;
 | 
			
		||||
            enum wsrep::provider::status
 | 
			
		||||
                status(client_state_.provider().bf_abort(
 | 
			
		||||
                           bf_seqno, id_, victim_seqno));
 | 
			
		||||
                           bf_seqno, id_, victim_ctx, victim_seqno));
 | 
			
		||||
            switch (status)
 | 
			
		||||
            {
 | 
			
		||||
            case wsrep::provider::success:
 | 
			
		||||
@@ -1102,14 +1103,15 @@ bool wsrep::transaction::bf_abort(
 | 
			
		||||
 | 
			
		||||
bool wsrep::transaction::total_order_bf_abort(
 | 
			
		||||
    wsrep::unique_lock<wsrep::mutex>& lock WSREP_UNUSED,
 | 
			
		||||
    wsrep::seqno bf_seqno)
 | 
			
		||||
    wsrep::seqno bf_seqno,
 | 
			
		||||
    wsrep::operation_context& victim_ctx)
 | 
			
		||||
{
 | 
			
		||||
    /* We must set this flag before entering bf_abort() in order
 | 
			
		||||
     * to streaming_rollback() work correctly. The flag will be
 | 
			
		||||
     * unset if BF abort was not allowed. Note that we rely in
 | 
			
		||||
     * bf_abort() not to release lock if the BF abort is not allowed. */
 | 
			
		||||
    bf_aborted_in_total_order_ = true;
 | 
			
		||||
    bool ret(bf_abort(lock, bf_seqno));
 | 
			
		||||
    bool ret(bf_abort(lock, bf_seqno, victim_ctx));
 | 
			
		||||
    if (not ret)
 | 
			
		||||
    {
 | 
			
		||||
        bf_aborted_in_total_order_ = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -242,7 +242,7 @@ namespace
 | 
			
		||||
                                      sizeof(trx_meta_.stid.node.data)),
 | 
			
		||||
                            wsrep::transaction_id(trx_meta_.stid.trx),
 | 
			
		||||
                            wsrep::client_id(trx_meta_.stid.conn)),
 | 
			
		||||
                seqno_from_native(trx_meta_.depends_on), flags_);
 | 
			
		||||
                seqno_from_native(trx_meta_.depends_on), flags_, 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        wsrep_trx_meta* native() { return &trx_meta_; }
 | 
			
		||||
@@ -347,7 +347,7 @@ namespace
 | 
			
		||||
            map_capabilities_from_native(view_info.capabilities),
 | 
			
		||||
            own_idx,
 | 
			
		||||
            view_info.proto_ver,
 | 
			
		||||
            members);
 | 
			
		||||
            members, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -501,7 +501,7 @@ namespace
 | 
			
		||||
                        wsrep::transaction_id(meta->stid.trx),
 | 
			
		||||
                        wsrep::client_id(meta->stid.conn)),
 | 
			
		||||
            wsrep::seqno(seqno_from_native(meta->depends_on)),
 | 
			
		||||
            map_flags_from_native(flags));
 | 
			
		||||
            map_flags_from_native(flags), 0);
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            if (high_priority_service->apply(ws_handle, ws_meta, data))
 | 
			
		||||
@@ -928,6 +928,7 @@ enum wsrep::provider::status
 | 
			
		||||
wsrep::wsrep_provider_v26::bf_abort(
 | 
			
		||||
    wsrep::seqno bf_seqno,
 | 
			
		||||
    wsrep::transaction_id victim_id,
 | 
			
		||||
    wsrep::operation_context& /* Ignored here */,
 | 
			
		||||
    wsrep::seqno& victim_seqno)
 | 
			
		||||
{
 | 
			
		||||
    wsrep_seqno_t wsrep_victim_seqno;
 | 
			
		||||
@@ -1025,6 +1026,7 @@ wsrep::wsrep_provider_v26::enter_toi(
 | 
			
		||||
 | 
			
		||||
enum wsrep::provider::status
 | 
			
		||||
wsrep::wsrep_provider_v26::leave_toi(wsrep::client_id client_id,
 | 
			
		||||
                                     const wsrep::ws_meta&,
 | 
			
		||||
                                     const wsrep::mutable_buffer& err)
 | 
			
		||||
{
 | 
			
		||||
    const wsrep_buf_t err_buf = { err.data(), err.size() };
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,7 @@ namespace wsrep
 | 
			
		||||
        enum wsrep::provider::status
 | 
			
		||||
        bf_abort(wsrep::seqno,
 | 
			
		||||
                 wsrep::transaction_id,
 | 
			
		||||
                 wsrep::operation_context&,
 | 
			
		||||
                 wsrep::seqno&) WSREP_OVERRIDE;
 | 
			
		||||
        enum wsrep::provider::status
 | 
			
		||||
        rollback(const wsrep::transaction_id) WSREP_OVERRIDE;
 | 
			
		||||
@@ -83,6 +84,7 @@ namespace wsrep
 | 
			
		||||
                                               int)
 | 
			
		||||
            WSREP_OVERRIDE;
 | 
			
		||||
        enum wsrep::provider::status leave_toi(wsrep::client_id,
 | 
			
		||||
                                               const wsrep::ws_meta& ws_meta,
 | 
			
		||||
                                               const wsrep::mutable_buffer&)
 | 
			
		||||
            WSREP_OVERRIDE;
 | 
			
		||||
        std::pair<wsrep::gtid, enum wsrep::provider::status>
 | 
			
		||||
 
 | 
			
		||||
@@ -171,13 +171,13 @@ namespace
 | 
			
		||||
                               wsrep::seqno seqno)
 | 
			
		||||
        {
 | 
			
		||||
            wsrep::ws_handle ws_handle(id, (void*)1);
 | 
			
		||||
            wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), seqno),
 | 
			
		||||
                                   wsrep::stid(sc.id(),
 | 
			
		||||
                                               wsrep::transaction_id(1),
 | 
			
		||||
                                               cc.id()),
 | 
			
		||||
            wsrep::ws_meta ws_meta(
 | 
			
		||||
                wsrep::gtid(wsrep::id("1"), seqno),
 | 
			
		||||
                wsrep::stid(sc.id(), wsrep::transaction_id(1), cc.id()),
 | 
			
		||||
                wsrep::seqno(0),
 | 
			
		||||
                                   wsrep::provider::flag::start_transaction |
 | 
			
		||||
                                   wsrep::provider::flag::commit);
 | 
			
		||||
                wsrep::provider::flag::start_transaction
 | 
			
		||||
                    | wsrep::provider::flag::commit,
 | 
			
		||||
                0);
 | 
			
		||||
            BOOST_REQUIRE(cc.start_transaction(ws_handle, ws_meta) == 0);
 | 
			
		||||
            BOOST_REQUIRE(tc.active() == true);
 | 
			
		||||
            BOOST_REQUIRE(tc.certified() == true);
 | 
			
		||||
@@ -207,13 +207,13 @@ namespace
 | 
			
		||||
            BOOST_REQUIRE(cc.before_command() == 0);
 | 
			
		||||
            BOOST_REQUIRE(cc.before_statement() == 0);
 | 
			
		||||
            wsrep::ws_handle ws_handle(wsrep::transaction_id(1), (void*)1);
 | 
			
		||||
            wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
 | 
			
		||||
                                   wsrep::stid(sc.id(),
 | 
			
		||||
                                               wsrep::transaction_id(1),
 | 
			
		||||
                                               cc.id()),
 | 
			
		||||
            wsrep::ws_meta ws_meta(
 | 
			
		||||
                wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
 | 
			
		||||
                wsrep::stid(sc.id(), wsrep::transaction_id(1), cc.id()),
 | 
			
		||||
                wsrep::seqno(0),
 | 
			
		||||
                                   wsrep::provider::flag::start_transaction |
 | 
			
		||||
                                   wsrep::provider::flag::commit);
 | 
			
		||||
                wsrep::provider::flag::start_transaction
 | 
			
		||||
                    | wsrep::provider::flag::commit,
 | 
			
		||||
                0);
 | 
			
		||||
            BOOST_REQUIRE(cc.start_transaction(ws_handle, ws_meta) == 0);
 | 
			
		||||
            BOOST_REQUIRE(tc.active() == true);
 | 
			
		||||
            BOOST_REQUIRE(tc.certified() == true);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,15 @@ BOOST_AUTO_TEST_CASE(id_test_uuid)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_AUTO_TEST_CASE(id_test_string)
 | 
			
		||||
{
 | 
			
		||||
    std::string id_str("node1");
 | 
			
		||||
    wsrep::id id(id_str);
 | 
			
		||||
    std::ostringstream os;
 | 
			
		||||
    os << id;
 | 
			
		||||
    BOOST_REQUIRE(id_str == os.str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_AUTO_TEST_CASE(id_test_string_max)
 | 
			
		||||
{
 | 
			
		||||
    std::string id_str("1234567890123456");
 | 
			
		||||
    wsrep::id id(id_str);
 | 
			
		||||
 
 | 
			
		||||
@@ -116,9 +116,8 @@ namespace wsrep
 | 
			
		||||
            {
 | 
			
		||||
                ++group_seqno_;
 | 
			
		||||
                wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
 | 
			
		||||
                ws_meta = wsrep::ws_meta(gtid, stid,
 | 
			
		||||
                                         wsrep::seqno(group_seqno_ - 1),
 | 
			
		||||
                                         flags);
 | 
			
		||||
                ws_meta = wsrep::ws_meta(
 | 
			
		||||
                    gtid, stid, wsrep::seqno(group_seqno_ - 1), flags, 0);
 | 
			
		||||
                return wsrep::provider::success;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
@@ -127,16 +126,15 @@ namespace wsrep
 | 
			
		||||
                if (it->second.is_undefined())
 | 
			
		||||
                {
 | 
			
		||||
                    ws_meta = wsrep::ws_meta(wsrep::gtid(), wsrep::stid(),
 | 
			
		||||
                                             wsrep::seqno::undefined(), 0);
 | 
			
		||||
                                             wsrep::seqno::undefined(), 0, 0);
 | 
			
		||||
                    ret = wsrep::provider::error_certification_failed;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    ++group_seqno_;
 | 
			
		||||
                    wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
 | 
			
		||||
                    ws_meta = wsrep::ws_meta(gtid, stid,
 | 
			
		||||
                                             wsrep::seqno(group_seqno_ - 1),
 | 
			
		||||
                                             flags);
 | 
			
		||||
                    ws_meta = wsrep::ws_meta(
 | 
			
		||||
                        gtid, stid, wsrep::seqno(group_seqno_ - 1), flags, 0);
 | 
			
		||||
                    ret = wsrep::provider::error_bf_abort;
 | 
			
		||||
                }
 | 
			
		||||
                bf_abort_map_.erase(it);
 | 
			
		||||
@@ -214,8 +212,9 @@ namespace wsrep
 | 
			
		||||
                        wsrep::gtid(group_id_, wsrep::seqno(group_seqno_)),
 | 
			
		||||
                        wsrep::stid(server_id_, tc.id(), cc.id()),
 | 
			
		||||
                        wsrep::seqno(group_seqno_ - 1),
 | 
			
		||||
                        wsrep::provider::flag::start_transaction |
 | 
			
		||||
                        wsrep::provider::flag::commit);
 | 
			
		||||
                        wsrep::provider::flag::start_transaction
 | 
			
		||||
                            | wsrep::provider::flag::commit,
 | 
			
		||||
                        0);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
@@ -244,12 +243,10 @@ namespace wsrep
 | 
			
		||||
        {
 | 
			
		||||
            ++group_seqno_;
 | 
			
		||||
            wsrep::gtid gtid(group_id_, wsrep::seqno(group_seqno_));
 | 
			
		||||
            wsrep::stid stid(server_id_,
 | 
			
		||||
                             wsrep::transaction_id::undefined(),
 | 
			
		||||
            wsrep::stid stid(server_id_, wsrep::transaction_id::undefined(),
 | 
			
		||||
                             client_id);
 | 
			
		||||
            toi_meta = wsrep::ws_meta(gtid, stid,
 | 
			
		||||
                                      wsrep::seqno(group_seqno_ - 1),
 | 
			
		||||
                                      flags);
 | 
			
		||||
                                      wsrep::seqno(group_seqno_ - 1), flags, 0);
 | 
			
		||||
            ++toi_write_sets_;
 | 
			
		||||
            if (flags & wsrep::provider::flag::start_transaction)
 | 
			
		||||
                ++toi_start_transaction_;
 | 
			
		||||
@@ -259,6 +256,7 @@ namespace wsrep
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        enum wsrep::provider::status leave_toi(wsrep::client_id,
 | 
			
		||||
                                               const wsrep::ws_meta&,
 | 
			
		||||
                                               const wsrep::mutable_buffer&)
 | 
			
		||||
            WSREP_OVERRIDE
 | 
			
		||||
        { return wsrep::provider::success; }
 | 
			
		||||
@@ -311,6 +309,7 @@ namespace wsrep
 | 
			
		||||
        enum wsrep::provider::status
 | 
			
		||||
        bf_abort(wsrep::seqno bf_seqno,
 | 
			
		||||
                 wsrep::transaction_id trx_id,
 | 
			
		||||
                 wsrep::operation_context&,
 | 
			
		||||
                 wsrep::seqno& victim_seqno)
 | 
			
		||||
            WSREP_OVERRIDE
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -149,7 +149,8 @@ namespace wsrep
 | 
			
		||||
                logged_view_.capabilities(),
 | 
			
		||||
                my_idx,
 | 
			
		||||
                logged_view_.protocol_version(),
 | 
			
		||||
                logged_view_.members()
 | 
			
		||||
                logged_view_.members(),
 | 
			
		||||
                0
 | 
			
		||||
            );
 | 
			
		||||
            return my_view;
 | 
			
		||||
        }
 | 
			
		||||
@@ -258,12 +259,28 @@ namespace wsrep
 | 
			
		||||
                                  rollback_mode)
 | 
			
		||||
            , mutex_()
 | 
			
		||||
            , cond_()
 | 
			
		||||
            , provider_(*this)
 | 
			
		||||
        { }
 | 
			
		||||
            , provider_()
 | 
			
		||||
        {
 | 
			
		||||
            set_provider_factory([&](wsrep::server_state&,
 | 
			
		||||
                                     const std::string&,
 | 
			
		||||
                                     const std::string&,
 | 
			
		||||
                                     const wsrep::provider::services&)
 | 
			
		||||
            {
 | 
			
		||||
                // The provider object is destroyed upon server state
 | 
			
		||||
                // destruction, so using a raw pointer is safe.
 | 
			
		||||
                provider_ = new wsrep::mock_provider(*this);
 | 
			
		||||
                return std::unique_ptr<wsrep::provider>(provider_);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        wsrep::mock_provider& provider() const WSREP_OVERRIDE
 | 
			
		||||
        { return provider_; }
 | 
			
		||||
            const int ret WSREP_UNUSED = load_provider("mock", "");
 | 
			
		||||
            assert(ret == 0);
 | 
			
		||||
            assert(provider_ != nullptr);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        wsrep::mock_provider& mock_provider() const
 | 
			
		||||
        {
 | 
			
		||||
            return *provider_;
 | 
			
		||||
        }
 | 
			
		||||
        // mock connected state for tests without overriding the connect()
 | 
			
		||||
        // method.
 | 
			
		||||
        int mock_connect(const std::string& own_id,
 | 
			
		||||
@@ -289,7 +306,8 @@ namespace wsrep
 | 
			
		||||
                                           0,
 | 
			
		||||
                                           0,
 | 
			
		||||
                                           1,
 | 
			
		||||
                                           members);
 | 
			
		||||
                                           members,
 | 
			
		||||
                                           0);
 | 
			
		||||
                server_state::on_connect(bootstrap_view);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
@@ -308,7 +326,7 @@ namespace wsrep
 | 
			
		||||
    private:
 | 
			
		||||
        wsrep::default_mutex mutex_;
 | 
			
		||||
        wsrep::default_condition_variable cond_;
 | 
			
		||||
        mutable wsrep::mock_provider provider_;
 | 
			
		||||
        wsrep::mock_provider* provider_;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -63,9 +63,9 @@ BOOST_FIXTURE_TEST_CASE(test_local_nbo,
 | 
			
		||||
 | 
			
		||||
    // There must have been two toi write sets, one with
 | 
			
		||||
    // start transaction flag, another with commit flag.
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_write_sets() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_start_transaction() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_commit() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_write_sets() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_start_transaction() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_commit() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(test_local_nbo_cert_failure,
 | 
			
		||||
@@ -79,7 +79,7 @@ BOOST_FIXTURE_TEST_CASE(test_local_nbo_cert_failure,
 | 
			
		||||
    key.append_key_part("k2", 2);
 | 
			
		||||
    wsrep::key_array keys{key};
 | 
			
		||||
    std::string data("data");
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    BOOST_REQUIRE(cc.begin_nbo_phase_one(
 | 
			
		||||
                      keys,
 | 
			
		||||
                      wsrep::const_buffer(data.data(),
 | 
			
		||||
@@ -103,13 +103,11 @@ BOOST_FIXTURE_TEST_CASE(test_applying_nbo,
 | 
			
		||||
    wsrep::ws_handle ws_handle(wsrep::transaction_id::undefined(), (void*)(1));
 | 
			
		||||
    const int nbo_begin_flags(wsrep::provider::flag::start_transaction |
 | 
			
		||||
                              wsrep::provider::flag::isolation);
 | 
			
		||||
    wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"),
 | 
			
		||||
                                       wsrep::seqno(1)),
 | 
			
		||||
    wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"), wsrep::seqno(1)),
 | 
			
		||||
                           wsrep::stid(wsrep::id("s1"),
 | 
			
		||||
                                       wsrep::transaction_id::undefined(),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(0),
 | 
			
		||||
                           nbo_begin_flags);
 | 
			
		||||
                           wsrep::seqno(0), nbo_begin_flags, 0);
 | 
			
		||||
    std::string nbo_begin("nbo_begin");
 | 
			
		||||
    BOOST_REQUIRE(sc.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
                              wsrep::const_buffer(nbo_begin.data(),
 | 
			
		||||
@@ -139,9 +137,9 @@ BOOST_FIXTURE_TEST_CASE(test_applying_nbo,
 | 
			
		||||
    BOOST_REQUIRE(nbo_cs->toi_mode() == wsrep::client_state::m_undefined);
 | 
			
		||||
 | 
			
		||||
    // There must have been one toi write set with commit flag.
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_write_sets() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_start_transaction() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_commit() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_write_sets() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_start_transaction() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_commit() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This test case operates through server_state object in order to
 | 
			
		||||
@@ -156,13 +154,11 @@ BOOST_FIXTURE_TEST_CASE(test_applying_nbo_fail,
 | 
			
		||||
    wsrep::ws_handle ws_handle(wsrep::transaction_id::undefined(), (void*)(1));
 | 
			
		||||
    const int nbo_begin_flags(wsrep::provider::flag::start_transaction |
 | 
			
		||||
                              wsrep::provider::flag::isolation);
 | 
			
		||||
    wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"),
 | 
			
		||||
                                       wsrep::seqno(1)),
 | 
			
		||||
    wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"), wsrep::seqno(1)),
 | 
			
		||||
                           wsrep::stid(wsrep::id("s1"),
 | 
			
		||||
                                       wsrep::transaction_id::undefined(),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(0),
 | 
			
		||||
                           nbo_begin_flags);
 | 
			
		||||
                           wsrep::seqno(0), nbo_begin_flags, 0);
 | 
			
		||||
    std::string nbo_begin("nbo_begin");
 | 
			
		||||
    hps.fail_next_toi_ = true;
 | 
			
		||||
    BOOST_REQUIRE(sc.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,8 @@ namespace
 | 
			
		||||
                                  wsrep::client_id(1)),
 | 
			
		||||
                      wsrep::seqno(0),
 | 
			
		||||
                      wsrep::provider::flag::start_transaction |
 | 
			
		||||
                      wsrep::provider::flag::commit)
 | 
			
		||||
                      wsrep::provider::flag::commit,
 | 
			
		||||
                      0)
 | 
			
		||||
            , cluster_id("1")
 | 
			
		||||
            , bootstrap_view()
 | 
			
		||||
            , second_view()
 | 
			
		||||
@@ -55,7 +56,8 @@ namespace
 | 
			
		||||
                                         0, // capabilities
 | 
			
		||||
                                         0, // own index
 | 
			
		||||
                                         1, // protocol version
 | 
			
		||||
                                         members);
 | 
			
		||||
                                         members,
 | 
			
		||||
                                         0);
 | 
			
		||||
 | 
			
		||||
            members.push_back(wsrep::view::member(
 | 
			
		||||
                                  wsrep::id("s2"), "s2", ""));
 | 
			
		||||
@@ -65,7 +67,8 @@ namespace
 | 
			
		||||
                                      0, // capabilities
 | 
			
		||||
                                      1, // own index
 | 
			
		||||
                                      1, // protocol version
 | 
			
		||||
                                      members);
 | 
			
		||||
                                      members,
 | 
			
		||||
                                      0);
 | 
			
		||||
 | 
			
		||||
            members.push_back(wsrep::view::member(
 | 
			
		||||
                                  wsrep::id("s3"), "s3", ""));
 | 
			
		||||
@@ -76,7 +79,8 @@ namespace
 | 
			
		||||
                                     0, // capabilities
 | 
			
		||||
                                     1, // own index
 | 
			
		||||
                                     1, // protocol version
 | 
			
		||||
                                     members);
 | 
			
		||||
                                     members,
 | 
			
		||||
                                     0);
 | 
			
		||||
 | 
			
		||||
            cc.open(cc.id());
 | 
			
		||||
            BOOST_REQUIRE(cc.before_command() == 0);
 | 
			
		||||
@@ -132,7 +136,8 @@ namespace
 | 
			
		||||
                             0,                                 // capabilities
 | 
			
		||||
                             -1,                                // own_index
 | 
			
		||||
                             0,                                 // protocol ver
 | 
			
		||||
                             std::vector<wsrep::view::member>() // members
 | 
			
		||||
                             std::vector<wsrep::view::member>(),// members
 | 
			
		||||
                             0
 | 
			
		||||
                );
 | 
			
		||||
            ss.on_view(view, &hps);
 | 
			
		||||
        }
 | 
			
		||||
@@ -258,7 +263,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_1pc_rollback,
 | 
			
		||||
                        applying_server_fixture)
 | 
			
		||||
{
 | 
			
		||||
    /* make sure default success result is flipped to error_fatal */
 | 
			
		||||
    ss.provider().commit_order_leave_result_ = wsrep::provider::success;
 | 
			
		||||
    ss.mock_provider().commit_order_leave_result_ = wsrep::provider::success;
 | 
			
		||||
    hps.fail_next_applying_ = true;
 | 
			
		||||
    char buf[1] = { 1 };
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
@@ -273,7 +278,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_2pc_rollback,
 | 
			
		||||
                        applying_server_fixture)
 | 
			
		||||
{
 | 
			
		||||
    /* make sure default success result is flipped to error_fatal */
 | 
			
		||||
    ss.provider().commit_order_leave_result_ = wsrep::provider::success;
 | 
			
		||||
    ss.mock_provider().commit_order_leave_result_ = wsrep::provider::success;
 | 
			
		||||
    hps.do_2pc_ = true;
 | 
			
		||||
    hps.fail_next_applying_ = true;
 | 
			
		||||
    char buf[1] = { 1 };
 | 
			
		||||
@@ -290,7 +295,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
 | 
			
		||||
                                         wsrep::transaction_id(1),
 | 
			
		||||
                                         wsrep::client_id(1)),
 | 
			
		||||
                             wsrep::seqno(0),
 | 
			
		||||
                             wsrep::provider::flag::start_transaction);
 | 
			
		||||
                             wsrep::provider::flag::start_transaction,
 | 
			
		||||
                             0);
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -300,6 +306,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
 | 
			
		||||
                                         wsrep::transaction_id(1),
 | 
			
		||||
                                         wsrep::client_id(1)),
 | 
			
		||||
                             wsrep::seqno(1),
 | 
			
		||||
                             0,
 | 
			
		||||
                             0);
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -308,7 +315,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
 | 
			
		||||
                                         wsrep::transaction_id(1),
 | 
			
		||||
                                         wsrep::client_id(1)),
 | 
			
		||||
                             wsrep::seqno(1),
 | 
			
		||||
                             wsrep::provider::flag::commit);
 | 
			
		||||
                             wsrep::provider::flag::commit,
 | 
			
		||||
                             0);
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -413,7 +421,8 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
                     0, // capabilities
 | 
			
		||||
                     0, // own index
 | 
			
		||||
                     1, // protocol version
 | 
			
		||||
                     members);
 | 
			
		||||
                     members,
 | 
			
		||||
                     0);
 | 
			
		||||
    ss.on_connect(view);
 | 
			
		||||
    BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
 | 
			
		||||
    // As storage engines have been initialized, there should not be
 | 
			
		||||
@@ -573,7 +582,8 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
                     0, // capabilities
 | 
			
		||||
                     0, // own index
 | 
			
		||||
                     1, // protocol version
 | 
			
		||||
                     members);
 | 
			
		||||
                     members,
 | 
			
		||||
                     0);
 | 
			
		||||
    ss.on_connect(view);
 | 
			
		||||
    BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
 | 
			
		||||
    // As storage engines have been initialized, there should not be
 | 
			
		||||
@@ -734,7 +744,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                                       wsrep::transaction_id(1),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(1),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction);
 | 
			
		||||
                           wsrep::provider::flag::start_transaction,
 | 
			
		||||
                           0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s2,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -747,7 +758,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                                       wsrep::transaction_id(1),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(2),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction);
 | 
			
		||||
                           wsrep::provider::flag::start_transaction,
 | 
			
		||||
                           0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -763,7 +775,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members,
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // transaction from s2 is still present
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -781,7 +794,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members, 0), &hps);
 | 
			
		||||
 | 
			
		||||
    // no streaming appliers are closed on non-primary view,
 | 
			
		||||
    // so transaction from s2 is still present
 | 
			
		||||
@@ -796,7 +809,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members,
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // transaction s2 is still present after non-primary view
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -810,7 +824,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members,
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // finally, transaction from s2 is still present (part of primary view)
 | 
			
		||||
    // and transaction from s3 is gone
 | 
			
		||||
@@ -825,7 +840,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
 | 
			
		||||
                                              wsrep::transaction_id(1),
 | 
			
		||||
                                              wsrep::client_id(1)),
 | 
			
		||||
                                  wsrep::seqno(3),
 | 
			
		||||
                                  wsrep::provider::flag::commit);
 | 
			
		||||
                                  wsrep::provider::flag::commit,
 | 
			
		||||
                                  0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_commit_s2,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -852,7 +868,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
 | 
			
		||||
                                       wsrep::transaction_id(1),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(1),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction);
 | 
			
		||||
                           wsrep::provider::flag::start_transaction,
 | 
			
		||||
                           0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s2,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -865,7 +882,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
 | 
			
		||||
                                       wsrep::transaction_id(1),
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(2),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction);
 | 
			
		||||
                           wsrep::provider::flag::start_transaction,
 | 
			
		||||
                           0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -879,7 +897,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           ss.current_view().members()), &hps);
 | 
			
		||||
                           ss.current_view().members(),
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // transaction from s2 and s3 are gone
 | 
			
		||||
    BOOST_REQUIRE(not ss.find_streaming_applier(
 | 
			
		||||
@@ -908,7 +927,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
 | 
			
		||||
                                       wsrep::client_id(1)),
 | 
			
		||||
                           wsrep::seqno(1),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction |
 | 
			
		||||
                           wsrep::provider::flag::prepare);
 | 
			
		||||
                           wsrep::provider::flag::prepare,
 | 
			
		||||
                           0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
@@ -925,7 +945,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members,
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // transaction from s3 is still present
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -939,7 +960,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
 | 
			
		||||
                           0, // capabilities
 | 
			
		||||
                           0, // own index
 | 
			
		||||
                           1, // protocol version
 | 
			
		||||
                           members), &hps);
 | 
			
		||||
                           members,
 | 
			
		||||
                           0), &hps);
 | 
			
		||||
 | 
			
		||||
    // transaction from s3 is still present
 | 
			
		||||
    BOOST_REQUIRE(ss.find_streaming_applier(
 | 
			
		||||
@@ -951,10 +973,22 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
 | 
			
		||||
                                              wsrep::transaction_id(1),
 | 
			
		||||
                                              wsrep::client_id(1)),
 | 
			
		||||
                                  wsrep::seqno(3),
 | 
			
		||||
                                  wsrep::provider::flag::commit);
 | 
			
		||||
                                  wsrep::provider::flag::commit,
 | 
			
		||||
                                  0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_commit_s3,
 | 
			
		||||
                              wsrep::const_buffer("1", 1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(not ss.find_streaming_applier(
 | 
			
		||||
                      meta_commit_s3.server_id(), meta_commit_s3.transaction_id()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(server_state_sync_in_disconnecting,
 | 
			
		||||
                        sst_first_server_fixture)
 | 
			
		||||
{
 | 
			
		||||
    bootstrap();
 | 
			
		||||
    ss.disconnect();
 | 
			
		||||
    BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnecting);
 | 
			
		||||
    // Synced event from the provider must not change the state.
 | 
			
		||||
    ss.on_sync();
 | 
			
		||||
    BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnecting);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,8 @@ void wsrep_test::bf_abort_provider(wsrep::mock_server_state& sc,
 | 
			
		||||
                                   wsrep::seqno bf_seqno)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::seqno victim_seqno;
 | 
			
		||||
    sc.provider().bf_abort(bf_seqno, tc.id(), victim_seqno);
 | 
			
		||||
    wsrep::null_operation_context victim_ctx;
 | 
			
		||||
    sc.provider().bf_abort(bf_seqno, tc.id(), victim_ctx, victim_seqno);
 | 
			
		||||
    (void)victim_seqno;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -63,13 +64,10 @@ void wsrep_test::terminate_streaming_applier(
 | 
			
		||||
    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::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, 0);
 | 
			
		||||
    wsrep::const_buffer data(0, 0);
 | 
			
		||||
    sc.on_apply(hps, ws_handle, ws_meta, data);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -41,22 +41,22 @@ BOOST_FIXTURE_TEST_CASE(test_toi_mode,
 | 
			
		||||
    BOOST_REQUIRE(cc.leave_toi_local(err) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.mode() == wsrep::client_state::m_local);
 | 
			
		||||
    BOOST_REQUIRE(cc.toi_mode() == wsrep::client_state::m_undefined);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_write_sets() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_start_transaction() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().toi_commit() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_write_sets() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_start_transaction() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().toi_commit() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(test_toi_applying,
 | 
			
		||||
                        applying_client_fixture)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.toi_mode() == wsrep::client_state::m_undefined);
 | 
			
		||||
    wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(2)),
 | 
			
		||||
                           wsrep::stid(sc.id(),
 | 
			
		||||
                                       wsrep::transaction_id::undefined(),
 | 
			
		||||
                                       cc.id()),
 | 
			
		||||
    wsrep::ws_meta ws_meta(
 | 
			
		||||
        wsrep::gtid(wsrep::id("1"), wsrep::seqno(2)),
 | 
			
		||||
        wsrep::stid(sc.id(), wsrep::transaction_id::undefined(), cc.id()),
 | 
			
		||||
        wsrep::seqno(1),
 | 
			
		||||
                           wsrep::provider::flag::start_transaction |
 | 
			
		||||
                           wsrep::provider::flag::commit);
 | 
			
		||||
        wsrep::provider::flag::start_transaction
 | 
			
		||||
            | wsrep::provider::flag::commit,
 | 
			
		||||
        0);
 | 
			
		||||
    cc.enter_toi_mode(ws_meta);
 | 
			
		||||
    BOOST_REQUIRE(cc.in_toi());
 | 
			
		||||
    BOOST_REQUIRE(cc.toi_mode() == wsrep::client_state::m_high_priority);
 | 
			
		||||
 
 | 
			
		||||
@@ -17,18 +17,17 @@
 | 
			
		||||
 * along with wsrep-lib.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "wsrep/transaction.hpp"
 | 
			
		||||
#include "wsrep/provider.hpp"
 | 
			
		||||
#include "wsrep/transaction.hpp"
 | 
			
		||||
 | 
			
		||||
#include "test_utils.hpp"
 | 
			
		||||
#include "client_state_fixture.hpp"
 | 
			
		||||
#include "test_utils.hpp"
 | 
			
		||||
 | 
			
		||||
#include <boost/mpl/vector.hpp>
 | 
			
		||||
 | 
			
		||||
namespace
 | 
			
		||||
{
 | 
			
		||||
    typedef
 | 
			
		||||
    boost::mpl::vector<replicating_client_fixture_sync_rm,
 | 
			
		||||
    typedef boost::mpl::vector<replicating_client_fixture_sync_rm,
 | 
			
		||||
                               replicating_client_fixture_async_rm>
 | 
			
		||||
        replicating_fixtures;
 | 
			
		||||
}
 | 
			
		||||
@@ -39,7 +38,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_append_key_data,
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.active());
 | 
			
		||||
    BOOST_REQUIRE(tc.is_empty());
 | 
			
		||||
    int vals[3] = {1, 2, 3};
 | 
			
		||||
    int vals[3] = { 1, 2, 3 };
 | 
			
		||||
    wsrep::key key(wsrep::key::exclusive);
 | 
			
		||||
    for (int i(0); i < 3; ++i)
 | 
			
		||||
    {
 | 
			
		||||
@@ -57,8 +56,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_append_key_data,
 | 
			
		||||
//
 | 
			
		||||
// Test a succesful 1PC transaction lifecycle
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc, T, replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
    const wsrep::transaction& tc(T::tc);
 | 
			
		||||
@@ -98,12 +96,11 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc, T,
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test a voluntary rollback
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_rollback, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_rollback, T, replicating_fixtures,
 | 
			
		||||
                                 T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
    const wsrep::transaction& tc(T::tc);
 | 
			
		||||
@@ -133,8 +130,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_rollback, T,
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets BF aborted before before_commit
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_before_before_commit, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_bf_before_before_commit, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -168,8 +164,6 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets BF aborted during before_commit via
 | 
			
		||||
// provider before the write set was ordered and certified.
 | 
			
		||||
@@ -249,9 +243,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_during_commit_order_enter, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_bf_during_commit_order_enter,
 | 
			
		||||
                                 T, replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
    const wsrep::transaction& tc(T::tc);
 | 
			
		||||
@@ -263,7 +256,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().commit_order_enter_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.mock_provider().commit_order_enter_result_
 | 
			
		||||
        = wsrep::provider::error_bf_abort;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -272,7 +266,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == true);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == true);
 | 
			
		||||
 | 
			
		||||
    sc.provider().commit_order_enter_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().commit_order_enter_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -318,8 +312,7 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction for which prepare data fails
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_error_during_prepare_data, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_error_during_prepare_data, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -357,8 +350,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets killed by DBMS before certification
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_killed_before_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_killed_before_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -397,13 +389,12 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
// Test a transaction which gets BF aborted inside provider before
 | 
			
		||||
// certification result is known. Replaying will be successful
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_bf_before_cert_result_replay_success,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_bf_before_cert_result_replay_success,
 | 
			
		||||
                        replicating_client_fixture_sync_rm)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.provider().replay_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.mock_provider().replay_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay);
 | 
			
		||||
@@ -418,18 +409,18 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
// certification result is known. Replaying will fail because of
 | 
			
		||||
// certification failure.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_bf_before_cert_result_replay_cert_fail,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_bf_before_cert_result_replay_cert_fail,
 | 
			
		||||
                        replicating_client_fixture_sync_rm)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.provider().replay_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.mock_provider().replay_result_
 | 
			
		||||
        = wsrep::provider::error_certification_failed;
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay);
 | 
			
		||||
    BOOST_REQUIRE(cc.will_replay_called() == true);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() );
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
 | 
			
		||||
    BOOST_REQUIRE(tc.active() == false);
 | 
			
		||||
@@ -441,8 +432,8 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
// result replaying of transaction.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_during_before_commit_certified, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
    transaction_1pc_bf_during_before_commit_certified, T, replicating_fixtures,
 | 
			
		||||
    T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -485,8 +476,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
// should not generate seqno for write set meta.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_before_unordered_cert_failure, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
    transaction_1pc_bf_before_unordered_cert_failure, T, replicating_fixtures,
 | 
			
		||||
    T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -498,7 +489,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
    cc.sync_point_enabled_ = "wsrep_before_certification";
 | 
			
		||||
    cc.sync_point_action_ = wsrep::mock_client_service::spa_bf_abort_unordered;
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_certification_failed;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_cert_failed);
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
@@ -507,7 +499,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() );
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    BOOST_REQUIRE(tc.active() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
@@ -517,8 +509,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets "warning error" from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_warning_error_from_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_warning_error_from_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
@@ -531,7 +522,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_warning;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_warning;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -539,7 +530,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -559,8 +550,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
// Test a 1PC transaction which gets transaction missing from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_transaction_missing_from_certify, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
    transaction_1pc_transaction_missing_from_certify, T, replicating_fixtures,
 | 
			
		||||
    T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -572,7 +563,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_transaction_missing;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_transaction_missing;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -580,7 +572,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -599,8 +591,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets size exceeded error from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_size_exceeded_from_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_size_exceeded_from_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
@@ -613,7 +604,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_size_exceeded;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_size_exceeded;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -621,7 +612,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -640,9 +631,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets connection failed error from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_connection_failed_from_certify, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_connection_failed_from_certify,
 | 
			
		||||
                                 T, replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -654,7 +644,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_connection_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_connection_failed;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -662,7 +653,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -681,8 +672,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets not allowed error from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_no_allowed_from_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_no_allowed_from_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
@@ -695,7 +685,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_not_allowed;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_not_allowed;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -703,7 +693,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -722,8 +712,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets fatal error from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_fatal_from_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_fatal_from_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
@@ -736,7 +725,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_fatal;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_fatal;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -744,7 +733,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -764,8 +753,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 1PC transaction which gets unknown from certify call
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_unknown_from_certify, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_unknown_from_certify, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_server_state& sc(T::sc);
 | 
			
		||||
@@ -778,7 +766,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_unknown;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::error_unknown;
 | 
			
		||||
 | 
			
		||||
    // Run before commit
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
@@ -786,7 +774,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
 | 
			
		||||
    // Rollback sequence
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
@@ -846,8 +834,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a transaction which gets BF aborted before before_statement.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_before_before_statement, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_bf_before_before_statement, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::client_state& cc(T::cc);
 | 
			
		||||
@@ -878,8 +865,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
//
 | 
			
		||||
// Test a transaction which gets BF aborted before after_statement.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_before_after_statement, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_bf_before_after_statement, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::client_state& cc(T::cc);
 | 
			
		||||
@@ -900,9 +886,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_1pc_bf_abort_after_after_statement, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc_bf_abort_after_after_statement,
 | 
			
		||||
                                 T, replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::client_state& cc(T::cc);
 | 
			
		||||
    const wsrep::transaction& tc(T::tc);
 | 
			
		||||
@@ -925,8 +910,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_1pc_autocommit_retry_bf_aborted,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_1pc_autocommit_retry_bf_aborted,
 | 
			
		||||
                        replicating_client_fixture_autocommit)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@@ -1201,8 +1185,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_ownership, T,
 | 
			
		||||
// Test before_command() with keep_command_error param
 | 
			
		||||
// BF abort right after before_command()
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_before_command, T,
 | 
			
		||||
                                 replicating_fixtures, T)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_before_command,
 | 
			
		||||
                                 T, replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
    const wsrep::transaction& tc(T::tc);
 | 
			
		||||
@@ -1235,7 +1219,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_before_command,
 | 
			
		||||
// Test before_command() with keep_command_error param
 | 
			
		||||
// BF abort right after after_command_before_result()
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_after_command_before_result, T,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
 | 
			
		||||
    transaction_keep_error_bf_after_after_command_before_result, T,
 | 
			
		||||
    replicating_fixtures, T)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::mock_client& cc(T::cc);
 | 
			
		||||
@@ -1267,11 +1252,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_keep_error_bf_after_after_command_b
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_1pc_applying,
 | 
			
		||||
                        applying_client_fixture)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_1pc_applying, applying_client_fixture)
 | 
			
		||||
{
 | 
			
		||||
    start_transaction(wsrep::transaction_id(1),
 | 
			
		||||
                      wsrep::seqno(1));
 | 
			
		||||
    start_transaction(wsrep::transaction_id(1), wsrep::seqno(1));
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing);
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
@@ -1284,9 +1267,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_1pc_applying,
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_applying_rollback,
 | 
			
		||||
                        applying_client_fixture)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_applying_rollback, applying_client_fixture)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting);
 | 
			
		||||
@@ -1315,9 +1296,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
@@ -1326,8 +1307,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_1pc_commit,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_row_batch_streaming_1pc_commit,
 | 
			
		||||
                        streaming_client_fixture_row)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.enable_streaming(
 | 
			
		||||
                      wsrep::streaming_context::row, 2) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.enable_streaming(wsrep::streaming_context::row, 2) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
 | 
			
		||||
@@ -1337,16 +1317,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_batch_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test 1PC row streaming with two separate statements
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_row_streaming_1pc_commit_two_statements,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_1pc_commit_two_statements,
 | 
			
		||||
                        streaming_client_fixture_row)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
@@ -1360,9 +1339,9 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
@@ -1373,7 +1352,8 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
// internally. This will cause the transaction to leave before_prepare()
 | 
			
		||||
// in aborted state.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_streaming_1pc_bf_abort_during_fragment_removal,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_streaming_1pc_bf_abort_during_fragment_removal,
 | 
			
		||||
    streaming_client_fixture_row)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
@@ -1400,13 +1380,12 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_rollback,
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().rollback_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    wsrep::high_priority_service* hps(
 | 
			
		||||
        sc.find_streaming_applier(
 | 
			
		||||
            sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
        sc.find_streaming_applier(sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
    BOOST_REQUIRE(hps);
 | 
			
		||||
    hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
 | 
			
		||||
    hps->after_apply();
 | 
			
		||||
@@ -1430,7 +1409,6 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_executing,
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    wsrep_test::terminate_streaming_applier(sc, sc.id(),
 | 
			
		||||
                                            wsrep::transaction_id(1));
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
@@ -1463,19 +1441,19 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_non_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_certification_failed;
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 1);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().rollback_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    wsrep::high_priority_service* hps(
 | 
			
		||||
        sc.find_streaming_applier(
 | 
			
		||||
            sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
        sc.find_streaming_applier(sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
    BOOST_REQUIRE(hps);
 | 
			
		||||
    hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
 | 
			
		||||
    hps->after_apply();
 | 
			
		||||
@@ -1492,21 +1470,21 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_certification_failed;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit() == 1);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_cert_failed);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().certify_result_ = wsrep::provider::success;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() );
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().rollback_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    wsrep::high_priority_service* hps(
 | 
			
		||||
        sc.find_streaming_applier(
 | 
			
		||||
            sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
        sc.find_streaming_applier(sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
    BOOST_REQUIRE(hps);
 | 
			
		||||
    hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
 | 
			
		||||
    hps->after_apply();
 | 
			
		||||
@@ -1534,9 +1512,9 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(cc.will_replay_called() == true);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
@@ -1587,7 +1565,6 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(tc.active() == false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_byte_streaming_1pc_commit,
 | 
			
		||||
                        streaming_client_fixture_byte)
 | 
			
		||||
{
 | 
			
		||||
@@ -1599,17 +1576,15 @@ BOOST_FIXTURE_TEST_CASE(transaction_byte_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_byte_batch_streaming_1pc_commit,
 | 
			
		||||
                        streaming_client_fixture_byte)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        cc.enable_streaming(
 | 
			
		||||
            wsrep::streaming_context::bytes, 2) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.enable_streaming(wsrep::streaming_context::bytes, 2) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
 | 
			
		||||
@@ -1619,13 +1594,13 @@ BOOST_FIXTURE_TEST_CASE(transaction_byte_batch_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_statement_with_no_effect,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_statement_streaming_statement_with_no_effect,
 | 
			
		||||
    streaming_client_fixture_statement)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
@@ -1642,9 +1617,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_statement_with_no_effect
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_1pc_commit,
 | 
			
		||||
@@ -1660,17 +1635,16 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_statement_batch_streaming_1pc_commit,
 | 
			
		||||
                        streaming_client_fixture_statement)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        cc.enable_streaming(
 | 
			
		||||
            wsrep::streaming_context::statement, 2) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.enable_streaming(wsrep::streaming_context::statement, 2)
 | 
			
		||||
                  == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
 | 
			
		||||
@@ -1686,9 +1660,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_batch_streaming_1pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
 | 
			
		||||
@@ -1697,7 +1671,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
 | 
			
		||||
    sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
 | 
			
		||||
    sc.mock_provider().certify_result_
 | 
			
		||||
        = wsrep::provider::error_certification_failed;
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
 | 
			
		||||
    // Note: Due to possible limitation in wsrep-API error codes
 | 
			
		||||
@@ -1706,13 +1681,12 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
 | 
			
		||||
    // If the limitation is lifted later on or the provider is fixed,
 | 
			
		||||
    // the above check should be change for fragments == 0,
 | 
			
		||||
    // rollback_fragments == 0.
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().rollback_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    wsrep::high_priority_service* hps(
 | 
			
		||||
        sc.find_streaming_applier(
 | 
			
		||||
            sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
        sc.find_streaming_applier(sc.id(), wsrep::transaction_id(1)));
 | 
			
		||||
    BOOST_REQUIRE(hps);
 | 
			
		||||
    hps->rollback(wsrep::ws_handle(), wsrep::ws_meta());
 | 
			
		||||
    hps->after_apply();
 | 
			
		||||
@@ -1726,38 +1700,27 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
 | 
			
		||||
 | 
			
		||||
BOOST_AUTO_TEST_CASE(transaction_state_strings)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(
 | 
			
		||||
                      wsrep::transaction::s_executing) == "executing");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(
 | 
			
		||||
                      wsrep::transaction::s_preparing) == "preparing");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_certifying) == "certifying");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_committing) == "committing");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_ordered_commit) == "ordered_commit");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_committed) == "committed");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_cert_failed) == "cert_failed");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_must_abort) == "must_abort");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_aborting) == "aborting");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_aborted) == "aborted");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_must_replay) == "must_replay");
 | 
			
		||||
    BOOST_REQUIRE(
 | 
			
		||||
        wsrep::to_string(
 | 
			
		||||
            wsrep::transaction::s_replaying) == "replaying");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_executing)
 | 
			
		||||
                  == "executing");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_preparing)
 | 
			
		||||
                  == "preparing");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_certifying)
 | 
			
		||||
                  == "certifying");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_committing)
 | 
			
		||||
                  == "committing");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_ordered_commit)
 | 
			
		||||
                  == "ordered_commit");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_committed)
 | 
			
		||||
                  == "committed");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_cert_failed)
 | 
			
		||||
                  == "cert_failed");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_must_abort)
 | 
			
		||||
                  == "must_abort");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_aborting)
 | 
			
		||||
                  == "aborting");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_aborted) == "aborted");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_must_replay)
 | 
			
		||||
                  == "must_replay");
 | 
			
		||||
    BOOST_REQUIRE(wsrep::to_string(wsrep::transaction::s_replaying)
 | 
			
		||||
                  == "replaying");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2018-2019 Codership Oy <info@codership.com>
 | 
			
		||||
 * Copyright (C) 2018-2021 Codership Oy <info@codership.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of wsrep-lib.
 | 
			
		||||
 *
 | 
			
		||||
@@ -22,8 +22,7 @@
 | 
			
		||||
//
 | 
			
		||||
// Test a succesful 2PC transaction lifecycle
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc, replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
    BOOST_REQUIRE(tc.active());
 | 
			
		||||
@@ -52,8 +51,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_2pc,
 | 
			
		||||
//
 | 
			
		||||
// Test a 2PC transaction which gets BF aborted before before_prepare
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_2pc_bf_before_before_prepare,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_bf_before_before_prepare,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
@@ -69,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() );
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement());
 | 
			
		||||
    BOOST_REQUIRE(tc.active() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == false);
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
@@ -79,8 +77,7 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
//
 | 
			
		||||
// Test a 2PC transaction which gets BF aborted before before_prepare
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_2pc_bf_before_after_prepare,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_bf_before_after_prepare,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
@@ -110,8 +107,7 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
// Test a 2PC transaction which gets BF aborted after_prepare() and
 | 
			
		||||
// the rollback takes place before entering before_commit().
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_2pc_bf_after_after_prepare,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_bf_after_after_prepare,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
@@ -139,8 +135,7 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
// Test a 2PC transaction which gets BF aborted between after_prepare()
 | 
			
		||||
// and before_commit()
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_2pc_bf_before_before_commit,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_bf_before_before_commit,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
@@ -168,13 +163,11 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test a 2PC transaction which gets BF aborted when trying to grab
 | 
			
		||||
// commit order.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_2pc_bf_during_commit_order_enter,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_bf_during_commit_order_enter,
 | 
			
		||||
                        replicating_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    cc.start_transaction(wsrep::transaction_id(1));
 | 
			
		||||
@@ -183,13 +176,14 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
    BOOST_REQUIRE(cc.before_prepare() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_prepare() == 0);
 | 
			
		||||
    sc.provider().commit_order_enter_result_ = wsrep::provider::error_bf_abort;
 | 
			
		||||
    sc.mock_provider().commit_order_enter_result_
 | 
			
		||||
        = wsrep::provider::error_bf_abort;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay);
 | 
			
		||||
    BOOST_REQUIRE(cc.will_replay_called() == true);
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == true);
 | 
			
		||||
    BOOST_REQUIRE(tc.ordered() == true);
 | 
			
		||||
    sc.provider().commit_order_enter_result_ = wsrep::provider::success;
 | 
			
		||||
    sc.mock_provider().commit_order_enter_result_ = wsrep::provider::success;
 | 
			
		||||
    BOOST_REQUIRE(cc.before_rollback() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_rollback() == 0);
 | 
			
		||||
@@ -205,7 +199,6 @@ BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
//                       STREAMING REPLICATION                               //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit,
 | 
			
		||||
                        streaming_client_fixture_row)
 | 
			
		||||
{
 | 
			
		||||
@@ -218,9 +211,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit_two_statements,
 | 
			
		||||
@@ -239,9 +232,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit_two_statements,
 | 
			
		||||
    BOOST_REQUIRE(cc.ordered_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
@@ -251,7 +244,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit_two_statements,
 | 
			
		||||
// internally. This will cause the transaction to leave before_prepare()
 | 
			
		||||
// in aborted state.
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_bf_abort_during_fragment_removal,
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(
 | 
			
		||||
    transaction_streaming_2pc_bf_abort_during_fragment_removal,
 | 
			
		||||
    streaming_client_fixture_row)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
 | 
			
		||||
@@ -270,8 +264,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_bf_abort_during_fragment_remov
 | 
			
		||||
//                              APPLYING                                     //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_applying,
 | 
			
		||||
                        applying_client_fixture_2pc)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_2pc_applying, applying_client_fixture_2pc)
 | 
			
		||||
{
 | 
			
		||||
    BOOST_REQUIRE(cc.before_prepare() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_preparing);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2019-2021 Codership Oy <info@codership.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of wsrep-lib.
 | 
			
		||||
 *
 | 
			
		||||
 * Wsrep-lib is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * Wsrep-lib is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with wsrep-lib.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "client_state_fixture.hpp"
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test a successful XA transaction lifecycle
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa,
 | 
			
		||||
                        replicating_client_fixture_sync_rm)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa, replicating_client_fixture_sync_rm)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::xid xid(1, 9, 0, "test xid");
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +42,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa,
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_prepared);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
    // XA START + PREPARE fragment
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing);
 | 
			
		||||
@@ -37,8 +54,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa,
 | 
			
		||||
    BOOST_REQUIRE(cc.after_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
 | 
			
		||||
    // XA PREPARE and XA COMMIT fragments
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(cc.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.active() == false);
 | 
			
		||||
@@ -47,7 +64,6 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa,
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test detaching of XA transactions
 | 
			
		||||
//
 | 
			
		||||
@@ -60,7 +76,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_detach_commit_by_xid,
 | 
			
		||||
    cc1.assign_xid(xid);
 | 
			
		||||
    cc1.before_prepare();
 | 
			
		||||
    cc1.after_prepare();
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
 | 
			
		||||
    cc1.xa_detach();
 | 
			
		||||
@@ -72,7 +88,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_detach_commit_by_xid,
 | 
			
		||||
    cc2.assign_xid(xid);
 | 
			
		||||
    BOOST_REQUIRE(cc2.client_state::commit_by_xid(xid) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc2.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    // xa_detach() creates a streaming applier, clean it up
 | 
			
		||||
    wsrep::mock_high_priority_service* hps(
 | 
			
		||||
@@ -94,7 +110,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_detach_rollback_by_xid,
 | 
			
		||||
    cc1.assign_xid(xid);
 | 
			
		||||
    cc1.before_prepare();
 | 
			
		||||
    cc1.after_prepare();
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
 | 
			
		||||
    cc1.xa_detach();
 | 
			
		||||
@@ -106,7 +122,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_detach_rollback_by_xid,
 | 
			
		||||
    cc2.assign_xid(xid);
 | 
			
		||||
    BOOST_REQUIRE(cc2.rollback_by_xid(xid) == 0);
 | 
			
		||||
    BOOST_REQUIRE(cc2.after_statement() == 0);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().rollback_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    // xa_detach() creates a streaming applier, clean it up
 | 
			
		||||
    wsrep::mock_high_priority_service* hps(
 | 
			
		||||
@@ -119,7 +135,6 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_detach_rollback_by_xid,
 | 
			
		||||
    server_service.release_high_priority_service(hps);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Test XA replay
 | 
			
		||||
//
 | 
			
		||||
@@ -214,8 +229,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_replay_after_command_after_result,
 | 
			
		||||
//
 | 
			
		||||
// Test a successful XA transaction lifecycle (applying side)
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa_applying,
 | 
			
		||||
                        applying_client_fixture)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa_applying, applying_client_fixture)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::xid xid(1, 9, 0, "test xid");
 | 
			
		||||
 | 
			
		||||
@@ -249,8 +263,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_applying,
 | 
			
		||||
//
 | 
			
		||||
// Test a successful XA transaction lifecycle
 | 
			
		||||
//
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa_sr,
 | 
			
		||||
                        streaming_client_fixture_byte)
 | 
			
		||||
BOOST_FIXTURE_TEST_CASE(transaction_xa_sr, streaming_client_fixture_byte)
 | 
			
		||||
{
 | 
			
		||||
    wsrep::xid xid(1, 9, 0, "test xid");
 | 
			
		||||
 | 
			
		||||
@@ -261,8 +274,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_sr,
 | 
			
		||||
    BOOST_REQUIRE(cc.after_row() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
 | 
			
		||||
    // XA START fragment with data
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(tc.active());
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
 | 
			
		||||
@@ -274,7 +287,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_sr,
 | 
			
		||||
    BOOST_REQUIRE(cc.after_prepare() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_prepared);
 | 
			
		||||
    // XA PREPARE fragment
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 2);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 2);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(cc.before_commit() == 0);
 | 
			
		||||
    BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing);
 | 
			
		||||
@@ -290,7 +303,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_xa_sr,
 | 
			
		||||
    BOOST_REQUIRE(tc.certified() == false);
 | 
			
		||||
    BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
 | 
			
		||||
    // XA START fragment (with data), XA PREPARE fragment and XA COMMIT fragment
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().fragments() == 3);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().start_fragments() == 1);
 | 
			
		||||
    BOOST_REQUIRE(sc.mock_provider().commit_fragments() == 1);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,8 @@ BOOST_AUTO_TEST_CASE(view_test_member_index)
 | 
			
		||||
                     0,
 | 
			
		||||
                     1,
 | 
			
		||||
                     0,
 | 
			
		||||
                     members);
 | 
			
		||||
                     members,
 | 
			
		||||
                     0);
 | 
			
		||||
    BOOST_REQUIRE(view.member_index(wsrep::id("1")) == 0);
 | 
			
		||||
    BOOST_REQUIRE(view.member_index(wsrep::id("2")) == 1);
 | 
			
		||||
    BOOST_REQUIRE(view.member_index(wsrep::id("3")) == 2);
 | 
			
		||||
@@ -64,7 +65,8 @@ BOOST_AUTO_TEST_CASE(view_test_equal_membership)
 | 
			
		||||
                   0,
 | 
			
		||||
                   1,
 | 
			
		||||
                   0,
 | 
			
		||||
                   m1);
 | 
			
		||||
                   m1,
 | 
			
		||||
                   0);
 | 
			
		||||
 | 
			
		||||
    wsrep::view v2(wsrep::gtid(wsrep::id("cluster"), wsrep::seqno(1)),
 | 
			
		||||
                   wsrep::seqno(1),
 | 
			
		||||
@@ -72,7 +74,8 @@ BOOST_AUTO_TEST_CASE(view_test_equal_membership)
 | 
			
		||||
                   0,
 | 
			
		||||
                   1,
 | 
			
		||||
                   0,
 | 
			
		||||
                   m2);
 | 
			
		||||
                   m2,
 | 
			
		||||
                   0);
 | 
			
		||||
 | 
			
		||||
    wsrep::view v3(wsrep::gtid(wsrep::id("cluster"), wsrep::seqno(1)),
 | 
			
		||||
                   wsrep::seqno(1),
 | 
			
		||||
@@ -80,7 +83,8 @@ BOOST_AUTO_TEST_CASE(view_test_equal_membership)
 | 
			
		||||
                   0,
 | 
			
		||||
                   1,
 | 
			
		||||
                   0,
 | 
			
		||||
                   m3);
 | 
			
		||||
                   m3,
 | 
			
		||||
                   0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(v1.equal_membership(v2));
 | 
			
		||||
    BOOST_REQUIRE(v2.equal_membership(v1));
 | 
			
		||||
@@ -97,7 +101,8 @@ BOOST_AUTO_TEST_CASE(view_test_is_member)
 | 
			
		||||
                     1,
 | 
			
		||||
                     0,
 | 
			
		||||
                     { wsrep::view::member(wsrep::id("1"), "", ""),
 | 
			
		||||
                       wsrep::view::member(wsrep::id("2"), "", "") });
 | 
			
		||||
                       wsrep::view::member(wsrep::id("2"), "", "") },
 | 
			
		||||
                     0);
 | 
			
		||||
 | 
			
		||||
    BOOST_REQUIRE(view.is_member(wsrep::id("2")));
 | 
			
		||||
    BOOST_REQUIRE(view.is_member(wsrep::id("1")));
 | 
			
		||||
 
 | 
			
		||||
 Submodule wsrep-API/v26 updated: 06ce602ade...694d6ca47f
									
								
							
		Reference in New Issue
	
	Block a user