|
299 | 299 | our $exe_ndb_example;
|
300 | 300 | our $path_ndb_testrun_log;
|
301 | 301 |
|
| 302 | +our $path_sql_dir; |
| 303 | + |
302 | 304 | our @data_dir_lst;
|
303 | 305 |
|
304 | 306 | our $used_binlog_format;
|
@@ -1497,12 +1499,16 @@ ()
|
1497 | 1499 | $exe_mysql_fix_system_tables=
|
1498 | 1500 | mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
|
1499 | 1501 | "$path_client_bindir/mysql_fix_privilege_tables");
|
| 1502 | + |
1500 | 1503 | }
|
1501 | 1504 |
|
| 1505 | + # Look for SQL scripts directory |
| 1506 | + $path_sql_dir= mtr_path_exists("$glob_basedir/share", |
| 1507 | + "$glob_basedir/scripts"); |
| 1508 | + |
1502 | 1509 | # Look for mysql_fix_privilege_tables.sql script
|
1503 | 1510 | $file_mysql_fix_privilege_tables=
|
1504 |
| - mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", |
1505 |
| - "$glob_basedir/share/mysql_fix_privilege_tables.sql"); |
| 1511 | + mtr_file_exists("$path_sql_dir/mysql_fix_privilege_tables.sql"); |
1506 | 1512 |
|
1507 | 1513 | if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
|
1508 | 1514 | {
|
|
1940 | 1946 | "--port=$master->[0]->{'port'} " .
|
1941 | 1947 | "--socket=$master->[0]->{'path_sock'}";
|
1942 | 1948 | $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
| 1949 | + |
1943 | 1950 | }
|
1944 | 1951 | $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
|
1945 | 1952 |
|
@@ -2856,38 +2863,11 @@ ($$)
|
2856 | 2863 | my $type= shift;
|
2857 | 2864 | my $data_dir= shift;
|
2858 | 2865 |
|
2859 |
| - my $init_db_sql= "lib/init_db.sql"; |
2860 |
| - my $init_db_sql_tmp= "/tmp/init_db.sql$$"; |
2861 |
| - my $args; |
2862 |
| - |
2863 | 2866 | mtr_report("Installing \u$type Database");
|
2864 | 2867 |
|
2865 |
| - open(IN, $init_db_sql) |
2866 |
| - or mtr_error("Can't open $init_db_sql: $!"); |
2867 |
| - open(OUT, ">", $init_db_sql_tmp) |
2868 |
| - or mtr_error("Can't write to $init_db_sql_tmp: $!"); |
2869 |
| - while (<IN>) |
2870 |
| - { |
2871 |
| - chomp; |
2872 |
| - s/\@HOSTNAME\@/$glob_hostname/; |
2873 |
| - if ( /^\s*$/ ) |
2874 |
| - { |
2875 |
| - print OUT "\n"; |
2876 |
| - } |
2877 |
| - elsif (/;$/) |
2878 |
| - { |
2879 |
| - print OUT "$_\n"; |
2880 |
| - } |
2881 |
| - else |
2882 |
| - { |
2883 |
| - print OUT "$_ "; |
2884 |
| - } |
2885 |
| - } |
2886 |
| - close OUT; |
2887 |
| - close IN; |
2888 | 2868 |
|
| 2869 | + my $args; |
2889 | 2870 | mtr_init_args(\$args);
|
2890 |
| - |
2891 | 2871 | mtr_add_arg($args, "--no-defaults");
|
2892 | 2872 | mtr_add_arg($args, "--bootstrap");
|
2893 | 2873 | mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
|
@@ -2921,21 +2901,44 @@ ($$)
|
2921 | 2901 | # ----------------------------------------------------------------------
|
2922 | 2902 | $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
|
2923 | 2903 |
|
| 2904 | + # ---------------------------------------------------------------------- |
| 2905 | + # Create the bootstrap.sql file |
| 2906 | + # ---------------------------------------------------------------------- |
| 2907 | + my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql$$"; |
| 2908 | + |
| 2909 | + # Use the mysql database for system tables |
| 2910 | + mtr_tofile($bootstrap_sql_file, "use mysql"); |
| 2911 | + |
| 2912 | + # Add the offical mysql system tables and initial system data |
| 2913 | + # for a prodcuction system |
| 2914 | + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", |
| 2915 | + $bootstrap_sql_file); |
| 2916 | + |
| 2917 | + # Add test data for timezone - this is just a subset, on a real |
| 2918 | + # system these tables will be populated either by mysql_tzinfo_to_sql |
| 2919 | + # or by downloading the timezone table package from our website |
| 2920 | + mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", |
| 2921 | + $bootstrap_sql_file); |
| 2922 | + |
| 2923 | + # Fill help tables, just an empty file when running from bk repo |
| 2924 | + # but will be replaced by a real fill_help_tables.sql when |
| 2925 | + # building the source dist |
| 2926 | + mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", |
| 2927 | + $bootstrap_sql_file); |
| 2928 | + |
2924 | 2929 | # Log bootstrap command
|
2925 | 2930 | my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
|
2926 | 2931 | mtr_tofile($path_bootstrap_log,
|
2927 | 2932 | "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
|
2928 | 2933 |
|
2929 |
| - if ( mtr_run($exe_mysqld_bootstrap, $args, $init_db_sql_tmp, |
| 2934 | + if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, |
2930 | 2935 | $path_bootstrap_log, $path_bootstrap_log,
|
2931 | 2936 | "", { append_log_file => 1 }) != 0 )
|
2932 | 2937 |
|
2933 | 2938 | {
|
2934 |
| - unlink($init_db_sql_tmp); |
2935 | 2939 | mtr_error("Error executing mysqld --bootstrap\n" .
|
2936 |
| - "Could not install $type test DBs"); |
| 2940 | + "Could not install system database, see $path_bootstrap_log"); |
2937 | 2941 | }
|
2938 |
| - unlink($init_db_sql_tmp); |
2939 | 2942 | }
|
2940 | 2943 |
|
2941 | 2944 |
|
|
0 commit comments