{"id":22626,"date":"2023-08-30T14:00:45","date_gmt":"2023-08-30T05:00:45","guid":{"rendered":"https:\/\/labs.gree.jp\/blog\/?p=22626"},"modified":"2023-08-30T14:02:20","modified_gmt":"2023-08-30T05:02:20","slug":"mysql8-0-27%e3%82%848-0-28%e3%81%82%e3%81%9f%e3%82%8a%e3%81%aememory-innodb-hash0hash%e3%82%84ut0new-h%e3%81%aa%e3%81%a9%e3%81%ae%e8%a9%b1","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2023\/08\/22626\/","title":{"rendered":"MySQL8.0.27\u30848.0.28\u3042\u305f\u308a\u306ememory\/innodb\/hash0hash\u3084ut0new.h\u306a\u3069\u306e\u8a71"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002\u305b\u3058\u307e\u3067\u3059\u3002<\/p>\n<p>\u5148\u65e5\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u3067\u65b0\u3057\u3044PC\u3092\u8cb7\u3063\u305f\u306e\u3067\u8a66\u3057\u306bVisual Studio 2022(version 17.7.2)\u3067MySQL8.0.34\u3092\u30c7\u30d0\u30c3\u30b0\u30d3\u30eb\u30c9\u3057\u3088\u3046\u3068\u601d\u3063\u305f\u3089\u3001sql_main \u304c<a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/error-messages\/compiler-errors-2\/compiler-error-c2678?view=msvc-170\">C2678<\/a>\u3067\u30d3\u30eb\u30c9\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u307e\u3057\u305f\uff082023-08-29\u6642\u70b9\uff09\u3002<\/p>\n<p>Hyper-V\u4e0a\u3067en_US\u306aWindows11\u958b\u767a\u74b0\u5883\u3092\u7acb\u3061\u4e0a\u3052\u3066\u8a66\u3057\u3066\u3082C2678\u304c\u767a\u751f\u3057\u305f\u306e\u3067\u3001\u65e5\u672c\u8a9e\u7248\u306eWindows\u306b\u9650\u3063\u305f\u554f\u984c\u3067\u3082\u306a\u3055\u305d\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u3002 <a href=\"https:\/\/developercommunity.visualstudio.com\/cpp?sort=newest&ftype=problem\">https:\/\/developercommunity.visualstudio.com\/<\/a> \u3092\u898b\u308b\u3068\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u5468\u308a\u3067 \"Fixed - Pending Release\" \u306a\u4ef6\u304c\u3044\u304f\u3064\u304b\u898b\u53d7\u3051\u3089\u308c\u305f\u306e\u3067\u3001\u3057\u3070\u3089\u304f\u69d8\u5b50\u898b\u3057\u3088\u3046\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>MySQL8.1.0\u30848.0.34\u3092\u30c7\u30d0\u30c3\u30b0\u30d3\u30eb\u30c9\u3059\u308b\u8a71\u3092\u66f8\u3053\u3046\u304b\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u5225\u306e\u8a71\u306b\u3057\u307e\u3059\u3002<\/p>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/performance-schema-memory-summary-tables.html\">performance_schema.memory_summary_global_by_event_name<\/a> \u3067<\/p>\n<pre class=\"lang:sql\"><code>SELECT * FROM memory_summary_global_by_event_name ORDER BY CURRENT_NUMBER_OF_BYTES_USED DESC LIMIT 10;<\/code><\/pre>\n<p>\u307f\u305f\u3044\u306aquery\u3092\u6295\u3052\u3066\u3001\u300cmemory\/innodb\/buf_buf_pool\u306f\u3068\u3082\u304b\u304fmemory\/innodb\/hash0hash\u306f\u4f55\u3060\uff1f\u300d\u3068\u601d\u3063\u305f\u3053\u3068\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u79c1\u306f\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>innodb_buffer_pool_size\u304c100GB\u304f\u3089\u3044\u306eDB\u306b\u306a\u308b\u3068\u3001memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u304cGB\u5358\u4f4d\u306b\u306a\u3063\u3066\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u3044\u3066\u3001mysqld\u306eResident set size\u306f memory\/innodb\/hash0hash \u306eCURRENT_NUMBER_OF_BYTES_USED\u5206\u3001\u8ffd\u52a0\u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u308b\u3088\u3046\u306b\u898b\u3048\u306a\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002mysqld\u3092\u9577\u671f\u9593\u7a3c\u50cd\u3055\u305b\u7d9a\u3051\u308b\u9593\u3001memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u306e\u5206\u304cmysqld\u306eResident set size\u306b\u7a4d\u307f\u4e0a\u304c\u3063\u3066\u304f\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3089\u3001\u305d\u308c\u304c\u3069\u3046\u3044\u3063\u305f\u30b1\u30fc\u30b9\u306b\u306a\u308b\u306e\u304b\u77e5\u308a\u305f\u3044\u3068\u3053\u308d\u3067\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001memory\/innodb\/hash0hash \u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u308b\u30e1\u30e2\u30ea\u3092\u8abf\u3079\u308b\u305f\u3081\u306b\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u5bfe\u8c61\u3068\u306a\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\uff08\u5177\u4f53\u7684\u306a\u7406\u7531\u306f\u5f8c\u8ff0\u3057\u307e\u3059\u304c\uff098.0.27 \u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u304a\u8a71\u306f\u3001malloc\u3068\u304b\u30da\u30fc\u30b8\u30d5\u30a9\u30eb\u30c8\u3068\u304b\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3068\u304b\u3001\u305d\u3046\u3044\u3063\u305f\u5358\u8a9e\u304c\u3067\u3066\u304d\u307e\u3059\u3002malloc\u306b\u3064\u3044\u3066\u306f\u304b\u306e\u9ad8\u540d\u306amalloc\u52d5\u753b\u3092\u8996\u8074\u3057\u3066\u3044\u305f\u3060\u3051\u3070\u3088\u3044\u304b\u3068\u5b58\u3058\u307e\u3059\u304c\u3001malloc\u4ee5\u5916\u306b\u3064\u3044\u3066\u3082\u4f55\u304b\u65e5\u672c\u8a9e\u306e\u60c5\u5831\u304c\u3042\u3063\u305f\u65b9\u304c\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u6700\u5f8c\u306b\u5c11\u3057References\u306e\u65b9\u306b\u8a18\u8f09\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u305d\u3061\u3089\u3082\u8aad\u3093\u3067\u3044\u305f\u3060\u304f\u3068\u3088\u308d\u3057\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>\u4e88\u3081\u96d1\u306a\u307e\u3068\u3081<\/h2>\n<p>\u66f8\u3044\u3066\u308b\u3046\u3061\u306b\u300c\u3051\u3063\u3053\u3046\u9577\u304f\u306a\u3063\u3066\u304d\u305f\u306a\u300d\u3068\u601d\u3063\u305f\u306e\u3067\u3001\u6700\u521d\u306b\u3056\u3063\u304f\u308a\u307e\u3068\u3081\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>MySQL8.0.27\u30848.0.28\u3042\u305f\u308a\u306ememory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u306f\u3001\u624b\u5143\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u78ba\u8a8d\u3057\u305f\u3068\u3053\u308d\u3001innodb_buffer_pool_size\u306e3%\u304f\u3089\u3044\u306b\u306a\u3063\u3066\u307e\u3057\u305f\u3002<\/li>\n<li>memory\/innodb\/hash0hash\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u30e1\u30e2\u30ea\u306fstd::malloc()\u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3067\u7269\u7406\u30e1\u30e2\u30ea\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002\n<ul>\n<li>\u6545\u306b\u3001mysqld\u306eResident set size\u304cmemory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u5206\u3060\u3051\u5e38\u306b\u5897\u52a0\u3059\u308b\u3068\u306f\u9650\u308a\u307e\u305b\u3093\u3002\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u306b\u3088\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<li>MySQL8.0.30\u4ee5\u964d\u3001memory\/innodb\/hash0hash\u306b\u8a08\u4e0a\u3055\u308c\u306a\u3044\u30e1\u30e2\u30ea\u306e\u9818\u57df\u304c\u5897\u3048\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3067\u306f\u8a73\u7d30\u306b\u5165\u308a\u307e\u3059\u3002<\/p>\n<h2>hash0hash<\/h2>\n<p>\u307e\u305a hash0hash \u304c\u3069\u3053\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u304b\u3068\u3044\u3046\u3068 <a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/ut0new.h#L311\">storage\/innobase\/include\/ut0new.h<\/a> \u3067\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/ut0new.h#L426\">PSI_memory_key auto_event_keys<\/a>\u306a\u308b\u914d\u5217\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001PSI_memory_key auto_event_keys\u306f\u3001 <a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ha\/hash0hash.cc#L103-L115\">hash_create()<\/a>\u3084<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ha\/hash0hash.cc#L149-L160\">hash_create_sync_obj()<\/a>\u304b\u3089ut::malloc_withkey()\u3092\u547c\u3076\u969b\u306b\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/ut0new.h#L539-L545\">UT_NEW_THIS_FILE_PSI_KEY<\/a>\u3067\u5bfe\u5fdc\u3059\u308bKEY\u3092\u5f15\u3044\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u6b21\u306b\u3001hash_create()\u3084hash_create_sync_obj()\u3067ut::malloc_withkey()\u3057\u3066\u308b\u3082\u306e\u304c\u8a72\u5f53\u3059\u308b\u306a\u3089\u3001hash_create()\u3084hash_create_sync_obj()\u306f\u3069\u3053\u304b\u3089\u547c\u3070\u308c\u3066\u3044\u308b\u304b\u304c\u6c17\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u203b<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/hash0hash.h#L49-L50\">hash_create() \u306f\u6b21\u306e\u3088\u3046\u306a #define \u304c\u3042\u308b\u306e\u3067\u3059\u304c<\/a>\u3001\u3053\u3053\u3067\u306f\u3044\u3063\u305f\u3093 hash_create() \u3068\u547c\u79f0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"start-line:49 lang:c++\"><code>\/* Fix Bug #13859: symbol collision between imap\/mysql *\/\n#define hash_create hash0_create<\/code><\/pre>\n<p>hash_create_sync_obj() \u306f <a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ha\/ha0ha.cc#L48-L72\">ib_create()<\/a> \u304b\u3089\u547c\u3070\u308c\u307e\u3059\u3002hash_create() \u3084 ib_create() \u306f buffer pool \u306e\u521d\u671f\u5316\u3084\u30ea\u30b5\u30a4\u30ba\u306e\u3068\u304d\u306a\u3069\u3067\u547c\u3070\u308c\u3066\u304a\u308a\u3001 hash_create() \u3084 ib_create() \u306b\u6e21\u3055\u308c\u308b\u5f15\u6570\u306f\u3001buffer pool size \u6b21\u7b2c\u3067\u5897\u6e1b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u6b21\u306e\u3088\u3046\u306a\u7b87\u6240\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dict.cc#L1026-L1030\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dict.cc#L1026-L1030<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/buf\/buf0buf.cc#L1291-L1295\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/buf\/buf0buf.cc#L1291-L1295<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/buf\/buf0buf.cc#L1514\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/buf\/buf0buf.cc#L1514<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/btr\/btr0sea.cc#L215-L216\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/btr\/btr0sea.cc#L215-L216<\/a><\/p>\n<p>hash_create()\u3067\u306f\u3001\u6e21\u3055\u308c\u305f\u5f15\u6570\u3088\u308a\u5927\u304d\u3044\u7d20\u6570\u3092\u3082\u3068\u306bhash_table_t::cells\u3092\u521d\u671f\u5316\u3059\u308b\u3088\u3046\u306a\u306e\u3067\u3001 innodb_buffer_pool_size \u306e\u5f71\u97ff\u306f\u53d7\u3051\u3064\u3064\u3082\u3001DBA\u304c\u4e8b\u524d\u306b\u30b5\u30a4\u30ba\u3092\u898b\u7a4d\u3082\u308b\u306a\u3069\u306f\u3084\u308a\u306b\u304f\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>ut_find_prime() \u306e\u5b9f\u88c5\u306a\u3069\u6c17\u306b\u306a\u308b\u65b9\u306f\u3053\u306e\u3042\u305f\u308a\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ha\/hash0hash.cc#L109\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ha\/hash0hash.cc#L109<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ut\/ut0rnd.cc#L47\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/ut\/ut0rnd.cc#L47<\/a><\/p>\n<h2>ut::malloc_withkey()<\/h2>\n<p>8.0.27\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089ut::malloc_withkey()\u3092\u5f15\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/ut0new.h#L563-L578\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/ut0new.h#L563-L578<\/a><\/p>\n<pre class=\"start-line:574 lang:c++\"><code>inline void *malloc_withkey(PSI_memory_key_t key, std::size_t size) noexcept {\n  using impl = detail::select_malloc_impl_t<WITH_PFS_MEMORY, false>;\n  using malloc_impl = detail::Alloc_<impl>;\n  return malloc_impl::alloc<false>(size, key());\n}<\/code><\/pre>\n<p>\u4f59\u8ac7\u3067\u3059\u304c\u3001MySQL8.0\u4ee5\u964d\u306eInnoDB\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u3001IDE\u4f7f\u3063\u3066\u8aad\u3093\u3060\u65b9\u304c\u3044\u3044\u306a\u3068\u518d\u8a8d\u8b58\u3057\u307e\u3057\u305f\u3002<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/source-configuration-options.html#option_cmake_disable_psi_memory\">DISABLE_PSI_MEMORY<\/a> \u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306fOFF\u306a\u306e\u3067\u3001PFS memory instrumentation\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u6709\u52b9\u306a\u308f\u3051\u3067\u3059\u304c\u3001\u3053\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3051\u8aad\u3093\u3067 malloc_impl \u306e\u578b\u304c\u306a\u3093\u306a\u306e\u304b\u7406\u89e3\u3057\u305f\u3044\u306a\u3089\u3001IDE\u306e\u529b\u3092\u501f\u308a\u308b\u306e\u304c\u7121\u96e3\u3060\u306a\u3068\u601d\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070 Visual Studio \u3067\u306f\u3001select_malloc_impl_t\u306b\u30de\u30a6\u30b9\u30dd\u30a4\u30f3\u30bf\u3092\u5408\u308f\u305b\u308b\u3068\u3001impl\u306fut::detail::Alloc_pfs\u3060\u3068\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>Ubuntu 20.04 LTS on WSL2\u4e0a\u3067 MySQL 8.0.27 \u3092\u30c7\u30d0\u30c3\u30b0\u30d3\u30eb\u30c9\u3057\u3066 vscode \u4e0a\u3067gdb\u4f7f\u3063\u3066\u30b9\u30c6\u30c3\u30d7\u5b9f\u884c\u3057\u305f\u3068\u3053\u308d\u3001hash_create()\u3084ib_create()\u304b\u3089\u60f3\u5b9a\u901a\u308a<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/alloc.h#L435-L439\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/alloc.h#L435-L439<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/alloc.h#L273-L276\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/alloc.h#L273-L276<\/a><\/p>\n<p>\u306b\u6765\u3066\u3001\u6700\u7d42\u7684\u306b<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/allocator_traits.h#L45-L48\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/include\/detail\/ut\/allocator_traits.h#L45-L48<\/a><\/p>\n<pre class=\"start-line:45 lang:c++\"><code>template <bool Zero_initialized>\nstruct Alloc_fn {\n  static void *alloc(size_t nbytes) { return std::malloc(nbytes); }\n};<\/code><\/pre>\n<p>\u3067std::malloc()\u304c\u547c\u3070\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u4f8b\u3048\u3070\u3001vscode\u3067\u306e\u30b3\u30fc\u30eb\u30b9\u30bf\u30c3\u30af\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-600x284.png\" alt=\"\" width=\"600\" height=\"284\" class=\"alignnone size-medium wp-image-22630\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-600x284.png 600w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-830x392.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-276x130.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-768x363.png 768w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-1536x726.png 1536w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25-2048x968.png 2048w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u3053\u3046\u3044\u3063\u305f\u78ba\u8a8d\u304cWSL2\u3068vscode\u3067\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3092\u898b\u308b\u305f\u3073\u306b\u3001\u4fbf\u5229\u306a\u6642\u4ee3\u306b\u306a\u3063\u305f\u306a\u3068\u3064\u304f\u3065\u304f\u5b9f\u611f\u3055\u305b\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2>memory\/innodb\/hash0hash \u306a\u3069\u306b\u3064\u3044\u3066\u3053\u3053\u307e\u3067\u3067\u96d1\u306a\u307e\u3068\u3081<\/h2>\n<ul>\n<li>memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u306f\u3001InnoDB\u306e\u521d\u671f\u5316\u6642\u3084buffer pool\u306e\u30ea\u30b5\u30a4\u30ba\u306e\u969b\u3001 storage\/innobase\/ha\/hash0hash.cc \u3067 hash table \u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30e1\u30e2\u30ea\u306e\u30b5\u30a4\u30ba\u306e\u5408\u8a08\u3067\u3042\u308b<\/li>\n<li>hash table \u306ehash_table_t::cells\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u30e1\u30e2\u30ea\u306e\u30b5\u30a4\u30ba\u306f\u3001 innodb_buffer_pool_size \u6b21\u7b2c\u3067\u5897\u6e1b\u3059\u308b<\/li>\n<li>memory\/innodb\/hash0hash\u3067hash_table_t::cells\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u30e1\u30e2\u30ea\u306f\u3001 std:malloc() \u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u3002<\/li>\n<\/ul>\n<p>std::malloc() \u3067\u3042\u308b\u7a0b\u5ea6\u307e\u3068\u307e\u3063\u305f\u9818\u57df\u3092\u5272\u308a\u5f53\u3066\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3001\u305d\u306e\u9818\u57df\u306f\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u3053\u3068\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u304c\u3001mysqld\u306eResident set size\u306b\u7a4d\u307f\u4e0a\u304c\u3063\u3066\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u306e\u3082\u9053\u7406\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u3069\u3046\u3044\u3063\u305f\u30b1\u30fc\u30b9\u3067mysqld\u306eResident set size\u306b\u3001\u3053\u308c\u3089\u306e\u9818\u57df\u304c\u7a4d\u307f\u4e0a\u304c\u3063\u3066\u3044\u304f\u306e\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u305d\u306e\u4e00\u3064\u306b\u3001\u300c\u305f\u304f\u3055\u3093\u30c6\u30fc\u30d6\u30eb\u3092\u958b\u3044\u305f\u3068\u304d\u300d\u3068\u3044\u3046\u3082\u306e\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2>\u305f\u304f\u3055\u3093\u30c6\u30fc\u30d6\u30eb\u3092\u958b\u304f\u3068memory\/innodb\/hash0hash\u3067\u78ba\u4fdd\u3057\u305f\u9818\u57df\u306e\u4e00\u90e8\u306b\u3001\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3067\u30e1\u30e2\u30ea\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u308b<\/h2>\n<p>\u5177\u4f53\u7684\u306bmemory\/innodb\/hash0hash\u3067\u3069\u3046\u3044\u3063\u305f\u3082\u306e\u304chash table\u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u304b\u3068\u3044\u3044\u307e\u3059\u3068\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dict.cc#L1026-L1030\">dict_sys->table_hash\u3084dict_sys->table_id_hash<\/a>\u306a\u3069\u304c\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n<p>innodb_buffer_pool_size=16G\u3067\u8a66\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001dict_sys->table_hash.cells\u3078\u306eut::malloc_withkey()\u306f\u3001size=35402344\u3067\u3001ut::detail::Alloc_pfs:alloc()\u5185\u3067total_len\u306f35402376\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-600x284.png\" alt=\"\" width=\"600\" height=\"284\" class=\"alignnone size-medium wp-image-22629\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-600x284.png 600w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-830x393.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-276x131.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-768x364.png 768w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-1536x727.png 1536w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2023\/08\/2023-08-25_02-2048x970.png 2048w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>dict_sys->table_hash\u3060\u3051\u3067\u305d\u308c\u3060\u3051\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u306e\u3067\u3059\u304b\u3089\u3001dict_sys->table_id_hash\u3082\u5408\u308f\u305b\u308b\u306867.5MB\u304f\u3089\u3044\u306b\u306a\u308a\u307e\u3059\u3002innodb_buffer_pool_size\u304c100GB\u3092\u8d85\u3048\u305f\u308a\u3059\u308b\u3068\u3001dict_sys->table_hash\u3068dict_sys->table_id_hash\u3060\u3051\u3067\u6570\u767eMB\u304f\u3089\u3044\u306fmalloc\u3055\u308c\u305d\u3046\u3060\u306a\u3001\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>dict_sys->table_hash\u3084dict_sys->table_id_hash\u304chash table\u3067\u3042\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3068\u3001dict_sys->table_hash->cells\u3084dict_sys->table_id_hash->cells\u304c\u9023\u7d9a\u3057\u3066\u57cb\u307e\u3063\u3066\u3044\u304f\u308f\u3051\u3067\u306f\u306a\u304f\u3001\u6b6f\u629c\u3051\u306e\u3088\u3046\u306a\u72b6\u614b\u3067\u4f7f\u308f\u308c\u308b\u3067\u3057\u3087\u3046\u3002<br \/>\n\u96d1\u306a\u8a00\u3044\u65b9\u3092\u3059\u308b\u3068\u3001\u5b9f\u969b\u306b\u30aa\u30fc\u30d7\u30f3\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u6570\u3068\u6bd4\u8f03\u3057\u3066\u3001dict_sys->table_hash->cells\u3084dict_sys->table_id_hash->cells\u306b\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3067\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u30e1\u30e2\u30ea\u306f\u3001\u591a\u3081\u306b\u306a\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001dict_sys->table_hash\u306bHASH_INSERT\u3055\u308c\u3066\u3044\u304f\u69d8\u3092ha_innobase::open() \u304b\u3089\u898b\u3066\u3044\u304f\u3068<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/handler\/ha_innodb.cc#L6978-L7077\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/handler\/ha_innodb.cc#L6978-L7077<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4524-L4530\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4524-L4530<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4153-L4184\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4153-L4184<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L2745-L2876\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L2745-L2876<\/a><\/p>\n<p>\u3067<\/p>\n<pre class=\"start-line:2874 lang:c++\"><code>  \/* Create the dict_table_t *\/\n  dict_table_t *m_table =\n      dict_mem_table_create(norm_name, 0, n_cols, n_v_cols, n_m_v_cols, 0, 0);<\/code><\/pre>\n<p>dict_table_t\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u3053\u3053\u3067\u5272\u308a\u5f53\u3066\u3066\u3001\u305d\u308c\u3092dict_sys->table_hash\u3084dict_sys->table_id_hash\u306bHASH_INSERT\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4183-L4361\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dd.cc#L4183-L4361<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dict.cc#L1193-L1243\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/dict\/dict0dict.cc#L1193-L1243<\/a><\/p>\n<pre class=\"start-line:1239 lang:c++\"><code>  \/* Add table to hash table of tables *\/\n  HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold, table);\n\n\n  \/* Add table to hash table of tables based on table id *\/\n  HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash, id_fold, table);<\/code><\/pre>\n<p>\u65b0\u898f\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u30aa\u30fc\u30d7\u30f3\u3057\u3066\u3001\u3044\u307e\u307e\u3067\u4f7f\u3063\u3066\u306a\u304b\u3063\u305ffold\u3084id_fold\u3067HASH_INSERT()\u3057\u305f\u969b\u3001hash_table_t::cells\u3067\u4eca\u307e\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3053\u3068\u306e\u306a\u3044\u30a2\u30c9\u30ec\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30da\u30fc\u30b8\u30d5\u30a9\u30eb\u30c8\u304c\u767a\u751f\u3057\u3001Anonymous Page\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u308f\u3051\u3067\u3059\u306d\u3002Anonymous Page\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u7d50\u679c\u3001mysqld\u306eResident set size\u304c\u7a4d\u307f\u4e0a\u304c\u3063\u3066\u3044\u304d\u307e\u3059\u3002\uff08\u305f\u3060\u3001 innodb_buffer_pool_size\u304c\u5c0f\u3055\u3044\u3068dict_sys->table_hash\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u30e1\u30e2\u30ea\u306e\u30b5\u30a4\u30ba\u3082\u5c0f\u3055\u304f\u306a\u3063\u3066\u3001 glibc malloc \u306f ARENA \u304b\u3089\u5272\u308a\u5f53\u3066\u3088\u3046\u3068\u3059\u308b\u305f\u3081\u3001\u3053\u306e\u3042\u305f\u308a\u306e\u6319\u52d5\u306f\u307e\u305f\u5909\u308f\u3063\u3066\u304f\u308b\u3067\u3057\u3087\u3046\uff09<\/p>\n<p>HASH_INSERT\u3055\u308c\u308bdict_table_t\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3082\u30d2\u30fc\u30d7\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3082\u3061\u3087\u3063\u3068\u305a\u3064mysqld\u306eResident set size\u306b\u53cd\u6620\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>dict_mem_table_create()\u304b\u3089ut::malloc_withkey()\u306b\u81f3\u308b\u307e\u3067\u9577\u3044\u306e\u3067\u3061\u3087\u3063\u3068\u5272\u611b\u3057\u307e\u3059\u304c\u3001\u6700\u7d42\u7684\u306b<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/mem\/memory.cc#L250-L283\">mem_heap_create_block_func()<\/a>\u306a\u306e\u3067\u3001memory.cc\u3067\u547c\u3073\u51fa\u3055\u308c\u305fut::malloc_withkey()\u306f performance schema \u3067\u306f memory\/innodb\/memory \u3067\u96c6\u8a08\u3055\u308c\u3001memory\/innodb\/hash0hash \u306b\u306f\u542b\u307e\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u79c1\u304cmysqld\u30678.0.27\u3067\u7a3c\u50cd\u3057\u3066\u3044\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u3044\u304f\u3064\u304b\u898b\u3066\u307f\u305f\u3068\u3053\u308d\u3001innodb_buffer_pool_size\u304c100GB\u304f\u3089\u3044\u3042\u308b\u3088\u3046\u306a\u3068\u3053\u308d\u306f\u3001memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED\u306f3GB\u304f\u3089\u3044\u3042\u3063\u305f\u306e\u3067\u3001dict_sys->table_hash\u3084dict_sys->table_id_hash\u304cmemory\/innodb\/hash0hash\u3067\u5360\u3081\u308b\u5272\u5408\u306f\u305d\u3053\u307e\u3067\u5927\u304d\u304f\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306b\u6319\u3052\u3066\u3044\u304f\u3068\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/buf\/buf0buf.cc#L1514\">btr_search_sys_create()<\/a>\u304b\u3089<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/btr\/btr0sea.cc#L187-L215\">\u547c\u3070\u308c\u308bib_create()<\/a>\u3084\u3001<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/handler\/ha_innodb.cc#L4908\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/handler\/ha_innodb.cc#L4908<\/a><\/p>\n<pre class=\"start-line:4908 lang:c++\"><code>  srv_lock_table_size = 5 * (srv_buf_pool_size \/ UNIV_PAGE_SIZE);<\/code><\/pre>\n<p>srv_lock_table_size\u306e\u30b5\u30a4\u30ba\u3092\u8e0f\u307e\u3048\u308b\u3068\u3001lock_sys_create()\u306a\u3069\u306e\u65b9\u304c memory\/innodb\/hash0hash\u306eCURRENT_NUMBER_OF_BYTES_USED \u3067\u5360\u3081\u308b\u5272\u5408\u306f\u5927\u304d\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/srv\/srv0start.cc#L2149\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/srv\/srv0start.cc#L2149<\/a><br \/>\n<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/lock\/lock0lock.cc#L308-L332\">https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.27\/storage\/innobase\/lock\/lock0lock.cc#L308-L332<\/a><\/p>\n<p>\u305f\u3060\u3001<\/p>\n<ul>\n<li>innodb_buffer_pool_size \u306b\u5fdc\u3058\u3066 InnoDB \u5185\u90e8\u306e hash table \u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u30e1\u30e2\u30ea\u306e\u91cf\u306f\u5897\u6e1b\u3059\u308b<\/li>\n<li>\u305f\u304f\u3055\u3093\u30c6\u30fc\u30d6\u30eb\u3092\u958b\u304f\u3088\u3046\u306a\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u3067\u306f\u3001InnoDB \u5185\u90e8\u306e hash table \u306b\u3001\u30c7\u30de\u30f3\u30c9\u30da\u30fc\u30b8\u30f3\u30b0\u3067\u30e1\u30e2\u30ea\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u3053\u3068\u304c\u3042\u308b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3063\u305f\u3053\u3068\u306f\uff08\u305f\u3057\u304b\uff09MySQL\u306e\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u306f\u898b\u304b\u3051\u305f\u8a18\u61b6\u304c\u7121\u304f\u3001\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u6b21\u7b2c\u3067\u5909\u308f\u3063\u3066\u304d\u305f\u308a\u3059\u308b\u90e8\u5206\u306a\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a\u306f\u77e5\u3063\u3066\u304a\u3044\u3066\u640d\u306f\u306a\u3044\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>InnoDB\u3067\u306e\u30e1\u30e2\u30ea\u30a2\u30ed\u30b1\u30fc\u30bf\u5468\u308a\u3067\u3001MySQL8.0.26\uff5e8.0.30\u306b\u304b\u3051\u3066\u5909\u66f4\u3055\u308c\u305f\u3053\u3068<\/h2>\n<p>8.0.27\u3067<a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/b0d9862e044c57fcf3d0936160565311b00c5fe1\">Bug #33159210 IMPLEMENT PFS-AWARE CUSTOM MEMORY ALLOCATOR<\/a>\u304c\u30de\u30fc\u30b8\u3055\u308c\u307e\u3057\u305f\u3002\u307e\u305f\u30018.0.30\u3067<a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/b11a175924194d574238f42068f09b15924ae2f8\">Bug #16739204 IMPROVE THE INNODB HASH FUNCTION<\/a>\u304c\u30de\u30fc\u30b8\u3055\u308c\u307e\u3057\u305f\u3002\uff08\u4f59\u8ac7\u3067\u3059\u304c\u30018.0.30\u306e\u3053\u306e\u4fee\u6b63\u306f\u6027\u80fd\u4e0a\u306e\u554f\u984c\u304c\u3042\u3063\u305f\u3089\u3057\u304f\u30018.0.34\u3067<a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/624f5847ef56c6a47e864c504d8bbc74335ba213\">Bug#34870256: New hash function causes performance regression<\/a>\u3068\u3044\u3046\u4fee\u6b63\u304c\u5165\u308a\u307e\u3057\u305f\u3002\uff09<\/p>\n<p>InnoDB\u306fPFS\u5bfe\u5fdc\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u30e1\u30e2\u30ea\u30a2\u30ed\u30b1\u30fc\u30bf\u30928.0.27\u3067\u65b0\u3057\u3044\u5b9f\u88c5\u306b\u5207\u308a\u66ff\u3048\u307e\u3057\u305f\u30028.0.30\u3067\u30cf\u30c3\u30b7\u30e5\u95a2\u6570\u3084\u4e71\u6570\u3092\u751f\u6210\u3059\u308b\u95a2\u6570\u3092\u7f6e\u304d\u63db\u3048\u308b\u969b\u3001hash_create()\u306f\u524a\u9664\u3055\u308c\u3001 ut::new_&lt;hash_table_t&gt;() \u3067\u7f6e\u304d\u63db\u3048\u3089\u308c\u307e\u3057\u305f\u3002ut::new_&lt;>()\u306f<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.34\/storage\/innobase\/include\/ut0new.h#L793-L796\">PSI_NOT_INSTRUMENTED<\/a>\u306a\u306e\u3067\u30018.0.27\u30848.0.28\u306ehash_crete()\u3067memory\/innodb\/hash0hash\u306b\u8a08\u4e0a\u3055\u308c\u3066\u3044\u305f\u3082\u306e\u306f\u3001performance schema\u4e0a\u3067\u8a08\u4e0a\u3055\u308c\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u8a73\u3057\u3044\u5185\u5bb9\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u30018.0.27\u3088\u308a\u524d\u306eInnoDB\u306f\u30ab\u30b9\u30bf\u30e0\u30e1\u30e2\u30ea\u30a2\u30ed\u30b1\u30fc\u30bf\u5468\u308a\u306b\u8ab2\u984c\u304c\u3042\u3063\u305f\u3089\u3057\u304f8.0.27\u3067\u4fee\u6b63\u3055\u308c\u305f\u3088\u3046\u3067\u3059\u3002<a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/b0d9862e044c57fcf3d0936160565311b00c5fe1\">Bug #33159210 IMPLEMENT PFS-AWARE CUSTOM MEMORY ALLOCATOR<\/a>\u306b\u306f\u6b21\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p>\n  This patch introduces a fresh implementation of standard-compliant custom memory allocator that addresses the many issues found in the old implementation, all of which are more thoroughly explained in Bug #32716067 UT0NEW ALLOCATOR IS TRYING TO FIT TOO MANY ORTHOGONAL CONCEPTS TOGETHER and several other related bug reports. Increased complexity in the old implementation is what has lead to creating unnoticed subtle bugs but also imposing limitations to the code design.\n<\/p><\/blockquote>\n<p>\u307e\u305f\u30018.0.30\u306b\u306a\u308b\u3068\u3001\u304b\u3064\u3066performance schema\u306b\u8a08\u4e0a\u3055\u308c\u3066\u3044\u305f\u30e1\u30e2\u30ea\u306e\u4f7f\u7528\u91cf\u304c\u4e00\u90e8\u8a08\u4e0a\u3055\u308c\u306a\u304f\u306a\u308b\u306a\u3069\u3001\u3053\u306e\u3042\u305f\u308a\u306f\u3044\u308d\u3044\u308d\u3068\u904e\u6e21\u671f\u306a\u3088\u3046\u306a\u6c17\u304c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u79c1\u306f\u305f\u307e\u305f\u307e8.0.27\u30848.0.28\u3067memory\/innodb\/hash0hash\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\u6a5f\u4f1a\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u300cmemory\/innodb\/hash0hash\u3067\u78ba\u4fdd\u3055\u308c\u305f\u9818\u57df\u306b\u304a\u3044\u3066\u3001\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u6b21\u7b2c\u3067\u306fResident set size\u306e\u5897\u3048\u65b9\u306b\u9055\u3044\u304c\u51fa\u3066\u304d\u305d\u3046\u3060\u300d\u3068\u3044\u3046\u3053\u3068\u306b\u6c17\u3065\u304d\u307e\u3057\u305f\u304c\u30018.0.26\u4ee5\u524d\u30848.0.30\u4ee5\u964d\u3067\u540c\u3058\u3053\u3068\u3092\u8abf\u3079\u3088\u3046\u3068\u3057\u305f\u3089\u3001\u305d\u3053\u307e\u3067\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>2021\u5e74\u4ee5\u964d\u306ecommit log\u3092\u3055\u3089\u3063\u3068\u898b\u3066\u3082\u30018.0.26\u30848.0.27\u3067\u3001\u30e1\u30e2\u30ea\u30a2\u30ed\u30b1\u30fc\u30bf\u5468\u308a\u3067\u306f\u304b\u306a\u308a\u4fee\u6b63\u304c\u5165\u3063\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/b04ce7e067b495ab212162a4e23db5d6fc0b5da7\">Bug #32715688 UT0NEW INFRASTRUCTURE IS MISSING TO TRACE MILLIONS OF STL ALLOCATIONS<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/77cc646c9e4c9a39429311b89e121e4334718f32\">Bug #32715359 UT0NEW ALLOCATOR DOUBTFUL OOM HANDLING<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/db6f9fd1169a5a774143edb199c2fa179d95fc1c\">Bug #32714144 UT0NEW LARGE-PAGE SUPPORT SHOULD ENCAPSULATE THE PFS METADATA<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/a3b91bede89d6115696be0ef583b1aef8c5e9605\">BUG #33110312 IMPLEMENT INNODB LIBRARY FOR DYNAMIC STORAGE MANAGEMENT OF SUITABLY ALIGNED TYPE<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/af1d3d208b09006d32b5ef49c7ceae1b2b286e65\">Bug #33118362 IMPLEMENT INNODB LIBRARY FOR 4K-PAGE SUPPORT<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/2c2844adfc1a533cf244ec648ef0dd08ad14b161\">Bug #33110341 UTILIZE INNODB LIBRARY FOR DYNAMIC STORAGE MANAGEMENT OF SUITABLY ALIGNED TYPES<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/mysql\/mysql-server\/commit\/b0d9862e044c57fcf3d0936160565311b00c5fe1\">Bug #33159210 IMPLEMENT PFS-AWARE CUSTOM MEMORY ALLOCATOR<\/a><\/li>\n<\/ul>\n<p>\u9a5a\u3044\u305f\u3053\u3068\u306b\u3001ut::malloc_withkey()\u304cInnoDB\u306b\u5c0e\u5165\u3055\u308c\u305f\u306e\u306f\u30018.0.27\u304b\u3089\u306e\u3088\u3046\u3067\u3059\u30028.0.26\u306ehash_create()\u3092\u773a\u3081\u3066\u307f\u308b\u3068\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.26\/storage\/innobase\/ha\/hash0hash.cc#L103-L114\">ut::malloc_withkey()\u3067\u306f\u306a\u304fut_malloc_nokey()\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/a>\u307e\u305f\u3001<a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/mysql-8.0.26\/storage\/innobase\/include\/ut0new.h#L1048-L1080\">ut_malloc_nokey()\u3042\u305f\u308a\u306e\u30b3\u30e1\u30f3\u30c8<\/a>\u3092\u8aad\u3080\u3068<\/p>\n<blockquote><p>\n  One should avoid using the macros below when writing new code in general, and try to remove them when refactoring existing code (in favor of using the UT_NEW).\n<\/p><\/blockquote>\n<p>\u3068\u3042\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u5ff5\u9858\u304b\u306a\u3063\u3066\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u304c\u9032\u3093\u3060\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3044\u307e\u306eInnoDB\u306e\u30e1\u30e2\u30ea\u7ba1\u7406\u5468\u308a\u306f\u305f\u3076\u3093\u904e\u6e21\u671f\u3067\u3001\u4eca\u5f8c\u307e\u305f\u6574\u7406\u3055\u308c\u308b\u3053\u3068\u3082\u3042\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u306a\u3041\u3068\u500b\u4eba\u7684\u306b\u306f\u611f\u3058\u3066\u3044\u307e\u3059\u304c\u3001\u6700\u65b0\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3051\u3067\u306a\u304f\u3061\u3087\u3063\u3068\u53e4\u3044\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3082\u4f75\u8aad\u3059\u308b\u3053\u3068\u3067\u7406\u89e3\u304c\u6df1\u307e\u308b\u3053\u3068\u3082\u3042\u308b\u306e\u3060\u306a\u3041\u3068\u3001\u518d\u8a8d\u8b58\u3057\u305f\u6b21\u7b2c\u3067\u3059\u3002<\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>\u73fe\u4ee3\u306emysqld\u306b\u304a\u3051\u308b\u30e1\u30e2\u30ea\u306e\u7528\u9014\u306f\u3001\u591a\u304f\u306e\u5834\u5408InnoDB\u306ebuffer pool\u304c\u5927\u534a\u3092\u5360\u3081\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u3069\u308c\u304f\u3089\u3044\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u304c\u5f35\u3089\u308c\u3001\u305d\u306e\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u304csort buffer\u306a\u3069\u30b9\u30ec\u30c3\u30c9\u3054\u3068\u306e\u30d0\u30c3\u30d5\u30a1\u3092\u3069\u308c\u304f\u3089\u3044\u4f7f\u3046\u304b\u8a66\u7b97\u3057\u3001binary log\u3084InnoDB\u306eredo log\u304c\u30da\u30fc\u30b8\u30ad\u30e3\u30c3\u30b7\u30e5\u306a\u3069\u3067\u4f7f\u3046\u30e1\u30e2\u30ea\u3082\u8003\u616e\u3057\u3064\u3064\u3001innodb_buffer_pool_size\u3092\u3069\u308c\u304f\u3089\u3044\u307e\u3067\u5f15\u304d\u4e0a\u3052\u3088\u3046\u304b\u3001\u3068\u3044\u3063\u305f\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u304c\u884c\u308f\u308c\u305f\u308a\u3082\u3059\u308b\u308f\u3051\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u5b9f\u306e\u3068\u3053\u308d\u8003\u616e\u3059\u3079\u304d\u8981\u7d20\u306f\u3053\u308c\u3089\u3060\u3051\u3067\u306a\u304f\u3001\u300cbuffer pool\u3084\u30b9\u30ec\u30c3\u30c9\u3054\u3068\u306e\u30d0\u30c3\u30d5\u30a1\u4ee5\u5916\u306b\u3082\u3001\u3051\u3063\u3053\u3046\u30e1\u30e2\u30ea\u98df\u3063\u3066\u308b\u3068\u3053\u308d\u3042\u308b\u306a\uff1f\u300d\u3068\u6570\u5e74\u524d\u304b\u3089\u6c17\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u4eca\u56de\u3001innodb_buffer_pool_size\u6b21\u7b2c\u3067\u5927\u304d\u304f\u5897\u6e1b\u3059\u308b\u8981\u7d20\u304c\u3042\u3063\u3066\u3001\u305d\u308c\u3092\u8abf\u3079\u308b\u8853\u3092\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u306e\u3067\u3001\u500b\u4eba\u7684\u306b\u306f\u826f\u3044\u5b66\u3073\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001innodb_buffer_pool_size\u306e\u6570%\u5206\u304f\u3089\u3044\u306f\u3001InnoDB\u304c\u5185\u90e8\u7684\u306bhash table\u3067\u78ba\u4fdd\u3057\u3066\u4f7f\u3063\u305f\u308a\u3082\u3059\u308b\u306e\u3060\u3001\u3068\u3044\u3046\u3053\u3068\u3092\u982d\u306e\u7247\u9685\u306b\u7f6e\u3044\u3066\u304a\u304f\u3068\u826f\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u3001MySQL\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092IDE\u3067\u8aad\u3081\u308b\u3068\u3084\u306f\u308a\u6709\u76ca\u3060\u306a\u3068\u601d\u3044\u307e\u3057\u305f\u306e\u3067\u3001MySQL8.1.0\u3092\u30c7\u30d0\u30c3\u30b0\u30d3\u30eb\u30c9\u3057\u3066IDE\u3067\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u8aad\u3081\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u8a18\u4e8b\u306a\u3069\u3001\u305d\u306e\u3046\u3061\u307e\u305f\u66f8\u304d\u305f\u3044\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/ja.wikipedia.org\/wiki\/%E3%83%9A%E3%83%BC%E3%82%B8%E3%83%B3%E3%82%B0%E6%96%B9%E5%BC%8F\">Wikipedia | \u30da\u30fc\u30b8\u30f3\u30b0\u65b9\u5f0f<\/a><\/li>\n<li><a href=\"https:\/\/wiki.bit-hive.com\/linuxkernelmemo\/pg\/%E3%83%9A%E3%83%BC%E3%82%B8%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88\">Linux\u30ab\u30fc\u30cd\u30eb\u30e1\u30e2 | \u30da\u30fc\u30b8\u30d5\u30a9\u30eb\u30c8<\/a><\/li>\n<li><a href=\"https:\/\/wiki.bit-hive.com\/linuxkernelmemo\/pg\/%E3%83%9A%E3%83%BC%E3%82%B8%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%20-%20%E5%80%8B%E3%80%85%E3%81%AE%E3%83%8F%E3%83%B3%E3%83%89%E3%83%A9\">Linux\u30ab\u30fc\u30cd\u30eb\u30e1\u30e2 | \u30da\u30fc\u30b8\u30d5\u30a9\u30eb\u30c8 - \u500b\u3005\u306e\u30cf\u30f3\u30c9\u30e9<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002\u305b\u3058\u307e\u3067\u3059\u3002 \u5148\u65e5\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u3067\u65b0\u3057\u3044PC\u3092\u8cb7\u3063\u305f\u306e\u3067\u8a66\u3057\u306bVisual Studio 2022(version 17.7.2)\u3067MySQL8.0.34\u3092\u30c7\u30d0\u30c3\u30b0\u30d3\u30eb\u30c9\u3057\u3088\u3046\u3068\u601d\u3063\u305f\u3089\u3001sql_main \u304c [&hellip;]<\/p>\n","protected":false},"author":137,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[17],"class_list":["post-22626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-info","tag-mysql"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/22626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/137"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=22626"}],"version-history":[{"count":14,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/22626\/revisions"}],"predecessor-version":[{"id":22628,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/22626\/revisions\/22628"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=22626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=22626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=22626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}