diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-27 14:49:20 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-27 14:49:39 +0200 |
commit | e82e216e374739d7cab022a86b48498aa9c33ad5 (patch) | |
tree | 1833233b74ad6cc5378f49a8b92b6417bb76332a /storage/innobase/fsp | |
parent | eb6364619ff807645230479bf7d2eb87d1a4edb4 (diff) | |
download | mariadb-git-e82e216e374739d7cab022a86b48498aa9c33ad5.tar.gz |
MDEV-17849 Undo tablespace truncation recovery fails to shrink file
fil_space_t::add(): Replaces fil_node_create(), fil_node_create_low().
Let the caller pass fil_node_t::handle, to avoid having to close and
re-open files.
fil_node_t::read_page0(): Refactored from fil_node_open_file().
Read the first page of a data file.
fil_node_open_file(): Open the file only once.
srv_undo_tablespace_open(): Set the file handle for the opened
undo tablespace. This should ensure that ut_ad(file->is_open())
no longer fails in recv_add_trim().
xtrabackup_backup_func(): Remove some dead code.
xb_fil_cur_open(): Open files only if needed. Undo tablespaces
should already have been opened.
Diffstat (limited to 'storage/innobase/fsp')
-rw-r--r-- | storage/innobase/fsp/fsp0space.cc | 13 | ||||
-rw-r--r-- | storage/innobase/fsp/fsp0sysspace.cc | 14 |
2 files changed, 10 insertions, 17 deletions
diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index df234f7274e..88b34be4952 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -123,18 +123,15 @@ Tablespace::open_or_create(bool is_temp) is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, NULL); + if (!space) { + return DB_ERROR; + } } ut_a(fil_validate()); - /* Create the tablespace node entry for this data file. */ - if (!fil_node_create( - it->m_filepath, it->m_size, space, false, - TRUE)) { - - err = DB_ERROR; - break; - } + space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size, + false, true); } return(err); diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index baf864bc1c3..b856bf3da74 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -918,6 +918,9 @@ SysTablespace::open_or_create( name(), space_id(), flags(), is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, NULL); + if (!space) { + return DB_ERROR; + } } ut_a(fil_validate()); @@ -928,15 +931,8 @@ SysTablespace::open_or_create( : m_last_file_size_max) : it->m_size); - /* Add the datafile to the fil_system cache. */ - if (!fil_node_create( - it->m_filepath, it->m_size, - space, it->m_type != SRV_NOT_RAW, - TRUE, max_size)) { - - err = DB_ERROR; - break; - } + space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size, + it->m_type != SRV_NOT_RAW, true, max_size); } return(err); |