mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-24626 fixup: Remove useless code
fil_ibd_create(): Remove code that should have been removed in
commit 86dc7b4d4c
already.
We no longer wrote an initialized page to the file, but we would
still allocate a page image in memory and write it.
xb_space_create_file(): Remove an unnecessary page write.
(This is a functional change for Mariabackup.)
This commit is contained in:
parent
68694c8ed9
commit
ed0a7b1b3f
6 changed files with 1 additions and 138 deletions
|
@ -4909,53 +4909,6 @@ xb_space_create_file(
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Align the memory for file i/o if we might have O_DIRECT set */
|
||||
byte* page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
|
||||
srv_page_size));
|
||||
|
||||
memset(page, '\0', srv_page_size);
|
||||
|
||||
fsp_header_init_fields(page, space_id, flags);
|
||||
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
|
||||
|
||||
const ulint zip_size = fil_space_t::zip_size(flags);
|
||||
|
||||
if (!zip_size) {
|
||||
buf_flush_init_for_writing(
|
||||
NULL, page, NULL,
|
||||
fil_space_t::full_crc32(flags));
|
||||
|
||||
ret = os_file_write(IORequestWrite, path, *file, page, 0,
|
||||
srv_page_size);
|
||||
} else {
|
||||
page_zip_des_t page_zip;
|
||||
page_zip_set_size(&page_zip, zip_size);
|
||||
page_zip.data = page + srv_page_size;
|
||||
fprintf(stderr, "zip_size = " ULINTPF "\n", zip_size);
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
page_zip.m_start = 0;
|
||||
#endif /* UNIV_DEBUG */
|
||||
page_zip.m_end = 0;
|
||||
page_zip.m_nonempty = 0;
|
||||
page_zip.n_blobs = 0;
|
||||
|
||||
buf_flush_init_for_writing(NULL, page, &page_zip, false);
|
||||
|
||||
ret = os_file_write(IORequestWrite, path, *file,
|
||||
page_zip.data, 0, zip_size);
|
||||
}
|
||||
|
||||
aligned_free(page);
|
||||
|
||||
if (ret != DB_SUCCESS) {
|
||||
msg("mariabackup: could not write the first page to %s",
|
||||
path);
|
||||
os_file_close(*file);
|
||||
os_file_delete(0, path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -372,33 +372,6 @@ void fil_crypt_parse(fil_space_t* space, const byte* data)
|
|||
}
|
||||
}
|
||||
|
||||
/** Fill crypt data information to the give page.
|
||||
It should be called during ibd file creation.
|
||||
@param[in] flags tablespace flags
|
||||
@param[in,out] page first page of the tablespace */
|
||||
void
|
||||
fil_space_crypt_t::fill_page0(
|
||||
ulint flags,
|
||||
byte* page)
|
||||
{
|
||||
const uint len = sizeof(iv);
|
||||
const ulint offset = FSP_HEADER_OFFSET
|
||||
+ fsp_header_get_encryption_offset(
|
||||
fil_space_t::zip_size(flags));
|
||||
|
||||
memcpy(page + offset, CRYPT_MAGIC, MAGIC_SZ);
|
||||
mach_write_to_1(page + offset + MAGIC_SZ, type);
|
||||
mach_write_to_1(page + offset + MAGIC_SZ + 1, len);
|
||||
memcpy(page + offset + MAGIC_SZ + 2, &iv, len);
|
||||
|
||||
mach_write_to_4(page + offset + MAGIC_SZ + 2 + len,
|
||||
min_key_version);
|
||||
mach_write_to_4(page + offset + MAGIC_SZ + 2 + len + 4,
|
||||
key_id);
|
||||
mach_write_to_1(page + offset + MAGIC_SZ + 2 + len + 8,
|
||||
encryption);
|
||||
}
|
||||
|
||||
/** Write encryption metadata to the first page.
|
||||
@param[in,out] block first page of the tablespace
|
||||
@param[in,out] mtr mini-transaction */
|
||||
|
|
|
@ -1962,7 +1962,6 @@ fil_ibd_create(
|
|||
dberr_t* err)
|
||||
{
|
||||
pfs_os_file_t file;
|
||||
byte* page;
|
||||
bool success;
|
||||
mtr_t mtr;
|
||||
bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
|
||||
|
@ -2043,43 +2042,18 @@ err_exit:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* We have to write the space id to the file immediately and flush the
|
||||
file to disk. This is because in crash recovery we must be aware what
|
||||
tablespaces exist and what are their space id's, so that we can apply
|
||||
the log records to the right file. It may take quite a while until
|
||||
buffer pool flush algorithms write anything to the file and flush it to
|
||||
disk. If we would not write here anything, the file would be filled
|
||||
with zeros from the call of os_file_set_size(), until a buffer pool
|
||||
flush would write to it. */
|
||||
|
||||
/* Align the memory for file i/o if we might have O_DIRECT set */
|
||||
page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
|
||||
srv_page_size));
|
||||
|
||||
memset(page, '\0', srv_page_size);
|
||||
|
||||
if (fil_space_t::full_crc32(flags)) {
|
||||
flags |= FSP_FLAGS_FCRC32_PAGE_SSIZE();
|
||||
} else {
|
||||
flags |= FSP_FLAGS_PAGE_SSIZE();
|
||||
}
|
||||
|
||||
fsp_header_init_fields(page, space_id, flags);
|
||||
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
|
||||
|
||||
/* Create crypt data if the tablespace is either encrypted or user has
|
||||
requested it to remain unencrypted. */
|
||||
crypt_data = (mode != FIL_ENCRYPTION_DEFAULT || srv_encrypt_tables)
|
||||
? fil_space_create_crypt_data(mode, key_id)
|
||||
: NULL;
|
||||
|
||||
if (crypt_data) {
|
||||
/* Write crypt data information in page0 while creating
|
||||
ibd file. */
|
||||
crypt_data->fill_page0(flags, page);
|
||||
}
|
||||
|
||||
aligned_free(page);
|
||||
fil_space_t::name_type space_name;
|
||||
|
||||
if (has_data_dir) {
|
||||
|
|
|
@ -525,26 +525,6 @@ void fil_space_t::modify_check(const mtr_t& mtr) const
|
|||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************//**
|
||||
Writes the space id and flags to a tablespace header. The flags contain
|
||||
row type, physical/compressed page size, and logical/uncompressed page
|
||||
size of the tablespace. */
|
||||
void
|
||||
fsp_header_init_fields(
|
||||
/*===================*/
|
||||
page_t* page, /*!< in/out: first page in the space */
|
||||
ulint space_id, /*!< in: space id */
|
||||
ulint flags) /*!< in: tablespace flags (FSP_SPACE_FLAGS) */
|
||||
{
|
||||
flags &= ~FSP_FLAGS_MEM_MASK;
|
||||
ut_a(fil_space_t::is_valid_flags(flags, space_id));
|
||||
|
||||
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page,
|
||||
space_id);
|
||||
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page,
|
||||
flags);
|
||||
}
|
||||
|
||||
/** Initialize a tablespace header.
|
||||
@param[in,out] space tablespace
|
||||
@param[in] size current size in blocks
|
||||
|
|
|
@ -172,12 +172,6 @@ struct fil_space_crypt_t : st_encryption_scheme
|
|||
return (encryption == FIL_ENCRYPTION_OFF);
|
||||
}
|
||||
|
||||
/** Fill crypt data information to the give page.
|
||||
It should be called during ibd file creation.
|
||||
@param[in] flags tablespace flags
|
||||
@param[in,out] page first page of the tablespace */
|
||||
void fill_page0(ulint flags, byte* page);
|
||||
|
||||
/** Write encryption metadata to the first page.
|
||||
@param[in,out] block first page of the tablespace
|
||||
@param[in,out] mtr mini-transaction */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2013, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2021, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -342,17 +342,6 @@ fsp_header_check_encryption_key(
|
|||
ulint fsp_flags,
|
||||
page_t* page);
|
||||
|
||||
/**********************************************************************//**
|
||||
Writes the space id and flags to a tablespace header. The flags contain
|
||||
row type, physical/compressed page size, and logical/uncompressed page
|
||||
size of the tablespace. */
|
||||
void
|
||||
fsp_header_init_fields(
|
||||
/*===================*/
|
||||
page_t* page, /*!< in/out: first page in the space */
|
||||
ulint space_id, /*!< in: space id */
|
||||
ulint flags); /*!< in: tablespace flags (FSP_SPACE_FLAGS):
|
||||
0, or table->flags if newer than COMPACT */
|
||||
/** Initialize a tablespace header.
|
||||
@param[in,out] space tablespace
|
||||
@param[in] size current size in blocks
|
||||
|
|
Loading…
Add table
Reference in a new issue