diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-10-24 12:44:21 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-10-24 12:44:21 +0200 |
commit | ee8a8162086b29022c304b270369439a3aaaf8a5 (patch) | |
tree | 3ad0ffd879de1d04184027bbde55e09dfc41a5cc /sql/rpl_parallel.h | |
parent | 96a4f1f62862883de4bf14268cfe28d5bf187f49 (diff) | |
download | mariadb-git-ee8a8162086b29022c304b270369439a3aaaf8a5.tar.gz |
MDEV-4506: Parallel replication.
Implement --slave-parallel-max-queue to limit memory usage
of SQL thread read-ahead in the relay log.
Diffstat (limited to 'sql/rpl_parallel.h')
-rw-r--r-- | sql/rpl_parallel.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index 7057ec66de2..fe9c6708e97 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -27,7 +27,29 @@ struct rpl_parallel_thread { char event_relay_log_name[FN_REFLEN]; char future_event_master_log_name[FN_REFLEN]; ulonglong event_relay_log_pos; + size_t event_size; } *event_queue, *last_in_queue; + uint64 queued_size; + + void enqueue(queued_event *qev) + { + if (last_in_queue) + last_in_queue->next= qev; + else + event_queue= qev; + last_in_queue= qev; + queued_size+= qev->event_size; + } + + void dequeue(queued_event *list) + { + queued_event *tmp; + + DBUG_ASSERT(list == event_queue); + event_queue= last_in_queue= NULL; + for (tmp= list; tmp; tmp= tmp->next) + queued_size-= tmp->event_size; + } }; @@ -87,7 +109,8 @@ struct rpl_parallel { void reset(); rpl_parallel_entry *find(uint32 domain_id); void wait_for_done(); - bool do_event(rpl_group_info *serial_rgi, Log_event *ev); + bool do_event(rpl_group_info *serial_rgi, Log_event *ev, + ulonglong event_size); }; |