summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-07-20 17:35:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-07-20 17:35:03 +0300
commited0a7b1b3fe6874acc5c18763b765c428709ac22 (patch)
treede2e076b4037b158a96305acf9dd26deb56225e2
parent68694c8ed98b0c9b1c98a11fd629d56220221152 (diff)
downloadmariadb-git-ed0a7b1b3fe6874acc5c18763b765c428709ac22.tar.gz
MDEV-24626 fixup: Remove useless code
fil_ibd_create(): Remove code that should have been removed in commit 86dc7b4d4cfe15a2d37f8b5f60c4fce5dba9491d 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.)
-rw-r--r--extra/mariabackup/xtrabackup.cc47
-rw-r--r--storage/innobase/fil/fil0crypt.cc27
-rw-r--r--storage/innobase/fil/fil0fil.cc26
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc20
-rw-r--r--storage/innobase/include/fil0crypt.h6
-rw-r--r--storage/innobase/include/fsp0fsp.h13
6 files changed, 1 insertions, 138 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 21f27c0c8ed..0b0cd5f55e3 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -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;
}
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index a0b4b45287f..82c26b59675 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -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 */
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index c841eb79497..3ebf0cc04dc 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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) {
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index c35ac118e05..8477e74c5f1 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -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
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index eb63c5cf427..29a76defec1 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -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 */
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 10765852529..51333cb5955 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -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