summaryrefslogtreecommitdiff
path: root/sql/wsrep_binlog.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-08-31 16:35:37 +0200
committerSergei Golubchik <serg@mariadb.org>2015-09-04 10:33:55 +0200
commit41d68cabee1d9c2a8e8c7a006b17070392a85ed7 (patch)
tree1f2cb4724fddd63923b0873ae3c35cf8d17c1c20 /sql/wsrep_binlog.cc
parent704ba5c514b030e4e1c20fe659d985d3bd493bf1 (diff)
downloadmariadb-git-41d68cabee1d9c2a8e8c7a006b17070392a85ed7.tar.gz
cleanup: Log_event::write() and MYSQL_BIN_LOG::write_cache()
Introduce Log_event_writer() that encapsulates writing data to an IO_CACHE with automatic checksum calculation. Now all events properly checksum themselves as needed. Use Log_event_writer in MYSQL_BIN_LOG::write_cache() instead of copy-pasting its logic all over. Later Log_event_writer will also do encryption.
Diffstat (limited to 'sql/wsrep_binlog.cc')
-rw-r--r--sql/wsrep_binlog.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index 0bc04ebb066..36917674128 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -445,6 +445,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
char filename[PATH_MAX]= {0};
File file;
IO_CACHE cache;
+ Log_event_writer writer(&cache);
Format_description_log_event *ev= wsrep_get_apply_format(thd);
int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld_v2.log",
@@ -476,7 +477,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
goto cleanup2;
}
- if (ev->write(&cache) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
+ if (writer.write(ev) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
flush_io_cache(&cache))
{
WSREP_ERROR("Failed to write to '%s'.", filename);