Browse Source

MDEV-27848: Remove unused wait/io/file/innodb/innodb_log_file

The performance_schema counter wait/io/file/innodb/innodb_log_file
is always reported as 0.

The way how redo log writes are being waited for was refactored in
commit 30ea63b7d2 by the introduction
of flush_lock and write_lock. Even before that change, all the
wait/io/file/innodb/ counters were always 0 in my tests.

Moreover, if the PMEM interface that was introduced in
commit 3daef523af
is being used, writes to the InnoDB log file will completely avoid
any system calls and performance_schema instrumentation.
In commit 685d958e38 also the reads
of the redo log (during recovery) would bypass any system calls.
pull/2022/head
Marko Mäkelä 4 years ago
parent
commit
f1beeb58e6
  1. 15
      extra/mariabackup/xtrabackup.cc
  2. 1
      storage/innobase/handler/ha_innodb.cc
  3. 6
      storage/innobase/include/log0log.h
  4. 1
      storage/innobase/include/os0file.h
  5. 12
      storage/innobase/log/log0recv.cc
  6. 1
      storage/innobase/os/os0file.cc
  7. 29
      storage/innobase/srv/srv0start.cc

15
extra/mariabackup/xtrabackup.cc

@ -2274,10 +2274,10 @@ static bool innodb_init()
bool ret;
const std::string ib_logfile0{get_log_file_path()};
os_file_delete_if_exists(innodb_log_file_key, ib_logfile0.c_str(), nullptr);
pfs_os_file_t file= os_file_create(innodb_log_file_key, ib_logfile0.c_str(),
OS_FILE_CREATE, OS_FILE_NORMAL,
OS_DATA_FILE_NO_O_DIRECT, false, &ret);
os_file_delete_if_exists_func(ib_logfile0.c_str(), nullptr);
os_file_t file= os_file_create_func(ib_logfile0.c_str(),
OS_FILE_CREATE, OS_FILE_NORMAL,
OS_DATA_FILE_NO_O_DIRECT, false, &ret);
if (!ret)
{
invalid_log:
@ -2298,13 +2298,12 @@ static bool innodb_init()
#ifdef _WIN32
DWORD len;
ret= WriteFile(os_file_t{file}, log_hdr_buf, sizeof log_hdr_buf,
ret= WriteFile(file, log_hdr_buf, sizeof log_hdr_buf,
&len, nullptr) && len == sizeof log_hdr_buf;
#else
ret= sizeof log_hdr_buf == write(os_file_t{file}, log_hdr_buf,
sizeof log_hdr_buf);
ret= sizeof log_hdr_buf == write(file, log_hdr_buf, sizeof log_hdr_buf);
#endif
if (!os_file_close(file) || !ret)
if (!os_file_close_func(file) || !ret)
goto invalid_log;
return false;
}

1
storage/innobase/handler/ha_innodb.cc

@ -635,7 +635,6 @@ static PSI_thread_info all_innodb_threads[] = {
performance schema instrumented if "UNIV_PFS_IO" is defined */
static PSI_file_info all_innodb_files[] = {
PSI_KEY(innodb_data_file),
PSI_KEY(innodb_log_file),
PSI_KEY(innodb_temp_file)
};
# endif /* UNIV_PFS_IO */

6
storage/innobase/include/log0log.h

@ -55,7 +55,7 @@ std::string get_log_file_path(const char *filename= LOG_FILE_NAME);
static inline void delete_log_file(const char* suffix)
{
auto path = get_log_file_path(LOG_FILE_NAME_PREFIX).append(suffix);
os_file_delete_if_exists(innodb_log_file_key, path.c_str(), nullptr);
os_file_delete_if_exists_func(path.c_str(), nullptr);
}
struct completion_callback;
@ -128,10 +128,10 @@ struct log_t;
class log_file_t
{
friend log_t;
pfs_os_file_t m_file;
os_file_t m_file{OS_FILE_CLOSED};
public:
log_file_t()= default;
log_file_t(pfs_os_file_t file) noexcept : m_file(file) {}
log_file_t(os_file_t file) noexcept : m_file(file) {}
/** Open a file
@return file size in bytes

1
storage/innobase/include/os0file.h

@ -447,7 +447,6 @@ bool os_file_close_func(os_file_t file);
/* Keys to register InnoDB I/O with performance schema */
extern mysql_pfs_key_t innodb_data_file_key;
extern mysql_pfs_key_t innodb_log_file_key;
extern mysql_pfs_key_t innodb_temp_file_key;
/* Following four macros are instumentations to register

12
storage/innobase/log/log0recv.cc

@ -1639,10 +1639,10 @@ dberr_t recv_sys_t::find_checkpoint()
file_checkpoint= 0;
std::string path{get_log_file_path()};
bool success;
pfs_os_file_t file= os_file_create(innodb_log_file_key, path.c_str(),
os_file_t file{os_file_create_func(path.c_str(),
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_NORMAL, OS_LOG_FILE,
srv_read_only_mode, &success);
srv_read_only_mode, &success)};
if (file == OS_FILE_CLOSED)
return DB_ERROR;
const os_offset_t size{os_file_get_size(file)};
@ -1665,10 +1665,10 @@ dberr_t recv_sys_t::find_checkpoint()
for (int i= 1; i < 101; i++)
{
path= get_log_file_path(LOG_FILE_NAME_PREFIX).append(std::to_string(i));
file= os_file_create(innodb_log_file_key, path.c_str(),
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT |
OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE, true, &success);
file= os_file_create_func(path.c_str(),
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT |
OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE, true, &success);
if (file == OS_FILE_CLOSED)
break;
const os_offset_t sz{os_file_get_size(file)};

1
storage/innobase/os/os0file.cc

@ -166,7 +166,6 @@ extern uint page_zip_level;
#ifdef UNIV_PFS_IO
/* Keys to register InnoDB I/O with performance schema */
mysql_pfs_key_t innodb_data_file_key;
mysql_pfs_key_t innodb_log_file_key;
mysql_pfs_key_t innodb_temp_file_key;
#endif

29
storage/innobase/srv/srv0start.cc

@ -200,10 +200,11 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn)
std::string logfile0{get_log_file_path("ib_logfile101")};
bool ret;
pfs_os_file_t file = os_file_create(
innodb_log_file_key, logfile0.c_str(),
OS_FILE_CREATE|OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_NORMAL,
OS_LOG_FILE, srv_read_only_mode, &ret);
os_file_t file{
os_file_create_func(logfile0.c_str(),
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_NORMAL, OS_LOG_FILE, false, &ret)
};
if (!ret) {
sql_print_error("InnoDB: Cannot create %.*s",
@ -489,7 +490,7 @@ dberr_t
srv_check_undo_redo_logs_exists()
{
bool ret;
pfs_os_file_t fh;
os_file_t fh;
char name[OS_FILE_MAX_PATH];
/* Check if any undo tablespaces exist */
@ -497,8 +498,8 @@ srv_check_undo_redo_logs_exists()
snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dir, i);
fh = os_file_create(
innodb_data_file_key, name,
fh = os_file_create_func(
name,
OS_FILE_OPEN_RETRY
| OS_FILE_ON_ERROR_NO_EXIT
| OS_FILE_ON_ERROR_SILENT,
@ -508,7 +509,7 @@ srv_check_undo_redo_logs_exists()
&ret);
if (ret) {
os_file_close(fh);
os_file_close_func(fh);
ib::error()
<< "undo tablespace '" << name << "' exists."
" Creating system tablespace with existing undo"
@ -522,14 +523,14 @@ srv_check_undo_redo_logs_exists()
/* Check if redo log file exists */
auto logfilename = get_log_file_path();
fh = os_file_create(innodb_log_file_key, logfilename.c_str(),
OS_FILE_OPEN_RETRY | OS_FILE_ON_ERROR_NO_EXIT
| OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE, srv_read_only_mode,
&ret);
fh = os_file_create_func(logfilename.c_str(),
OS_FILE_OPEN_RETRY | OS_FILE_ON_ERROR_NO_EXIT
| OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE,
srv_read_only_mode, &ret);
if (ret) {
os_file_close(fh);
os_file_close_func(fh);
ib::error() << "redo log file '" << logfilename
<< "' exists. Creating system tablespace with"
" existing redo log file is not recommended."

Loading…
Cancel
Save