3742 magnus.blaudd@stripped 2011-12-20 [merge]
Merge
modified:
mysql-test/suite/ndb_team/t/ndb_autodiscover3.test
sql/ha_ndbcluster.cc
sql/ndb_local_schema.cc
sql/ndb_local_schema.h
sql/ndb_thd_ndb.h
3741 magnus.blaudd@stripped 2011-12-20 [merge]
Merge 7.1 -> 7.2
modified:
mysql-test/suite/ndb_rpl/t/ndb_rpl_ddl_open_trans.test
=== modified file 'mysql-test/suite/ndb_team/t/ndb_autodiscover3.test'
--- a/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test 2011-09-30 06:29:58 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test 2011-12-20 13:26:37 +0000
@@ -79,14 +79,6 @@ select * from t2 order by a limit 3;
select * from t2;
show tables like 't2';
reset master;
-#
-# Add this in 5.5...I don't want to disable all test
-# btw, we should add a new testcase for this
---disable_query_log
---disable_result_log
-drop table if exists t2;
---enable_result_log
---enable_query_log
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
@@ -117,15 +109,6 @@ reset master;
select * from t2;
show tables like 't2';
reset master;
-#
-# TODO 5.5 failure...
-# TODO we should write more comprehensive testcase for this
-#
---disable_query_log
---disable_result_log
-drop table if exists t2;
---enable_result_log
---enable_query_log
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-12-19 18:19:35 +0000
+++ b/sql/ha_ndbcluster.cc 2011-12-20 13:26:37 +0000
@@ -58,6 +58,7 @@
#include "ndb_component.h"
#include "ndb_util_thread.h"
#include "ndb_local_connection.h"
+#include "ndb_local_schema.h"
// ndb interface initialization/cleanup
extern "C" void ndb_init_internal();
@@ -11205,8 +11206,7 @@ int ha_ndbcluster::delete_table(const ch
DBUG_ENTER("ha_ndbcluster::delete_table");
DBUG_PRINT("enter", ("name: %s", name));
- if ((thd == injector_thd) ||
- (thd_ndb->options & TNO_NO_NDB_DROP_TABLE))
+ if (thd == injector_thd)
{
/*
Table was dropped remotely is already
@@ -12298,44 +12298,45 @@ ndbcluster_find_files(handlerton *hton,
}
}
-#ifndef NDB_NO_MYSQL_RM_TABLE_PART2
- /*
- Delete old files
-
- ndbcluster_find_files() may be called from I_S code and ndbcluster_binlog
- thread in situations when some tables are already open. This means that
- code below will try to obtain exclusive metadata lock on some table
- while holding shared meta-data lock on other tables. This might lead to a
- deadlock but such a deadlock should be detected by MDL deadlock detector.
- */
- List_iterator_fast<char> it3(delete_list);
- while ((file_name_str= it3++))
+ if (thd == injector_thd)
{
- DBUG_PRINT("info", ("Removing table %s/%s", db, file_name_str));
- // Delete the table and all related files
- TABLE_LIST table_list;
- table_list.init_one_table(db, strlen(db),
- file_name_str, strlen(file_name_str),
- file_name_str,
- TL_WRITE);
- table_list.mdl_request.set_type(MDL_EXCLUSIVE);
- /*
- set TNO_NO_NDB_DROP_TABLE flag to not drop ndb table.
- it should not exist anyways
- */
- thd_ndb->options|= TNO_NO_NDB_DROP_TABLE;
- (void)mysql_rm_table_part2(thd, &table_list,
- false, /* if_exists */
- false, /* drop_temporary */
- false, /* drop_view */
- true /* dont_log_query*/);
- thd_ndb->options&= ~TNO_NO_NDB_DROP_TABLE;
- trans_commit_implicit(thd); /* Safety, should be unnecessary. */
- thd->mdl_context.release_transactional_locks();
- /* Clear error message that is returned when table is deleted */
- thd->clear_error();
+ /*
+ Don't delete anything when called from
+ the binlog thread. This is a kludge to avoid
+ that something is deleted when "Ndb schema dist"
+ uses find_files() to check for "local tables in db"
+ */
+ }
+ else
+ {
+ /*
+ Delete old files
+ (.frm files with corresponding .ndb + does not exists in NDB)
+ */
+ List_iterator_fast<char> it3(delete_list);
+ while ((file_name_str= it3++))
+ {
+ DBUG_PRINT("info", ("Deleting local files for table '%s.%s'",
+ db, file_name_str));
+
+ // Delete the table and its related files from disk
+ Ndb_local_schema::Table local_table(thd, db, file_name_str);
+ local_table.remove_table();
+
+ // Flush the table out of ndbapi's dictionary cache
+ Ndb_table_guard ndbtab_g(ndb->getDictionary(), file_name_str);
+ ndbtab_g.invalidate();
+
+ // Flush the table from table def. cache.
+ TABLE_LIST table_list;
+ memset(&table_list, 0, sizeof(table_list));
+ table_list.db= (char*)db;
+ table_list.alias= table_list.table_name= file_name_str;
+ close_cached_tables(thd, &table_list, false, 0);
+
+ DBUG_ASSERT(!thd->is_error());
+ }
}
-#endif
// Create new files
List_iterator_fast<char> it2(create_list);
=== modified file 'sql/ndb_local_schema.cc'
--- a/sql/ndb_local_schema.cc 2011-12-14 21:10:25 +0000
+++ b/sql/ndb_local_schema.cc 2011-12-20 13:26:37 +0000
@@ -85,8 +85,19 @@ void Ndb_local_schema::Base::log_warning
my_vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- sql_print_warning("Ndb schema[%s.%s]: %s",
- m_db, m_name, buf);
+ if (m_push_warnings)
+ {
+ // Append the error which caused the error to thd's warning list
+ push_warning_printf(m_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_GET_ERRMSG, "Ndb schema[%s.%s]: %s",
+ m_db, m_name, buf);
+ }
+ else
+ {
+ // Print the warning to log file
+ sql_print_warning("Ndb schema[%s.%s]: %s",
+ m_db, m_name, buf);
+ }
}
@@ -94,6 +105,12 @@ Ndb_local_schema::Base::Base(THD* thd, c
m_thd(thd),
m_db(db), m_name(name)
{
+ /*
+ System(or daemon) threads report error to log file
+ all other threads use push_warning
+ */
+ m_push_warnings = (thd->command != COM_DAEMON);
+
m_have_mdl_lock= mdl_try_lock();
}
=== modified file 'sql/ndb_local_schema.h'
--- a/sql/ndb_local_schema.h 2011-12-14 18:38:53 +0000
+++ b/sql/ndb_local_schema.h 2011-12-20 13:26:37 +0000
@@ -26,6 +26,7 @@ class Ndb_local_schema
*/
class Base {
bool m_have_mdl_lock;
+ bool m_push_warnings;
bool mdl_try_lock(void) const;
void mdl_unlock(void);
=== modified file 'sql/ndb_thd_ndb.h'
--- a/sql/ndb_thd_ndb.h 2011-10-31 09:22:55 +0000
+++ b/sql/ndb_thd_ndb.h 2011-12-20 13:26:37 +0000
@@ -39,13 +39,6 @@ enum THD_NDB_OPTIONS
lock, as one other mysqld already has the lock.
*/
TNO_NO_LOCK_SCHEMA_OP= 1 << 1
- /*
- Skip drop of ndb table in delete_table. Used when calling
- mysql_rm_table_part2 in "show tables", as we do not want to
- remove ndb tables "by mistake". The table should not exist
- in ndb in the first place.
- */
- ,TNO_NO_NDB_DROP_TABLE= 1 << 2
};
enum THD_NDB_TRANS_OPTIONS
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster-7.2 branch (magnus.blaudd:3741 to 3742) | magnus.blaudd | 21 Dec |