List:Commits« Previous MessageNext Message »
From:msvensson Date:November 16 2006 2:16pm
Subject:bk commit into 5.1 tree (msvensson:1.2352)
View as plain text  
Below is the list of changes that have just been committed into a local
5.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-16 14:16:03+01:00, msvensson@neptunus.(none) +11 -0
  Merge neptunus.(none):/home/msvensson/mysql/bug20166/my50-bug20166
  into  neptunus.(none):/home/msvensson/mysql/bug20166/my51-bug20166
  MERGE: 1.1810.1698.174

  BitKeeper/deleted/.del-init_db.sql@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.14.1.2

  BitKeeper/deleted/.del-init_db.sql@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Merge rename: mysql-test/lib/init_db.sql -> BitKeeper/deleted/.del-init_db.sql

  BitKeeper/deleted/.del-init_db.sql~af2dfeabaa348dd7@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.4.1.2

  BitKeeper/deleted/.del-mysql_create_system_tables.sh@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.12.1.17

  BitKeeper/deleted/.del-mysql_create_system_tables.sh@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Merge rename: scripts/mysql_create_system_tables.sh ->
BitKeeper/deleted/.del-mysql_create_system_tables.sh

  mysql-test/Makefile.am@stripped, 2006-11-16 14:16:01+01:00, msvensson@neptunus.(none) +0 -0
    Manual merge
    MERGE: 1.66.1.8

  mysql-test/install_test_db.sh@stripped, 2006-11-16 14:13:52+01:00, msvensson@neptunus.(none)
+0 -0
    Auto merged
    MERGE: 1.35.1.1

  mysql-test/mysql-test-run.pl@stripped, 2006-11-16 14:13:52+01:00, msvensson@neptunus.(none)
+0 -0
    Auto merged
    MERGE: 1.30.49.8

  scripts/Makefile.am@stripped, 2006-11-16 14:16:01+01:00, msvensson@neptunus.(none) +1 -1
    Manual merge
    MERGE: 1.43.1.11

  scripts/make_binary_distribution.sh@stripped, 2006-11-16 14:13:52+01:00,
msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.101.1.14

  scripts/mysql_install_db.sh@stripped, 2006-11-16 14:13:52+01:00, msvensson@neptunus.(none)
+0 -0
    Auto merged
    MERGE: 1.64.1.2

  sql/mysql_priv.h@stripped, 2006-11-16 14:13:53+01:00, msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.290.1.131

  sql/sql_acl.h@stripped, 2006-11-16 14:16:01+01:00, msvensson@neptunus.(none) +1 -2
    Manual merge
    MERGE: 1.28.1.23

# 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/my51-bug20166/RESYNC

--- 1.37/mysql-test/install_test_db.sh	2006-11-16 14:16:09 +01:00
+++ 1.38/mysql-test/install_test_db.sh	2006-11-16 14:16:09 +01:00
@@ -83,10 +83,27 @@ fi
 mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --tmpdir=.
$EXTRA_ARG"
 echo "running $mysqld_boot"
 
-if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
+# Create the bootstrap file
+bootstrap_sql="/tmp/bootstrap.sql$$"
+# Add the system tables
+cat $scriptdir/mysql_create_system_tables.sql > $bootstrap_sql
+# Add timezone test data
+cat $scriptdir/mysql_test_data_timezone.sql >> $bootstrap_sql
+# Add test users
+echo "
+INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+REPLACE INTO user VALUES
('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user (host,user) values ('localhost','');
+INSERT INTO user (host,user) values ('$hostname','');" >> $bootstrap_sql
+
+# Execute the bootstrap file with "mysqld --boostrap"
+if cat $bootstrap_sql | eval $mysqld_boot
 then
+    rm $bootstrap_sql
     exit 0
 else
     echo "Error executing mysqld --bootstrap"
+    rm $bootstrap_sql
     exit 1
 fi

--- 1.58/scripts/Makefile.am	2006-11-16 14:16:09 +01:00
+++ 1.59/scripts/Makefile.am	2006-11-16 14:16:09 +01:00
@@ -30,8 +30,7 @@ bin_SCRIPTS =		@server_scripts@ \
 			mysql_find_rows \
 			mysqlhotcopy \
 			mysqldumpslow \
-			mysqld_multi \
-			mysql_create_system_tables
+			mysqld_multi
 
 noinst_SCRIPTS =	make_binary_distribution \
 			make_sharedlib_distribution
@@ -53,15 +52,17 @@ EXTRA_SCRIPTS =		make_binary_distributio
 			mysqlhotcopy.sh \
 			mysqldumpslow.sh \
 			mysqld_multi.sh \
-			mysqld_safe.sh \
-			mysql_create_system_tables.sh
+			mysqld_safe.sh
 
 EXTRA_DIST =		$(EXTRA_SCRIPTS) \
 			mysqlaccess.conf \
 			mysqlbug \
 			make_win_bin_dist
 
-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 \
+			mysql_test_data_timezone.sql
 
 # mysqlbug should be distributed built so that people can report build
 # failures with it.

--- 1.133/scripts/make_binary_distribution.sh	2006-11-16 14:16:09 +01:00
+++ 1.134/scripts/make_binary_distribution.sh	2006-11-16 14:16:09 +01:00
@@ -287,12 +287,29 @@ rm -f $BASE/bin/Makefile* $BASE/bin/*.in
 # Copy system dependent files
 #
 if [ $BASE_SYSTEM = "netware" ] ; then
+  #
+  # Create two SQL files
+  #  - init_db.sql, used when installing production db
+  #  - test_db.sql, used when installing test db
+  #
   echo "CREATE DATABASE mysql;" > $BASE/bin/init_db.sql
   echo "CREATE DATABASE test;" >> $BASE/bin/init_db.sql
-  sh ./scripts/mysql_create_system_tables.sh real "" "%" 0 \
-      >> $BASE/bin/init_db.sql
-  sh ./scripts/mysql_create_system_tables.sh test "" "%" 0 \
-      > $BASE/bin/test_db.sql
+  cat ./scripts/mysql_create_system_tables.sql >> $BASE/bin/init_db.sql
+  cat <<END_OF_DATA >> $BASE/bin/init_db.sql
+INSERT INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user (host,user) values ('$hostname','');
+INSERT INTO user (host,user) values ('localhost','');
+END_OF_DATA
+
+  cat ./scripts/mysql_create_system_tables.sql > $BASE/bin/test_db.sql
+  cat ./scripts/mysql_test_data_timezone.sql >> $BASE/bin/test_db.sql
+  cat <<END_OF_DATA >> $BASE/bin/test_db.sql
+INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+REPLACE INTO user VALUES
('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user (host,user) values ('localhost','');
+INSERT INTO user (host,user) values ('$hostname','');
+END_OF_DATA
   ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
 fi
 

--- 1.67/scripts/mysql_install_db.sh	2006-11-16 14:16:09 +01:00
+++ 1.68/scripts/mysql_install_db.sh	2006-11-16 14:16:09 +01:00
@@ -81,6 +81,7 @@ basedir=
 force=0
 verbose=0
 fill_help_tables=""
+mysql_create_system_tables=""
 
 parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
 parse_arguments PICK-ARGS-FROM-ARGV "$@"
@@ -105,23 +106,33 @@ else
   fi
 fi
 
-# find fill_help_tables.sh
+# Find mysql_create_system_tables.sql
 for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts
`pwd` `pwd`/scripts @pkgdatadir@
 do
-  if test -f $i/fill_help_tables.sql
+  if test -f $i/mysql_create_system_tables.sql
   then
     pkgdatadir=$i
   fi
 done
 
+if test -f $pkgdatadir/mysql_create_system_tables.sql
+then
+  mysql_create_system_tables=$pkgdatadir/mysql_create_system_tables.sql
+else
+  echo "Could not find 'mysql_create_system_tables.sql' in @pkgdatadir@ or in inside
$basedir".
+  exit 1;
+fi
+
+# Check that fill_help_tables.sql exists in the same directory
 if test -f $pkgdatadir/fill_help_tables.sql
 then
   fill_help_tables=$pkgdatadir/fill_help_tables.sql
 else
-  echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@ or inside
$basedir".
+  echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@".
   exit 1;
 fi
 
+
 mdata=$ldata/mysql
 mysqld=$execdir/mysqld
 mysqld_opt=""
@@ -213,9 +224,30 @@ fi
 mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \
 --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \
 --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K"
-if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \
-   | eval "$mysqld_install_cmd_line" 
+if (cat $mysql_create_system_tables) | eval "$mysqld_install_cmd_line"
 then
+  if test "$windows" = "0"
+  then
+    users="
+      INSERT INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+       INSERT INTO user (host,user) values ('$hostname','');
+       INSERT INTO user (host,user) values ('localhost','');"
+  else
+    users="
+      INSERT INTO user VALUES
('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);"
+  fi
+  (echo "use mysql; $users") | eval "$mysqld_install_cmd_line"
+  res=$?
+  if test $res != 0
+  then
+    echo ""
+    echo "WARNING: Failed to add default users, only root@localhost added!"
+    echo "You can insert those users manually:"
+    echo ""
+    echo "shell> $bindir/mysql -u root mysql"
+    echo "mysql> $users"
+    echo ""
+  fi
   if test -n "$fill_help_tables"
   then
     if test "$in_rpm" -eq 0 -a "$windows" -eq 0

--- 1.454/sql/mysql_priv.h	2006-11-16 14:16:09 +01:00
+++ 1.455/sql/mysql_priv.h	2006-11-16 14:16:09 +01:00
@@ -389,7 +389,7 @@ MY_LOCALE *my_locale_by_name(const char 
   updated (to store more bytes on disk).
 
   NOTE: When adding new SQL_MODE types, make sure to also add them to
-  ../scripts/mysql_create_system_tables.sh and
+  ../scripts/mysql_create_system_tables.sql and
   ../scripts/mysql_fix_privilege_tables.sql
 */
 

--- 1.50/sql/sql_acl.h	2006-11-16 14:16:09 +01:00
+++ 1.51/sql/sql_acl.h	2006-11-16 14:16:09 +01:00
@@ -48,8 +48,7 @@
   don't forget to update
   1. static struct show_privileges_st sys_privileges[]
   2. static const char *command_array[] and static uint command_lengths[]
-  3. mysql_create_system_tables.sh, mysql_fix_privilege_tables.sql
-     and mysql-test/lib/init_db.sql
+  3. mysql_create_system_tables.sql and mysql_fix_privilege_tables.sql
   4. acl_init() or whatever - to define behaviour for old privilege tables
   5. sql_yacc.yy - for GRANT/REVOKE to work
 */

--- 1.228/mysql-test/mysql-test-run.pl	2006-11-16 14:16:10 +01:00
+++ 1.229/mysql-test/mysql-test-run.pl	2006-11-16 14:16:10 +01:00
@@ -2640,40 +2640,91 @@ 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 while checking
+# it's 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 (<IN>)
   {
     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);
+
+  # Add the offical mysql system tables and initial system data
+  # for a prodcuction system
+  bootstrap_append("$glob_basedir/scripts/mysql_create_system_tables.sql",
+		  $bootstrap_sql_file);
+
+  if ($mysql_version_id >= 50000)
+  {
+    # Add test data for timezone - this is just a subset, on a real
+    # system these tables will be populated either by mysql_tzinfo_to_sql
+    # or by downloading the timezone table package from our website
+    bootstrap_append("$glob_basedir/scripts/mysql_test_data_timezone.sql",
+		    $bootstrap_sql_file);
+
+    # Add test users
+    mtr_tofile($bootstrap_sql_file,
+    "INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+    INSERT INTO user VALUES
('$glob_hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+    REPLACE INTO user VALUES
('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+    INSERT INTO user (host,user) values ('localhost','');
+    INSERT INTO user (host,user) values ('$glob_hostname','');");
+  }
+
+  my $args;
   mtr_init_args(\$args);
 
   mtr_add_arg($args, "--no-defaults");
@@ -2704,16 +2755,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.85/mysql-test/Makefile.am	2006-11-16 14:16:10 +01:00
+++ 1.86/mysql-test/Makefile.am	2006-11-16 14:16:10 +01:00
@@ -68,7 +68,6 @@ dist-hook:
 	$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
 	$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
 	$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
-	$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
 	$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
 
 install-data-local:
@@ -108,7 +107,6 @@ install-data-local:
 	$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
 	$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP*
$(DESTDIR)$(testdir)/std_data/ndb_backup50
 	$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP*
$(DESTDIR)$(testdir)/std_data/ndb_backup51
-	$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
 	$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
 
 uninstall-local:
Thread
bk commit into 5.1 tree (msvensson:1.2352)msvensson16 Nov