MDEV-21225 Remove ut_align() and use aligned_malloc()
Before commit 90c52e5291b3ad0935df7da56ec0fcbf530733b4 introduced aligned_malloc(), InnoDB always used a pattern of over-allocating memory and invoking ut_align() to guarantee the desired alignment. It is cleaner to invoke aligned_malloc() and aligned_free() directly. ut_align(): Remove. In assertions, ut_align_down() can be used instead.
This commit is contained in:
parent
504202bd7f
commit
42a4ae54c2
@ -1551,8 +1551,6 @@ int main(
|
|||||||
/* our input filename. */
|
/* our input filename. */
|
||||||
char* filename;
|
char* filename;
|
||||||
/* Buffer to store pages read. */
|
/* Buffer to store pages read. */
|
||||||
byte* buf_ptr = NULL;
|
|
||||||
byte* xdes_ptr = NULL;
|
|
||||||
byte* buf = NULL;
|
byte* buf = NULL;
|
||||||
byte* xdes = NULL;
|
byte* xdes = NULL;
|
||||||
/* bytes read count */
|
/* bytes read count */
|
||||||
@ -1632,10 +1630,10 @@ int main(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buf_ptr = (byte*) malloc(UNIV_PAGE_SIZE_MAX * 2);
|
buf = static_cast<byte*>(aligned_malloc(UNIV_PAGE_SIZE_MAX,
|
||||||
xdes_ptr = (byte*)malloc(UNIV_PAGE_SIZE_MAX * 2);
|
UNIV_PAGE_SIZE_MAX));
|
||||||
buf = (byte *) ut_align(buf_ptr, UNIV_PAGE_SIZE_MAX);
|
xdes = static_cast<byte*>(aligned_malloc(UNIV_PAGE_SIZE_MAX,
|
||||||
xdes = (byte *) ut_align(xdes_ptr, UNIV_PAGE_SIZE_MAX);
|
UNIV_PAGE_SIZE_MAX));
|
||||||
|
|
||||||
/* The file name is not optional. */
|
/* The file name is not optional. */
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
@ -2014,21 +2012,9 @@ first_non_zero:
|
|||||||
fclose(log_file);
|
fclose(log_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf_ptr);
|
goto common_exit;
|
||||||
free(xdes_ptr);
|
|
||||||
|
|
||||||
my_end(exit_status);
|
|
||||||
DBUG_RETURN(exit_status);
|
|
||||||
|
|
||||||
my_exit:
|
my_exit:
|
||||||
if (buf_ptr) {
|
|
||||||
free(buf_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xdes_ptr) {
|
|
||||||
free(xdes_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!read_from_stdin && fil_in) {
|
if (!read_from_stdin && fil_in) {
|
||||||
fclose(fil_in);
|
fclose(fil_in);
|
||||||
}
|
}
|
||||||
@ -2037,6 +2023,9 @@ my_exit:
|
|||||||
fclose(log_file);
|
fclose(log_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common_exit:
|
||||||
|
aligned_free(buf);
|
||||||
|
aligned_free(xdes);
|
||||||
my_end(exit_status);
|
my_end(exit_status);
|
||||||
DBUG_RETURN(exit_status);
|
DBUG_RETURN(exit_status);
|
||||||
}
|
}
|
||||||
|
@ -466,14 +466,13 @@ struct datafile_cur_t {
|
|||||||
char abs_path[FN_REFLEN];
|
char abs_path[FN_REFLEN];
|
||||||
MY_STAT statinfo;
|
MY_STAT statinfo;
|
||||||
uint thread_n;
|
uint thread_n;
|
||||||
byte* orig_buf;
|
|
||||||
byte* buf;
|
byte* buf;
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
size_t buf_read;
|
size_t buf_read;
|
||||||
size_t buf_offset;
|
size_t buf_offset;
|
||||||
|
|
||||||
explicit datafile_cur_t(const char* filename = NULL) :
|
explicit datafile_cur_t(const char* filename = NULL) :
|
||||||
file(), thread_n(0), orig_buf(NULL), buf(NULL), buf_size(0),
|
file(), thread_n(0), buf(NULL), buf_size(0),
|
||||||
buf_read(0), buf_offset(0)
|
buf_read(0), buf_offset(0)
|
||||||
{
|
{
|
||||||
memset(rel_path, 0, sizeof rel_path);
|
memset(rel_path, 0, sizeof rel_path);
|
||||||
|
@ -142,7 +142,7 @@ xb_fil_cur_open(
|
|||||||
int err;
|
int err;
|
||||||
/* Initialize these first so xb_fil_cur_close() handles them correctly
|
/* Initialize these first so xb_fil_cur_close() handles them correctly
|
||||||
in case of error */
|
in case of error */
|
||||||
cursor->orig_buf = NULL;
|
cursor->buf = NULL;
|
||||||
cursor->node = NULL;
|
cursor->node = NULL;
|
||||||
|
|
||||||
cursor->space_id = node->space->id;
|
cursor->space_id = node->space->id;
|
||||||
@ -238,10 +238,8 @@ xb_fil_cur_open(
|
|||||||
|
|
||||||
/* Allocate read buffer */
|
/* Allocate read buffer */
|
||||||
cursor->buf_size = XB_FIL_CUR_PAGES * cursor->page_size;
|
cursor->buf_size = XB_FIL_CUR_PAGES * cursor->page_size;
|
||||||
cursor->orig_buf = static_cast<byte *>
|
cursor->buf = static_cast<byte*>(aligned_malloc(cursor->buf_size,
|
||||||
(malloc(cursor->buf_size + srv_page_size));
|
srv_page_size));
|
||||||
cursor->buf = static_cast<byte *>
|
|
||||||
(ut_align(cursor->orig_buf, srv_page_size));
|
|
||||||
|
|
||||||
cursor->buf_read = 0;
|
cursor->buf_read = 0;
|
||||||
cursor->buf_npages = 0;
|
cursor->buf_npages = 0;
|
||||||
@ -494,7 +492,8 @@ xb_fil_cur_close(
|
|||||||
cursor->read_filter->deinit(&cursor->read_filter_ctxt);
|
cursor->read_filter->deinit(&cursor->read_filter_ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cursor->orig_buf);
|
aligned_free(cursor->buf);
|
||||||
|
cursor->buf = NULL;
|
||||||
|
|
||||||
if (cursor->node != NULL) {
|
if (cursor->node != NULL) {
|
||||||
xb_fil_node_close_file(cursor->node);
|
xb_fil_node_close_file(cursor->node);
|
||||||
|
@ -44,8 +44,7 @@ struct xb_fil_cur_t {
|
|||||||
xb_read_filt_t* read_filter; /*!< read filter */
|
xb_read_filt_t* read_filter; /*!< read filter */
|
||||||
xb_read_filt_ctxt_t read_filter_ctxt;
|
xb_read_filt_ctxt_t read_filter_ctxt;
|
||||||
/*!< read filter context */
|
/*!< read filter context */
|
||||||
byte* orig_buf; /*!< read buffer */
|
byte* buf; /*!< read buffer */
|
||||||
byte* buf; /*!< aligned pointer for orig_buf */
|
|
||||||
size_t buf_size; /*!< buffer size in bytes */
|
size_t buf_size; /*!< buffer size in bytes */
|
||||||
size_t buf_read; /*!< number of read bytes in buffer
|
size_t buf_read; /*!< number of read bytes in buffer
|
||||||
after the last cursor read */
|
after the last cursor read */
|
||||||
|
@ -3269,8 +3269,6 @@ static dberr_t xb_assign_undo_space_start()
|
|||||||
{
|
{
|
||||||
|
|
||||||
pfs_os_file_t file;
|
pfs_os_file_t file;
|
||||||
byte* buf;
|
|
||||||
byte* page;
|
|
||||||
bool ret;
|
bool ret;
|
||||||
dberr_t error = DB_SUCCESS;
|
dberr_t error = DB_SUCCESS;
|
||||||
ulint space;
|
ulint space;
|
||||||
@ -3289,8 +3287,8 @@ static dberr_t xb_assign_undo_space_start()
|
|||||||
return DB_ERROR;
|
return DB_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = static_cast<byte*>(ut_malloc_nokey(2U << srv_page_size_shift));
|
byte* page = static_cast<byte*>
|
||||||
page = static_cast<byte*>(ut_align(buf, srv_page_size));
|
(aligned_malloc(srv_page_size, srv_page_size));
|
||||||
|
|
||||||
if (os_file_read(IORequestRead, file, page, 0, srv_page_size)
|
if (os_file_read(IORequestRead, file, page, 0, srv_page_size)
|
||||||
!= DB_SUCCESS) {
|
!= DB_SUCCESS) {
|
||||||
@ -3337,7 +3335,7 @@ retry:
|
|||||||
srv_undo_space_id_start = space;
|
srv_undo_space_id_start = space;
|
||||||
|
|
||||||
func_exit:
|
func_exit:
|
||||||
ut_free(buf);
|
aligned_free(page);
|
||||||
ret = os_file_close(file);
|
ret = os_file_close(file);
|
||||||
ut_a(ret);
|
ut_a(ret);
|
||||||
|
|
||||||
@ -4552,8 +4550,6 @@ xb_space_create_file(
|
|||||||
pfs_os_file_t* file) /*!<out: file handle */
|
pfs_os_file_t* file) /*!<out: file handle */
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
byte* buf;
|
|
||||||
byte* page;
|
|
||||||
|
|
||||||
*file = os_file_create_simple_no_error_handling(
|
*file = os_file_create_simple_no_error_handling(
|
||||||
0, path, OS_FILE_CREATE, OS_FILE_READ_WRITE, false, &ret);
|
0, path, OS_FILE_CREATE, OS_FILE_READ_WRITE, false, &ret);
|
||||||
@ -4572,9 +4568,9 @@ xb_space_create_file(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = static_cast<byte *>(malloc(3U << srv_page_size_shift));
|
|
||||||
/* Align the memory for file i/o if we might have O_DIRECT set */
|
/* Align the memory for file i/o if we might have O_DIRECT set */
|
||||||
page = static_cast<byte *>(ut_align(buf, srv_page_size));
|
byte* page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
|
||||||
|
srv_page_size));
|
||||||
|
|
||||||
memset(page, '\0', srv_page_size);
|
memset(page, '\0', srv_page_size);
|
||||||
|
|
||||||
@ -4608,7 +4604,7 @@ xb_space_create_file(
|
|||||||
page_zip.data, 0, zip_size);
|
page_zip.data, 0, zip_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
aligned_free(page);
|
||||||
|
|
||||||
if (ret != DB_SUCCESS) {
|
if (ret != DB_SUCCESS) {
|
||||||
msg("mariabackup: could not write the first page to %s",
|
msg("mariabackup: could not write the first page to %s",
|
||||||
@ -4821,8 +4817,7 @@ xtrabackup_apply_delta(
|
|||||||
xb_delta_info_t info(srv_page_size, 0, SRV_TMP_SPACE_ID);
|
xb_delta_info_t info(srv_page_size, 0, SRV_TMP_SPACE_ID);
|
||||||
ulint page_size;
|
ulint page_size;
|
||||||
ulint page_size_shift;
|
ulint page_size_shift;
|
||||||
byte* incremental_buffer_base = NULL;
|
byte* incremental_buffer = NULL;
|
||||||
byte* incremental_buffer;
|
|
||||||
|
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
@ -4890,11 +4885,8 @@ xtrabackup_apply_delta(
|
|||||||
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
|
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
|
||||||
|
|
||||||
/* allocate buffer for incremental backup (4096 pages) */
|
/* allocate buffer for incremental backup (4096 pages) */
|
||||||
incremental_buffer_base = static_cast<byte *>
|
|
||||||
(malloc((page_size / 4 + 1) * page_size));
|
|
||||||
incremental_buffer = static_cast<byte *>
|
incremental_buffer = static_cast<byte *>
|
||||||
(ut_align(incremental_buffer_base,
|
(aligned_malloc(page_size / 4 * page_size, page_size));
|
||||||
page_size));
|
|
||||||
|
|
||||||
msg("Applying %s to %s...", src_path, dst_path);
|
msg("Applying %s to %s...", src_path, dst_path);
|
||||||
|
|
||||||
@ -5003,7 +4995,7 @@ xtrabackup_apply_delta(
|
|||||||
incremental_buffers++;
|
incremental_buffers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(incremental_buffer_base);
|
aligned_free(incremental_buffer);
|
||||||
if (src_file != OS_FILE_CLOSED) {
|
if (src_file != OS_FILE_CLOSED) {
|
||||||
os_file_close(src_file);
|
os_file_close(src_file);
|
||||||
os_file_delete(0,src_path);
|
os_file_delete(0,src_path);
|
||||||
@ -5013,7 +5005,7 @@ xtrabackup_apply_delta(
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(incremental_buffer_base);
|
aligned_free(incremental_buffer);
|
||||||
if (src_file != OS_FILE_CLOSED)
|
if (src_file != OS_FILE_CLOSED)
|
||||||
os_file_close(src_file);
|
os_file_close(src_file);
|
||||||
if (dst_file != OS_FILE_CLOSED)
|
if (dst_file != OS_FILE_CLOSED)
|
||||||
|
@ -1601,8 +1601,11 @@ buf_chunk_init(
|
|||||||
opt_large_page_size is smaller than srv_page_size,
|
opt_large_page_size is smaller than srv_page_size,
|
||||||
we may allocate one fewer block than requested. When
|
we may allocate one fewer block than requested. When
|
||||||
it is bigger, we may allocate more blocks than requested. */
|
it is bigger, we may allocate more blocks than requested. */
|
||||||
|
static_assert(sizeof(byte*) == sizeof(ulint), "pointer size");
|
||||||
|
|
||||||
frame = (byte*) ut_align(chunk->mem, srv_page_size);
|
frame = reinterpret_cast<byte*>((reinterpret_cast<ulint>(chunk->mem)
|
||||||
|
+ srv_page_size - 1)
|
||||||
|
& ~(srv_page_size - 1));
|
||||||
chunk->size = (chunk->mem_pfx.m_size >> srv_page_size_shift)
|
chunk->size = (chunk->mem_pfx.m_size >> srv_page_size_shift)
|
||||||
- (frame != chunk->mem);
|
- (frame != chunk->mem);
|
||||||
|
|
||||||
|
@ -126,11 +126,8 @@ static void buf_dblwr_init(const byte *doublewrite)
|
|||||||
buf_dblwr->in_use = static_cast<bool*>(
|
buf_dblwr->in_use = static_cast<bool*>(
|
||||||
ut_zalloc_nokey(buf_size * sizeof(bool)));
|
ut_zalloc_nokey(buf_size * sizeof(bool)));
|
||||||
|
|
||||||
buf_dblwr->write_buf_unaligned = static_cast<byte*>(
|
|
||||||
ut_malloc_nokey((1 + buf_size) << srv_page_size_shift));
|
|
||||||
|
|
||||||
buf_dblwr->write_buf = static_cast<byte*>(
|
buf_dblwr->write_buf = static_cast<byte*>(
|
||||||
ut_align(buf_dblwr->write_buf_unaligned,
|
aligned_malloc(buf_size << srv_page_size_shift,
|
||||||
srv_page_size));
|
srv_page_size));
|
||||||
|
|
||||||
buf_dblwr->buf_block_arr = static_cast<buf_page_t**>(
|
buf_dblwr->buf_block_arr = static_cast<buf_page_t**>(
|
||||||
@ -355,17 +352,12 @@ buf_dblwr_init_or_load_pages(
|
|||||||
ulint space_id;
|
ulint space_id;
|
||||||
byte* read_buf;
|
byte* read_buf;
|
||||||
byte* doublewrite;
|
byte* doublewrite;
|
||||||
byte* unaligned_read_buf;
|
|
||||||
ibool reset_space_ids = FALSE;
|
ibool reset_space_ids = FALSE;
|
||||||
recv_dblwr_t& recv_dblwr = recv_sys.dblwr;
|
recv_dblwr_t& recv_dblwr = recv_sys.dblwr;
|
||||||
|
|
||||||
/* We do the file i/o past the buffer pool */
|
/* We do the file i/o past the buffer pool */
|
||||||
|
|
||||||
unaligned_read_buf = static_cast<byte*>(
|
|
||||||
ut_malloc_nokey(3U << srv_page_size_shift));
|
|
||||||
|
|
||||||
read_buf = static_cast<byte*>(
|
read_buf = static_cast<byte*>(
|
||||||
ut_align(unaligned_read_buf, srv_page_size));
|
aligned_malloc(2 * srv_page_size, srv_page_size));
|
||||||
|
|
||||||
/* Read the trx sys header to check if we are using the doublewrite
|
/* Read the trx sys header to check if we are using the doublewrite
|
||||||
buffer */
|
buffer */
|
||||||
@ -382,9 +374,8 @@ buf_dblwr_init_or_load_pages(
|
|||||||
|
|
||||||
ib::error()
|
ib::error()
|
||||||
<< "Failed to read the system tablespace header page";
|
<< "Failed to read the system tablespace header page";
|
||||||
|
func_exit:
|
||||||
ut_free(unaligned_read_buf);
|
aligned_free(read_buf);
|
||||||
|
|
||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,8 +394,8 @@ buf_dblwr_init_or_load_pages(
|
|||||||
|
|
||||||
buf = buf_dblwr->write_buf;
|
buf = buf_dblwr->write_buf;
|
||||||
} else {
|
} else {
|
||||||
ut_free(unaligned_read_buf);
|
err = DB_SUCCESS;
|
||||||
return(DB_SUCCESS);
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
|
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
|
||||||
@ -432,10 +423,7 @@ buf_dblwr_init_or_load_pages(
|
|||||||
ib::error()
|
ib::error()
|
||||||
<< "Failed to read the first double write buffer "
|
<< "Failed to read the first double write buffer "
|
||||||
"extent";
|
"extent";
|
||||||
|
goto func_exit;
|
||||||
ut_free(unaligned_read_buf);
|
|
||||||
|
|
||||||
return(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os_file_read(
|
err = os_file_read(
|
||||||
@ -450,10 +438,7 @@ buf_dblwr_init_or_load_pages(
|
|||||||
ib::error()
|
ib::error()
|
||||||
<< "Failed to read the second double write buffer "
|
<< "Failed to read the second double write buffer "
|
||||||
"extent";
|
"extent";
|
||||||
|
goto func_exit;
|
||||||
ut_free(unaligned_read_buf);
|
|
||||||
|
|
||||||
return(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if any of these pages is half-written in data files, in the
|
/* Check if any of these pages is half-written in data files, in the
|
||||||
@ -480,10 +465,8 @@ buf_dblwr_init_or_load_pages(
|
|||||||
+ i - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE;
|
+ i - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IORequest write_request(IORequest::WRITE);
|
|
||||||
|
|
||||||
err = os_file_write(
|
err = os_file_write(
|
||||||
write_request, path, file, page,
|
IORequestWrite, path, file, page,
|
||||||
source_page_no << srv_page_size_shift,
|
source_page_no << srv_page_size_shift,
|
||||||
srv_page_size);
|
srv_page_size);
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
@ -491,10 +474,7 @@ buf_dblwr_init_or_load_pages(
|
|||||||
ib::error()
|
ib::error()
|
||||||
<< "Failed to write to the double write"
|
<< "Failed to write to the double write"
|
||||||
" buffer";
|
" buffer";
|
||||||
|
goto func_exit;
|
||||||
ut_free(unaligned_read_buf);
|
|
||||||
|
|
||||||
return(err);
|
|
||||||
}
|
}
|
||||||
} else if (mach_read_from_8(page + FIL_PAGE_LSN)) {
|
} else if (mach_read_from_8(page + FIL_PAGE_LSN)) {
|
||||||
/* Each valid page header must contain
|
/* Each valid page header must contain
|
||||||
@ -509,9 +489,8 @@ buf_dblwr_init_or_load_pages(
|
|||||||
os_file_flush(file);
|
os_file_flush(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(unaligned_read_buf);
|
err = DB_SUCCESS;
|
||||||
|
goto func_exit;
|
||||||
return(DB_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Process and remove the double write buffer pages for all tablespaces. */
|
/** Process and remove the double write buffer pages for all tablespaces. */
|
||||||
@ -520,18 +499,14 @@ buf_dblwr_process()
|
|||||||
{
|
{
|
||||||
ulint page_no_dblwr = 0;
|
ulint page_no_dblwr = 0;
|
||||||
byte* read_buf;
|
byte* read_buf;
|
||||||
byte* unaligned_read_buf;
|
|
||||||
recv_dblwr_t& recv_dblwr = recv_sys.dblwr;
|
recv_dblwr_t& recv_dblwr = recv_sys.dblwr;
|
||||||
|
|
||||||
if (!buf_dblwr) {
|
if (!buf_dblwr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unaligned_read_buf = static_cast<byte*>(
|
|
||||||
ut_malloc_nokey(3U << srv_page_size_shift));
|
|
||||||
|
|
||||||
read_buf = static_cast<byte*>(
|
read_buf = static_cast<byte*>(
|
||||||
ut_align(unaligned_read_buf, srv_page_size));
|
aligned_malloc(2 * srv_page_size, srv_page_size));
|
||||||
byte* const buf = read_buf + srv_page_size;
|
byte* const buf = read_buf + srv_page_size;
|
||||||
|
|
||||||
for (recv_dblwr_t::list::iterator i = recv_dblwr.pages.begin();
|
for (recv_dblwr_t::list::iterator i = recv_dblwr.pages.begin();
|
||||||
@ -687,7 +662,7 @@ bad:
|
|||||||
recv_dblwr.pages.clear();
|
recv_dblwr.pages.clear();
|
||||||
|
|
||||||
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
|
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
|
||||||
ut_free(unaligned_read_buf);
|
aligned_free(read_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************//**
|
/****************************************************************//**
|
||||||
@ -702,15 +677,9 @@ buf_dblwr_free()
|
|||||||
|
|
||||||
os_event_destroy(buf_dblwr->b_event);
|
os_event_destroy(buf_dblwr->b_event);
|
||||||
os_event_destroy(buf_dblwr->s_event);
|
os_event_destroy(buf_dblwr->s_event);
|
||||||
ut_free(buf_dblwr->write_buf_unaligned);
|
aligned_free(buf_dblwr->write_buf);
|
||||||
buf_dblwr->write_buf_unaligned = NULL;
|
|
||||||
|
|
||||||
ut_free(buf_dblwr->buf_block_arr);
|
ut_free(buf_dblwr->buf_block_arr);
|
||||||
buf_dblwr->buf_block_arr = NULL;
|
|
||||||
|
|
||||||
ut_free(buf_dblwr->in_use);
|
ut_free(buf_dblwr->in_use);
|
||||||
buf_dblwr->in_use = NULL;
|
|
||||||
|
|
||||||
mutex_free(&buf_dblwr->mutex);
|
mutex_free(&buf_dblwr->mutex);
|
||||||
ut_free(buf_dblwr);
|
ut_free(buf_dblwr);
|
||||||
buf_dblwr = NULL;
|
buf_dblwr = NULL;
|
||||||
|
@ -1837,12 +1837,10 @@ dberr_t
|
|||||||
fil_write_flushed_lsn(
|
fil_write_flushed_lsn(
|
||||||
lsn_t lsn)
|
lsn_t lsn)
|
||||||
{
|
{
|
||||||
byte* buf1;
|
|
||||||
byte* buf;
|
byte* buf;
|
||||||
dberr_t err = DB_TABLESPACE_NOT_FOUND;
|
dberr_t err = DB_TABLESPACE_NOT_FOUND;
|
||||||
|
|
||||||
buf1 = static_cast<byte*>(ut_malloc_nokey(2U << srv_page_size_shift));
|
buf = static_cast<byte*>(aligned_malloc(srv_page_size, srv_page_size));
|
||||||
buf = static_cast<byte*>(ut_align(buf1, srv_page_size));
|
|
||||||
|
|
||||||
const page_id_t page_id(TRX_SYS_SPACE, 0);
|
const page_id_t page_id(TRX_SYS_SPACE, 0);
|
||||||
|
|
||||||
@ -1862,7 +1860,7 @@ fil_write_flushed_lsn(
|
|||||||
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
|
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(buf1);
|
aligned_free(buf);
|
||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2919,7 +2917,6 @@ fil_ibd_create(
|
|||||||
dberr_t* err)
|
dberr_t* err)
|
||||||
{
|
{
|
||||||
pfs_os_file_t file;
|
pfs_os_file_t file;
|
||||||
byte* buf2;
|
|
||||||
byte* page;
|
byte* page;
|
||||||
bool success;
|
bool success;
|
||||||
bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
|
bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
|
||||||
@ -2998,9 +2995,9 @@ err_exit:
|
|||||||
with zeros from the call of os_file_set_size(), until a buffer pool
|
with zeros from the call of os_file_set_size(), until a buffer pool
|
||||||
flush would write to it. */
|
flush would write to it. */
|
||||||
|
|
||||||
buf2 = static_cast<byte*>(ut_malloc_nokey(3U << srv_page_size_shift));
|
|
||||||
/* Align the memory for file i/o if we might have O_DIRECT set */
|
/* Align the memory for file i/o if we might have O_DIRECT set */
|
||||||
page = static_cast<byte*>(ut_align(buf2, srv_page_size));
|
page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
|
||||||
|
srv_page_size));
|
||||||
|
|
||||||
memset(page, '\0', srv_page_size);
|
memset(page, '\0', srv_page_size);
|
||||||
|
|
||||||
@ -3048,7 +3045,7 @@ err_exit:
|
|||||||
IORequestWrite, path, file, page, 0, srv_page_size);
|
IORequestWrite, path, file, page, 0, srv_page_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(buf2);
|
aligned_free(page);
|
||||||
|
|
||||||
if (*err != DB_SUCCESS) {
|
if (*err != DB_SUCCESS) {
|
||||||
ib::error()
|
ib::error()
|
||||||
|
@ -291,13 +291,10 @@ Datafile::read_first_page(bool read_only_mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_first_page_buf = static_cast<byte*>(
|
|
||||||
ut_malloc_nokey(2 * UNIV_PAGE_SIZE_MAX));
|
|
||||||
|
|
||||||
/* Align the memory for a possible read from a raw device */
|
/* Align the memory for a possible read from a raw device */
|
||||||
|
|
||||||
m_first_page = static_cast<byte*>(
|
m_first_page = static_cast<byte*>(
|
||||||
ut_align(m_first_page_buf, srv_page_size));
|
aligned_malloc(UNIV_PAGE_SIZE_MAX, srv_page_size));
|
||||||
|
|
||||||
IORequest request;
|
IORequest request;
|
||||||
dberr_t err = DB_ERROR;
|
dberr_t err = DB_ERROR;
|
||||||
@ -379,14 +376,10 @@ Datafile::read_first_page(bool read_only_mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Free the first page from memory when it is no longer needed. */
|
/** Free the first page from memory when it is no longer needed. */
|
||||||
void
|
void Datafile::free_first_page()
|
||||||
Datafile::free_first_page()
|
|
||||||
{
|
{
|
||||||
if (m_first_page_buf) {
|
aligned_free(m_first_page);
|
||||||
ut_free(m_first_page_buf);
|
m_first_page= nullptr;
|
||||||
m_first_page_buf = NULL;
|
|
||||||
m_first_page = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Validates the datafile and checks that it conforms with the expected
|
/** Validates the datafile and checks that it conforms with the expected
|
||||||
@ -514,7 +507,6 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
|
|||||||
|
|
||||||
error_txt = "Cannot read first page";
|
error_txt = "Cannot read first page";
|
||||||
} else {
|
} else {
|
||||||
ut_ad(m_first_page_buf);
|
|
||||||
ut_ad(m_first_page);
|
ut_ad(m_first_page);
|
||||||
|
|
||||||
if (flush_lsn != NULL) {
|
if (flush_lsn != NULL) {
|
||||||
@ -663,11 +655,8 @@ Datafile::find_space_id()
|
|||||||
<< "Page size:" << page_size
|
<< "Page size:" << page_size
|
||||||
<< ". Pages to analyze:" << page_count;
|
<< ". Pages to analyze:" << page_count;
|
||||||
|
|
||||||
byte* buf = static_cast<byte*>(
|
|
||||||
ut_malloc_nokey(2 * UNIV_PAGE_SIZE_MAX));
|
|
||||||
|
|
||||||
byte* page = static_cast<byte*>(
|
byte* page = static_cast<byte*>(
|
||||||
ut_align(buf, UNIV_SECTOR_SIZE));
|
aligned_malloc(page_size, page_size));
|
||||||
|
|
||||||
ulint fsp_flags;
|
ulint fsp_flags;
|
||||||
/* provide dummy value if the first os_file_read() fails */
|
/* provide dummy value if the first os_file_read() fails */
|
||||||
@ -684,19 +673,11 @@ Datafile::find_space_id()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (ulint j = 0; j < page_count; ++j) {
|
for (ulint j = 0; j < page_count; ++j) {
|
||||||
|
if (dberr_t err = os_file_read(
|
||||||
dberr_t err;
|
IORequestRead, m_handle, page,
|
||||||
ulint n_bytes = j * page_size;
|
j * page_size, page_size)) {
|
||||||
IORequest request(IORequest::READ);
|
|
||||||
|
|
||||||
err = os_file_read(
|
|
||||||
request, m_handle, page, n_bytes, page_size);
|
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
|
||||||
|
|
||||||
ib::info()
|
ib::info()
|
||||||
<< "READ FAIL: page_no:" << j;
|
<< "READ FAIL: page_no:" << j;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +723,7 @@ Datafile::find_space_id()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(buf);
|
aligned_free(page);
|
||||||
|
|
||||||
ib::info()
|
ib::info()
|
||||||
<< "Page size: " << page_size
|
<< "Page size: " << page_size
|
||||||
|
@ -687,7 +687,6 @@ inline uint buf_page_full_crc32_size(const byte* buf, bool* comp, bool* cr)
|
|||||||
return page_size;
|
return page_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
# ifdef UNIV_LINUX
|
# ifdef UNIV_LINUX
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# endif
|
# endif
|
||||||
@ -716,6 +715,7 @@ inline void aligned_free(void *ptr)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
/**********************************************************************//**
|
/**********************************************************************//**
|
||||||
Gets the hash value of a block. This can be used in searches in the
|
Gets the hash value of a block. This can be used in searches in the
|
||||||
lock hash table.
|
lock hash table.
|
||||||
|
@ -150,8 +150,6 @@ struct buf_dblwr_t{
|
|||||||
doublewrite buffer, aligned to an
|
doublewrite buffer, aligned to an
|
||||||
address divisible by srv_page_size
|
address divisible by srv_page_size
|
||||||
(which is required by Windows aio) */
|
(which is required by Windows aio) */
|
||||||
byte* write_buf_unaligned;/*!< pointer to write_buf,
|
|
||||||
but unaligned */
|
|
||||||
buf_page_t** buf_block_arr;/*!< array to store pointers to
|
buf_page_t** buf_block_arr;/*!< array to store pointers to
|
||||||
the buffer blocks which have been
|
the buffer blocks which have been
|
||||||
cached to write_buf */
|
cached to write_buf */
|
||||||
|
@ -61,7 +61,6 @@ public:
|
|||||||
m_flags(),
|
m_flags(),
|
||||||
m_exists(),
|
m_exists(),
|
||||||
m_is_valid(),
|
m_is_valid(),
|
||||||
m_first_page_buf(),
|
|
||||||
m_first_page(),
|
m_first_page(),
|
||||||
m_last_os_error(),
|
m_last_os_error(),
|
||||||
m_file_info()
|
m_file_info()
|
||||||
@ -83,7 +82,6 @@ public:
|
|||||||
m_flags(flags),
|
m_flags(flags),
|
||||||
m_exists(),
|
m_exists(),
|
||||||
m_is_valid(),
|
m_is_valid(),
|
||||||
m_first_page_buf(),
|
|
||||||
m_first_page(),
|
m_first_page(),
|
||||||
m_last_os_error(),
|
m_last_os_error(),
|
||||||
m_file_info()
|
m_file_info()
|
||||||
@ -103,7 +101,6 @@ public:
|
|||||||
m_flags(file.m_flags),
|
m_flags(file.m_flags),
|
||||||
m_exists(file.m_exists),
|
m_exists(file.m_exists),
|
||||||
m_is_valid(file.m_is_valid),
|
m_is_valid(file.m_is_valid),
|
||||||
m_first_page_buf(),
|
|
||||||
m_first_page(),
|
m_first_page(),
|
||||||
m_last_os_error(),
|
m_last_os_error(),
|
||||||
m_file_info()
|
m_file_info()
|
||||||
@ -162,7 +159,6 @@ public:
|
|||||||
|
|
||||||
/* Do not make a copy of the first page,
|
/* Do not make a copy of the first page,
|
||||||
it should be reread if needed */
|
it should be reread if needed */
|
||||||
m_first_page_buf = NULL;
|
|
||||||
m_first_page = NULL;
|
m_first_page = NULL;
|
||||||
|
|
||||||
return(*this);
|
return(*this);
|
||||||
@ -459,10 +455,7 @@ private:
|
|||||||
/* true if the tablespace is valid */
|
/* true if the tablespace is valid */
|
||||||
bool m_is_valid;
|
bool m_is_valid;
|
||||||
|
|
||||||
/** Buffer to hold first page */
|
/** Aligned buffer to hold first page */
|
||||||
byte* m_first_page_buf;
|
|
||||||
|
|
||||||
/** Pointer to the first page held in the buffer above */
|
|
||||||
byte* m_first_page;
|
byte* m_first_page;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -80,12 +80,8 @@ struct fts_psort_t {
|
|||||||
/*!< sort file */
|
/*!< sort file */
|
||||||
row_merge_block_t* merge_block[FTS_NUM_AUX_INDEX];
|
row_merge_block_t* merge_block[FTS_NUM_AUX_INDEX];
|
||||||
/*!< buffer to write to file */
|
/*!< buffer to write to file */
|
||||||
row_merge_block_t* block_alloc[FTS_NUM_AUX_INDEX];
|
|
||||||
/*!< buffer to allocated */
|
|
||||||
row_merge_block_t* crypt_block[FTS_NUM_AUX_INDEX];
|
row_merge_block_t* crypt_block[FTS_NUM_AUX_INDEX];
|
||||||
/*!< buffer to crypt data */
|
/*!< buffer to crypt data */
|
||||||
row_merge_block_t* crypt_alloc[FTS_NUM_AUX_INDEX];
|
|
||||||
/*!< buffer to allocated */
|
|
||||||
ulint child_status; /*!< child task status */
|
ulint child_status; /*!< child task status */
|
||||||
ulint state; /*!< parent state */
|
ulint state; /*!< parent state */
|
||||||
fts_doc_list_t fts_doc_list; /*!< doc list to process */
|
fts_doc_list_t fts_doc_list; /*!< doc list to process */
|
||||||
|
@ -633,8 +633,6 @@ typedef void* os_thread_ret_t;
|
|||||||
extern ulong srv_page_size_shift;
|
extern ulong srv_page_size_shift;
|
||||||
extern ulong srv_page_size;
|
extern ulong srv_page_size;
|
||||||
|
|
||||||
static const size_t UNIV_SECTOR_SIZE = 512;
|
|
||||||
|
|
||||||
/* Dimension of spatial object we support so far. It has its root in
|
/* Dimension of spatial object we support so far. It has its root in
|
||||||
myisam/sp_defs.h. We only support 2 dimension data */
|
myisam/sp_defs.h. We only support 2 dimension data */
|
||||||
#define SPDIMS 2
|
#define SPDIMS 2
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
|
Copyright (c) 2019, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -62,15 +63,6 @@ ut_uint64_align_up(
|
|||||||
ulint align_no); /*!< in: align by this number
|
ulint align_no); /*!< in: align by this number
|
||||||
which must be a power of 2 */
|
which must be a power of 2 */
|
||||||
/*********************************************************//**
|
/*********************************************************//**
|
||||||
The following function rounds up a pointer to the nearest aligned address.
|
|
||||||
@return aligned pointer */
|
|
||||||
UNIV_INLINE
|
|
||||||
void*
|
|
||||||
ut_align(
|
|
||||||
/*=====*/
|
|
||||||
const void* ptr, /*!< in: pointer */
|
|
||||||
ulint align_no); /*!< in: align by this number */
|
|
||||||
/*********************************************************//**
|
|
||||||
The following function rounds down a pointer to the nearest
|
The following function rounds down a pointer to the nearest
|
||||||
aligned address.
|
aligned address.
|
||||||
@return aligned pointer */
|
@return aligned pointer */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
|
Copyright (c) 2019, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -74,25 +75,6 @@ ut_uint64_align_up(
|
|||||||
return((n + align_1) & ~align_1);
|
return((n + align_1) & ~align_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************//**
|
|
||||||
The following function rounds up a pointer to the nearest aligned address.
|
|
||||||
@return aligned pointer */
|
|
||||||
UNIV_INLINE
|
|
||||||
void*
|
|
||||||
ut_align(
|
|
||||||
/*=====*/
|
|
||||||
const void* ptr, /*!< in: pointer */
|
|
||||||
ulint align_no) /*!< in: align by this number */
|
|
||||||
{
|
|
||||||
ut_ad(align_no > 0);
|
|
||||||
ut_ad(((align_no - 1) & align_no) == 0);
|
|
||||||
ut_ad(ptr);
|
|
||||||
|
|
||||||
ut_ad(sizeof(void*) == sizeof(ulint));
|
|
||||||
|
|
||||||
return((void*)((((ulint) ptr) + align_no - 1) & ~(align_no - 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************//**
|
/*********************************************************//**
|
||||||
The following function rounds down a pointer to the nearest
|
The following function rounds down a pointer to the nearest
|
||||||
aligned address.
|
aligned address.
|
||||||
|
@ -822,13 +822,13 @@ log_buffer_switch()
|
|||||||
|
|
||||||
if (log_sys.first_in_use) {
|
if (log_sys.first_in_use) {
|
||||||
log_sys.first_in_use = false;
|
log_sys.first_in_use = false;
|
||||||
ut_ad(log_sys.buf == ut_align(log_sys.buf,
|
ut_ad(log_sys.buf == ut_align_down(log_sys.buf,
|
||||||
OS_FILE_LOG_BLOCK_SIZE));
|
OS_FILE_LOG_BLOCK_SIZE));
|
||||||
log_sys.buf += srv_log_buffer_size;
|
log_sys.buf += srv_log_buffer_size;
|
||||||
} else {
|
} else {
|
||||||
log_sys.first_in_use = true;
|
log_sys.first_in_use = true;
|
||||||
log_sys.buf -= srv_log_buffer_size;
|
log_sys.buf -= srv_log_buffer_size;
|
||||||
ut_ad(log_sys.buf == ut_align(log_sys.buf,
|
ut_ad(log_sys.buf == ut_align_down(log_sys.buf,
|
||||||
OS_FILE_LOG_BLOCK_SIZE));
|
OS_FILE_LOG_BLOCK_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3627,12 +3627,8 @@ fallback:
|
|||||||
<< srv_page_size_shift;
|
<< srv_page_size_shift;
|
||||||
|
|
||||||
/* Align the buffer for possible raw i/o */
|
/* Align the buffer for possible raw i/o */
|
||||||
byte* buf2;
|
byte* buf = static_cast<byte*>(aligned_malloc(buf_size,
|
||||||
|
srv_page_size));
|
||||||
buf2 = static_cast<byte*>(ut_malloc_nokey(buf_size + srv_page_size));
|
|
||||||
|
|
||||||
byte* buf = static_cast<byte*>(ut_align(buf2, srv_page_size));
|
|
||||||
|
|
||||||
/* Write buffer full of zeros */
|
/* Write buffer full of zeros */
|
||||||
memset(buf, 0, buf_size);
|
memset(buf, 0, buf_size);
|
||||||
|
|
||||||
@ -3661,7 +3657,7 @@ fallback:
|
|||||||
current_size += n_bytes;
|
current_size += n_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(buf2);
|
aligned_free(buf);
|
||||||
|
|
||||||
return(current_size >= size && os_file_flush(file));
|
return(current_size >= size && os_file_flush(file));
|
||||||
}
|
}
|
||||||
@ -3959,13 +3955,13 @@ static bool is_linux_native_aio_supported()
|
|||||||
|
|
||||||
memset(&io_event, 0x0, sizeof(io_event));
|
memset(&io_event, 0x0, sizeof(io_event));
|
||||||
|
|
||||||
byte* buf = static_cast<byte*>(ut_malloc_nokey(srv_page_size * 2));
|
byte* ptr = static_cast<byte*>(aligned_malloc(srv_page_size,
|
||||||
byte* ptr = static_cast<byte*>(ut_align(buf, srv_page_size));
|
srv_page_size));
|
||||||
|
|
||||||
struct iocb iocb;
|
struct iocb iocb;
|
||||||
|
|
||||||
/* Suppress valgrind warning. */
|
/* Suppress valgrind warning. */
|
||||||
memset(buf, 0x00, srv_page_size * 2);
|
memset(ptr, 0, srv_page_size);
|
||||||
memset(&iocb, 0x0, sizeof(iocb));
|
memset(&iocb, 0x0, sizeof(iocb));
|
||||||
|
|
||||||
struct iocb* p_iocb = &iocb;
|
struct iocb* p_iocb = &iocb;
|
||||||
@ -3988,7 +3984,7 @@ static bool is_linux_native_aio_supported()
|
|||||||
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
|
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(buf);
|
aligned_free(ptr);
|
||||||
my_close(fd, MYF(MY_WME));
|
my_close(fd, MYF(MY_WME));
|
||||||
|
|
||||||
switch (err) {
|
switch (err) {
|
||||||
|
@ -3285,8 +3285,6 @@ page_zip_validate_low(
|
|||||||
TRUE=ignore the MIN_REC_FLAG */
|
TRUE=ignore the MIN_REC_FLAG */
|
||||||
{
|
{
|
||||||
page_zip_des_t temp_page_zip;
|
page_zip_des_t temp_page_zip;
|
||||||
byte* temp_page_buf;
|
|
||||||
page_t* temp_page;
|
|
||||||
ibool valid;
|
ibool valid;
|
||||||
|
|
||||||
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
|
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
|
||||||
@ -3309,9 +3307,8 @@ page_zip_validate_low(
|
|||||||
|
|
||||||
/* page_zip_decompress() expects the uncompressed page to be
|
/* page_zip_decompress() expects the uncompressed page to be
|
||||||
srv_page_size aligned. */
|
srv_page_size aligned. */
|
||||||
temp_page_buf = static_cast<byte*>(
|
page_t* temp_page = static_cast<byte*>(aligned_malloc(srv_page_size,
|
||||||
ut_malloc_nokey(2 << srv_page_size_shift));
|
srv_page_size));
|
||||||
temp_page = static_cast<byte*>(ut_align(temp_page_buf, srv_page_size));
|
|
||||||
|
|
||||||
UNIV_MEM_ASSERT_RW(page, srv_page_size);
|
UNIV_MEM_ASSERT_RW(page, srv_page_size);
|
||||||
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
|
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
|
||||||
@ -3467,7 +3464,7 @@ func_exit:
|
|||||||
page_zip_hexdump(page, srv_page_size);
|
page_zip_hexdump(page, srv_page_size);
|
||||||
page_zip_hexdump(temp_page, srv_page_size);
|
page_zip_hexdump(temp_page, srv_page_size);
|
||||||
}
|
}
|
||||||
ut_free(temp_page_buf);
|
aligned_free(temp_page);
|
||||||
return(valid);
|
return(valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,14 +252,9 @@ row_fts_psort_info_init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Need to align memory for O_DIRECT write */
|
/* Need to align memory for O_DIRECT write */
|
||||||
psort_info[j].block_alloc[i] =
|
|
||||||
static_cast<row_merge_block_t*>(ut_malloc_nokey(
|
|
||||||
block_size + 1024));
|
|
||||||
|
|
||||||
psort_info[j].merge_block[i] =
|
psort_info[j].merge_block[i] =
|
||||||
static_cast<row_merge_block_t*>(
|
static_cast<row_merge_block_t*>(
|
||||||
ut_align(
|
aligned_malloc(block_size, 1024));
|
||||||
psort_info[j].block_alloc[i], 1024));
|
|
||||||
|
|
||||||
if (!psort_info[j].merge_block[i]) {
|
if (!psort_info[j].merge_block[i]) {
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
@ -269,23 +264,17 @@ row_fts_psort_info_init(
|
|||||||
/* If tablespace is encrypted, allocate additional buffer for
|
/* If tablespace is encrypted, allocate additional buffer for
|
||||||
encryption/decryption. */
|
encryption/decryption. */
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
|
|
||||||
/* Need to align memory for O_DIRECT write */
|
/* Need to align memory for O_DIRECT write */
|
||||||
psort_info[j].crypt_alloc[i] =
|
|
||||||
static_cast<row_merge_block_t*>(ut_malloc_nokey(
|
|
||||||
block_size + 1024));
|
|
||||||
|
|
||||||
psort_info[j].crypt_block[i] =
|
psort_info[j].crypt_block[i] =
|
||||||
static_cast<row_merge_block_t*>(
|
static_cast<row_merge_block_t*>(
|
||||||
ut_align(
|
aligned_malloc(block_size,
|
||||||
psort_info[j].crypt_alloc[i], 1024));
|
1024));
|
||||||
|
|
||||||
if (!psort_info[j].crypt_block[i]) {
|
if (!psort_info[j].crypt_block[i]) {
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
psort_info[j].crypt_alloc[i] = NULL;
|
|
||||||
psort_info[j].crypt_block[i] = NULL;
|
psort_info[j].crypt_block[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,12 +326,9 @@ row_fts_psort_info_destroy(
|
|||||||
psort_info[j].merge_file[i]);
|
psort_info[j].merge_file[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(psort_info[j].block_alloc[i]);
|
aligned_free(psort_info[j].merge_block[i]);
|
||||||
ut_free(psort_info[j].merge_file[i]);
|
ut_free(psort_info[j].merge_file[i]);
|
||||||
|
aligned_free(psort_info[j].crypt_block[i]);
|
||||||
if (psort_info[j].crypt_alloc[i]) {
|
|
||||||
ut_free(psort_info[j].crypt_alloc[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_free(&psort_info[j].mutex);
|
mutex_free(&psort_info[j].mutex);
|
||||||
|
@ -3656,11 +3656,10 @@ fil_tablespace_iterate(
|
|||||||
|
|
||||||
/* Allocate a page to read in the tablespace header, so that we
|
/* Allocate a page to read in the tablespace header, so that we
|
||||||
can determine the page size and zip_size (if it is compressed).
|
can determine the page size and zip_size (if it is compressed).
|
||||||
We allocate an extra page in case it is a compressed table. One
|
We allocate an extra page in case it is a compressed table. */
|
||||||
page is to ensure alignement. */
|
|
||||||
|
|
||||||
void* page_ptr = ut_malloc_nokey(3U << srv_page_size_shift);
|
byte* page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
|
||||||
byte* page = static_cast<byte*>(ut_align(page_ptr, srv_page_size));
|
srv_page_size));
|
||||||
|
|
||||||
buf_block_t* block = reinterpret_cast<buf_block_t*>
|
buf_block_t* block = reinterpret_cast<buf_block_t*>
|
||||||
(ut_zalloc_nokey(sizeof *block));
|
(ut_zalloc_nokey(sizeof *block));
|
||||||
@ -3712,20 +3711,16 @@ fil_tablespace_iterate(
|
|||||||
iter.n_io_buffers = n_io_buffers;
|
iter.n_io_buffers = n_io_buffers;
|
||||||
|
|
||||||
/* Add an extra page for compressed page scratch area. */
|
/* Add an extra page for compressed page scratch area. */
|
||||||
void* io_buffer = ut_malloc_nokey(
|
|
||||||
(2 + iter.n_io_buffers) << srv_page_size_shift);
|
|
||||||
|
|
||||||
iter.io_buffer = static_cast<byte*>(
|
iter.io_buffer = static_cast<byte*>(
|
||||||
ut_align(io_buffer, srv_page_size));
|
aligned_malloc((1 + iter.n_io_buffers)
|
||||||
|
<< srv_page_size_shift, srv_page_size));
|
||||||
|
|
||||||
void* crypt_io_buffer = NULL;
|
iter.crypt_io_buffer = iter.crypt_data
|
||||||
if (iter.crypt_data) {
|
? static_cast<byte*>(
|
||||||
crypt_io_buffer = ut_malloc_nokey(
|
aligned_malloc((1 + iter.n_io_buffers)
|
||||||
(2 + iter.n_io_buffers)
|
<< srv_page_size_shift,
|
||||||
<< srv_page_size_shift);
|
srv_page_size))
|
||||||
iter.crypt_io_buffer = static_cast<byte*>(
|
: NULL;
|
||||||
ut_align(crypt_io_buffer, srv_page_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block->page.zip.ssize) {
|
if (block->page.zip.ssize) {
|
||||||
ut_ad(iter.n_io_buffers == 1);
|
ut_ad(iter.n_io_buffers == 1);
|
||||||
@ -3739,8 +3734,8 @@ fil_tablespace_iterate(
|
|||||||
fil_space_destroy_crypt_data(&iter.crypt_data);
|
fil_space_destroy_crypt_data(&iter.crypt_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(crypt_io_buffer);
|
aligned_free(iter.crypt_io_buffer);
|
||||||
ut_free(io_buffer);
|
aligned_free(iter.io_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == DB_SUCCESS) {
|
if (err == DB_SUCCESS) {
|
||||||
@ -3756,7 +3751,7 @@ fil_tablespace_iterate(
|
|||||||
|
|
||||||
os_file_close(file);
|
os_file_close(file);
|
||||||
|
|
||||||
ut_free(page_ptr);
|
aligned_free(page);
|
||||||
ut_free(filepath);
|
ut_free(filepath);
|
||||||
ut_free(block);
|
ut_free(block);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user