mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-27 09:01:50 +03:00
Implemented dbsim high prio service log_dummy_write_set()
The empty implementation of log_dummy_write_set() in dbsim
high priority service implementation left unreleased commit
order critical section behind whenever remote write set failed
certification. Added calls to do empty commit to release the
critical section.
Other:
Implemented ostream operator<< for wsrep:🧵:id, and added
printout of owning thread into transaction debug output.
This commit is contained in:
@ -89,6 +89,23 @@ void db::high_priority_service::after_apply()
|
|||||||
client_.client_state_.after_applying();
|
client_.client_state_.after_applying();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int db::high_priority_service::log_dummy_write_set(
|
||||||
|
const wsrep::ws_handle& ws_handle,
|
||||||
|
const wsrep::ws_meta& ws_meta)
|
||||||
|
{
|
||||||
|
int ret(client_.client_state_.start_transaction(ws_handle, ws_meta));
|
||||||
|
assert(ret == 0);
|
||||||
|
client_.client_state_.prepare_for_ordering(ws_handle, ws_meta, true);
|
||||||
|
ret = client_.client_state_.before_commit();
|
||||||
|
assert(ret == 0);
|
||||||
|
ret = client_.client_state_.ordered_commit();
|
||||||
|
assert(ret == ret);
|
||||||
|
ret = client_.client_state_.after_commit();
|
||||||
|
assert(ret == 0);
|
||||||
|
client_.client_state_.after_applying();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
bool db::high_priority_service::is_replaying() const
|
bool db::high_priority_service::is_replaying() const
|
||||||
{
|
{
|
||||||
return (client_.client_state_.transaction().state() == wsrep::transaction::s_replaying);
|
return (client_.client_state_.transaction().state() == wsrep::transaction::s_replaying);
|
||||||
|
@ -52,8 +52,7 @@ namespace db
|
|||||||
void switch_execution_context(wsrep::high_priority_service&) override
|
void switch_execution_context(wsrep::high_priority_service&) override
|
||||||
{ }
|
{ }
|
||||||
int log_dummy_write_set(const wsrep::ws_handle&,
|
int log_dummy_write_set(const wsrep::ws_handle&,
|
||||||
const wsrep::ws_meta&) override
|
const wsrep::ws_meta&) override;
|
||||||
{ return 0; }
|
|
||||||
bool is_replaying() const override;
|
bool is_replaying() const override;
|
||||||
void debug_crash(const char*) override { }
|
void debug_crash(const char*) override { }
|
||||||
private:
|
private:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Codership Oy <info@codership.com>
|
* Copyright (C) 2018-2019 Codership Oy <info@codership.com>
|
||||||
*
|
*
|
||||||
* This file is part of wsrep-lib.
|
* This file is part of wsrep-lib.
|
||||||
*
|
*
|
||||||
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace wsrep
|
namespace wsrep
|
||||||
{
|
{
|
||||||
@ -34,6 +35,7 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
return (pthread_equal(left.thread_, right.thread_));
|
return (pthread_equal(left.thread_, right.thread_));
|
||||||
}
|
}
|
||||||
|
friend std::ostream& operator<<(std::ostream&, const id&);
|
||||||
pthread_t thread_;
|
pthread_t thread_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,4 +50,6 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
static inline thread::id get_id() { return thread::id(pthread_self()); }
|
static inline thread::id get_id() { return thread::id(pthread_self()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream&, const thread::id&);
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,7 @@ add_library(wsrep-lib
|
|||||||
seqno.cpp
|
seqno.cpp
|
||||||
view.cpp
|
view.cpp
|
||||||
server_state.cpp
|
server_state.cpp
|
||||||
|
thread.cpp
|
||||||
transaction.cpp
|
transaction.cpp
|
||||||
wsrep_provider_v26.cpp)
|
wsrep_provider_v26.cpp)
|
||||||
target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl)
|
target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl)
|
||||||
|
30
src/thread.cpp
Normal file
30
src/thread.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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 "wsrep/thread.hpp"
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::thread::id& id)
|
||||||
|
{
|
||||||
|
std::ios_base::fmtflags orig_flags(os.flags());
|
||||||
|
os << std::hex << id.thread_;
|
||||||
|
os.flags(orig_flags);
|
||||||
|
return os;
|
||||||
|
}
|
@ -758,8 +758,6 @@ int wsrep::transaction::after_statement()
|
|||||||
ret = provider().commit_order_enter(ws_handle_, ws_meta_);
|
ret = provider().commit_order_enter(ws_handle_, ws_meta_);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
// client_state_.server_state().last_committed_gtid(
|
|
||||||
// ws_meta.gtid());
|
|
||||||
provider().commit_order_leave(ws_handle_, ws_meta_);
|
provider().commit_order_leave(ws_handle_, ws_meta_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1550,6 +1548,7 @@ void wsrep::transaction::debug_log_state(
|
|||||||
<< ", bytes: " << streaming_context_.bytes_certified()
|
<< ", bytes: " << streaming_context_.bytes_certified()
|
||||||
<< ", sr_rb: " << streaming_context_.rolled_back()
|
<< ", sr_rb: " << streaming_context_.rolled_back()
|
||||||
<< "\n own: " << (client_state_.owning_thread_id_ == wsrep::this_thread::get_id())
|
<< "\n own: " << (client_state_.owning_thread_id_ == wsrep::this_thread::get_id())
|
||||||
|
<< " thread_id: " << client_state_.owning_thread_id_
|
||||||
<< "");
|
<< "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user