/* --------------------------------------------- ./storage/innobase/fil/fil0fil.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/fil/fil0fil.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/fil/fil0fil.cc 2023-08-02 01:45:09.205000000 +0800 @@ -751,6 +751,11 @@ size_bytes = os_file_get_size(node->handle); ut_a(size_bytes != (os_offset_t) -1); + if(size_bytes < UNIV_PAGE_SIZE or size_bytes % UNIV_PAGE_SIZE!=0){ + ib::error() << "File '"<< node->name <<"': should be " << UNIV_PAGE_SIZE <<" bytes or multiples," + " But size of file only "<id == 0) { node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE); @@ -773,6 +778,7 @@ success = os_file_read( request, + node->name, node->handle, page, 0, UNIV_PAGE_SIZE); space_id = fsp_header_get_space_id(page); @@ -6374,6 +6383,7 @@ os_offset_t offset; ulint page_no = 0; ulint space_id = callback.get_space_id(); + const char* name = callback.m_filepath; ulint n_bytes = iter.n_io_buffers * iter.page_size; ut_ad(!srv_read_only_mode); @@ -6433,7 +6443,7 @@ } err = os_file_read( - read_request, iter.file, io_buffer, offset, + read_request, name, iter.file, io_buffer, offset, (ulint) n_bytes); if (err != DB_SUCCESS) { @@ -6602,7 +6612,7 @@ IORequest request(IORequest::READ); - err = os_file_read(request, file, page, 0, UNIV_PAGE_SIZE); + err = os_file_read(request, filepath, file, page, 0, UNIV_PAGE_SIZE); if (err != DB_SUCCESS) { /* --------------------------------------------- ./storage/innobase/include/os0file.h ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/include/os0file.h 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/include/os0file.h 2023-08-02 06:31:29.699000000 +0800 @@ -1292,12 +1292,12 @@ n, read_only, message1, message2, space_id, \ trx, should_buffer, __FILE__, __LINE__) -# define os_file_read_pfs(type, file, buf, offset, n) \ - pfs_os_file_read_func(type, file, buf, offset, n, NULL, \ +# define os_file_read_pfs(type, name, file, buf, offset, n) \ + pfs_os_file_read_func(type, name, file, buf, offset, n, NULL, \ __FILE__, __LINE__) -# define os_file_read_trx_pfs(file, buf, offset, n, trx) \ - pfs_os_file_read_func(file, buf, offset, n, trx, \ +# define os_file_read_trx_pfs(file, name, buf, offset, n, trx) \ + pfs_os_file_read_func(file, name, buf, offset, n, trx, \ __FILE__, __LINE__) # define os_file_read_no_error_handling_pfs(type, file, buf, offset, n, o) \ @@ -1470,6 +1470,7 @@ dberr_t pfs_os_file_read_func( IORequest& type, + const char* name, pfs_os_file_t file, void* buf, os_offset_t offset, @@ -1751,8 +1752,8 @@ n, read_only, message1, message2, space_id, trx, \ should_buffer) -# define os_file_read_pfs(type, file, buf, offset, n) \ - os_file_read_func(type, file, buf, offset, n) +# define os_file_read_pfs(type, name, file, buf, offset, n) \ + os_file_read_func(type, name, file, buf, offset, n) # define os_file_read_no_error_handling_pfs(type, file, buf, offset, n, o) \ os_file_read_no_error_handling_func(type, file, buf, offset, n, o) @@ -1760,8 +1761,8 @@ # define os_file_read_no_error_handling_int_fd(type, file, buf, offset, n, o) \ os_file_read_no_error_handling_func(type, file, buf, offset, n, o) -# define os_file_read_trx_pfs(file, buf, offset, n, trx) \ - os_file_read_func(file, buf, offset, n, trx) +# define os_file_read_trx_pfs(file, name, buf, offset, n, trx) \ + os_file_read_func(file, name, buf, offset, n, trx) # define os_file_write_pfs(type, name, file, buf, offset, n) \ os_file_write_func(type, name, file, buf, offset, n) @@ -1799,11 +1800,11 @@ #endif #ifdef UNIV_PFS_IO - #define os_file_read(type, file, buf, offset, n) \ - os_file_read_pfs(type, file, buf, offset, n) + #define os_file_read(type, name, file, buf, offset, n) \ + os_file_read_pfs(type, name, file, buf, offset, n) #else - #define os_file_read(type, file, buf, offset, n) \ - os_file_read_pfs(type, file.m_file, buf, offset, n) + #define os_file_read(type, name, file, buf, offset, n) \ + os_file_read_pfs(type, name, file.m_file, buf, offset, n) #endif #ifdef UNIV_PFS_IO @@ -1945,6 +1946,7 @@ dberr_t os_file_read_func( IORequest& type, + const char* name, os_file_t file, void* buf, os_offset_t offset, /* --------------------------------------------- ./storage/innobase/include/os0file.ic ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/include/os0file.ic 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/include/os0file.ic 2023-08-02 01:03:32.562000000 +0800 @@ -315,6 +315,7 @@ dberr_t pfs_os_file_read_func( IORequest& type, + const char* name, pfs_os_file_t file, void* buf, os_offset_t offset, @@ -333,7 +334,7 @@ dberr_t result; - result = os_file_read_func(type, file.m_file, buf, offset, n, trx); + result = os_file_read_func(type, name, file.m_file, buf, offset, n, trx); register_pfs_file_io_end(locker, n); /* --------------------------------------------- ./storage/innobase/trx/trx0purge.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/trx/trx0purge.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/trx/trx0purge.cc 2023-08-02 01:37:31.320000000 +0800 @@ -857,7 +857,7 @@ dberr_t err; - err = os_file_read(request, handle, log_buf, 0, sz); + err = os_file_read(request, log_file_name,handle, log_buf, 0, sz); os_file_close(handle); /* --------------------------------------------- ./storage/innobase/fsp/fsp0fsp.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/fsp/fsp0fsp.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/fsp/fsp0fsp.cc 2023-08-01 20:08:33.073000000 +0800 @@ -2463,6 +2463,12 @@ fseg_inode_t* inode = fseg_inode_try_get(header, space, page_size, mtr, block); + if(!inode){ + ib::error() << "Tried to read inode for tablespace " << space + << ", but was only able to read NULL. Check the tablespace state according to innodb_sys_tables."; + } + + SRV_CORRUPT_TABLE_CHECK(inode, ; /* do nothing */); return(inode); /* --------------------------------------------- ./storage/innobase/fsp/fsp0file.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/fsp/fsp0file.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/fsp/fsp0file.cc 2023-08-02 01:20:01.585000000 +0800 @@ -763,7 +763,7 @@ IORequest request(IORequest::READ); err = os_file_read( - request, m_handle, page, n_bytes, page_size); + request, m_filepath, m_handle, page, n_bytes, page_size); if (err == DB_IO_DECOMPRESS_FAIL) { @@ -776,6 +776,7 @@ err = os_file_read( request, + m_filepath, m_handle, page, page_size, UNIV_PAGE_SIZE_MAX); /* --------------------------------------------- ./storage/innobase/log/log0online.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/log/log0online.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/log/log0online.cc 2023-08-02 01:35:31.582000000 +0800 @@ -291,7 +291,7 @@ ut_a(bitmap_file->offset % MODIFIED_PAGE_BLOCK_SIZE == 0); IORequest io_request(IORequest::LOG | IORequest::READ); - success = os_file_read(io_request, bitmap_file->file, page, + success = os_file_read(io_request, bitmap_file->name,bitmap_file->file, page, bitmap_file->offset, MODIFIED_PAGE_BLOCK_SIZE); if (UNIV_UNLIKELY(!success)) { /* --------------------------------------------- ./storage/innobase/os/os0file.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/os/os0file.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/os/os0file.cc 2023-07-31 17:41:21.195000000 +0800 @@ -5909,6 +5911,7 @@ dberr_t os_file_read_page( IORequest& type, + const char* name, os_file_t file, void* buf, os_offset_t offset, @@ -5960,12 +5963,12 @@ if (exit_on_err) { - if (!os_file_handle_error(NULL, "read")) { + if (!os_file_handle_error(name, "read")) { /* Hard error */ break; } - } else if (!os_file_handle_error_no_exit(NULL, "read", false)) { + } else if (!os_file_handle_error_no_exit(name, "read", false)) { /* Hard error */ break; @@ -6321,6 +6324,7 @@ dberr_t os_file_read_func( IORequest& type, + const char* name, os_file_t file, void* buf, os_offset_t offset, @@ -6330,7 +6334,7 @@ ut_ad(type.is_read()); ut_ad(!trx || trx->take_stats); - return(os_file_read_page(type, file, buf, offset, n, NULL, true, trx)); + return(os_file_read_page(type, name, file, buf, offset, n, NULL, true, trx)); } /** NOTE! Use the corresponding macro os_file_read_no_error_handling(), @@ -6355,7 +6359,7 @@ { ut_ad(type.is_read()); - return(os_file_read_page(type, file, buf, offset, n, o, false, NULL)); + return(os_file_read_page(type, NULL, file, buf, offset, n, o, false, NULL)); } /** NOTE! Use the corresponding macro os_file_write(), not directly @@ -7759,7 +7763,7 @@ and os_file_write_func() */ if (type.is_read()) { - return(os_file_read_func(type, file.m_file, buf, + return(os_file_read_func(type, name, file.m_file, buf, offset, n, trx)); } @@ -8102,6 +8106,7 @@ { dberr_t err = os_file_read_func( slot->type, + slot->name, slot->file.m_file, slot->ptr, slot->offset, /* --------------------------------------------- ./storage/innobase/buf/buf0dblwr.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/buf/buf0dblwr.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/buf/buf0dblwr.cc 2023-08-02 01:08:41.742000000 +0800 @@ -489,6 +489,7 @@ err = os_file_read( read_request, + NULL, file, read_buf, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE, UNIV_PAGE_SIZE); @@ -536,6 +537,7 @@ /* Read the pages from the doublewrite buffer to memory */ err = os_file_read( read_request, + NULL, file, buf, block1 * UNIV_PAGE_SIZE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE); @@ -552,6 +554,7 @@ err = os_file_read( read_request, + NULL, file, buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE, block2 * UNIV_PAGE_SIZE, @@ -708,7 +711,7 @@ (ut_align(parallel_dblwr_buf.recovery_buf_unaligned, UNIV_PAGE_SIZE)); - err = os_file_read(read_request, parallel_dblwr_buf.file, + err = os_file_read(read_request,NULL, parallel_dblwr_buf.file, recovery_buf, 0, size); if (err != DB_SUCCESS) { ib::error() << "Failed to read the parallel " /* --------------------------------------------- ./storage/innobase/row/row0mysql.cc ---------------------------------------------*/ --- ../orig_code/percona-server-5.7.21-20/./storage/innobase/row/row0mysql.cc 2018-02-16 15:57:38.000000000 +0800 +++ ./storage/innobase/row/row0mysql.cc 2023-08-04 10:21:04.030000000 +0800 @@ -5298,6 +5298,10 @@ remove the ibd file for this. */ if (is_discarded || !is_encrypted || !ibd_file_missing) { + if (!is_system_tablespace(space_id)){ + ib::error() << "File: '"<(ut_align(buf, UNIV_PAGE_SIZE)); do { - err = os_file_read(request, handle, log_buf, 0, sz); + err = os_file_read(request,log_file_name, handle, log_buf, 0, sz); if (err != DB_SUCCESS) { os_file_close(handle);