#At file:///home/msvensson/mysql/5.5-cluster/ based on revid:magnus.blaudd@strippedmk9
3259 Magnus Blåudd 2011-03-28 [merge]
Merge 7.0 -> 5.5-cluster
modified:
mysql-test/suite/ndb/r/ndb_multi.result
mysql-test/suite/ndb/t/ndb_multi.test
sql/ha_ndbcluster_binlog.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_multi.result'
--- a/mysql-test/suite/ndb/r/ndb_multi.result 2009-11-10 14:07:30 +0000
+++ b/mysql-test/suite/ndb/r/ndb_multi.result 2011-03-22 08:32:32 +0000
@@ -189,3 +189,10 @@ b
c
drop table t1;
drop table t1;
+Bug 11894966 - second mysqld does not have table after non
+distributed table alter to ndb
+create table t1(a int) engine myisam;
+insert into t1 values(37);
+alter table t1 engine ndb;
+truncate t1;
+drop table t1;
=== modified file 'mysql-test/suite/ndb/t/ndb_multi.test'
--- a/mysql-test/suite/ndb/t/ndb_multi.test 2009-12-17 15:43:35 +0000
+++ b/mysql-test/suite/ndb/t/ndb_multi.test 2011-03-22 08:32:32 +0000
@@ -210,4 +210,39 @@ select * from t1 order by s;
connection server1;
drop table t1;
connection server2;
-drop table t1;
\ No newline at end of file
+drop table t1;
+
+#
+--echo Bug 11894966 - second mysqld does not have table after non
+--echo distributed table alter to ndb
+#
+# - only queries with "autodiscover" see the new table
+# on second mysqld since schema distribution does not
+# create the table on second mysqld(at least when !ndb_binlog_running)
+#
+connection server1;
+
+# Create table t1 in myisam
+create table t1(a int) engine myisam;
+insert into t1 values(37);
+
+# Alter t1 into ndb
+alter table t1 engine ndb;
+
+# Switch to other mysqld
+connection server2;
+
+# Check that .frm and .ndb file has been created
+# on second mysqld
+let $datadir2 = `select @@datadir`;
+#echo datadir2: $datadir2;
+--file_exists $datadir2/test/t1.frm
+--file_exists $datadir2/test/t1.ndb
+
+# Check that truncate works on second mysqld
+# (didn't work before fix)
+truncate t1;
+
+# Cleanup
+drop table t1;
+connection server1;
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-03-09 13:09:55 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-03-28 13:22:35 +0000
@@ -2790,36 +2790,33 @@ ndb_binlog_thread_handle_schema_event_po
}
free_share(&share);
}
- if (ndb_binlog_running)
+
+ if (share)
{
/*
- we need to free any share here as command below
- may need to call handle_trailing_share
+ Free the share pointer early, ndb_create_table_from_engine()
+ may delete what share is pointing to as a sideeffect
*/
- if (share)
- {
- /* ndb_share reference temporary free */
- DBUG_PRINT("NDB_SHARE", ("%s temporary free use_count: %u",
- share->key, share->use_count));
- free_share(&share);
- share= 0;
- }
- thd_ndb_options.set(TNO_NO_LOCK_SCHEMA_OP);
- if (ndbcluster_check_if_local_table(schema->db, schema->name))
- {
- DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
- schema->db, schema->name));
- sql_print_error("NDB Binlog: Skipping locally defined table '%s.%s' from "
- "binlog schema event '%s' from node %d. ",
- schema->db, schema->name, schema->query,
- schema->node_id);
- }
- else if (ndb_create_table_from_engine(thd, schema->db, schema->name))
- {
- print_could_not_discover_error(thd, schema);
- }
+ DBUG_PRINT("NDB_SHARE", ("%s early free, use_count: %u",
+ share->key, share->use_count));
+ free_share(&share);
+ share= 0;
+ }
+
+ thd_ndb_options.set(TNO_NO_LOCK_SCHEMA_OP);
+ if (ndbcluster_check_if_local_table(schema->db, schema->name))
+ {
+ sql_print_error("NDB Binlog: Skipping locally defined table '%s.%s' "
+ "from binlog schema event '%s' from node %d.",
+ schema->db, schema->name, schema->query,
+ schema->node_id);
+ }
+ else if (ndb_create_table_from_engine(thd, schema->db, schema->name))
+ {
+ print_could_not_discover_error(thd, schema);
}
break;
+
case SOT_ONLINE_ALTER_TABLE_PREPARE:
{
if (opt_ndb_extra_logging > 9)
No bundle (reason: revision is a merge).| Thread |
|---|
| • bzr commit into mysql-5.5-cluster branch (magnus.blaudd:3259) | Magnus Blåudd | 28 Mar |