WL#12300: Automatically configure default redo log file size for innodb dedicated server

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

Currently, we have 2 system variables for setting redo log file size,
innodb_log_file_size(default value = 48M) and innodb_log_files_in_group(default 
value = 2). And when innodb_dedicated_server is enabled, the value of 
innodb_log_file_size will depend on detected server memory.

innodb_log_file_size is configured as:

Detected Server Memory    Log File Size
< 1GB    48MiB (the innodb_log_file_size default)
<= 4GB    128MiB
<= 8GB    512MiB
<= 16GB    1024MiB
> 16GB    2048MiB

And innodb_log_files_in_group is always 2, which means, it will not be changed 
even the memory size is bigger. In fact, we want this value can be adjusted 
according to memory size also.

In this worklog, we will introduce a mechanism to automatically config these 2 
variables according to buffer pool size or detected server memory size.

WE are using the following expressions:

innodb_log_file_size:

=IF( C2<8, 0.5, IF( C2<=128, 1, 2 ))

innodb_log_files_in_group:

=IF( C2<8, ROUND(C2), IF( C2<=128, ROUND(C2 * 0.75), 64 ))

C2 is the auto-tuned buffer pool size in GB.

The ROUND(C2) assumes GB rounding of course there too (i.e if the buffer is 
5.5GB, we’d want “5” there, to try and get between 1 and 64 logs).

Note:This feature is only for innodb dedicated server, which means it works 
once innodb_dedicated_server is enabled. So, if user has already set those 
options in my.cnf, we will still take user's configuration. User settings 
override dedicated server settings.
Requirements

F1 - system variable innodb_log_file_size can be automatically configured as 
expected when innodb_dedicated_server is enabled.
F2 - system variable innodb_log_files_in_group can be automatically configured 
as expected when innodb_dedicated_server is enabled.
F3 - redo log file can be created as expected according to innodb_log_file_size 
and innodb_log_files_in_group.

Non-Functional requirements
NF-1 - There's no performance impact


Basically, we just need to change some logic in function innodb_init_params().
In this function, we need to set proper values for innodb_log_file_size and 
innodb_log_files_in_group.
In function innodb_init_params():

.....

+  acquire_sysvar_source_service();
+  /* If innodb_dedicated_server == ON */
+  if (srv_dedicated_server && sysvar_source_svc != nullptr) {
+    static const char *variable_name = "innodb_log_file_size";
+    enum_variable_source source;
+
+    if (!sysvar_source_svc->get(
+            variable_name, static_cast<unsigned int>(strlen(variable_name)),
+            &source)) {
+      if (source == COMPILED) {
+        double buf_pool_size_in_gb = srv_buf_pool_size / GB;
+        if (buf_pool_size_in_gb < 8.0) {
+          srv_log_file_size = 512ULL * MB;
+          srv_n_log_files = round(buf_pool_size_in_gb);
+        } else if (buf_pool_size_in_gb <= 128.0) {
+          srv_log_file_size = 1024ULL * MB;
+          srv_n_log_files = round(buf_pool_size_in_gb * 0.75);
+        } else {
+          srv_log_file_size = 2048ULL * MB;
+          srv_n_log_files = 64;
+        }
+      } else {
+        ib::warn(ER_IB_MSG_535)
+            << "Option innodb_dedicated_server is ignored for "
+            << "innodb_log_file_size"
+            << " because innodb_log_file_size=" << srv_log_file_size
+            << " is specified explicitly.";
+      }
+    }
+  }
+  release_sysvar_source_service();

.....