summaryrefslogtreecommitdiff
path: root/sql/rpl_parallel.h
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-06-24 10:50:25 +0200
committerunknown <knielsen@knielsen-hq.org>2013-06-24 10:50:25 +0200
commit26a9fbc416cc8afaf2099ce293334e85c76b50cb (patch)
treea49b66fcdbc8775fca1b610019ab5dcc0094af20 /sql/rpl_parallel.h
parent6a0a4f00a1741df68c0d201e090f5d28f59410c8 (diff)
downloadmariadb-git-26a9fbc416cc8afaf2099ce293334e85c76b50cb.tar.gz
MDEV-4506: Parallel replication of group-committed transactions: Intermediate commit
First very rough sketch. We spawn and retire a pool of slave threads. Test main.alias works, most likely not much else does.
Diffstat (limited to 'sql/rpl_parallel.h')
-rw-r--r--sql/rpl_parallel.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h
new file mode 100644
index 00000000000..7e966f1615c
--- /dev/null
+++ b/sql/rpl_parallel.h
@@ -0,0 +1,74 @@
+#ifndef RPL_PARALLEL_H
+#define RPL_PARALLEL_H
+
+#include "log_event.h"
+
+
+struct rpl_parallel;
+struct rpl_parallel_entry;
+struct rpl_parallel_thread_pool;
+
+class Relay_log_info;
+struct rpl_parallel_thread {
+ bool delay_start;
+ bool running;
+ bool stop;
+ bool free;
+ mysql_mutex_t LOCK_rpl_thread;
+ mysql_cond_t COND_rpl_thread;
+ struct rpl_parallel_thread *next; /* For free list. */
+ struct rpl_parallel_thread_pool *pool;
+ THD *thd;
+ struct rpl_parallel_entry *current_entry;
+ struct queued_event {
+ queued_event *next;
+ Log_event *ev;
+ Relay_log_info *rli;
+ } *event_queue, *last_in_queue;
+ rpl_parallel_thread *wait_for; /* ToDo: change this ... */
+};
+
+
+struct rpl_parallel_thread_pool {
+ uint32 count;
+ struct rpl_parallel_thread **threads;
+ struct rpl_parallel_thread *free_list;
+ mysql_mutex_t LOCK_rpl_thread_pool;
+ mysql_cond_t COND_rpl_thread_pool;
+ bool changing;
+ bool inited;
+
+ rpl_parallel_thread_pool();
+ int init(uint32 size);
+ void destroy();
+ struct rpl_parallel_thread *get_thread(rpl_parallel_entry *entry);
+};
+
+
+struct rpl_parallel_entry {
+ uint32 domain_id;
+ uint32 last_server_id;
+ uint64 last_seq_no;
+ uint64 last_commit_id;
+ bool active;
+ rpl_parallel_thread *rpl_thread;
+};
+struct rpl_parallel {
+ HASH domain_hash;
+ rpl_parallel_entry *current;
+
+ rpl_parallel();
+ ~rpl_parallel();
+ rpl_parallel_entry *find(uint32 domain_id);
+ bool do_event(Relay_log_info *rli, Log_event *ev, THD *thd);
+};
+
+
+extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
+
+
+extern int rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
+ uint32 new_count,
+ bool skip_check= false);
+
+#endif /* RPL_PARALLEL_H */