Bug #113270 Unable to compile 8.0.35 with DISABLE_PSI_THREAD

Submitted: 29 Nov 2023 0:18 Modified: 29 Nov 2023 10:25
Reporter: Mark Callaghan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.35 OS:Any
Assigned to: CPU Architecture:Any

[29 Nov 2023 0:18] Mark Callaghan
Description:
The docs state that I can compile MySQL with less PSI support by specifying several flags to CMake, but when I use -DDISABLE_PSI_THREAD I get compile errors.

The docs are here:
https://dev.mysql.com/doc/refman/8.0/en/source-configuration-options.html#option_cmake_dis...

The compiler errors occur for storage/innobase/os/os0file.cc

/home/mdcallag/b/mysql-8.0.35/storage/innobase/os/os0file.cc: In static member function ‘static void AIO::start_threads()’:
/home/mdcallag/b/mysql-8.0.35/storage/innobase/os/os0file.cc:6373:11: error: ‘io_ibuf_thread_key’ was not declared in this scope; did you mean ‘PSI_thread_key’?
 6373 |     start(io_ibuf_thread_key, 0);
      |           ^~~~~~~~~~~~~~~~~~
      |           PSI_thread_key
/home/mdcallag/b/mysql-8.0.35/storage/innobase/os/os0file.cc:6379:11: error: ‘io_read_thread_key’ was not declared in this scope
 6379 |     start(io_read_thread_key, i);
      |           ^~~~~~~~~~~~~~~~~~
/home/mdcallag/b/mysql-8.0.35/storage/innobase/os/os0file.cc:6383:11: error: ‘io_write_thread_key’ was not declared in this scope
 6383 |     start(io_write_thread_key, i);
      |           ^~~~~~~~~~~~~~~~~~~

How to repeat:

Compile MySQL 8.0.35 with this, it takes 1 arg -- see CMAKE_INSTALL_PREFIX below

BF=" -g1 "
CF=" $BF "
CXXF=" $BF "

cmake .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DWITH_SSL=system \
  -DWITH_ZLIB=bundled \
  -DMYSQL_MAINTAINER_MODE=0 \
  -DENABLED_LOCAL_INFILE=1 \
  -DCMAKE_INSTALL_PREFIX=$1 \
  -DWITH_BOOST=$PWD/../boost \
  -DCMAKE_CXX_FLAGS="$CXXF" -DCMAKE_C_FLAGS="$CF" \
  -DWITH_NUMA=ON -DWITH_ROUTER=OFF -DWITH_MYSQLX=OFF -DWITH_UNIT_TESTS=OFF \
  -DDISABLE_PSI_COND=1 \
  -DDISABLE_PSI_DATA_LOCK=1 \
  -DDISABLE_PSI_ERROR=1 \
  -DDISABLE_PSI_FILE=1 \
  -DDISABLE_PSI_IDLE=1 \
  -DDISABLE_PSI_MEMORY=1 \
  -DDISABLE_PSI_METADATA=1 \
  -DDISABLE_PSI_MUTEX=1 \
  -DDISABLE_PSI_PS=1 \
  -DDISABLE_PSI_RWLOCK=1 \
  -DDISABLE_PSI_SOCKET=1 \
  -DDISABLE_PSI_SP=1 \
  -DDISABLE_PSI_STAGE=1 \
  -DDISABLE_PSI_STATEMENT=1 \
  -DDISABLE_PSI_STATEMENT_DIGEST=1 \
  -DDISABLE_PSI_TABLE=1 \
  -DDISABLE_PSI_THREAD=1 \
  -DDISABLE_PSI_TRANSACTION=1 \
  -DDISABLE_TLS_CHANNEL=1 \
  -DDISABLE_PSI_SERVER_TELEMETRY_TRACES=1 \
  -DENABLED_PROFILING=0 \
  -DHAVE_PSI_MEMORY_INTERFACE=0

Suggested fix:
My quick, and possibly incorrect, fix is:

diff -u --recursive x/mysql-8.0.35/storage/innobase/include/sync0sync.h mysql-8.0.35/storage/innobase/include/sync0sync.h
--- x/mysql-8.0.35/storage/innobase/include/sync0sync.h 2023-10-12 11:45:01.000000000 +0000
+++ mysql-8.0.35/storage/innobase/include/sync0sync.h   2023-11-28 22:58:29.193936188 +0000
@@ -44,7 +44,7 @@
 #include "univ.i"
 #include "ut0counter.h"

-#ifdef HAVE_PSI_INTERFACE
+// #ifdef HAVE_PSI_INTERFACE

 /** Define for performance schema registration key */
 struct mysql_pfs_key_t {
@@ -67,7 +67,7 @@
   static unsigned int s_count;
 };

-#endif /* HAVE_PFS_INTERFACE */
+// #endif /* HAVE_PFS_INTERFACE */

 #if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK

diff -u --recursive x/mysql-8.0.35/storage/innobase/os/os0file.cc mysql-8.0.35/storage/innobase/os/os0file.cc
--- x/mysql-8.0.35/storage/innobase/os/os0file.cc       2023-10-12 11:45:01.000000000 +0000
+++ mysql-8.0.35/storage/innobase/os/os0file.cc 2023-11-28 23:57:21.627057149 +0000
@@ -6355,11 +6355,11 @@
   }
 }

-#ifdef UNIV_PFS_THREAD
+// #ifdef UNIV_PFS_THREAD
 mysql_pfs_key_t io_ibuf_thread_key;
 mysql_pfs_key_t io_read_thread_key;
 mysql_pfs_key_t io_write_thread_key;
-#endif /* UNIV_PFS_THREAD */
+// #endif /* UNIV_PFS_THREAD */

 void AIO::start_threads() {
   ulint segment = 0;
[29 Nov 2023 10:25] MySQL Verification Team
Hello Mark,

Thank you for the report and feedback!

Thanks,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.