List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:December 12 2007 11:36pm
Subject:RE: bk commit into 6.0 tree (rafal:1.2748) BUG#32190
View as plain text  
Rafal,

Patch looks good but there was a test failure (see below). You need to make
sure you delete any databases you create in the tests. This one, db3, can be
traced to the backup test. Please add the appropriate DROP DATABASE db3
statement to the test. Patch approved pending this change.

Chuck


TEST                           RESULT         TIME (ms)
-------------------------------------------------------

main.backup                    [ pass ]              0
main.backup_commit_blocker     [ pass ]              0
main.backup_ddl_blocker        [ pass ]              0
main.backup_errors             [ pass ]              0
main.backup_fkey               [ pass ]              0
main.backup_no_data            [ fail ]

---
d:/source/c++/mysql-6.0_BUG_review/mysql-test/r/backup_no_data.result2007-12
-13 02:19:55 +03:00
+++
d:\source\c++\mysql-6.0_BUG_review\mysql-test\r\backup_no_data.reject2007-12
-13 02:28:16 +03:00
@@ -11,6 +11,7 @@
 SHOW DATABASES;
 Database
 information_schema
+db3
 mysql
 RESTORE FROM 'all.bak';
 backup_id
@@ -18,6 +19,7 @@
 SHOW DATABASES;
 Database
 information_schema
+db3
 empty_db
 mysql
 test
@@ -29,6 +31,7 @@
 SHOW DATABASES;
 Database
 information_schema
+db3
 empty_db
 mysql
 SHOW TABLES IN empty_db;
@@ -39,6 +42,7 @@
 SHOW DATABASES;
 Database
 information_schema
+db3
 empty_db
 mysql
 test
@@ -61,6 +65,7 @@
 SHOW DATABASES;
 Database
 information_schema
+db3
 empty_db
 mysql
 test

mysqltest: Result content mismatch

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

main.backup_no_engine          [ pass ]              0
main.backup_progress           [ pass ]              0
main.backup_security           [ pass ]              0
main.backup_snapshot           [ pass ]              0
-------------------------------------------------------
Stopping All Servers
Failed 1/10 tests, 90.00% were successful.

 

> -----Original Message-----
> From: rsomla@stripped [mailto:rsomla@stripped] 
> Sent: Wednesday, December 12, 2007 8:56 AM
> To: commits@stripped
> Subject: bk commit into 6.0 tree (rafal:1.2748) BUG#32190
> 
> Below is the list of changes that have just been committed 
> into a local 6.0 repository of rafal. When rafal 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, 2007-12-12 14:55:50+01:00, rafal@quant.(none) +6 -0
>   BUG#32190 (Online backup does not save character set 
> settings for databases).
>   
>   This patch redefines backup::meta::Db::get_create_stmt() 
> method to return a
>   correct CREATE DATABASE statement with all necessary 
> clauses. This will make the
>   backup kernel to use this statement when creating a 
> database during restore. 
>   Thus the default character set and collation will be 
> restored as needed.
> 
>   mysql-test/r/backup.result@stripped, 2007-12-12 14:55:44+01:00, 
> rafal@quant.(none) +11 -1
>     Results update.
> 
>   mysql-test/r/backup_ddl_blocker.result@stripped, 2007-12-12 
> 14:55:44+01:00, rafal@quant.(none) +1 -1
>     Results update.
> 
>   mysql-test/t/backup.test@stripped, 2007-12-12 14:55:44+01:00, 
> rafal@quant.(none) +6 -1
>     Add CHARACTER SET and COLLATION clauses to CREATE 
> DATABASE statements to test that these 
>     settings are correctly restored.
> 
>   mysql-test/t/backup_ddl_blocker.test@stripped, 2007-12-12 
> 14:55:45+01:00, rafal@quant.(none) +0 -15
>     Remove obsolete comments.
> 
>   sql/backup/meta_data.cc@stripped, 2007-12-12 14:55:45+01:00, 
> rafal@quant.(none) +81 -13
>     Define store_db_create_info() function and use it to get 
> a CREATE statement for a database.
> 
>   sql/backup/meta_data.h@stripped, 2007-12-12 14:55:45+01:00, 
> rafal@quant.(none) +2 -1
>     The meta::Db class uses now the standard create() method 
> and doesn't redefine it.
> 
> diff -Nrup a/mysql-test/r/backup.result b/mysql-test/r/backup.result
> --- a/mysql-test/r/backup.result	2007-12-03 21:28:01 +01:00
> +++ b/mysql-test/r/backup.result	2007-12-12 14:55:44 +01:00
> @@ -5,7 +5,8 @@ DROP DATABASE IF EXISTS db2;
>  Warnings:
>  Note	1008	Can't drop database 'db2'; database doesn't exist
>  CREATE DATABASE db1;
> -CREATE DATABASE db2;
> +CREATE DATABASE db2 CHARACTER SET=utf8; CREATE DATABASE db3 COLLATE 
> +latin1_bin;
>  USE db1;
>  DROP TABLE IF EXISTS `building`;
>  Warnings:
> @@ -63,6 +64,15 @@ DROP DATABASE db2;
>  USE mysql;
>  RESTORE FROM 'test.ba';
>  backup_id	#
> +SHOW CREATE DATABASE db1;
> +Database	Create Database
> +db1	CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */
> +SHOW CREATE DATABASE db2;
> +Database	Create Database
> +db2	CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET utf8 */
> +SHOW CREATE DATABASE db3;
> +Database	Create Database
> +db3	CREATE DATABASE `db3` /*!40100 DEFAULT CHARACTER SET 
> latin1 COLLATE latin1_bin */
>  USE db1;
>  SHOW TABLES;
>  Tables_in_db1
> diff -Nrup a/mysql-test/r/backup_ddl_blocker.result 
> b/mysql-test/r/backup_ddl_blocker.result
> --- a/mysql-test/r/backup_ddl_blocker.result	2007-12-04 
> 18:38:01 +01:00
> +++ b/mysql-test/r/backup_ddl_blocker.result	2007-12-12 
> 14:55:44 +01:00
> @@ -933,7 +933,7 @@ bup_ddl_blocker_2
>  bup_ddl_blocker_4
>  SHOW CREATE DATABASE bup_ddl_blocker_2;
>  Database	Create Database
> -bup_ddl_blocker_2	CREATE DATABASE `bup_ddl_blocker_2` 
> /*!40100 DEFAULT CHARACTER SET latin1 */
> +bup_ddl_blocker_2	CREATE DATABASE `bup_ddl_blocker_2` 
> /*!40100 DEFAULT CHARACTER SET latin2 */
>  SHOW CREATE DATABASE bup_ddl_blocker_4;
>  Database	Create Database
>  bup_ddl_blocker_4	CREATE DATABASE `bup_ddl_blocker_4` 
> /*!40100 DEFAULT CHARACTER SET latin1 */
> diff -Nrup a/mysql-test/t/backup.test b/mysql-test/t/backup.test
> --- a/mysql-test/t/backup.test	2007-12-03 21:28:06 +01:00
> +++ b/mysql-test/t/backup.test	2007-12-12 14:55:44 +01:00
> @@ -9,7 +9,8 @@ DROP DATABASE IF EXISTS db1;  DROP DATABASE 
> IF EXISTS db2;
>  
>  CREATE DATABASE db1;
> -CREATE DATABASE db2;
> +CREATE DATABASE db2 CHARACTER SET=utf8; CREATE DATABASE db3 COLLATE 
> +latin1_bin;
>  
>  USE db1;
>  
> @@ -109,6 +110,10 @@ USE mysql;
>  
>  --replace_column 1 # 2 # 3 # 4 # 10 # 11 # 12 #  
> --query_vertical RESTORE FROM 'test.ba'
> +
> +SHOW CREATE DATABASE db1;
> +SHOW CREATE DATABASE db2;
> +SHOW CREATE DATABASE db3;
>  
>  USE db1;
>  SHOW TABLES;
> diff -Nrup a/mysql-test/t/backup_ddl_blocker.test 
> b/mysql-test/t/backup_ddl_blocker.test
> --- a/mysql-test/t/backup_ddl_blocker.test	2007-12-06 
> 19:05:56 +01:00
> +++ b/mysql-test/t/backup_ddl_blocker.test	2007-12-12 
> 14:55:45 +01:00
> @@ -1583,14 +1583,6 @@ RESTORE FROM "bup_ddl_blocker.bak";
>  
>  --echo con1: Showing databases that were backed up  --echo 
> con1: bup_ddl_blocker_1 has been renamed and
> -
> -#
> -# NOTE: The online backup does not preserve character set 
> information as -# it should. Thus, the results of this test 
> will not show the changes -# made with the alter database 
> command to bup_ddl_blocker_2. This has -# been reported as BUG#32190. 
> -#
> -
>  --echo con1: bup_ddl_blocker_2.t1 has been truncated.
>  --echo con1: bup_ddl_blocker_4 has not had its character set 
> changed. 
>  --echo con1: bup_ddl_blocker_4.t1 has not been truncated.
> @@ -1772,13 +1764,6 @@ reap;
>  --echo Verifying Test 5 results for restore.
>  --echo
>  ##############################################################
> -
> -#
> -# NOTE: The online backup does not preserve character set 
> information as -# it should. Thus, the results of this test 
> will not show the changes -# made with the alter database 
> command to bup_ddl_blocker_2. This has -# been reported as BUG#32190. 
> -#
>  
>  --echo con1: bup_ddl_blocker_4 has had its character set changed. 
>  --echo con1: bup_ddl_blocker_2.t1 has not been truncated.
> diff -Nrup a/sql/backup/meta_data.cc b/sql/backup/meta_data.cc
> --- a/sql/backup/meta_data.cc	2007-11-30 19:20:34 +01:00
> +++ b/sql/backup/meta_data.cc	2007-12-12 14:55:45 +01:00
> @@ -106,6 +106,9 @@ int bcat_get_item_create_data(st_bstream
>  
>   *****************************************************************/
>  
> +int store_db_create_info(THD *thd, const char *dbname, uint 
> create_options,
> +                         String *buffer);
> +
>  namespace backup {
>  
>  /**
> @@ -145,22 +148,12 @@ result_t meta::Item::drop(THD *thd)
>  
>  result_t meta::Db::get_create_stmt(::String &stmt)  {
> -  // TODO: get a full CREATE statement for a database
> -  return ERROR;
> -}
> -
> -result_t meta::Db::create(THD *thd, ::String&, byte*, byte*) -{
> -  String stmt;
> -
> -  // TODO: CREATE DATABASE statement should be taken from 
> the backup image.
> -
> -  stmt.append("CREATE DATABASE ");
> -  stmt.append(sql_name());
> +  int res= ::store_db_create_info(::current_thd, sql_name(), 
> 0, &stmt);
>  
> -  return silent_exec_query(thd,stmt) ? ERROR : OK;
> +  return res ? ERROR : OK;
>  }
>  
> +
>  result_t meta::Table::get_create_stmt(::String &stmt)  {
>    stmt.free();
> @@ -187,3 +180,78 @@ result_t meta::Table::get_create_stmt(::
>  }
>  
>  } // backup namespace
> +
> +
> +/**
> +  Get complete CREATE statement for a database.
> +
> +  The database is identified by its name, passed as @c 
> dbname parameter.
> +  The name should be encoded using the system character set 
> (UTF8 currently).
> +
> +  Resulting statement is stored in the string pointed by @c 
> buffer. The 
> + string  is emptied first and its charset is set to the 
> system character set.
> +
> +  If HA_LEX_CREATE_IF_NOT_EXISTS flag is set in @c 
> create_options, then  
> + the resulting CREATE statement contains "IF NOT EXISTS" 
> clause. Other 
> + flags  in @c create_options are ignored.
> +
> +  @param  thd     The current thread instance.
> +  @param  dbname  The name of the database.
> +  @param  create_options Options influencing the resulting 
> CRATE statement.
> +  @param  buffer  A String instance where the statement is stored.
> +
> +  @retval 0                 All OK.
> +  @retval ER_BAD_DB_ERROR   Wrong database name.
> +*/
> +
> +int store_db_create_info(THD *thd, const char *dbname, uint 
> create_options,
> +                         String *buffer) {
> +  HA_CREATE_INFO create;
> +  DBUG_ENTER("store_db_create_info");
> +
> +  /*
> +    This code is adapted from mysql_show_create_db() defined 
> in sql_show.cc.
> +
> +    TODO: refactor above function so that it uses 
> store_db_create_info()
> +    internally. In that case, the later function should be 
> moved to sql_show.cc.
> +  */
> +  if (!my_strcasecmp(system_charset_info, dbname,
> +                     INFORMATION_SCHEMA_NAME.str))  {
> +    dbname= INFORMATION_SCHEMA_NAME.str;
> +    create.default_table_charset= system_charset_info;  }  else  {
> +    if (check_db_dir_existence(dbname))
> +      DBUG_RETURN(ER_BAD_DB_ERROR);
> +
> +    load_db_opt_by_name(thd, dbname, &create);  }
> +
> +  buffer->length(0);
> +  buffer->free();
> +  buffer->set_charset(system_charset_info);
> +  buffer->append(STRING_WITH_LEN("CREATE DATABASE "));
> +
> +  if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS)
> +    buffer->append(STRING_WITH_LEN("/*!32312 IF NOT EXISTS*/ "));
> +
> +  append_identifier(thd, buffer, dbname, strlen(dbname));
> +
> +  if (create.default_table_charset)
> +  {
> +    buffer->append(STRING_WITH_LEN(" /*!40100"));
> +    buffer->append(STRING_WITH_LEN(" DEFAULT CHARACTER SET "));
> +    buffer->append(create.default_table_charset->csname);
> +    if (!(create.default_table_charset->state & MY_CS_PRIMARY))
> +    {
> +      buffer->append(STRING_WITH_LEN(" COLLATE "));
> +      buffer->append(create.default_table_charset->name);
> +    }
> +    buffer->append(STRING_WITH_LEN(" */"));  }
> +
> +  DBUG_RETURN(0);
> +}
> diff -Nrup a/sql/backup/meta_data.h b/sql/backup/meta_data.h
> --- a/sql/backup/meta_data.h	2007-11-30 09:23:30 +01:00
> +++ b/sql/backup/meta_data.h	2007-12-12 14:55:45 +01:00
> @@ -84,6 +84,8 @@ class Item
>   */
>  class Db: public Item
>  {
> + public:
> +
>    const enum_type type() const
>    { return DB; }
>  
> @@ -91,7 +93,6 @@ class Db: public Item
>    { return "DATABASE"; }
>  
>    result_t get_create_stmt(::String&);
> -  result_t create(THD*, ::String&, byte*, byte*);  };
>  
>  /**
> 
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:    
> http://lists.mysql.com/commits?unsub=1
> 

Thread
bk commit into 6.0 tree (rafal:1.2748) BUG#32190rsomla12 Dec
  • RE: bk commit into 6.0 tree (rafal:1.2748) BUG#32190Chuck Bell13 Dec
    • Re: bk commit into 6.0 tree (rafal:1.2748) BUG#32190Rafal Somla13 Dec
    • Re: bk commit into 6.0 tree (rafal:1.2748) BUG#32190Rafal Somla13 Dec
Re: bk commit into 6.0 tree (rafal:1.2748) BUG#32190Rafal Somla13 Dec