From: Date: May 9 2008 11:42am Subject: bk commit into 5.1 tree (msvensson:1.2588) BUG#36123 List-Archive: http://lists.mysql.com/commits/46556 X-Bug: 36123 Message-Id: <20080509094222.1DD7830E94F@pilot> 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, 2008-05-09 11:42:18+02:00, msvensson@pilot.(none) +5 -0 Bug#36123 Selecting from mysql.ndb_apply_status leads to failure - When an old .frm file exists on disk and is removed, we must also remove the table from table defintion cache with a FLUSH TABLE mysql-test/mysql-test-run.pl@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +0 -39 Remove code that removed the files for mysql.ndb_apply_status and mysql.ndb_schema after server restart Remove code that was waiting for first mysqld to create mysql.ndb_apply_status mysql-test/std_data/ndb_apply_status.frm@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +195 -0 New BitKeeper file ``mysql-test/std_data/ndb_apply_status.frm'' mysql-test/std_data/ndb_apply_status.frm@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +0 -0 mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +1 -0 Add test for bug#36123 mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +15 -0 Add test for bug#36123 sql/ha_ndbcluster_binlog.cc@stripped, 2008-05-09 11:42:16+02:00, msvensson@pilot.(none) +32 -2 If an old .frm file existed on disk and was removed, we most also remove the table from table definition cache by running a FLUSH TABLE diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl --- a/mysql-test/mysql-test-run.pl 2008-04-08 10:29:04 +02:00 +++ b/mysql-test/mysql-test-run.pl 2008-05-09 11:42:16 +02:00 @@ -332,7 +332,6 @@ sub setup_vardir (); sub check_ssl_support ($); sub check_running_as_root(); sub check_ndbcluster_support ($); -sub rm_ndbcluster_tables ($); sub ndbcluster_start_install ($); sub ndbcluster_start ($$); sub ndbcluster_wait_started ($$); @@ -2835,16 +2834,6 @@ sub ndbcluster_start ($$) { } -sub rm_ndbcluster_tables ($) { - my $dir= shift; - foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"), - glob("$dir/mysql/ndb_schema*")) - { - unlink($bin); - } -} - - ############################################################################## # # Run the benchmark suite @@ -4278,10 +4267,6 @@ sub stop_all_servers () { # Make sure that process has shutdown else try to kill them mtr_check_stop_servers(\@kill_pids); - foreach my $mysqld (@{$master}, @{$slave}) - { - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } } @@ -4551,14 +4536,6 @@ sub run_testcase_stop_servers($$$) { # Make sure that process has shutdown else try to kill them mtr_check_stop_servers(\@kill_pids); - foreach my $mysqld (@{$master}, @{$slave}) - { - if ( ! $mysqld->{'pid'} ) - { - # Remove ndbcluster tables if server is stopped - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } - } } @@ -4600,22 +4577,6 @@ sub run_testcase_start_servers($) { $tinfo->{'master_num'} > 1 ) { # Test needs cluster, start an extra mysqld connected to cluster - - if ( $mysql_version_id >= 50100 ) - { - # First wait for first mysql server to have created ndb system - # tables ok FIXME This is a workaround so that only one mysqld - # create the tables - if ( ! sleep_until_file_created( - "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb", - $master->[0]->{'start_timeout'}, - $master->[0]->{'pid'})) - { - - $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; - return 1; - } - } mysqld_start($master->[1],$tinfo->{'master_opt'},[]); } Binary files a/mysql-test/std_data/ndb_apply_status.frm and b/mysql-test/std_data/ndb_apply_status.frm differ diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result 2007-11-02 13:07:11 +01:00 +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result 2008-05-09 11:42:16 +02:00 @@ -1,3 +1,4 @@ +select * from mysql.ndb_apply_status; stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test 2007-11-02 13:07:11 +01:00 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test 2008-05-09 11:42:16 +02:00 @@ -1,3 +1,18 @@ + +# +# BUG#36123 Selecting from mysql.ndb_apply_status leads to failure +# +# Load the mysql.ndb_apply_status table into table def cache +# + +copy_file $MYSQL_TEST_DIR/std_data/ndb_apply_status.frm $MYSQLTEST_VARDIR/master-data/mysql/ndb_apply_status.frm; +--disable_result_log +--disable_abort_on_error +select * from mysql.ndb_apply_status; +--enable_abort_on_error +--enable_result_log + + -- source include/have_ndb.inc -- source include/have_binlog_format_row.inc -- source include/ndb_master-slave.inc diff -Nrup a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc --- a/sql/ha_ndbcluster_binlog.cc 2008-05-06 10:24:15 +02:00 +++ b/sql/ha_ndbcluster_binlog.cc 2008-05-09 11:42:16 +02:00 @@ -786,7 +786,22 @@ static int ndbcluster_create_ndb_apply_s { build_table_filename(buf, sizeof(buf), NDB_REP_DB, NDB_APPLY_TABLE, reg_ext, 0); - my_delete(buf, MYF(0)); + if (my_delete(buf, MYF(0)) == 0) + { + /* + The .frm file existed and was deleted from disk. + It's possible that someone has tried to use it and thus + it might have been inserted in the table definition cache. + It must be flushed to avoid that it exist only in the + table definition cache. + */ + if (ndb_extra_logging) + sql_print_information("NDB: Flushing " NDB_REP_DB "." NDB_APPLY_TABLE); + + end= strmov(buf, "FLUSH TABLE " NDB_REP_DB "." NDB_APPLY_TABLE); + const int no_print_error[1]= {0}; + run_query(thd, buf, end, no_print_error, TRUE); + } } /* @@ -844,7 +859,22 @@ static int ndbcluster_create_schema_tabl { build_table_filename(buf, sizeof(buf), NDB_REP_DB, NDB_SCHEMA_TABLE, reg_ext, 0); - my_delete(buf, MYF(0)); + if (my_delete(buf, MYF(0)) == 0) + { + /* + The .frm file existed and was deleted from disk. + It's possible that someone has tried to use it and thus + it might have been inserted in the table definition cache. + It must be flushed to avoid that it exist only in the + table definition cache. + */ + if (ndb_extra_logging) + sql_print_information("NDB: Flushing " NDB_REP_DB "." NDB_SCHEMA_TABLE); + + end= strmov(buf, "FLUSH TABLE " NDB_REP_DB "." NDB_SCHEMA_TABLE); + const int no_print_error[1]= {0}; + run_query(thd, buf, end, no_print_error, TRUE); + } } /*