List:Commits« Previous MessageNext Message »
From:Daogang Qu Date:December 27 2010 2:55am
Subject:Re: bzr commit into mysql-5.1-bugteam branch (Dao-Gang.Qu:3521)
Bug#50914
View as plain text  
2010-12-24 19:53, Alfranio Correia wrote:
> Hi Daogang,
>
> Patch approved.
> See minor comments in what follows.
Thanks for your comments. Will update them before push.

Best Regards,

Daogang
>
> Cheers.
>
> On 12/14/2010 03:03 AM, Dao-Gang.Qu@stripped wrote:
>> #At file:///home/daogang/bzrwork/bug50914/mysql-5.1-bugteam/ based on 
>> revid:azundris@stripped
>>
>>   3521 Dao-Gang.Qu@stripped    2010-12-14
>>        Bug #50914      mysqlbinlog not handling drop of current 
>> default database
>>
>>        mysqlbinlog only prints "use $database" statements to its 
>> output stream
>>        when the active default database changes between events. Which 
>> will cause
>>        "No Database Selected" error when dropping and recreating that 
>> database
>>        though.
>
> s/Which/This/
>
>>
>>        To fix the problem to clear print_event_info->db when printing 
>> an event
>>        of CREATE/DROP/ALTER database statements, so that the 
>> Query_log_event
>>        after such statements will be printed with the use 'db' anyway 
>> except
>>        transaction keywords.
>
> s/to clear/we clear/
>
>>       @ mysql-test/r/mysqlbinlog.result
>>          Test result for Bug#50914.
>>       @ mysql-test/t/mysqlbinlog.test
>>          Added test to verify if the approach of the mysqlbinlog prints
>>          "use $database"statements to its output stream will cause
>>          "No Database Selected" error when dropping and recreating
>>          that database though.
>
> Add a space between "use $database" and statements.
> s/though//
>
>>       @ sql/log_event.cc
>>          Updated code to clear print_event_info->db when printing an 
>> event
>>          of CREATE/DROP/ALTER database statements, so that the 
>> Query_log_event
>>          after such statements will be printed with the use 'db' 
>> anyway except
>>          transaction keywords.
>>
>>      modified:
>>        mysql-test/r/mysqlbinlog.result
>>        mysql-test/t/mysqlbinlog.test
>>        sql/log_event.cc
>> === modified file 'mysql-test/r/mysqlbinlog.result'
>> --- a/mysql-test/r/mysqlbinlog.result    2010-03-28 11:57:33 +0000
>> +++ b/mysql-test/r/mysqlbinlog.result    2010-12-14 03:03:37 +0000
>> @@ -638,3 +638,23 @@ ROLLBACK /* added by mysqlbinlog */;
>>   /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
>>   End of 5.0 tests
>>   End of 5.1 tests
>> +RESET MASTER;
>> +CREATE DATABASE test1;
>> +USE test1;
>> +CREATE TABLE t1(id int);
>> +DROP DATABASE test1;
>> +CREATE DATABASE test1;
>> +USE test1;
>> +CREATE TABLE t1(id int);
>> +DROP TABLE t1;
>> +DROP DATABASE test1;
>> +FLUSH LOGS;
>> +show binlog events in 'master-bin.000002' from<binlog_start>;
>> +Log_name    Pos    Event_type    Server_id    End_log_pos    Info
>> +master-bin.000002    #    Query    #    #    CREATE DATABASE test1
>> +master-bin.000002    #    Query    #    #    use `test1`; CREATE 
>> TABLE t1(id int)
>> +master-bin.000002    #    Query    #    #    DROP DATABASE test1
>> +master-bin.000002    #    Query    #    #    CREATE DATABASE test1
>> +master-bin.000002    #    Query    #    #    use `test1`; CREATE 
>> TABLE t1(id int)
>> +master-bin.000002    #    Query    #    #    use `test1`; DROP TABLE t1
>> +master-bin.000002    #    Query    #    #    DROP DATABASE test1
>>
>> === modified file 'mysql-test/t/mysqlbinlog.test'
>> --- a/mysql-test/t/mysqlbinlog.test    2010-08-03 10:27:45 +0000
>> +++ b/mysql-test/t/mysqlbinlog.test    2010-12-14 03:03:37 +0000
>> @@ -474,3 +474,30 @@ diff_files $MYSQLTEST_VARDIR/tmp/mysqlbi
>>   # Cleanup for this part of test
>>   remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
>>   remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
>> +
>> +#
>> +# BUG#50914
>> +# This test verifies if the approach of the mysqlbinlog prints
>> +# "use $database"statements to its output stream will cause
>> +# "No Database Selected" error when dropping and recreating
>> +# that database though.
>
> See comments above.
>
>> +#
>> +RESET MASTER;
>> +CREATE DATABASE test1;
>> +USE test1;
>> +CREATE TABLE t1(id int);
>> +DROP DATABASE test1;
>> +CREATE DATABASE test1;
>> +USE test1;
>> +CREATE TABLE t1(id int);
>> +DROP TABLE t1;
>> +DROP DATABASE test1;
>> +let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
>> +FLUSH LOGS;
>> +
>> +let $MYSQLD_DATADIR= `SELECT @@datadir`;
>> +exec $MYSQL_BINLOG $MYSQLD_DATADIR/$master_binlog | $MYSQL test 2>&1;
>> +
>> +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
>> +source include/show_binlog_events.inc;
>> +
>>
>> === modified file 'sql/log_event.cc'
>> --- a/sql/log_event.cc    2010-10-23 12:55:44 +0000
>> +++ b/sql/log_event.cc    2010-12-14 03:03:37 +0000
>> @@ -2894,7 +2894,12 @@ void Query_log_event::print_query_header
>>                   error_code);
>>     }
>>
>> -  if (!(flags&  LOG_EVENT_SUPPRESS_USE_F)&&  db)
>> +  if ((flags&  LOG_EVENT_SUPPRESS_USE_F))
>> +  {
>> +    if (!is_trans_keyword())
>> +      print_event_info->db[0]= '\0';
>> +  }
>> +  else if (db)
>>     {
>>       different_db= memcmp(print_event_info->db, db, db_len + 1);
>>       if (different_db)
>>
>>
>>
>>
>>
>
>

Thread
bzr commit into mysql-5.1-bugteam branch (Dao-Gang.Qu:3521) Bug#50914Dao-Gang.Qu14 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (Dao-Gang.Qu:3521)Bug#50914Libing Song15 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (Dao-Gang.Qu:3521) Bug#50914Alfranio Correia24 Dec
    • Re: bzr commit into mysql-5.1-bugteam branch (Dao-Gang.Qu:3521)Bug#50914Daogang Qu27 Dec