summaryrefslogtreecommitdiff
path: root/sql/wsrep_priv.h
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2013-11-06 00:29:37 +0200
committerSeppo Jaakola <seppo.jaakola@codership.com>2013-11-06 00:29:37 +0200
commit2b4183f10b54a5b3f8c848d897b3107859c23fa4 (patch)
tree5d48ff3f0a9814926ba59b7adae1d056c57b54c8 /sql/wsrep_priv.h
parent9129c8f1d3e1f8c9daeae559eaf6b9807b4331ec (diff)
downloadmariadb-git-2b4183f10b54a5b3f8c848d897b3107859c23fa4.tar.gz
bzr merge -r3890..3891 lp:codership-mysql/5.5
Diffstat (limited to 'sql/wsrep_priv.h')
-rw-r--r--sql/wsrep_priv.h206
1 files changed, 14 insertions, 192 deletions
diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h
index 700639ebcb1..291823d773e 100644
--- a/sql/wsrep_priv.h
+++ b/sql/wsrep_priv.h
@@ -26,208 +26,30 @@
#include <pthread.h>
#include <cstdio>
-extern void wsrep_ready_set (my_bool x);
+void wsrep_ready_set (my_bool x);
-extern ssize_t wsrep_sst_prepare (void** msg);
-extern int wsrep_sst_donate_cb (void* app_ctx,
- void* recv_ctx,
- const void* msg, size_t msg_len,
- const wsrep_uuid_t* current_uuid,
- wsrep_seqno_t current_seqno,
- const char* state, size_t state_len,
- bool bypass);
-
-extern size_t guess_ip (char* buf, size_t buf_len);
-extern size_t guess_address(char* buf, size_t buf_len);
+ssize_t wsrep_sst_prepare (void** msg);
+wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx,
+ void* recv_ctx,
+ const void* msg, size_t msg_len,
+ const wsrep_gtid_t* state_id,
+ const char* state, size_t state_len,
+ bool bypass);
extern wsrep_uuid_t local_uuid;
extern wsrep_seqno_t local_seqno;
+// a helper function
+void wsrep_sst_received(wsrep_t*, const wsrep_uuid_t*, wsrep_seqno_t,
+ const void*, size_t);
/*! SST thread signals init thread about sst completion */
-extern void wsrep_sst_complete(const wsrep_uuid_t* uuid, wsrep_seqno_t, bool);
+void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool);
extern void wsrep_notify_status (wsrep_member_status_t new_status,
const wsrep_view_info_t* view = 0);
-namespace wsp {
-class node_status
-{
-public:
- node_status() : status(WSREP_MEMBER_UNDEFINED) {}
- void set(wsrep_member_status_t new_status,
- const wsrep_view_info_t* view = 0)
- {
- if (status != new_status || 0 != view)
- {
- wsrep_notify_status(new_status, view);
- status = new_status;
- }
- }
- wsrep_member_status_t get() const { return status; }
-private:
- wsrep_member_status_t status;
-};
-} /* namespace wsp */
-
-extern wsp::node_status local_status;
-
-namespace wsp {
-/* A small class to run external programs. */
-class process
-{
-private:
- const char* const str_;
- FILE* io_;
- int err_;
- pid_t pid_;
-
-public:
-/*! @arg type is a pointer to a null-terminated string which must contain
- either the letter 'r' for reading or the letter 'w' for writing.
- */
- process (const char* cmd, const char* type);
- ~process ();
-
- FILE* pipe () { return io_; }
- int error() { return err_; }
- int wait ();
- const char* cmd() { return str_; }
-};
-#ifdef REMOVED
-class lock
-{
- pthread_mutex_t* const mtx_;
-
-public:
-
- lock (pthread_mutex_t* mtx) : mtx_(mtx)
- {
- int err = pthread_mutex_lock (mtx_);
-
- if (err)
- {
- WSREP_ERROR("Mutex lock failed: %s", strerror(err));
- abort();
- }
- }
-
- virtual ~lock ()
- {
- int err = pthread_mutex_unlock (mtx_);
-
- if (err)
- {
- WSREP_ERROR("Mutex unlock failed: %s", strerror(err));
- abort();
- }
- }
-
- inline void wait (pthread_cond_t* cond)
- {
- pthread_cond_wait (cond, mtx_);
- }
-
-private:
-
- lock (const lock&);
- lock& operator=(const lock&);
-
-};
-
-class monitor
-{
- int mutable refcnt;
- pthread_mutex_t mutable mtx;
- pthread_cond_t mutable cond;
-
-public:
-
- monitor() : refcnt(0)
- {
- pthread_mutex_init (&mtx, NULL);
- pthread_cond_init (&cond, NULL);
- }
-
- ~monitor()
- {
- pthread_mutex_destroy (&mtx);
- pthread_cond_destroy (&cond);
- }
-
- void enter() const
- {
- lock l(&mtx);
-
- while (refcnt)
- {
- l.wait(&cond);
- }
- refcnt++;
- }
-
- void leave() const
- {
- lock l(&mtx);
-
- refcnt--;
- if (refcnt == 0)
- {
- pthread_cond_signal (&cond);
- }
- }
-
-private:
-
- monitor (const monitor&);
- monitor& operator= (const monitor&);
-};
-
-class critical
-{
- const monitor& mon;
-
-public:
-
- critical(const monitor& m) : mon(m) { mon.enter(); }
-
- ~critical() { mon.leave(); }
-
-private:
-
- critical (const critical&);
- critical& operator= (const critical&);
-};
-#endif
-
-class thd
-{
- class thd_init
- {
- public:
- thd_init() { my_thread_init(); }
- ~thd_init() { my_thread_end(); }
- }
- init;
-
- thd (const thd&);
- thd& operator= (const thd&);
-
-public:
-
- thd(my_bool wsrep_on);
- ~thd();
- THD* const ptr;
-};
+/* binlog-related stuff */
+int wsrep_write_cache(IO_CACHE *cache, uchar **buf, size_t *buf_len);
-class string
-{
-public:
- string() : string_(0) {}
- void set(char* str) { if (string_) free (string_); string_ = str; }
- ~string() { set (0); }
-private:
- char* string_;
-};
-} // namespace wsrep
#endif /* WSREP_PRIV_H */