From 47926cd0efceb335388b870f6381dd2b9345c9c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jan 2008 12:59:20 +0100 Subject: Bug#33763 Mysqld leaves readonly mode for cluster tables too early - part2 - Open tables readonly while not properly initialized - Close cached tables when coming out of readonly mode - Apply basically same patch as for 32275 mysql-test/include/ndb_not_readonly.inc: Fix syntax of "die" call Remove the maskin of ER_GET_ERRMSG, should never happen sql/ha_ndbcluster.cc: - Open tables readonly until binlog tables have been initialized sql/ha_ndbcluster_binlog.cc: - Reset "ndb_binlog_tables_inited" when something has happened to schema table, apply status table or when connection to cluster is lost. - Close cached tabled after setting ndb_binlog_is_ready to cleanout any tables opened as readonly. --- sql/ha_ndbcluster.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sql/ha_ndbcluster.cc') diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index bf2b19bfc9c..1b0b5c53250 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -5138,6 +5138,7 @@ int ha_ndbcluster::create(const char *name, strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0)) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } single_user_mode = NdbDictionary::Table::SingleUserModeReadWrite; @@ -5963,6 +5964,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb, if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } /* ndb_share reference temporary */ @@ -6144,6 +6146,7 @@ int ha_ndbcluster::delete_table(const char *name) if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } #endif @@ -6424,8 +6427,11 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(res); } #ifdef HAVE_NDB_BINLOG - if (!ndb_binlog_tables_inited && ndb_binlog_running) + if (!ndb_binlog_tables_inited) + { table->db_stat|= HA_READ_ONLY; + sql_print_information("table '%s' opened read only", name); + } #endif DBUG_RETURN(0); } @@ -6784,8 +6790,8 @@ static void ndbcluster_drop_database(handlerton *hton, char *path) if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_VOID_RETURN; - //DBUG_RETURN(HA_ERR_NO_CONNECTION); } #endif ndbcluster_drop_database_impl(path); -- cgit v1.2.1