summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-11-09 18:59:08 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2017-11-09 19:07:05 +0000
commit53c7aaf332d31d0441a533fd9a91b380169ab611 (patch)
treec03c907c7be0c642eaeb7e0e98ff6a2cd0bcee5c /extra
parentd2ffafe00f7e4c2246bb0b45bd407ff179163c5e (diff)
downloadmariadb-git-53c7aaf332d31d0441a533fd9a91b380169ab611.tar.gz
MDEV-14077 Incremental backup extremly slow
Remove the main bottleneck - the memset() call mentioned in the bug. Use os_mem_alloc_large() instead of malloc()/memset().
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/write_filt.cc21
-rw-r--r--extra/mariabackup/write_filt.h2
2 files changed, 12 insertions, 11 deletions
diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc
index 77c8b9bcc6b..05981489bb6 100644
--- a/extra/mariabackup/write_filt.cc
+++ b/extra/mariabackup/write_filt.cc
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "write_filt.h"
#include "fil_cur.h"
#include "xtrabackup.h"
+#include <os0proc.h>
/************************************************************************
Write-through page write filter. */
@@ -68,18 +69,21 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
{
char meta_name[FN_REFLEN];
xb_delta_info_t info;
- ulint buf_size;
xb_wf_incremental_ctxt_t *cp =
&(ctxt->u.wf_incremental_ctxt);
ctxt->cursor = cursor;
/* allocate buffer for incremental backup (4096 pages) */
- buf_size = (cursor->page_size / 4 + 1) * cursor->page_size;
- cp->delta_buf_base = static_cast<byte *>(ut_malloc(buf_size));
- memset(cp->delta_buf_base, 0, buf_size);
- cp->delta_buf = static_cast<byte *>
- (ut_align(cp->delta_buf_base, cursor->page_size));
+ cp->delta_buf_size = (cursor->page_size / 4) * cursor->page_size;
+ cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
+
+ if (!cp->delta_buf) {
+ msg("[%02u] mariabackup: Error: "
+ "cannot allocate %zu bytes\n",
+ cursor->thread_n, (size_t) cp->delta_buf_size);
+ return (FALSE);
+ }
/* write delta meta info */
snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name,
@@ -183,10 +187,7 @@ static void
wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt)
{
xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
-
- if (cp->delta_buf_base != NULL) {
- ut_free(cp->delta_buf_base);
- }
+ os_mem_free_large(cp->delta_buf, cp->delta_buf_size);
}
/************************************************************************
diff --git a/extra/mariabackup/write_filt.h b/extra/mariabackup/write_filt.h
index bcab263f1dd..69655db5b0b 100644
--- a/extra/mariabackup/write_filt.h
+++ b/extra/mariabackup/write_filt.h
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
/* Incremental page filter context */
typedef struct {
- byte *delta_buf_base;
+ ulint delta_buf_size;
byte *delta_buf;
ulint npages;
} xb_wf_incremental_ctxt_t;