-
Notifications
You must be signed in to change notification settings - Fork 14
This is the first version of the SR speedup feature for MariaDB 10.7. #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,10 @@ namespace wsrep | |
wsrep::transaction_id client_id, | ||
int flags, | ||
const wsrep::const_buffer& data, | ||
const wsrep::xid& xid) = 0; | ||
|
||
int sr_store, | ||
size_t offset, | ||
const wsrep::xid& xid, | ||
void *binlog_cache) = 0; | ||
/** | ||
* Update fragment meta data after certification process. | ||
*/ | ||
|
@@ -78,6 +80,13 @@ namespace wsrep | |
*/ | ||
virtual int remove_fragments() = 0; | ||
|
||
/** | ||
* Update the list of fragments in the streaming context by | ||
* adding all fragments in the streaming log table for the given | ||
* transaction. | ||
*/ | ||
virtual int set_fragments_from_table() = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is never called from wsrep-lib side, so it does not have to be in the service interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, set_fragments_from_table() method is not unused and hence not needed in wsrep-lib. I will remove it, as you suggested. |
||
|
||
/** | ||
* Commit the transaction. | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ namespace wsrep | |
, fragment_size_() | ||
, unit_counter_() | ||
, log_position_() | ||
, sr_store_(0) | ||
{ } | ||
|
||
/** | ||
|
@@ -189,6 +190,17 @@ namespace wsrep | |
unit_counter_ = 0; | ||
log_position_ = 0; | ||
} | ||
|
||
void set_sr_store(int store_type) | ||
{ | ||
sr_store_ = store_type; | ||
} | ||
|
||
int get_sr_store() const | ||
{ | ||
return (sr_store_); | ||
} | ||
|
||
private: | ||
|
||
void check_fragment_seqno(wsrep::seqno seqno WSREP_UNUSED) | ||
|
@@ -204,6 +216,7 @@ namespace wsrep | |
size_t fragment_size_; | ||
size_t unit_counter_; | ||
size_t log_position_; | ||
int sr_store_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable could perhaps be moved into storage_service implementation on MariaDB side. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can not be moved to But maybe there is some other class on the MariaDB side where |
||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,47 @@ namespace wsrep | |
void xa_detach(); | ||
|
||
int xa_replay(wsrep::unique_lock<wsrep::mutex>&); | ||
int fragment_cache_remove_transaction( | ||
const wsrep::id& server_id, wsrep::transaction_id transaction_id); | ||
void *get_binlog_cache(); | ||
/* state of Streaming Replication Speedup feature for the | ||
transaction. This describes the relationship of this WSREP | ||
transaction and the underlying InnoDB transaction. | ||
*/ | ||
enum sr_state | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SR state handling could perhaps be moved to MariaDB side. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we have the same question as above with |
||
{ | ||
/* this is not an SR Speedup transaction */ | ||
sr_state_none, | ||
/* this is an SR Speedup transaction, but SR XID is not set | ||
for the underlying InnoDB transaction | ||
*/ | ||
sr_state_require_xid, | ||
/* this is an SR Speedup transaction, and SR XID is set | ||
for the underlying InnoDB transaction | ||
*/ | ||
sr_state_xid_set | ||
}; | ||
static const int n_sr_states = sr_state_xid_set + 1; | ||
enum sr_state sr_state() const | ||
{ return sr_state_; } | ||
void require_sr_xid() | ||
{ | ||
if (sr_state_ == sr_state_none) { | ||
sr_state_ = sr_state_require_xid; | ||
} | ||
} | ||
void sr_xid_was_set() | ||
{ | ||
sr_state_ = sr_state_xid_set; | ||
} | ||
bool sr_xid_is_required() | ||
{ | ||
return sr_state_ == sr_state_require_xid; | ||
} | ||
bool sr_xid_is_set() | ||
{ | ||
return sr_state_ == sr_state_xid_set; | ||
} | ||
|
||
bool pa_unsafe() const { return (flags() & wsrep::provider::flag::pa_unsafe); } | ||
void pa_unsafe(bool pa_unsafe) { | ||
|
@@ -253,6 +294,7 @@ namespace wsrep | |
int release_commit_order(wsrep::unique_lock<wsrep::mutex>&); | ||
void streaming_rollback(wsrep::unique_lock<wsrep::mutex>&); | ||
int replay(wsrep::unique_lock<wsrep::mutex>&); | ||
void clear_fragments(); | ||
void xa_replay_common(wsrep::unique_lock<wsrep::mutex>&); | ||
int xa_replay_commit(wsrep::unique_lock<wsrep::mutex>&); | ||
void cleanup(); | ||
|
@@ -281,6 +323,7 @@ namespace wsrep | |
wsrep::mutable_buffer apply_error_buf_; | ||
wsrep::xid xid_; | ||
bool streaming_rollback_in_progress_; | ||
enum sr_state sr_state_; | ||
}; | ||
|
||
static inline const char* to_c_string(enum wsrep::transaction::state state) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method exists only to pass the void pointer as argument for one of the service interface calls. This could be handled on MariaDB side, by storing the binlog cache pointer or client session THD pointer when constructing
Wsrep_storage_service
object.