1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-27 09:01:50 +03:00

Enhanced dbsim to store view and position in storage engine

Mimic real DBMS implementation by storing view and position
into storage engine.
This commit is contained in:
Teemu Ollakka
2019-01-23 19:10:34 +02:00
parent 632f8c3b14
commit f30d9c06ce
8 changed files with 82 additions and 22 deletions

View File

@ -39,6 +39,8 @@ namespace db
, transactions_()
, alg_freq_(params.alg_freq)
, bf_aborts_()
, position_()
, view_()
{ }
class transaction
@ -55,7 +57,7 @@ namespace db
bool active() const { return cc_ != nullptr; }
void start(client* cc);
void apply(const wsrep::transaction&);
void commit();
void commit(const wsrep::gtid&);
void rollback();
db::client* client() { return cc_; }
transaction(const transaction&) = delete;
@ -66,11 +68,18 @@ namespace db
};
void bf_abort_some(const wsrep::transaction& tc);
long long bf_aborts() const { return bf_aborts_; }
void store_position(const wsrep::gtid& gtid);
wsrep::gtid get_position() const;
void store_view(const wsrep::view& view);
wsrep::view get_view() const;
private:
void validate_position(const wsrep::gtid& gtid) const;
wsrep::default_mutex mutex_;
std::unordered_set<db::client*> transactions_;
size_t alg_freq_;
std::atomic<long long> bf_aborts_;
wsrep::gtid position_;
wsrep::view view_;
};
}