From: msvensson Date: November 15 2006 2:19pm Subject: bk commit into 4.1 tree (msvensson:1.2556) BUG#20166 List-Archive: http://lists.mysql.com/commits/15356 X-Bug: 20166 Message-Id: <20061115141956.EAA5986DEEF@neptunus.localdomain> Below is the list of changes that have just been committed into a local 4.1 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-11-15 15:19:53+01:00, msvensson@neptunus.(none) +5 -0 Bug#20166 mysql-test-run.pl does not test system privilege tables creation - Build mysql_create_system_tables.sql from the output of "mysql_create_system_tables test" - Remove mysql-test/init_db.sql and mysql-test/lib/init_db.sql - Leave netware/init_db.sql until 5.0 where we should soon have possibility to test with mysql-test-run.pl BitKeeper/deleted/.del-init_db.sql@stripped, 2006-11-15 15:16:19+01:00, msvensson@neptunus.(none) +0 -0 Rename: mysql-test/lib/init_db.sql -> BitKeeper/deleted/.del-init_db.sql BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7@stripped, 2006-11-15 15:16:19+01:00, msvensson@neptunus.(none) +0 -0 Rename: mysql-test/init_db.sql -> BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7 mysql-test/Makefile.am@stripped, 2006-11-15 15:19:52+01:00, msvensson@neptunus.(none) +0 -2 Remove install of removed file lib/init_db.sql mysql-test/mysql-test-run.pl@stripped, 2006-11-15 15:19:52+01:00, msvensson@neptunus.(none) +57 -18 Use mysql_create_system_tables.sql when installing the test database(s) That file is in 4.1 created from output of "mysql_create_system_tables test" but will in 5.0 and up be the original and can thus be sourced both from mysql_create_system_tables/mysql_install_db, other system specific installers like on windows, NetWare and also from mysql-test-run.pl scripts/Makefile.am@stripped, 2006-11-15 15:19:52+01:00, msvensson@neptunus.(none) +13 -3 Build mysql_create_system_tables.sql from output of "mysql_create_system_tables test" # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: neptunus.(none) # Root: /home/msvensson/mysql/bug20166/my41-bug20166 --- 1.47/scripts/Makefile.am 2006-11-15 15:19:56 +01:00 +++ 1.48/scripts/Makefile.am 2006-11-15 15:19:56 +01:00 @@ -33,7 +33,8 @@ bin_SCRIPTS = @server_scripts@ \ mysql_explain_log \ mysql_tableinfo \ mysqld_multi \ - mysql_create_system_tables + mysql_create_system_tables \ + mysql_create_system_tables.sql noinst_SCRIPTS = make_binary_distribution \ make_sharedlib_distribution \ @@ -66,7 +67,9 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) \ mysqlaccess.conf \ mysqlbug -dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql +dist_pkgdata_DATA = fill_help_tables.sql \ + mysql_fix_privilege_tables.sql \ + mysql_create_system_tables.sql # mysqlbug should be distributed built so that people can report build # failures with it. @@ -89,7 +92,8 @@ CLEANFILES = @server_scripts@ \ mysql_tableinfo \ mysqld_multi \ make_win_src_distribution \ - mysql_create_system_tables + mysql_create_system_tables \ + mysql_create_system_tables.sql DISTCLEANFILES = mysqlbug @@ -149,6 +153,12 @@ SUFFIXES = .sh $< > $@-t @CHMOD@ +x $@-t @MV@ $@-t $@ +# +# Build mysql_create_system_tables.sql by executing mysql_create_system_tables +# the file will contain test data as well +mysql_create_system_tables.sql: mysql_create_system_tables + $(top_builddir)/scripts/mysql_create_system_tables \ + test . \@HOSTNAME\@ > $@ # Don't update the files from bitkeeper %::SCCS/s.% --- 1.145/mysql-test/mysql-test-run.pl 2006-11-15 15:19:56 +01:00 +++ 1.146/mysql-test/mysql-test-run.pl 2006-11-15 15:19:56 +01:00 @@ -2621,40 +2621,79 @@ sub copy_install_db ($$) { } -sub install_db ($$) { - my $type= shift; - my $data_dir= shift; - - my $init_db_sql= "lib/init_db.sql"; - my $init_db_sql_tmp= "/tmp/init_db.sql$$"; - my $args; - - mtr_report("Installing \u$type Database"); - - open(IN, $init_db_sql) - or mtr_error("Can't open $init_db_sql: $!"); - open(OUT, ">", $init_db_sql_tmp) - or mtr_error("Can't write to $init_db_sql_tmp: $!"); +# +# Append one file to the bootstrap file +# - replace the hostname +# - check that format is correct for bootstrapping +# +sub bootstrap_append($$) +{ + my ($from_file, $to_file)= @_; + + open(IN, "<", $from_file) + or mtr_error("Can't read from to $from_file: $!"); + open(OUT, ">>", $to_file) + or mtr_error("Can't write to $to_file: $!"); while () { chomp; s/\@HOSTNAME\@/$glob_hostname/; if ( /^\s*$/ ) { + # Allow empty lines print OUT "\n"; } elsif (/;$/) { + # Allow lines ending in ; print OUT "$_\n"; } else { - print OUT "$_ "; + # Everything else is an error + mtr_error("Wrong format of SQL statement for bootstrap " . + "detected in file: \"$from_file\" " . + "at line containing \"$_\""); } } close OUT; close IN; +} +# +# Bootstrap mysqld with the contents of mysql_create_system_tables.sql +# and some test data files depending on version +# +# In 4.1 mysql_create_system_tables.sql file is built from the output of +# "mysql_create_system_tables.sh test" and will thus contain test data +# for timezone related files as well, no additional files are needed +# +# In 5.0 and upwards, the mysql_create_system_tables.sql becomes the +# original location of the SQL that creates the system tables and can +# thus be sourced directly. It will however not contain any test data +# and that has to be added to the bootstrap file +# +sub install_db ($$) { + my $type= shift; + my $data_dir= shift; + + my $bootstrap_sql_file= "/tmp/bootstrap.sql$$"; + + mtr_report("Installing \u$type Database"); + + # Make sure to start from scratch + unlink($bootstrap_sql_file); + + bootstrap_append("$glob_basedir/scripts/mysql_create_system_tables.sql", + $bootstrap_sql_file); + + if ($mysql_version_id >= 50000) + { + bootstrap_append("$glob_basedir/scripts/mysql_test_data_timezone.sql", + $bootstrap_sql_file); + } + + my $args; mtr_init_args(\$args); mtr_add_arg($args, "--no-defaults"); @@ -2685,16 +2724,16 @@ sub install_db ($$) { mtr_tofile($path_bootstrap_log, "$exe_mysqld " . join(" ", @$args) . "\n"); - if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp, + if ( mtr_run($exe_mysqld, $args, $bootstrap_sql_file, $path_bootstrap_log, $path_bootstrap_log, "", { append_log_file => 1 }) != 0 ) { - unlink($init_db_sql_tmp); + unlink($bootstrap_sql_file); mtr_error("Error executing mysqld --bootstrap\n" . "Could not install $type test DBs"); } - unlink($init_db_sql_tmp); + unlink($bootstrap_sql_file); } --- 1.55/mysql-test/Makefile.am 2006-11-15 15:19:56 +01:00 +++ 1.56/mysql-test/Makefile.am 2006-11-15 15:19:56 +01:00 @@ -61,7 +61,6 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib @@ -88,7 +87,6 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib uninstall-local: