From e82e216e374739d7cab022a86b48498aa9c33ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 27 Nov 2018 14:49:20 +0200 Subject: 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. --- storage/innobase/fsp/fsp0space.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'storage/innobase/fsp/fsp0space.cc') 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); -- cgit v1.2.1