Commit a8715884 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-11903 Windows : Support innodb page sizes in the installer/mysql_install_db.exe

- add PAGESIZE property to the MSI installer
- add combobox  to the MSI UI to select innodb page size
- add new parameter --innodb_page_size for mysql_install_db.exe.
this is passed down to bootstrap and also stored in my.ini.

MSI will call mysql_install_db.exe with --innodb_page_size set to the
PAGESIZE property
parent bfef611a
...@@ -47,6 +47,7 @@ static char *opt_datadir; ...@@ -47,6 +47,7 @@ static char *opt_datadir;
static char *opt_service; static char *opt_service;
static char *opt_password; static char *opt_password;
static int opt_port; static int opt_port;
static int opt_innodb_page_size;
static char *opt_socket; static char *opt_socket;
static char *opt_os_user; static char *opt_os_user;
static char *opt_os_password; static char *opt_os_password;
...@@ -56,6 +57,7 @@ static my_bool opt_skip_networking; ...@@ -56,6 +57,7 @@ static my_bool opt_skip_networking;
static my_bool opt_verbose_bootstrap; static my_bool opt_verbose_bootstrap;
static my_bool verbose_errors; static my_bool verbose_errors;
#define DEFAULT_INNODB_PAGE_SIZE 16*1024
static struct my_option my_long_options[]= static struct my_option my_long_options[]=
{ {
...@@ -81,6 +83,8 @@ static struct my_option my_long_options[]= ...@@ -81,6 +83,8 @@ static struct my_option my_long_options[]=
{"skip-networking", 'N', "Do not use TCP connections, use pipe instead", {"skip-networking", 'N', "Do not use TCP connections, use pipe instead",
&opt_skip_networking, &opt_skip_networking, 0 , GET_BOOL, OPT_ARG, 0, 0, 0, 0, &opt_skip_networking, &opt_skip_networking, 0 , GET_BOOL, OPT_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{ "innodb-page-size", 'i', "Page size for innodb",
&opt_innodb_page_size, &opt_innodb_page_size, 0, GET_INT, REQUIRED_ARG, DEFAULT_INNODB_PAGE_SIZE, 1*1024, 64*1024, 0, 0, 0 },
{"silent", 's', "Print less information", &opt_silent, {"silent", 's', "Print less information", &opt_silent,
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose-bootstrap", 'o', "Include mysqld bootstrap output",&opt_verbose_bootstrap, {"verbose-bootstrap", 'o', "Include mysqld bootstrap output",&opt_verbose_bootstrap,
...@@ -259,13 +263,13 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) ...@@ -259,13 +263,13 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
char basedir[MAX_PATH]; char basedir[MAX_PATH];
get_basedir(basedir, sizeof(basedir), mysqld_path); get_basedir(basedir, sizeof(basedir), mysqld_path);
my_snprintf(cmdline, size-1, my_snprintf(cmdline, size - 1,
"\"\"%s\" --no-defaults %s --bootstrap" "\"\"%s\" --no-defaults %s --innodb-page-size=%d --bootstrap"
" \"--lc-messages-dir=%s/share\"" " \"--lc-messages-dir=%s/share\""
" --basedir=. --datadir=. --default-storage-engine=myisam" " --basedir=. --datadir=. --default-storage-engine=myisam"
" --max_allowed_packet=9M " " --max_allowed_packet=9M "
" --net-buffer-length=16k\"", mysqld_path, " --net-buffer-length=16k\"", mysqld_path,
opt_verbose_bootstrap?"--console":"", basedir ); opt_verbose_bootstrap ? "--console" : "", opt_innodb_page_size, basedir);
return cmdline; return cmdline;
} }
...@@ -316,7 +320,10 @@ static int create_myini() ...@@ -316,7 +320,10 @@ static int create_myini()
{ {
fprintf(myini,"port=%d\n", opt_port); fprintf(myini,"port=%d\n", opt_port);
} }
if (opt_innodb_page_size != DEFAULT_INNODB_PAGE_SIZE)
{
fprintf(myini, "innodb-page-size=%d\n", opt_innodb_page_size);
}
/* Write out client settings. */ /* Write out client settings. */
fprintf(myini, "[client]\n"); fprintf(myini, "[client]\n");
...@@ -652,13 +659,6 @@ static int create_db_instance() ...@@ -652,13 +659,6 @@ static int create_db_instance()
goto end; goto end;
} }
/*
Remove innodb log files if they exist (this works around "different size logs"
error in MSI installation). TODO : remove this with the next Innodb, where
different size is handled gracefully.
*/
DeleteFile("ib_logfile0");
DeleteFile("ib_logfile1");
/* Create my.ini file in data directory.*/ /* Create my.ini file in data directory.*/
ret= create_myini(); ret= create_myini();
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<!-- If Innodb is compiled in, enable "optimize for transactions" checkbox --> <!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
<?ifndef HaveInnodb ?> <?ifndef HaveInnodb ?>
<?define HaveInnodb="0"?> <?define HaveInnodb="1"?>
<?endif?> <?endif?>
<Property Id="PortTemplate" Value="#####" /> <Property Id="PortTemplate" Value="#####" />
...@@ -55,13 +55,14 @@ ...@@ -55,13 +55,14 @@
<!-- Activate feedback plugin--> <!-- Activate feedback plugin-->
<Property Id="FEEDBACK" Secure="yes"/> <Property Id="FEEDBACK" Secure="yes"/>
<?if $(var.HaveInnodb) = "1" ?>
<!-- Quick configuration : set default storage engine to innodb, use strict sql_mode --> <!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
<Property Id="STDCONFIG" Secure="yes" Value="1"/> <Property Id="STDCONFIG" Secure="yes" Value="1"/>
<?endif?>
<!-- Innodb Buffer pool size in MB--> <!-- Innodb Buffer pool size in MB-->
<Property Id="BUFFERPOOLSIZE" Secure="yes"/> <Property Id="BUFFERPOOLSIZE" Secure="yes"/>
<!-- Innodb page size -->
<Property Id="PAGESIZE" Secure="yes" Value="16K"/>
<CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" /> <CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
...@@ -336,29 +337,25 @@ ...@@ -336,29 +337,25 @@
<Condition Action="disable">Not EnableNetworking</Condition> <Condition Action="disable">Not EnableNetworking</Condition>
</Control> </Control>
<?if $(var.HaveInnodb) = "1" ?> <Control Id="LabelInnodbSettings" Type="Text" Height="18" Width="220" X="25" Y="171" >
<Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1"> <Text>{\Font1}Innodb engine settings</Text>
<Text>{\Font1}Optimize for transactions</Text>
</Control>
<Control Id="StandardConfigExplain" Type="Text" X="25" Y="190" Width="270" Height="14" TabSkip="yes">
<Text>(Uses transactional storage engine and "strict" SQL mode)</Text>
<Condition Action="enable" >STDCONFIG</Condition>
<Condition Action="disable">Not STDCONFIG</Condition>
</Control>
<Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="210" Text="Buffer pool size:" >
<Condition Action="enable" >STDCONFIG</Condition>
<Condition Action="disable">Not STDCONFIG</Condition>
</Control> </Control>
<Control Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]"> <Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="190" Text="Buffer pool size:" />
<Condition Action="enable" >STDCONFIG</Condition> <Control Id="BPSize" Type="MaskedEdit" X="104" Y="188" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]"/>
<Condition Action="disable">Not STDCONFIG</Condition> <Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="190" Text="MB" />
<Control Id="LabelInnodbPageSize" Type="Text" Height="17" Width="77" X="25" Y="208" Text="Page size:" />
<Control Id="LabelKB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="KB" />
<Control Id="ComboBoxInnodbPageSize" Type="ComboBox" X="104" Y="208" Width="30" Height="17" ComboList="yes" Sorted="yes" Property="PAGESIZE" >
<ComboBox Property="PAGESIZE">
<ListItem Text=" 1" Value="1K"/>
<ListItem Text=" 2" Value="2K"/>
<ListItem Text=" 4" Value="4K"/>
<ListItem Text=" 8" Value="8K"/>
<ListItem Text="16" Value="16K"/>
<ListItem Text="32" Value="32K"/>
<ListItem Text="64" Value="64K"/>
</ComboBox>
</Control> </Control>
<Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="MB" >
<Condition Action="enable" >STDCONFIG</Condition>
<Condition Action="disable">Not STDCONFIG</Condition>
</Control>
<?endif?>
<!-- Navigation buttons--> <!-- Navigation buttons-->
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back"> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
...@@ -493,26 +490,11 @@ ...@@ -493,26 +490,11 @@
<ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/> <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/>
<ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/> <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
</Component> </Component>
<?if $(var.HaveInnodb) = "1" ?>
<Component Id="C.myiniconfig" Guid="*" Directory="DATADIR"> <Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
<Condition>STDCONFIG</Condition>
<RegistryValue Root='HKLM' <RegistryValue Root='HKLM'
Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@' Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/> Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/>
<IniFile Id="Ini1"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="sql_mode"
Value="&quot;STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION&quot;" />
<IniFile Id="Ini2"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="default_storage_engine"
Value="innodb" />
<IniFile Id="Ini3" <IniFile Id="Ini3"
Action="createLine" Action="createLine"
Directory="DATADIR" Directory="DATADIR"
...@@ -520,16 +502,7 @@ ...@@ -520,16 +502,7 @@
Name="my.ini" Name="my.ini"
Key="innodb_buffer_pool_size" Key="innodb_buffer_pool_size"
Value="[BUFFERPOOLSIZE]M" /> Value="[BUFFERPOOLSIZE]M" />
<IniFile Id="Ini4"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="innodb_log_file_size"
Value="[LOGFILESIZE]M" />
</Component> </Component>
<?endif?>
<Component Id="C.feedback" Guid="*" Directory="DATADIR"> <Component Id="C.feedback" Guid="*" Directory="DATADIR">
<Condition>FEEDBACK</Condition> <Condition>FEEDBACK</Condition>
<RegistryValue Root='HKLM' <RegistryValue Root='HKLM'
...@@ -699,7 +672,7 @@ ...@@ -699,7 +672,7 @@
<CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' /> <CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
<CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase" <CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
Value= Value=
"&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER] --verbose-bootstrap" "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] --innodb-page-size=[PAGESIZE] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER] --verbose-bootstrap"
Execute="immediate" Execute="immediate"
HideTarget="yes" HideTarget="yes"
/> />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment