3941 Martin Skold 2012-06-15 [merge]
Merge from 7.1
modified:
mysql-test/suite/ndb/r/ndb_index_stat_restart.result
mysql-test/suite/ndb/t/ndb_reconnect.test
3940 Martin Skold 2012-06-15 [merge]
Merge from 7.1
modified:
mysql-test/suite/ndb/r/ndb_reconnect.result
mysql-test/suite/ndb/t/ndb_reconnect.test
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ndb_thd_ndb.h
sql/sql_show.cc
sql/sql_show.h
3939 magnus.blaudd@stripped 2012-06-13 [merge]
Merge 7.1 -> 7.2
renamed:
mysql-test/include/rpl_multi_engine2.inc => mysql-test/suite/ndb_rpl/t/ndb_rpl_multi_engine2.inc
modified:
mysql-test/suite/ndb/r/ndb_alter_table_online.result
mysql-test/suite/ndb/r/ndb_basic.result
mysql-test/suite/ndb/t/ndb_alter_table_online.test
mysql-test/suite/ndb_rpl/r/ndb_rpl_dd_advance.result
mysql-test/suite/ndb_rpl/t/ndb_rpl_2multi_basic.inc
mysql-test/suite/ndb_rpl/t/ndb_rpl_dd_advance.test
sql/ha_ndbcluster.cc
storage/ndb/include/ndb_version.h.in
storage/ndb/include/ndbapi/NdbScanOperation.hpp
storage/ndb/src/common/util/version.cpp
=== modified file 'mysql-test/suite/ndb/r/ndb_index_stat_restart.result'
--- a/mysql-test/suite/ndb/r/ndb_index_stat_restart.result 2012-03-27 09:47:51 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_stat_restart.result 2012-06-15 10:58:32 +0000
@@ -44,7 +44,7 @@ Ndb_index_stat_cache_clean 0
set global ndb_dbg_check_shares=1;
drop table if exists t1;
Warnings:
-Warning 155 Table 'test.t1' doesn't exist
+Note 1051 Unknown table 't1'
create table t1 (
a int primary key,
b int,
=== modified file 'mysql-test/suite/ndb/r/ndb_reconnect.result'
--- a/mysql-test/suite/ndb/r/ndb_reconnect.result 2009-02-03 13:35:56 +0000
+++ b/mysql-test/suite/ndb/r/ndb_reconnect.result 2012-06-14 11:48:36 +0000
@@ -26,3 +26,33 @@ a b c
1 row 1 2
insert into t1 values (2, "row 1", 37);
drop table t1;
+create table t1(a int, b varchar(10), c date) engine=ndb;
+CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN
+SET new.c = '1901-01-01 01:01:01';
+End //
+insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL);
+select * from t1 order by a;
+a b c
+1 row 1 NULL
+2 row 2 NULL
+create table t2(a int, b varchar(10), c date) engine=myisam;
+CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN
+SET new.c = '1901-01-01 01:01:01';
+End //
+create table t1(a int, b varchar(10), c date) engine=ndb;
+CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN
+SET new.c = '1902-02-02 02:02:02';
+End //
+insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL);
+select * from t1 order by a;
+a b c
+1 row 1 NULL
+2 row 2 NULL
+create table t2(a int, b varchar(10), c date) engine=myisam;
+ERROR 42S01: Table 't2' already exists
+drop table t2;
+create table t2(a int, b varchar(10), c date) engine=myisam;
+CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN
+SET new.c = '1901-01-01 01:01:01';
+End //
+drop table t1, t2;
=== modified file 'mysql-test/suite/ndb/t/ndb_reconnect.test'
--- a/mysql-test/suite/ndb/t/ndb_reconnect.test 2009-06-06 13:04:45 +0000
+++ b/mysql-test/suite/ndb/t/ndb_reconnect.test 2012-06-15 09:14:25 +0000
@@ -76,3 +76,69 @@ insert into t1 values (2, "row 1", 37);
# cleanup
drop table t1;
+
+#
+#Bug #13824846 FRM FILES ARE CREATED FOR MYSQLD, BUT TABLE DOES NOT EXIST IN CLUSTER
+#
+
+connection default;
+create table t1(a int, b varchar(10), c date) engine=ndb;
+delimiter //;
+CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN
+ SET new.c = '1901-01-01 01:01:01';
+End //
+delimiter ;//
+
+insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL);
+select * from t1 order by a;
+
+create table t2(a int, b varchar(10), c date) engine=myisam;
+delimiter //;
+CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN
+ SET new.c = '1901-01-01 01:01:01';
+End //
+delimiter ;//
+
+# drop the ndb table inside ndb
+system exec $NDB_DROP_TABLE --no-defaults -d test t1 >> $NDB_TOOLS_OUTPUT ;
+
+# Restart cluster nodes and clear all meta-data
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all restart" >> $NDB_TOOLS_OUTPUT
+# Wait for all nodes to enter "started"
+--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT
+
+#
+# Wait until the connection to the
+# cluster has been restored or timeout occurs
+#
+connection default;
+--disable_result_log
+--disable_query_log
+--source include/ndb_not_readonly.inc
+--enable_result_log
+--enable_query_log
+
+# Create the table again to check there are no conflicts
+create table t1(a int, b varchar(10), c date) engine=ndb;
+delimiter //;
+CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN
+ SET new.c = '1902-02-02 02:02:02';
+End //
+delimiter ;//
+
+insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL);
+select * from t1 order by a;
+
+# Check that only ndb tables have been cleaned away
+--error ER_TABLE_EXISTS_ERROR
+create table t2(a int, b varchar(10), c date) engine=myisam;
+drop table t2;
+create table t2(a int, b varchar(10), c date) engine=myisam;
+delimiter //;
+CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN
+ SET new.c = '1901-01-01 01:01:01';
+End //
+delimiter ;//
+
+# cleanup
+drop table t1, t2;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2012-06-13 19:32:58 +0000
+++ b/sql/ha_ndbcluster.cc 2012-06-15 10:08:39 +0000
@@ -11605,8 +11605,19 @@ ndbcluster_find_files(handlerton *hton,
{
DBUG_PRINT("info", ("NDB says %s does not exists", file_name->str));
it.remove();
- // Put in list of tables to remove from disk
- delete_list.push_back(thd->strdup(file_name->str));
+ if (thd == injector_thd &&
+ thd_ndb->options & TNTO_NO_REMOVE_STRAY_FILES)
+ {
+ /*
+ 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
+ // Put in list of tables to remove from disk
+ delete_list.push_back(thd->strdup(file_name->str));
}
}
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2012-03-28 15:55:23 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2012-06-15 10:08:39 +0000
@@ -1090,6 +1090,51 @@ static void ndb_notify_tables_writable()
}
/*
+
+ */
+
+static void clean_away_stray_files(THD *thd)
+{
+ /*
+ Clean-up any stray files for non-existing NDB tables
+ */
+ LOOKUP_FIELD_VALUES lookup_field_values;
+ bool with_i_schema;
+ List<LEX_STRING> db_names;
+ List_iterator_fast<LEX_STRING> it(db_names);
+ LEX_STRING *db_name;
+ List<LEX_STRING> tab_names;
+ char path[FN_REFLEN + 1];
+
+ DBUG_ENTER("clean_away_stray_files");
+ bzero((char*) &lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
+ if (make_db_list(thd, &db_names, &lookup_field_values, &with_i_schema))
+ {
+ thd->clear_error();
+ DBUG_PRINT("info", ("Failed to find databases"));
+ DBUG_VOID_RETURN;
+ }
+ it.rewind();
+ while ((db_name= it++))
+ {
+ DBUG_PRINT("info", ("Found database %s", db_name->str));
+ if (strcmp(NDB_REP_DB, db_name->str)) /* Skip system database */
+ {
+ sql_print_information("NDB: Cleaning stray tables from database '%s'",
+ db_name->str);
+ build_table_filename(path, sizeof(path) - 1, db_name->str, "", "", 0);
+ if (find_files(thd, &tab_names, db_name->str, path, NullS, 0)
+ != FIND_FILES_OK)
+ {
+ thd->clear_error();
+ DBUG_PRINT("info", ("Failed to find tables"));
+ }
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
+/*
Ndb has no representation of the database schema objects.
The mysql.ndb_schema table contains the latest schema operations
done via a mysqld, and thus reflects databases created/dropped/altered
@@ -1227,7 +1272,7 @@ static int ndbcluster_find_all_databases
if (database_exists)
{
/* drop missing database */
- sql_print_information("NDB: Discovered reamining database '%s'", db);
+ sql_print_information("NDB: Discovered remaining database '%s'", db);
}
}
}
@@ -1442,6 +1487,8 @@ ndb_binlog_setup(THD *thd)
}
}
+ clean_away_stray_files(thd);
+
if (ndbcluster_find_all_databases(thd))
{
return false;
=== modified file 'sql/ndb_thd_ndb.h'
--- a/sql/ndb_thd_ndb.h 2011-12-20 13:26:37 +0000
+++ b/sql/ndb_thd_ndb.h 2012-06-15 10:08:39 +0000
@@ -46,6 +46,7 @@ enum THD_NDB_TRANS_OPTIONS
TNTO_INJECTED_APPLY_STATUS= 1 << 0
,TNTO_NO_LOGGING= 1 << 1
,TNTO_TRANSACTIONS_OFF= 1 << 2
+ ,TNTO_NO_REMOVE_STRAY_FILES= 1 << 3
};
class Thd_ndb
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2012-06-08 11:56:49 +0000
+++ b/sql/sql_show.cc 2012-06-15 10:08:39 +0000
@@ -2400,11 +2400,13 @@ void calc_sum_of_all_status(STATUS_VAR *
/* This is only used internally, but we need it here as a forward reference */
extern ST_SCHEMA_TABLE schema_tables[];
+#ifdef MCP_WL1735
typedef struct st_lookup_field_values
{
LEX_STRING db_value, table_value;
bool wild_db_value, wild_table_value;
} LOOKUP_FIELD_VALUES;
+#endif
/*
=== modified file 'sql/sql_show.h'
--- a/sql/sql_show.h 2011-08-31 10:39:08 +0000
+++ b/sql/sql_show.h 2012-06-15 10:08:39 +0000
@@ -35,6 +35,14 @@ typedef struct st_schema_table ST_SCHEMA
struct TABLE;
typedef struct system_status_var STATUS_VAR;
+#ifndef MCP_WL1735
+typedef struct st_lookup_field_values
+{
+ LEX_STRING db_value, table_value;
+ bool wild_db_value, wild_table_value;
+} LOOKUP_FIELD_VALUES;
+#endif
+
enum find_files_result {
FIND_FILES_OK,
FIND_FILES_OOM,
@@ -81,6 +89,12 @@ enum find_files_result {
#define IS_FILES_STATUS 36
#define IS_FILES_EXTRA 37
+#ifndef MCP_WL1735
+int make_db_list(THD *thd, List<LEX_STRING> *files,
+ LOOKUP_FIELD_VALUES *lookup_field_vals,
+ bool *with_i_schema);
+#endif
+
find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db,
const char *path, const char *wild, bool dir);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster-7.2 branch (Martin.Skold:3939 to 3941) | Martin Skold | 18 Jun |