Skip to content

Commit

Permalink
MDEV-11903 Windows : Support innodb page sizes in the installer/mysql…
Browse files Browse the repository at this point in the history
…_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
  • Loading branch information
vaintroub committed Mar 13, 2017
1 parent bfef611 commit a871588
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 64 deletions.
22 changes: 11 additions & 11 deletions sql/mysql_install_db.cc
Expand Up @@ -47,6 +47,7 @@ static char *opt_datadir;
static char *opt_service;
static char *opt_password;
static int opt_port;
static int opt_innodb_page_size;
static char *opt_socket;
static char *opt_os_user;
static char *opt_os_password;
Expand All @@ -56,6 +57,7 @@ static my_bool opt_skip_networking;
static my_bool opt_verbose_bootstrap;
static my_bool verbose_errors;

#define DEFAULT_INNODB_PAGE_SIZE 16*1024

static struct my_option my_long_options[]=
{
Expand All @@ -81,6 +83,8 @@ static struct my_option my_long_options[]=
{"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,
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,
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose-bootstrap", 'o', "Include mysqld bootstrap output",&opt_verbose_bootstrap,
Expand Down Expand Up @@ -259,13 +263,13 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
char basedir[MAX_PATH];
get_basedir(basedir, sizeof(basedir), mysqld_path);

my_snprintf(cmdline, size-1,
"\"\"%s\" --no-defaults %s --bootstrap"
my_snprintf(cmdline, size - 1,
"\"\"%s\" --no-defaults %s --innodb-page-size=%d --bootstrap"
" \"--lc-messages-dir=%s/share\""
" --basedir=. --datadir=. --default-storage-engine=myisam"
" --max_allowed_packet=9M "
" --net-buffer-length=16k\"", mysqld_path,
opt_verbose_bootstrap?"--console":"", basedir );
opt_verbose_bootstrap ? "--console" : "", opt_innodb_page_size, basedir);
return cmdline;
}

Expand Down Expand Up @@ -316,7 +320,10 @@ static int create_myini()
{
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. */
fprintf(myini, "[client]\n");

Expand Down Expand Up @@ -652,13 +659,6 @@ static int create_db_instance()
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.*/
ret= create_myini();
Expand Down
79 changes: 26 additions & 53 deletions win/packaging/extra.wxs.in
Expand Up @@ -12,7 +12,7 @@

<!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
<?ifndef HaveInnodb ?>
<?define HaveInnodb="0"?>
<?define HaveInnodb="1"?>
<?endif?>

<Property Id="PortTemplate" Value="#####" />
Expand Down Expand Up @@ -55,13 +55,14 @@
<!-- Activate feedback plugin-->
<Property Id="FEEDBACK" Secure="yes"/>

<?if $(var.HaveInnodb) = "1" ?>
<!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
<Property Id="STDCONFIG" Secure="yes" Value="1"/>
<?endif?>

<!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
<Property Id="STDCONFIG" Secure="yes" Value="1"/>

<!-- Innodb Buffer pool size in MB-->
<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" />

Expand Down Expand Up @@ -336,29 +337,25 @@
<Condition Action="disable">Not EnableNetworking</Condition>
</Control>

<?if $(var.HaveInnodb) = "1" ?>
<Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1">
<Text>{\Font1}Optimize for transactions</Text>
<Control Id="LabelInnodbSettings" Type="Text" Height="18" Width="220" X="25" Y="171" >
<Text>{\Font1}Innodb engine settings</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 Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="190" Text="Buffer pool size:" />
<Control Id="BPSize" Type="MaskedEdit" X="104" Y="188" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]"/>
<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 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 Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]">
<Condition Action="enable" >STDCONFIG</Condition>
<Condition Action="disable">Not STDCONFIG</Condition>
</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-->
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
Expand Down Expand Up @@ -493,43 +490,19 @@
<ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/>
<ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
</Component>
<?if $(var.HaveInnodb) = "1" ?>

<Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
<Condition>STDCONFIG</Condition>
<RegistryValue Root='HKLM'
Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
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"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="innodb_buffer_pool_size"
Value="[BUFFERPOOLSIZE]M" />
<IniFile Id="Ini4"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="innodb_log_file_size"
Value="[LOGFILESIZE]M" />
</Component>
<?endif?>

<Component Id="C.feedback" Guid="*" Directory="DATADIR">
<Condition>FEEDBACK</Condition>
<RegistryValue Root='HKLM'
Expand Down Expand Up @@ -699,7 +672,7 @@
<CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
<CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
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"
HideTarget="yes"
/>
Expand Down

0 comments on commit a871588

Please sign in to comment.