Bug #115568 innodb_validate_tablespace_paths is dummy
Submitted: 11 Jul 22:36 Modified: 15 Jul 13:12
Reporter: Satya Bodapati (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[11 Jul 22:36] Satya Bodapati
Description:
When to trying to workaround the 8.0.38 crashes caused by https://github.com/mysql/mysql-server/commit/28eb1ff112777406cd6587231341b9b47167f9f1

Jean-François Gagné suggested to me that there is an option called
innodb_validate_tablespace_paths to skip validation on https://perconadev.atlassian.net/browse/PS-9306

But unfortunately, it doesn't work.

There is regression from https://github.com/mysql/mysql-server/commit/eef88fb2565a0fd9d9b123ce4c7c969f678f6831

Introduced in 8.0.24

How to repeat:
create 8K tablespaces
shutdown
restart server with --innodb_validate_tablespace_paths=OFF
still it would crash.

Suggested fix:
dberr_t Validate_files::validate(const DD_tablespaces &tablespaces) {
  m_n_to_check = tablespaces.size();
  m_n_threads = fil_get_scan_threads(m_n_to_check);
  m_start_time = std::chrono::steady_clock::now();

  if (!srv_validate_tablespace_paths && !recv_needed_recovery &&
      ibuf_is_empty()) {
    ib::info(ER_IB_TABLESPACE_PATH_VALIDATION_SKIPPED);
    ---- return missing here------------------------------------->
  }
[12 Jul 9:24] MySQL Verification Team
Hi Mr. Bodapati,

Thank you for your bug report.

However, your bug is a duplicate of the following ones:

https://bugs.mysql.com/bug.php?id=115517
https://bugs.mysql.com/bug.php?id=115528
https://bugs.mysql.com/bug.php?id=115515
https://bugs.mysql.com/bug.php?id=115528

However, thank you for your fix, which we are making available to our Development.

Thanks again.
[12 Jul 9:29] Satya Bodapati
This is not same bug as them.
This is not about the crash.

This bug existed since 8.0.24. It is about innodb_validate_tablespace_paths not working.

It is supposed to NOT do path validations when the options is OFF but when the option is set to OFF, it will still *do* validations.

Hope it is clear now.
[12 Jul 9:56] MySQL Verification Team
Hi Mr. Bodapati,

Sorry for the confusion.

Hence, you were kind enough to send us a patch for the commit to our internal bug  #32493885.

It was approved in ReviewBoard entry #25948.

Since, this is not a duplicate bug, we are verifying your report.

Thank you for your contribution.
[12 Jul 10:04] Satya Bodapati
Thank you for marking it as Verified!
[12 Jul 10:07] MySQL Verification Team
Hi Mr. Bodapati,

There is truly nothing to thank us for ......
[15 Jul 9:24] MySQL Verification Team
Hi Mr. Bodapati,

There are several more factors that should be mentioned here.

The variable innodb_validate_tablespace_paths is working as expected.

Our Reference Manual also says:

"
The innodb_validate_tablespace_paths variable permits disabling tablespace path validation. This feature is intended for environments where tablespaces files are not moved. Disabling path validation improves startup time on systems with a large number of tablespace files.
"

So, we have to consider more factors for this bug.
[15 Jul 10:37] MySQL Verification Team
Hi Mr. Bodapati,

Our Development has analysed the functionality of the above variable in the latest release of 8.0 and concluded that it is working as it is supposed to and how it is described in our Reference Manual.
[15 Jul 11:05] Satya Bodapati
Well, I think there is a misunderstanding here.

Sure, even when this option is turned ON, there are cases that validation shouldn't be turned OFF. These cases are 
1. there is crash recovery
2. there is some opening change buffer merges/entries.

But let's say there is no crash recovery, no ibuf, and the user wants to disable validations. Shouldn't it be possible to disable them?

With the current logic, it doesn't.
[15 Jul 12:17] MySQL Verification Team
Here is a full comment from our InnoDB team:

The code comment says 

"
  /* Validate all tablespaces if innodb_validate_tablespace_paths=ON OR
  server is in recovery  OR Change buffer is not empty.
  <snip>.
  If all the conditions mentioned above are false then
  validate only undo tablespaces */
"

So the intention is, validate UNDO tablespaces, even if innodb_validate_tablespace_paths=OFF and we are not in recovery. Intention can also be seen clearly mentioned in commit message

"
...
The setting innodb_validate_tablespace_paths can turn off this
validation effort for all IBD and IBU tablespaces in the DD, even
during a recovery.  But it should always run after a recovery and
it should always run for undo tablespaces.
..."

If we start the server with "--innodb_validate_tablespace_paths=OFF", then we see at server log

"
[Note] [MY-012357] [InnoDB] Reading DD tablespace files
[Note] [MY-013604] [InnoDB] Skipping InnoDB tablespace path validation. Manually moved tablespace files will not be detected!
[Note] [MY-011825] [InnoDB] # of tablespaces : 7. # of threads : 0
[Note] [MY-012356] [InnoDB] Scanned 7 tablespaces. Validated 2. Skipped 5.
"

Which clearly says the warning that validation is being skipped and that only 2 tablespaces (UNDO) were validated and rest 5 were skipped.

If we start the server normally, then we see at server log

"
[Note] [MY-012357] [InnoDB] Reading DD tablespace files
[Note] [MY-011825] [InnoDB] # of tablespaces : 7. # of threads : 0
[Note] [MY-012356] [InnoDB] Scanned 7 tablespaces. Validated 7.
"

Which says all the 7 tablespaces were validated.

So innodb_validate_tablespace_paths is not DUMMY.

Not a bug.
[15 Jul 13:12] Satya Bodapati
Thanks for the clarification.
[15 Jul 13:25] MySQL Verification Team
You are welcome.