From d0baba61141c6581f661459636c29b90c4f66eac Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Jul 2006 03:26:13 +0200 Subject: [PATCH] Bug #20843 tests fails randomly with assertion in completeClusterFailed Bug #20902 Alter table invalid schema version with statement-based binlogging (latter caused by the above) --- mysql-test/t/ndb_alter_table3.test | 3 --- mysql-test/t/ndb_autodiscover3.test | 4 ---- mysql-test/t/ndb_dd_advance.test | 3 --- mysql-test/t/ndb_multi.test | 4 ---- sql/ha_ndbcluster.cc | 4 ++-- sql/ha_ndbcluster_binlog.cc | 33 +++++++++++++++++------------ 6 files changed, 22 insertions(+), 29 deletions(-) diff --git a/mysql-test/t/ndb_alter_table3.test b/mysql-test/t/ndb_alter_table3.test index b0295834563..a5fe613adcf 100644 --- a/mysql-test/t/ndb_alter_table3.test +++ b/mysql-test/t/ndb_alter_table3.test @@ -2,9 +2,6 @@ -- source include/have_multi_ndb.inc -- source include/not_embedded.inc -# BUG#20902: Test fails in statement-based binlogging mode. Remove when fixed. --- source include/have_binlog_format_row.inc - --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test index 5c8a95f302b..5f6d457d140 100644 --- a/mysql-test/t/ndb_autodiscover3.test +++ b/mysql-test/t/ndb_autodiscover3.test @@ -2,10 +2,6 @@ -- source include/have_multi_ndb.inc -- source include/not_embedded.inc -# BUG#20902: Test fails in statement-based binlogging mode. Remove when fixed. --- source include/have_binlog_format_row.inc - - --disable_warnings drop table if exists t1, t2; --enable_warnings diff --git a/mysql-test/t/ndb_dd_advance.test b/mysql-test/t/ndb_dd_advance.test index 51d01c139f0..e882ec794c1 100755 --- a/mysql-test/t/ndb_dd_advance.test +++ b/mysql-test/t/ndb_dd_advance.test @@ -28,9 +28,6 @@ -- source include/have_ndb.inc -- source include/not_embedded.inc -# BUG#20902: Test fails in statement-based binlogging mode. Remove when fixed. --- source include/have_binlog_format_row.inc - --disable_warnings DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test index 5b04612bbc5..36018e6c679 100644 --- a/mysql-test/t/ndb_multi.test +++ b/mysql-test/t/ndb_multi.test @@ -3,10 +3,6 @@ -- source include/not_embedded.inc -- source include/have_binlog_format_statement.inc -# BUG#20902: Test fails in statement-based binlogging mode. Remove when fixed. --- source include/have_binlog_format_row.inc - - --disable_warnings connection server2; drop table if exists t1, t2, t3, t4; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9a85d0888b2..8b17dae9d7e 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4781,7 +4781,7 @@ int ha_ndbcluster::create(const char *name, expect it to be there. */ if (!ndbcluster_create_event(ndb, m_table, event_name.c_ptr(), share, - share && do_event_op /* push warning */)) + share && do_event_op ? 2 : 1/* push warning */)) { if (ndb_extra_logging) sql_print_information("NDB Binlog: CREATE TABLE Event: %s", @@ -5175,7 +5175,7 @@ int ha_ndbcluster::rename_table(const char *from, const char *to) const NDBTAB *ndbtab= ndbtab_g2.get_table(); if (!ndbcluster_create_event(ndb, ndbtab, event_name.c_ptr(), share, - share && ndb_binlog_running /* push warning */)) + share && ndb_binlog_running ? 2 : 1/* push warning */)) { if (ndb_extra_logging) sql_print_information("NDB Binlog: RENAME Event: %s", diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 8b04f263b26..8e9f0077dd0 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1220,7 +1220,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, type_str= "create table"; break; case SOT_ALTER_TABLE: - type_str= "create table"; + type_str= "alter table"; break; case SOT_DROP_DB: type_str= "drop db"; @@ -2500,7 +2500,7 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, /* failed, print a warning */ - if (push_warning) + if (push_warning > 1) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_GET_ERRMSG, ER(ER_GET_ERRMSG), dict->getNdbError().code, @@ -2528,7 +2528,7 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, if (dict->getNdbError().code == NDB_INVALID_SCHEMA_OBJECT && dict->dropEvent(my_event.getName())) { - if (push_warning) + if (push_warning > 1) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_GET_ERRMSG, ER(ER_GET_ERRMSG), dict->getNdbError().code, @@ -2547,7 +2547,7 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, */ if (dict->createEvent(my_event)) { - if (push_warning) + if (push_warning > 1) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_GET_ERRMSG, ER(ER_GET_ERRMSG), dict->getNdbError().code, @@ -3442,24 +3442,31 @@ restart: // wait for the first event thd->proc_info= "Waiting for first event from ndbcluster"; DBUG_PRINT("info", ("Waiting for the first event")); - int schema_res= 0, res= 0; - Uint64 schema_gci= 0, gci= 0; - while (schema_res == 0 && !abort_loop) + int schema_res, res; + Uint64 schema_gci; + do { + if (abort_loop) + goto err; schema_res= s_ndb->pollEvents(100, &schema_gci); - } - // now check that we have epochs consistant with what we had before the restart - DBUG_PRINT("info", ("schema_res: %d schema_gci: %d", schema_res, schema_gci)); - if (schema_res > 0) + } while (ndb_latest_received_binlog_epoch == schema_gci); + if (ndb_binlog_running) { - while (res >= 0 && gci < schema_gci && !abort_loop) + Uint64 gci= i_ndb->getLatestGCI(); + while (gci < schema_gci || gci == ndb_latest_received_binlog_epoch) { - res= i_ndb->pollEvents(100, &gci); + if (abort_loop) + goto err; + res= i_ndb->pollEvents(10, &gci); } if (gci > schema_gci) { schema_gci= gci; } + } + // now check that we have epochs consistant with what we had before the restart + DBUG_PRINT("info", ("schema_res: %d schema_gci: %d", schema_res, schema_gci)); + { i_ndb->flushIncompleteEvents(schema_gci); s_ndb->flushIncompleteEvents(schema_gci); if (schema_gci < ndb_latest_handled_binlog_epoch)