Bug #117943 Startup ibd-file validation uses too much CPU threads

Submitted: 11 Apr 2025 8:07 Modified: 6 May 2025 15:13
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.4.4, 9.2.0 OS:Any
Assigned to: CPU Architecture:Any

[11 Apr 2025 8:07] Tsubasa Tanaka
Description:
When starting up mysqld process, mysqld runs ibd-file validation ( controlled by innodb_validate_tablespace_paths )

This procedure is paralellized, but seems too much CPU threads.
Following log is printed on box which has 8 vCPUs.

```
2025-04-10T10:32:25.069134-00:00 0 [Note] [MY-012350] [InnoDB] 16threads have validated 42600 out of 200008 tablespaces so far.
```

I think "std::thread::hardware_concurrency" returns "How many CPU *threads* to use",  already considered about SMT (ex. Hyperthreading) .
Therefore, FIL_SCAN_THREADS_PER_CORE(Hardcoded as 2) * std::thread::hardware_concurrency() is too much number of threads.

https://github.com/mysql/mysql-server/blob/mysql-9.2.0/storage/innobase/fil/fil0fil.cc#L14...

How to repeat:
- Create tables more than FIL_SCAN_MAX_TABLESPACES_PER_THREAD(Hardcoded as 8000 in MySQL 9.2.0) * vCPU cores.

- Start mysqld
- Observe LoadAvg and %sys during startup

Suggested fix:
Remove to multiply by FIL_SCAN_THREADS_PER_CORE
[6 May 2025 15:13] MySQL Verification Team
Hello tanaka-San,

Thank you for the report and feedback.

regards,
Umesh

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

Page generated in 0.056 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.