diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 13:00:48 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 13:00:48 +0200 |
commit | f5ff7d09c73b5527cb6e0540cd470db9d8a82108 (patch) | |
tree | 23728ff9752891cb78060ed748a3fc8bb7381c40 /storage | |
parent | 0eabc285a3c0cf0285d569a29c549634238fbdae (diff) | |
parent | 9ba385a50d0cd611fce61462fc3e03e82b1ffee9 (diff) | |
download | mariadb-git-f5ff7d09c73b5527cb6e0540cd470db9d8a82108.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.cc | 29 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 73 | ||||
-rw-r--r-- | storage/innobase/sync/sync0debug.cc | 10 |
4 files changed, 40 insertions, 76 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9143af5dbbf..07076f0660c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2751,7 +2751,7 @@ innobase_trx_init( while holding lock_sys.mutex, by lock_rec_enqueue_waiting(), will not end up acquiring LOCK_global_system_variables in intern_sys_var_ptr(). */ - THDVAR(thd, lock_wait_timeout); + (void) THDVAR(thd, lock_wait_timeout); trx->check_foreigns = !thd_test_options( thd, OPTION_NO_FOREIGN_KEY_CHECKS); @@ -15979,7 +15979,7 @@ struct ShowStatus { }; /** Order by m_waits, in descending order. */ - struct OrderByWaits: public std::binary_function<Value, Value, bool> + struct OrderByWaits { /** @return true if rhs < lhs */ bool operator()( diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 8a166398f66..d21c0cefec0 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6711,6 +6711,9 @@ static ST_FIELD_INFO innodb_sys_tablespaces_fields_info[]= END_OF_ST_FIELD_INFO }; + +extern size_t os_file_get_fs_block_size(const char *path); + /**********************************************************************//** Function to fill INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES with information collected by scanning SYS_TABLESPACESS table. @@ -6775,11 +6778,10 @@ i_s_dict_fill_sys_tablespaces( OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( fil_space_t::physical_size(cflags), true)); - os_file_stat_t stat; + size_t fs_block_size = 0; os_file_size_t file; memset(&file, 0xff, sizeof(file)); - memset(&stat, 0x0, sizeof(stat)); if (fil_space_t* s = fil_space_acquire_silent(space)) { const char *filepath = s->chain.start @@ -6789,36 +6791,19 @@ i_s_dict_fill_sys_tablespaces( } file = os_file_get_size(filepath); - - /* Get the file system (or Volume) block size. */ - switch (dberr_t err = os_file_get_status(filepath, &stat, - false, false)) { - case DB_FAIL: - ib::warn() - << "File '" << filepath << "', failed to get " - << "stats"; - break; - - case DB_SUCCESS: - case DB_NOT_FOUND: - break; - - default: - ib::error() << "File '" << filepath << "' " << err; - break; - } + fs_block_size= os_file_get_fs_block_size(filepath); file_done: s->release(); } if (file.m_total_size == static_cast<os_offset_t>(~0)) { - stat.block_size = 0; + fs_block_size = 0; file.m_total_size = 0; file.m_alloc_size = 0; } - OK(fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->store(stat.block_size, true)); + OK(fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->store(fs_block_size, true)); OK(fields[SYS_TABLESPACES_FILE_SIZE]->store(file.m_total_size, true)); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 5903fca86b6..a7b6eb57a22 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -4351,48 +4351,6 @@ os_file_get_status_win32( CloseHandle(fh); } } - stat_info->block_size = 0; - - /* What follows, is calculation of FS block size, which is not important - (it is just shown in I_S innodb tables). The error to calculate it will be ignored.*/ - char volname[MAX_PATH]; - BOOL result = GetVolumePathName(path, volname, MAX_PATH); - static bool warned_once = false; - if (!result) { - if (!warned_once) { - ib::warn() - << "os_file_get_status_win32: " - << "Failed to get the volume path name for: " - << path - << "- OS error number " << GetLastError(); - warned_once = true; - } - return(DB_SUCCESS); - } - - DWORD sectorsPerCluster; - DWORD bytesPerSector; - DWORD numberOfFreeClusters; - DWORD totalNumberOfClusters; - - result = GetDiskFreeSpace( - (LPCSTR) volname, - §orsPerCluster, - &bytesPerSector, - &numberOfFreeClusters, - &totalNumberOfClusters); - - if (!result) { - if (!warned_once) { - ib::warn() - << "GetDiskFreeSpace(" << volname << ",...) " - << "failed " - << "- OS error number " << GetLastError(); - warned_once = true; - } - return(DB_SUCCESS); - } - stat_info->block_size = bytesPerSector * sectorsPerCluster; } else { stat_info->type = OS_FILE_TYPE_UNKNOWN; } @@ -5284,6 +5242,35 @@ IORequest::punch_hole(os_file_t fh, os_offset_t off, ulint len) return (err); } +/* + Get file system block size, by path. + + This is expensive on Windows, and not very useful in general, + (only shown in some I_S table), so we keep that out of usual + stat. +*/ +size_t os_file_get_fs_block_size(const char *path) +{ +#ifdef _WIN32 + char volname[MAX_PATH]; + if (!GetVolumePathName(path, volname, MAX_PATH)) + return 0; + DWORD sectorsPerCluster; + DWORD bytesPerSector; + DWORD numberOfFreeClusters; + DWORD totalNumberOfClusters; + + if (GetDiskFreeSpace(volname, §orsPerCluster, &bytesPerSector, + &numberOfFreeClusters, &totalNumberOfClusters)) + return ((size_t) bytesPerSector) * sectorsPerCluster; +#else + os_file_stat_t info; + if (os_file_get_status(path, &info, false, false) == DB_SUCCESS) + return info.block_size; +#endif + return 0; +} + /** This function returns information about the specified file @param[in] path pathname of the file @param[out] stat_info information of a file in a directory diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index a00c9cef5af..377adc5b009 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -101,10 +101,6 @@ struct LatchDebug { /** Comparator for the ThreadMap. */ struct os_thread_id_less - : public std::binary_function< - os_thread_id_t, - os_thread_id_t, - bool> { /** @return true if lhs < rhs */ bool operator()( @@ -390,10 +386,6 @@ private: private: /** Comparator for the Levels . */ struct latch_level_less - : public std::binary_function< - latch_level_t, - latch_level_t, - bool> { /** @return true if lhs < rhs */ bool operator()( |