Bug #107288 mysqld crash when innodb_log_recent_written_size were incorrectly configured
Submitted: 13 May 2022 11:27 Modified: 16 May 2022 12:22
Reporter: alex xing (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.29 OS:Any
Assigned to: CPU Architecture:Any

[13 May 2022 11:27] alex xing
Description:
The kernel can automatically adjust parameters according to the power of 2, rather than crash 

template <typename Position>
Link_buf<Position>::Link_buf(size_t capacity)
    : m_capacity(capacity), m_tail(0) {
  if (capacity == 0) {
    m_links = nullptr;
    return;
  }
  //adjust to the power of 2 ?
  ut_a((capacity & (capacity - 1)) == 0);

  m_links = UT_NEW_ARRAY_NOKEY(std::atomic<Distance>, capacity);

  for (size_t i = 0; i < capacity; ++i) {
    m_links[i].store(0);
  }
}

How to repeat:
just read the code

Suggested fix:
The kernel can automatically adjust parameters according to the power of 2, rather than crash
[13 May 2022 13:41] MySQL Verification Team
Hi Mr. xing,

Thank you for your bug report.

We have found our own definition of the Position template in the InnoDB utility header file ut0link.h.

Your own definition does not seem suitable to us.  We do not see a necessity for the assert nor for the usage of macro that, actually, we do not use , nor do we have it defined.

You are mentioning that kernel automatically adjust the size of any allocation to the power of 2 (two), but that is not valid for all kernels.

Your further explanations are more then welcome .....
[13 May 2022 13:57] alex xing
I just misexpressed myself. I mean, if use set innodb_log_recent_written_size =1025, the mysqld can set it to 1024 instead of crash.
[13 May 2022 14:12] MySQL Verification Team
Hi Mr. xing,

We can not accept your contribution simply because innodb_log_recent_written_size is not a configuration variable that can be set by user nor by DBA nor by  system administrator.

Not a bug.
[16 May 2022 1:36] alex xing
user can set innodb_log_recent_written_size ,if mysqld compile with -DENABLE_EXPERIMENT_SYSVARS=1
[16 May 2022 12:10] MySQL Verification Team
Hi Mr. xing,

Yes, we are aware of that, but if you change anything, it is up to you to make it work.

These are meant for developers conducting experiments to fine tune these "hardcoded" settings. Hence, this is an option for developers to try their own patches, by setting  ENABLE_EXPERIMENT_SYSVARS.

Hence, this is not a bug, but we must point out that we are interested in any findings that you have discovered by experimenting with InnoDB. Both positive and negative discoveries that you made. 

Those will not lead to verified bugs, but might lead to feature requests.
[16 May 2022 12:22] alex xing
Thank you very much for your reply
[16 May 2022 12:24] MySQL Verification Team
You are truly welcome.