From 5a7517422677175af55f678060d572f77d2f20b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Feb 2006 09:58:47 +0100 Subject: [PATCH 01/26] NdbEventOperationImpl.cpp, NdbEventOperation.cpp, NdbEventOperation.hpp: Put back getTable NdbDictionaryImpl.cpp, NdbDictionary.cpp, NdbDictionary.hpp: Added putTable storage/ndb/include/ndbapi/NdbDictionary.hpp: Added putTable storage/ndb/include/ndbapi/NdbEventOperation.hpp: Put back getTable storage/ndb/src/ndbapi/NdbDictionary.cpp: Added putTable storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Added putTable storage/ndb/src/ndbapi/NdbEventOperation.cpp: Put back getTable storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp: Put back getTable --- storage/ndb/include/ndbapi/NdbDictionary.hpp | 8 ++++++++ storage/ndb/include/ndbapi/NdbEventOperation.hpp | 1 + storage/ndb/src/ndbapi/NdbDictionary.cpp | 7 +++++++ storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp | 7 +++++++ storage/ndb/src/ndbapi/NdbEventOperation.cpp | 4 ++++ storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp | 8 ++++++++ 6 files changed, 35 insertions(+) diff --git a/storage/ndb/include/ndbapi/NdbDictionary.hpp b/storage/ndb/include/ndbapi/NdbDictionary.hpp index d96ebc896c3..8139cc3b570 100644 --- a/storage/ndb/include/ndbapi/NdbDictionary.hpp +++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp @@ -1588,6 +1588,14 @@ public: */ const Table * getTable(const char * name) const; +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + /* + * Save a table definition in dictionary cache + * @param table Object to put into cache + */ + void putTable(const Table * table); +#endif + /** * Get index with given name, NULL if undefined * @param indexName Name of index to get. diff --git a/storage/ndb/include/ndbapi/NdbEventOperation.hpp b/storage/ndb/include/ndbapi/NdbEventOperation.hpp index 698b66ce701..25d7b8c6644 100644 --- a/storage/ndb/include/ndbapi/NdbEventOperation.hpp +++ b/storage/ndb/include/ndbapi/NdbEventOperation.hpp @@ -220,6 +220,7 @@ public: #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** these are subject to change at any time */ + const NdbDictionary::Table* getTable() const; const NdbDictionary::Event *getEvent() const; const NdbRecAttr *getFirstPkAttr() const; const NdbRecAttr *getFirstPkPreAttr() const; diff --git a/storage/ndb/src/ndbapi/NdbDictionary.cpp b/storage/ndb/src/ndbapi/NdbDictionary.cpp index ea60b36fdee..5b8e06f5df8 100644 --- a/storage/ndb/src/ndbapi/NdbDictionary.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionary.cpp @@ -1337,6 +1337,13 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data) const return 0; } +void NdbDictionary::Dictionary::putTable(const NdbDictionary::Table * table) +{ + NdbDictionary::Table *copy_table = new NdbDictionary::Table; + *copy_table = *table; + m_impl.putTable(&NdbTableImpl::getImpl(*copy_table)); +} + void NdbDictionary::Dictionary::set_local_table_data_size(unsigned sz) { m_impl.m_local_table_data_size= sz; diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 75760fb4019..6866c059119 100644 --- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1271,7 +1271,14 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const BaseString& internalTableName) void NdbDictionaryImpl::putTable(NdbTableImpl *impl) { + NdbTableImpl *old; + m_globalHash->lock(); + if ((old= m_globalHash->get(impl->m_internalName.c_str()))) + { + old->m_status = NdbDictionary::Object::Invalid; + m_globalHash->drop(old); + } m_globalHash->put(impl->m_internalName.c_str(), impl); m_globalHash->unlock(); Ndb_local_table_info *info= diff --git a/storage/ndb/src/ndbapi/NdbEventOperation.cpp b/storage/ndb/src/ndbapi/NdbEventOperation.cpp index 71bb8889614..4e96ee63565 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperation.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperation.cpp @@ -144,6 +144,10 @@ NdbEventOperation::print() /* * Internal for the mysql server */ +const NdbDictionary::Table *NdbEventOperation::getTable() const +{ + return m_impl.m_eventImpl->m_tableImpl->m_facade; +} const NdbDictionary::Event *NdbEventOperation::getEvent() const { return m_impl.m_eventImpl->m_facade; diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 0a9993e33a1..2acfa339d37 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -639,6 +639,14 @@ NdbEventOperationImpl::receive_event() m_buffer.length() / 4, true); m_buffer.clear(); + if (at) + at->buildColumnHash(); + else + { + DBUG_PRINT_EVENT("info", ("Failed to parse DictTabInfo error %u", + error.code)); + DBUG_RETURN_EVENT(1); + } if ( m_eventImpl->m_tableImpl) delete m_eventImpl->m_tableImpl; m_eventImpl->m_tableImpl = at; From 0fd784928c340968967a104dd0191837549ee8a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Feb 2006 13:00:32 +0100 Subject: [PATCH 02/26] Fixed BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION Check if AGGREGATE was given with a stored (non-UDF) function, and return error in that case. Also made udf_example/udf_test work again, by adding a missing *_init() function. (_init() functions required unless --allow_suspicious_udfs is given to the server, since March 2005 - it seems udf_example wasn't updated at the time.) mysql-test/r/sp-error.result: Updated results for BUG#16896. mysql-test/t/sp-error.test: Added test case for BUG#16896. sql/share/errmsg.txt: New error message: ER_SP_NO_AGGREGATE sql/sql_yacc.yy: Check if AGGREGATE was used when creating a stored function (i.e. not an UDF). sql/udf_example.cc: Added myfunc_int_init() function to make it work when the server is running without --allow_suspicious_udfs. --- mysql-test/r/sp-error.result | 3 +++ mysql-test/t/sp-error.test | 12 ++++++++++++ sql/share/errmsg.txt | 2 ++ sql/sql_yacc.yy | 10 ++++++++++ sql/udf_example.cc | 9 +++++++++ 5 files changed, 36 insertions(+) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 2766dca5845..c0e02cbeb6f 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1176,3 +1176,6 @@ end| call bug15091(); ERROR 42S02: Unknown table 'c' in field list drop procedure bug15091; +drop function if exists bug16896; +create aggregate function bug16896() returns int return 1; +ERROR 42000: AGGREGATE is not supported for stored functions diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index e1839b4b98f..c4745537de3 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1703,6 +1703,17 @@ call bug15091(); drop procedure bug15091; +# +# BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION +# +--disable_warnings +drop function if exists bug16896; +--enable_warnings + +--error ER_SP_NO_AGGREGATE +create aggregate function bug16896() returns int return 1; + + # # BUG#NNNN: New bug synopsis # @@ -1710,3 +1721,4 @@ drop procedure bug15091; #drop procedure if exists bugNNNN| #--enable_warnings #create procedure bugNNNN... + diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 8017ba3ef9f..1315de6528a 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5607,3 +5607,5 @@ ER_SP_PROC_TABLE_CORRUPT eng "Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)" ER_SP_WRONG_NAME 42000 eng "Incorrect routine name '%-.64s'" +ER_SP_NO_AGGREGATE 42000 + eng "AGGREGATE is not supported for stored functions" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ebb97cde3e4..4f4ec5e92de 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1326,6 +1326,16 @@ create_function_tail: LEX *lex= Lex; sp_head *sp; + /* + First check if AGGREGATE was used, in that case it's a + syntax error. + */ + if (lex->udf.type == UDFTYPE_AGGREGATE) + { + my_error(ER_SP_NO_AGGREGATE, MYF(0)); + YYABORT; + } + if (lex->sphead) { my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION"); diff --git a/sql/udf_example.cc b/sql/udf_example.cc index a186b4fbf6c..35833e63fab 100644 --- a/sql/udf_example.cc +++ b/sql/udf_example.cc @@ -144,6 +144,7 @@ char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result, my_bool myfunc_double_init(UDF_INIT *, UDF_ARGS *args, char *message); double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error); +my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message); longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error); my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message); @@ -597,6 +598,14 @@ longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, return val; } +/* + At least one of _init/_deinit is needed unless the server is started + with --allow_suspicious_udfs. +*/ +my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +{ + return 0; +} /* Simple example of how to get a sequences starting from the first argument From f1f71c4879c369d95ddff80414256deb9ed5641c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Feb 2006 11:22:20 +0100 Subject: [PATCH 03/26] Explicit cscript.exe execution of .js files. --- win/cmakefiles/sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/cmakefiles/sql b/win/cmakefiles/sql index ee53436a1a6..19e8b8ab739 100644 --- a/win/cmakefiles/sql +++ b/win/cmakefiles/sql @@ -76,14 +76,14 @@ ADD_CUSTOM_COMMAND( #ADD_CUSTOM_COMMAND( # SOURCE ${PROJECT_SOURCE_DIR}/include/mysql_version.h.in # OUTPUT ${PROJECT_SOURCE_DIR}/include/mysql_version.h -# COMMAND ${PROJECT_SOURCE_DIR}/win/config-version.js +# COMMAND cscript.exe ${PROJECT_SOURCE_DIR}/win/config-version.js # DEPENDS ${PROJECT_SOURCE_DIR}/include/mysql_version.h.in) # Handlerton file ADD_CUSTOM_COMMAND( SOURCE ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in OUTPUT ${PROJECT_SOURCE_DIR}/sql/handlerton.cc - COMMAND ${PROJECT_SOURCE_DIR}/win/config-handlerton.js ARGS ${PROJECT_SOURCE_DIR}/win/configure.data + COMMAND cscript.exe ${PROJECT_SOURCE_DIR}/win/config-handlerton.js ARGS ${PROJECT_SOURCE_DIR}/win/configure.data DEPENDS ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in) # Error file From 86df81d8c332252fff33427fc860cd204e944f38 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Feb 2006 13:29:01 +0100 Subject: [PATCH 04/26] Changes to make testsuite run in CMake build tree. --- client/mysqlbinlog.cc | 2 +- mysql-test/mysql-test-run.pl | 19 ++++++++++++++----- win/cmakefiles/client | 32 ++++++++++++++++++++++++++++++-- win/cmakefiles/extra | 2 ++ 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 96792d0ffcb..490a74e6035 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1497,7 +1497,7 @@ int main(int argc, char** argv) the server */ -#ifdef __WIN__ +#if defined(__WIN__) && !defined(USING_CMAKE) #include "my_decimal.h" #include "decimal.c" #include "my_decimal.cpp" diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6cd878fce70..dfa3655a8cc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -954,16 +954,25 @@ sub executable_setup () { if ( $glob_win32 ) { $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", - "$glob_basedir/bin"); + "$glob_basedir/bin", + # New CMake locations. + "$glob_basedir/client/release", + "$glob_basedir/client/debug"); $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max", "$path_client_bindir/mysqld-nt", "$path_client_bindir/mysqld", - "$path_client_bindir/mysqld-debug",); - $path_language= mtr_path_exists("$glob_basedir/share/english/"); - $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); + "$path_client_bindir/mysqld-debug", + "$glob_basedir/sql/release/mysqld", + "$glob_basedir/sql/debug/mysqld"); + $path_language= mtr_path_exists("$glob_basedir/share/english/", + "$glob_basedir/sql/share/english/"); + $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets", + "$glob_basedir/sql/share/charsets"); $exe_my_print_defaults= - mtr_exe_exists("$path_client_bindir/my_print_defaults"); + mtr_exe_exists("$path_client_bindir/my_print_defaults", + "$glob_basedir/extra/release/my_print_defaults", + "$glob_basedir/extra/debug/my_print_defaults"); } else { diff --git a/win/cmakefiles/client b/win/cmakefiles/client index 7c0c6f2400b..9c5582f58ff 100644 --- a/win/cmakefiles/client +++ b/win/cmakefiles/client @@ -1,11 +1,16 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT) +# The old Windows build method used renamed (.cc -> .cpp) source files, fails +# in #include in mysqlbinlog.cc. So disable that using the USING_CMAKE define. +ADD_DEFINITIONS(-DUSE_TLS -DUSING_CMAKE) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/extra/yassl/include - ${CMAKE_SOURCE_DIR}/libmysql) + ${CMAKE_SOURCE_DIR}/libmysql + ${CMAKE_SOURCE_DIR}/regex + ${CMAKE_SOURCE_DIR}/sql + ${CMAKE_SOURCE_DIR}/strings) ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c @@ -47,3 +52,26 @@ ADD_DEPENDENCIES(mysqlclient GenError) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc) LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib) TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl zlib dbug yassl taocrypt wsock32) + +ADD_EXECUTABLE(mysqltest mysqltest.c) +TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys yassl zlib dbug regex wsock32) + +ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) +TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug yassl zlib wsock32) + +ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) +TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug yassl zlib wsock32) + +ADD_EXECUTABLE(mysqlimport mysqlimport.c) +TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl zlib wsock32) + +ADD_EXECUTABLE(mysqlshow mysqlshow.c) +TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl zlib wsock32) + +ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc + ../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/my_vle.c + ../mysys/base64.c) +TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug yassl zlib wsock32) + +ADD_EXECUTABLE(mysqladmin mysqladmin.cc) +TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl zlib wsock32) diff --git a/win/cmakefiles/extra b/win/cmakefiles/extra index 40327eac0ad..328e20a696a 100644 --- a/win/cmakefiles/extra +++ b/win/cmakefiles/extra @@ -19,3 +19,5 @@ ADD_CUSTOM_TARGET(GenError +ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) +TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32) From b2571980bb4440d6acd1ab2288dfb5156e57a22c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Feb 2006 11:23:13 +0100 Subject: [PATCH 05/26] Added on-line handling of altered frm in binlog thread --- mysql-test/r/ndb_alter_table_row.result | 9 ++ mysql-test/t/ndb_alter_table_row.test | 2 + sql/ha_ndbcluster.cc | 4 +- sql/ha_ndbcluster_binlog.cc | 117 ++++++++++++++++++++---- sql/ha_ndbcluster_binlog.h | 2 + 5 files changed, 112 insertions(+), 22 deletions(-) diff --git a/mysql-test/r/ndb_alter_table_row.result b/mysql-test/r/ndb_alter_table_row.result index 450b2c9a5af..ee7c9b1c7b0 100644 --- a/mysql-test/r/ndb_alter_table_row.result +++ b/mysql-test/r/ndb_alter_table_row.result @@ -3,10 +3,19 @@ create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) ) engine=ndb; insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); create index c on t1(c); +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 a A 3 NULL NULL BTREE +t1 1 b 1 b A 3 NULL NULL YES BTREE +t1 1 c 1 c A 3 NULL NULL YES BTREE select * from t1 where c = 'two'; a b c 2 two two alter table t1 drop index c; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 a A 3 NULL NULL BTREE +t1 1 b 1 b A 3 NULL NULL YES BTREE select * from t1 where c = 'two'; a b c 2 two two diff --git a/mysql-test/t/ndb_alter_table_row.test b/mysql-test/t/ndb_alter_table_row.test index 5dbfa26289b..9c834e0dd20 100644 --- a/mysql-test/t/ndb_alter_table_row.test +++ b/mysql-test/t/ndb_alter_table_row.test @@ -13,10 +13,12 @@ engine=ndb; insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); create index c on t1(c); connection server2; +show indexes from t1; select * from t1 where c = 'two'; connection server1; alter table t1 drop index c; connection server2; +show indexes from t1; select * from t1 where c = 'two'; connection server1; drop table t1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index f1fdfe86930..acd8208c324 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -993,8 +993,8 @@ bool ha_ndbcluster::uses_blob_value() -2 Meta data has changed; Re-read data and try again */ -static int cmp_frm(const NDBTAB *ndbtab, const void *pack_data, - uint pack_length) +int cmp_frm(const NDBTAB *ndbtab, const void *pack_data, + uint pack_length) { DBUG_ENTER("cmp_frm"); /* diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index b349e3320de..783cb0a39b7 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1291,20 +1291,87 @@ static int ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, NDB_SHARE *share) { + DBUG_ENTER("ndb_handle_schema_change"); int remote_drop_table= 0, do_close_cached_tables= 0; + const char *dbname= share->table->s->db.str; + const char *tabname= share->table->s->table_name.str; + bool online_alter_table= (pOp->getEventType() == NDBEVENT::TE_ALTER && + pOp->tableFrmChanged()); if (pOp->getEventType() != NDBEVENT::TE_CLUSTER_FAILURE && pOp->getReqNodeId() != g_ndb_cluster_connection->node_id()) { - ndb->setDatabaseName(share->table->s->db.str); + NDBDICT *dict= ndb->getDictionary(); + NdbDictionary::Dictionary::List index_list; + + ndb->setDatabaseName(dbname); + // Invalidating indexes + if (! dict->listIndexes(index_list, tabname)) + { + for (unsigned i = 0; i < index_list.count; i++) { + NdbDictionary::Dictionary::List::Element& index= + index_list.elements[i]; + DBUG_PRINT("info", ("Invalidating index %s.%s", + index.database, index.name)); + dict->invalidateIndex(index.name, tabname); + } + } + // Invalidate table ha_ndbcluster::invalidate_dictionary_cache(share->table->s, ndb, - share->table->s->db.str, - share->table->s->table_name.str, + dbname, + tabname, TRUE); + + if (online_alter_table) + { + char key[FN_REFLEN]; + const void *data= 0, *pack_data= 0; + uint length, pack_length; + int error; + + DBUG_PRINT("info", ("Detected frm change of table %s.%s", + dbname, tabname)); + const NDBTAB *altered_table= pOp->getEvent()->getTable(); + bool remote_event= + pOp->getReqNodeId() != g_ndb_cluster_connection->node_id(); + strxnmov(key, FN_LEN-1, mysql_data_home, "/", + dbname, "/", tabname, NullS); + /* + If the frm of the altered table is different than the one on + disk then overwrite it with the new table definition + */ + if (remote_event && + readfrm(key, &data, &length) == 0 && + packfrm(data, length, &pack_data, &pack_length) == 0 && + cmp_frm(altered_table, pack_data, pack_length)) + { + DBUG_DUMP("frm", (char*)altered_table->getFrmData(), + altered_table->getFrmLength()); + pthread_mutex_lock(&LOCK_open); + dict->putTable(altered_table); + + if ((error= unpackfrm(&data, &length, altered_table->getFrmData())) || + (error= writefrm(key, data, length))) + { + sql_print_information("NDB: Failed write frm for %s.%s, error %d", + dbname, tabname, error); + } + pthread_mutex_unlock(&LOCK_open); + close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); + } + } remote_drop_table= 1; } + // If only frm was changed continue replicating + if (online_alter_table) + { + /* Signal ha_ndbcluster::alter_table that drop is done */ + (void) pthread_cond_signal(&injector_cond); + DBUG_RETURN(0); + } + (void) pthread_mutex_lock(&share->mutex); DBUG_ASSERT(share->op == pOp || share->op_old == pOp); if (share->op_old == pOp) @@ -1385,7 +1452,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, /* fall through */ case SOT_ALTER_TABLE: /* fall through */ - if (!ndb_binlog_running) + if (ndb_binlog_running) { log_query= 1; break; /* discovery will be handled by binlog */ @@ -1482,11 +1549,16 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, // skip break; case NDBEVENT::TE_ALTER: - /* do the rename of the table in the share */ - share->table->s->db.str= share->db; - share->table->s->db.length= strlen(share->db); - share->table->s->table_name.str= share->table_name; - share->table->s->table_name.length= strlen(share->table_name); + if (pOp->tableNameChanged()) + { + DBUG_PRINT("info", ("Detected name change of table %s.%s", + share->db, share->table_name)); + /* do the rename of the table in the share */ + share->table->s->db.str= share->db; + share->table->s->db.length= strlen(share->db); + share->table->s->table_name.str= share->table_name; + share->table->s->table_name.length= strlen(share->table_name); + } ndb_handle_schema_change(thd, ndb, pOp, share); break; case NDBEVENT::TE_CLUSTER_FAILURE: @@ -2357,17 +2429,22 @@ ndb_binlog_thread_handle_non_data_event(Ndb *ndb, NdbEventOperation *pOp, share->key, share, pOp, share->op, share->op_old)); break; case NDBEVENT::TE_ALTER: - /* ToDo: remove printout */ - if (ndb_extra_logging) - sql_print_information("NDB Binlog: rename table %s%s/%s -> %s.", - share_prefix, share->table->s->db.str, - share->table->s->table_name.str, - share->key); - /* do the rename of the table in the share */ - share->table->s->db.str= share->db; - share->table->s->db.length= strlen(share->db); - share->table->s->table_name.str= share->table_name; - share->table->s->table_name.length= strlen(share->table_name); + if (pOp->tableNameChanged()) + { + DBUG_PRINT("info", ("Detected name change of table %s.%s", + share->db, share->table_name)); + /* ToDo: remove printout */ + if (ndb_extra_logging) + sql_print_information("NDB Binlog: rename table %s%s/%s -> %s.", + share_prefix, share->table->s->db.str, + share->table->s->table_name.str, + share->key); + /* do the rename of the table in the share */ + share->table->s->db.str= share->db; + share->table->s->db.length= strlen(share->db); + share->table->s->table_name.str= share->table_name; + share->table->s->table_name.length= strlen(share->table_name); + } goto drop_alter_common; case NDBEVENT::TE_DROP: if (apply_status_share == share) diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h index a297f80f6ab..88f476357b2 100644 --- a/sql/ha_ndbcluster_binlog.h +++ b/sql/ha_ndbcluster_binlog.h @@ -122,6 +122,8 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print, prototypes for ndb handler utility function also needed by the ndb binlog code */ +int cmp_frm(const NDBTAB *ndbtab, const void *pack_data, + uint pack_length); int ndbcluster_find_all_files(THD *thd); #endif /* HAVE_NDB_BINLOG */ From 4628da295f421042f9aa3b24e307f5d20133528b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Feb 2006 17:28:34 +0100 Subject: [PATCH 06/26] Additional tests for nested handlers added to sp.test. A follow-up to BUG#15011 (already fixed). mysql-test/r/sp.result: Updated results for new handler tests. mysql-test/t/sp.test: Additional tests for nested handlers. --- mysql-test/r/sp.result | 335 ++++++++++++++++++++++++++++++++++- mysql-test/t/sp.test | 393 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 725 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index bec2f049bc4..61c977f1a5c 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1413,8 +1413,6 @@ select `foo` ()| 5 drop function `foo`| drop function if exists t1max| -Warnings: -Note 1305 FUNCTION t1max does not exist create function t1max() returns int begin declare x int; @@ -1470,6 +1468,339 @@ zip 3 foo 1 drop table t3| drop function getcount| +drop table if exists t3| +drop procedure if exists h_ee| +drop procedure if exists h_es| +drop procedure if exists h_en| +drop procedure if exists h_ew| +drop procedure if exists h_ex| +drop procedure if exists h_se| +drop procedure if exists h_ss| +drop procedure if exists h_sn| +drop procedure if exists h_sw| +drop procedure if exists h_sx| +drop procedure if exists h_ne| +drop procedure if exists h_ns| +drop procedure if exists h_nn| +drop procedure if exists h_we| +drop procedure if exists h_ws| +drop procedure if exists h_ww| +drop procedure if exists h_xe| +drop procedure if exists h_xs| +drop procedure if exists h_xx| +create table t3 (a smallint primary key)| +insert into t3 (a) values (1)| +create procedure h_ee() +deterministic +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Outer (bad)' as 'h_ee'; +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Inner (good)' as 'h_ee'; +insert into t3 values (1); +end; +end| +create procedure h_es() +deterministic +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Outer (good)' as 'h_es'; +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' + select 'Inner (bad)' as 'h_es'; +insert into t3 values (1); +end; +end| +create procedure h_en() +deterministic +begin +declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA +select 'Outer (good)' as 'h_en'; +begin +declare x int; +declare continue handler for sqlstate '02000' -- no data +select 'Inner (bad)' as 'h_en'; +select a into x from t3 where a = 42; +end; +end| +create procedure h_ew() +deterministic +begin +declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE +select 'Outer (good)' as 'h_ew'; +begin +declare continue handler for sqlwarning +select 'Inner (bad)' as 'h_ew'; +insert into t3 values (123456789012); +end; +delete from t3; +insert into t3 values (1); +end| +create procedure h_ex() +deterministic +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Outer (good)' as 'h_ex'; +begin +declare continue handler for sqlexception +select 'Inner (bad)' as 'h_ex'; +insert into t3 values (1); +end; +end| +create procedure h_se() +deterministic +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' +select 'Outer (bad)' as 'h_se'; +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Inner (good)' as 'h_se'; +insert into t3 values (1); +end; +end| +create procedure h_ss() +deterministic +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' +select 'Outer (bad)' as 'h_ss'; +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' +select 'Inner (good)' as 'h_ss'; +insert into t3 values (1); +end; +end| +create procedure h_sn() +deterministic +begin +-- Note: '02000' is more specific than NOT FOUND ; +-- there might be other not found states +declare continue handler for sqlstate '02000' -- no data +select 'Outer (good)' as 'h_sn'; +begin +declare x int; +declare continue handler for not found +select 'Inner (bad)' as 'h_sn'; +select a into x from t3 where a = 42; +end; +end| +create procedure h_sw() +deterministic +begin +-- data exception - numeric value out of range +declare continue handler for sqlstate '22003' + select 'Outer (good)' as 'h_sw'; +begin +declare continue handler for sqlwarning +select 'Inner (bad)' as 'h_sw'; +insert into t3 values (123456789012); +end; +delete from t3; +insert into t3 values (1); +end| +create procedure h_sx() +deterministic +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' +select 'Outer (good)' as 'h_sx'; +begin +declare continue handler for sqlexception +select 'Inner (bad)' as 'h_sx'; +insert into t3 values (1); +end; +end| +create procedure h_ne() +deterministic +begin +declare continue handler for not found +select 'Outer (bad)' as 'h_ne'; +begin +declare x int; +declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA +select 'Inner (good)' as 'h_ne'; +select a into x from t3 where a = 42; +end; +end| +create procedure h_ns() +deterministic +begin +declare continue handler for not found +select 'Outer (bad)' as 'h_ns'; +begin +declare x int; +declare continue handler for sqlstate '02000' -- no data +select 'Inner (good)' as 'h_ns'; +select a into x from t3 where a = 42; +end; +end| +create procedure h_nn() +deterministic +begin +declare continue handler for not found +select 'Outer (bad)' as 'h_nn'; +begin +declare x int; +declare continue handler for not found +select 'Inner (good)' as 'h_nn'; +select a into x from t3 where a = 42; +end; +end| +create procedure h_we() +deterministic +begin +declare continue handler for sqlwarning +select 'Outer (bad)' as 'h_we'; +begin +declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE +select 'Inner (good)' as 'h_we'; +insert into t3 values (123456789012); +end; +delete from t3; +insert into t3 values (1); +end| +create procedure h_ws() +deterministic +begin +declare continue handler for sqlwarning +select 'Outer (bad)' as 'h_ws'; +begin +-- data exception - numeric value out of range +declare continue handler for sqlstate '22003' + select 'Inner (good)' as 'h_ws'; +insert into t3 values (123456789012); +end; +delete from t3; +insert into t3 values (1); +end| +create procedure h_ww() +deterministic +begin +declare continue handler for sqlwarning +select 'Outer (bad)' as 'h_ww'; +begin +declare continue handler for sqlwarning +select 'Inner (good)' as 'h_ww'; +insert into t3 values (123456789012); +end; +delete from t3; +insert into t3 values (1); +end| +create procedure h_xe() +deterministic +begin +declare continue handler for sqlexception +select 'Outer (bad)' as 'h_xe'; +begin +declare continue handler for 1062 -- ER_DUP_ENTRY +select 'Inner (good)' as 'h_xe'; +insert into t3 values (1); +end; +end| +create procedure h_xs() +deterministic +begin +declare continue handler for sqlexception +select 'Outer (bad)' as 'h_xs'; +begin +-- integrity constraint violation +declare continue handler for sqlstate '23000' + select 'Inner (good)' as 'h_xs'; +insert into t3 values (1); +end; +end| +create procedure h_xx() +deterministic +begin +declare continue handler for sqlexception +select 'Outer (bad)' as 'h_xx'; +begin +declare continue handler for sqlexception +select 'Inner (good)' as 'h_xx'; +insert into t3 values (1); +end; +end| +call h_ee()| +h_ee +Inner (good) +call h_es()| +h_es +Outer (good) +call h_en()| +h_en +Outer (good) +call h_ew()| +h_ew +Outer (good) +call h_ex()| +h_ex +Outer (good) +call h_se()| +h_se +Inner (good) +call h_ss()| +h_ss +Inner (good) +call h_sn()| +h_sn +Outer (good) +call h_sw()| +h_sw +Outer (good) +call h_sx()| +h_sx +Outer (good) +call h_ne()| +h_ne +Inner (good) +call h_ns()| +h_ns +Inner (good) +call h_nn()| +h_nn +Inner (good) +call h_we()| +h_we +Inner (good) +call h_ws()| +h_ws +Inner (good) +call h_ww()| +h_ww +Inner (good) +call h_xe()| +h_xe +Inner (good) +call h_xs()| +h_xs +Inner (good) +call h_xx()| +h_xx +Inner (good) +drop table t3| +drop procedure h_ee| +drop procedure h_es| +drop procedure h_en| +drop procedure h_ew| +drop procedure h_ex| +drop procedure h_se| +drop procedure h_ss| +drop procedure h_sn| +drop procedure h_sw| +drop procedure h_sx| +drop procedure h_ne| +drop procedure h_ns| +drop procedure h_nn| +drop procedure h_we| +drop procedure h_ws| +drop procedure h_ww| +drop procedure h_xe| +drop procedure h_xs| +drop procedure h_xx| drop procedure if exists bug822| create procedure bug822(a_id char(16), a_data int) begin diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 53c15ffd05b..bc0b6f654b8 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1660,7 +1660,7 @@ drop function `foo`| # Implicit LOCK/UNLOCK TABLES for table access in functions # ---disable_warning +--disable_warnings drop function if exists t1max| --enable_warnings create function t1max() returns int @@ -1704,6 +1704,397 @@ drop table t3| drop function getcount| +# Test cases for different combinations of condition handlers in nested +# begin-end blocks in stored procedures. +# +# Note that the standard specifies that the most specific handler should +# be triggered even if it's an outer handler masked by a less specific +# handler in an inner block. +# Note also that '02000' is more specific than NOT FOUND; there might be +# other '02xxx' states, even if we currently do not issue them in any +# situation (e.g. '02001'). +# +# The combinations we test are these: +# +# Inner +# errcode sqlstate not found sqlwarning sqlexception +# Outer +------------+------------+------------+------------+------------+ +#errcode | h_ee (i) | h_es (o) | h_en (o) | h_ew (o) | h_ex (o) | +#sqlstate | h_se (i) | h_ss (i) | h_sn (o) | h_sw (o) | h_sx (o) | +#not found | h_ne (i) | h_ns (i) | h_nn (i) | | | +#sqlwarning | h_we (i) | h_ws (i) | | h_ww (i) | | +#sqlexception | h_xe (i) | h_xs (i) | | | h_xx (i) | +# +------------+---------------------------------------------------+ +# +# (i) means that the inner handler is the one that should be invoked, +# (o) means that the outer handler should be invoked. +# +# ('not found', 'sqlwarning' and 'sqlexception' are mutually exclusive, hence +# no tests for those combinations.) +# + +--disable_warnings +drop table if exists t3| +drop procedure if exists h_ee| +drop procedure if exists h_es| +drop procedure if exists h_en| +drop procedure if exists h_ew| +drop procedure if exists h_ex| +drop procedure if exists h_se| +drop procedure if exists h_ss| +drop procedure if exists h_sn| +drop procedure if exists h_sw| +drop procedure if exists h_sx| +drop procedure if exists h_ne| +drop procedure if exists h_ns| +drop procedure if exists h_nn| +drop procedure if exists h_we| +drop procedure if exists h_ws| +drop procedure if exists h_ww| +drop procedure if exists h_xe| +drop procedure if exists h_xs| +drop procedure if exists h_xx| +--enable_warnings + +# smallint - to get out of range warnings +# primary key - to get constraint errors +create table t3 (a smallint primary key)| + +insert into t3 (a) values (1)| + +create procedure h_ee() + deterministic +begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Outer (bad)' as 'h_ee'; + + begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Inner (good)' as 'h_ee'; + + insert into t3 values (1); + end; +end| + +create procedure h_es() + deterministic +begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Outer (good)' as 'h_es'; + + begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Inner (bad)' as 'h_es'; + + insert into t3 values (1); + end; +end| + +create procedure h_en() + deterministic +begin + declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA + select 'Outer (good)' as 'h_en'; + + begin + declare x int; + declare continue handler for sqlstate '02000' -- no data + select 'Inner (bad)' as 'h_en'; + + select a into x from t3 where a = 42; + end; +end| + +create procedure h_ew() + deterministic +begin + declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE + select 'Outer (good)' as 'h_ew'; + + begin + declare continue handler for sqlwarning + select 'Inner (bad)' as 'h_ew'; + + insert into t3 values (123456789012); + end; + delete from t3; + insert into t3 values (1); +end| + +create procedure h_ex() + deterministic +begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Outer (good)' as 'h_ex'; + + begin + declare continue handler for sqlexception + select 'Inner (bad)' as 'h_ex'; + + insert into t3 values (1); + end; +end| + +create procedure h_se() + deterministic +begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Outer (bad)' as 'h_se'; + + begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Inner (good)' as 'h_se'; + + insert into t3 values (1); + end; +end| + +create procedure h_ss() + deterministic +begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Outer (bad)' as 'h_ss'; + + begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Inner (good)' as 'h_ss'; + + insert into t3 values (1); + end; +end| + +create procedure h_sn() + deterministic +begin + -- Note: '02000' is more specific than NOT FOUND ; + -- there might be other not found states + declare continue handler for sqlstate '02000' -- no data + select 'Outer (good)' as 'h_sn'; + + begin + declare x int; + declare continue handler for not found + select 'Inner (bad)' as 'h_sn'; + + select a into x from t3 where a = 42; + end; +end| + +create procedure h_sw() + deterministic +begin + -- data exception - numeric value out of range + declare continue handler for sqlstate '22003' + select 'Outer (good)' as 'h_sw'; + + begin + declare continue handler for sqlwarning + select 'Inner (bad)' as 'h_sw'; + + insert into t3 values (123456789012); + end; + delete from t3; + insert into t3 values (1); +end| + +create procedure h_sx() + deterministic +begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Outer (good)' as 'h_sx'; + + begin + declare continue handler for sqlexception + select 'Inner (bad)' as 'h_sx'; + + insert into t3 values (1); + end; +end| + +create procedure h_ne() + deterministic +begin + declare continue handler for not found + select 'Outer (bad)' as 'h_ne'; + + begin + declare x int; + declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA + select 'Inner (good)' as 'h_ne'; + + select a into x from t3 where a = 42; + end; +end| + +create procedure h_ns() + deterministic +begin + declare continue handler for not found + select 'Outer (bad)' as 'h_ns'; + + begin + declare x int; + declare continue handler for sqlstate '02000' -- no data + select 'Inner (good)' as 'h_ns'; + + select a into x from t3 where a = 42; + end; +end| + +create procedure h_nn() + deterministic +begin + declare continue handler for not found + select 'Outer (bad)' as 'h_nn'; + + begin + declare x int; + declare continue handler for not found + select 'Inner (good)' as 'h_nn'; + + select a into x from t3 where a = 42; + end; +end| + +create procedure h_we() + deterministic +begin + declare continue handler for sqlwarning + select 'Outer (bad)' as 'h_we'; + + begin + declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE + select 'Inner (good)' as 'h_we'; + + insert into t3 values (123456789012); + end; + delete from t3; + insert into t3 values (1); +end| + +create procedure h_ws() + deterministic +begin + declare continue handler for sqlwarning + select 'Outer (bad)' as 'h_ws'; + + begin + -- data exception - numeric value out of range + declare continue handler for sqlstate '22003' + select 'Inner (good)' as 'h_ws'; + + insert into t3 values (123456789012); + end; + delete from t3; + insert into t3 values (1); +end| + +create procedure h_ww() + deterministic +begin + declare continue handler for sqlwarning + select 'Outer (bad)' as 'h_ww'; + + begin + declare continue handler for sqlwarning + select 'Inner (good)' as 'h_ww'; + + insert into t3 values (123456789012); + end; + delete from t3; + insert into t3 values (1); +end| + +create procedure h_xe() + deterministic +begin + declare continue handler for sqlexception + select 'Outer (bad)' as 'h_xe'; + + begin + declare continue handler for 1062 -- ER_DUP_ENTRY + select 'Inner (good)' as 'h_xe'; + + insert into t3 values (1); + end; +end| + +create procedure h_xs() + deterministic +begin + declare continue handler for sqlexception + select 'Outer (bad)' as 'h_xs'; + + begin + -- integrity constraint violation + declare continue handler for sqlstate '23000' + select 'Inner (good)' as 'h_xs'; + + insert into t3 values (1); + end; +end| + +create procedure h_xx() + deterministic +begin + declare continue handler for sqlexception + select 'Outer (bad)' as 'h_xx'; + + begin + declare continue handler for sqlexception + select 'Inner (good)' as 'h_xx'; + + insert into t3 values (1); + end; +end| + +call h_ee()| +call h_es()| +call h_en()| +call h_ew()| +call h_ex()| +call h_se()| +call h_ss()| +call h_sn()| +call h_sw()| +call h_sx()| +call h_ne()| +call h_ns()| +call h_nn()| +call h_we()| +call h_ws()| +call h_ww()| +call h_xe()| +call h_xs()| +call h_xx()| + +drop table t3| +drop procedure h_ee| +drop procedure h_es| +drop procedure h_en| +drop procedure h_ew| +drop procedure h_ex| +drop procedure h_se| +drop procedure h_ss| +drop procedure h_sn| +drop procedure h_sw| +drop procedure h_sx| +drop procedure h_ne| +drop procedure h_ns| +drop procedure h_nn| +drop procedure h_we| +drop procedure h_ws| +drop procedure h_ww| +drop procedure h_xe| +drop procedure h_xs| +drop procedure h_xx| + + # # Test cases for old bugs # From 9e34838372573cc687a525e755dcd5288f6b5008 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2006 10:07:31 +0100 Subject: [PATCH 07/26] Improvement of on-line discovery in injector thread --- sql/ha_ndbcluster.cc | 12 +- sql/ha_ndbcluster.h | 5 +- sql/ha_ndbcluster_binlog.cc | 195 +++++++++--------- storage/ndb/include/kernel/ndb_limits.h | 1 + .../include/kernel/signaldata/AlterTable.hpp | 1 + .../ndb/src/kernel/blocks/backup/Backup.hpp | 2 +- storage/ndb/src/kernel/blocks/suma/Suma.cpp | 10 +- storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp | 2 + 8 files changed, 127 insertions(+), 101 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 14a2159209c..9f49ffab097 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -519,6 +519,7 @@ void ha_ndbcluster::invalidate_dictionary_cache(bool global) { NDBINDEX *index = (NDBINDEX *) m_index[i].index; NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index; + if (!index && !unique_index) continue; NDB_INDEX_TYPE idx_type= m_index[i].type; switch (idx_type) { @@ -1076,7 +1077,7 @@ int ha_ndbcluster::get_metadata(const char *path) m_table= (void *)tab; m_table_info= NULL; // Set in external lock - DBUG_RETURN(open_indexes(ndb, table)); + DBUG_RETURN(open_indexes(ndb, table, FALSE)); } static int fix_unique_index_attr_order(NDB_INDEX_DATA &data, @@ -1249,7 +1250,7 @@ int ha_ndbcluster::add_index_handle(THD *thd, NDBDICT *dict, KEY *key_info, /* Associate index handles for each index of a table */ -int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab) +int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error) { uint i; int error= 0; @@ -1263,7 +1264,10 @@ int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab) for (i= 0; i < tab->s->keys; i++, key_info++, key_name++) { if ((error= add_index_handle(thd, dict, key_info, *key_name, i))) - break; + if (ignore_error) + m_index[i].index= m_index[i].unique_index= NULL; + else + break; } DBUG_RETURN(error); @@ -3699,7 +3703,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) { m_table= (void *)tab; m_table_version = tab->getObjectVersion(); - if (!(my_errno= open_indexes(ndb, table))) + if (!(my_errno= open_indexes(ndb, table, FALSE))) DBUG_RETURN(my_errno); } m_table_info= tab_info; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 12a5be32881..1c3a57caff3 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -691,6 +691,9 @@ static void set_tabname(const char *pathname, char *tabname); private: friend int ndbcluster_drop_database_impl(const char *path); + friend int ndb_handle_schema_change(THD *thd, + Ndb *ndb, NdbEventOperation *pOp, + NDB_SHARE *share); int alter_table_name(const char *to); static int delete_table(ha_ndbcluster *h, Ndb *ndb, const char *path, @@ -708,7 +711,7 @@ private: int create_indexes(Ndb *ndb, TABLE *tab); void clear_index(int i); void clear_indexes(); - int open_indexes(Ndb *ndb, TABLE *tab); + int open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error); void renumber_indexes(Ndb *ndb, TABLE *tab); int drop_indexes(Ndb *ndb, TABLE *tab); int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict, diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 783cb0a39b7..6e80c27719a 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -233,6 +233,72 @@ static void run_query(THD *thd, char *buf, char *end, } } +int +ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share, + TABLE_SHARE *table_share, TABLE *table) +{ + int error; + MEM_ROOT *mem_root= &share->mem_root; + DBUG_ENTER("ndbcluster_binlog_open_table"); + + init_tmp_table_share(table_share, share->db, 0, share->table_name, + share->key); + if ((error= open_table_def(thd, table_share, 0))) + { + sql_print_error("Unable to get table share for %s, error=%d", + share->key, error); + DBUG_PRINT("error", ("open_table_def failed %d", error)); + my_free((gptr) table_share, MYF(0)); + table_share= 0; + my_free((gptr) table, MYF(0)); + table= 0; + DBUG_RETURN(error); + } + if ((error= open_table_from_share(thd, table_share, "", 0, + (uint) READ_ALL, 0, table, FALSE))) + { + sql_print_error("Unable to open table for %s, error=%d(%d)", + share->key, error, my_errno); + DBUG_PRINT("error", ("open_table_from_share failed %d", error)); + my_free((gptr) table_share, MYF(0)); + table_share= 0; + my_free((gptr) table, MYF(0)); + table= 0; + DBUG_RETURN(error); + } + assign_new_table_id(table); + if (!table->record[1] || table->record[1] == table->record[0]) + { + table->record[1]= alloc_root(&table->mem_root, + table->s->rec_buff_length); + } + table->in_use= injector_thd; + + table->s->db.str= share->db; + table->s->db.length= strlen(share->db); + table->s->table_name.str= share->table_name; + table->s->table_name.length= strlen(share->table_name); + + share->table_share= table_share; + share->table= table; +#ifndef DBUG_OFF + dbug_print_table("table", table); +#endif + /* + ! do not touch the contents of the table + it may be in use by the injector thread + */ + share->ndb_value[0]= (NdbValue*) + alloc_root(mem_root, sizeof(NdbValue) * table->s->fields + + 1 /*extra for hidden key*/); + share->ndb_value[1]= (NdbValue*) + alloc_root(mem_root, sizeof(NdbValue) * table->s->fields + +1 /*extra for hidden key*/); + + DBUG_RETURN(0); +} + + /* Initialize the binlog part of the NDB_SHARE */ @@ -260,64 +326,12 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table) } while (1) { + int error; TABLE_SHARE *table_share= (TABLE_SHARE *) my_malloc(sizeof(*table_share), MYF(MY_WME)); TABLE *table= (TABLE*) my_malloc(sizeof(*table), MYF(MY_WME)); - int error; - - init_tmp_table_share(table_share, share->db, 0, share->table_name, - share->key); - if ((error= open_table_def(thd, table_share, 0))) - { - sql_print_error("Unable to get table share for %s, error=%d", - share->key, error); - DBUG_PRINT("error", ("open_table_def failed %d", error)); - my_free((gptr) table_share, MYF(0)); - table_share= 0; - my_free((gptr) table, MYF(0)); - table= 0; + if ((error= ndbcluster_binlog_open_table(thd, share, table_share, table))) break; - } - if ((error= open_table_from_share(thd, table_share, "", 0, - (uint) READ_ALL, 0, table, FALSE))) - { - sql_print_error("Unable to open table for %s, error=%d(%d)", - share->key, error, my_errno); - DBUG_PRINT("error", ("open_table_from_share failed %d", error)); - my_free((gptr) table_share, MYF(0)); - table_share= 0; - my_free((gptr) table, MYF(0)); - table= 0; - break; - } - assign_new_table_id(table); - if (!table->record[1] || table->record[1] == table->record[0]) - { - table->record[1]= alloc_root(&table->mem_root, - table->s->rec_buff_length); - } - table->in_use= injector_thd; - - table->s->db.str= share->db; - table->s->db.length= strlen(share->db); - table->s->table_name.str= share->table_name; - table->s->table_name.length= strlen(share->table_name); - - share->table_share= table_share; - share->table= table; -#ifndef DBUG_OFF - dbug_print_table("table", table); -#endif - /* - ! do not touch the contents of the table - it may be in use by the injector thread - */ - share->ndb_value[0]= (NdbValue*) - alloc_root(mem_root, sizeof(NdbValue) * table->s->fields - + 1 /*extra for hidden key*/); - share->ndb_value[1]= (NdbValue*) - alloc_root(mem_root, sizeof(NdbValue) * table->s->fields - +1 /*extra for hidden key*/); { int i, no_nodes= g_ndb_cluster_connection->no_db_nodes(); share->subscriber_bitmap= (MY_BITMAP*) @@ -651,10 +665,10 @@ static int ndbcluster_create_apply_status_table(THD *thd) if so, remove it since there is none in Ndb */ { - strxnmov(buf, sizeof(buf), - mysql_data_home, - "/" NDB_REP_DB "/" NDB_APPLY_TABLE, - reg_ext, NullS); + build_table_filename(buf, sizeof(buf), + NDB_REP_DB, + NDB_APPLY_TABLE, + reg_ext); unpack_filename(buf,buf); my_delete(buf, MYF(0)); } @@ -703,10 +717,10 @@ static int ndbcluster_create_schema_table(THD *thd) if so, remove it since there is none in Ndb */ { - strxnmov(buf, sizeof(buf), - mysql_data_home, - "/" NDB_REP_DB "/" NDB_SCHEMA_TABLE, - reg_ext, NullS); + build_table_filename(buf, sizeof(buf), + NDB_REP_DB, + NDB_SCHEMA_TABLE, + reg_ext); unpack_filename(buf,buf); my_delete(buf, MYF(0)); } @@ -1287,7 +1301,8 @@ end: /* Handle _non_ data events from the storage nodes */ -static int +//static int +int ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, NDB_SHARE *share) { @@ -1299,50 +1314,37 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, pOp->tableFrmChanged()); if (pOp->getEventType() != NDBEVENT::TE_CLUSTER_FAILURE && - pOp->getReqNodeId() != g_ndb_cluster_connection->node_id()) + (uint) pOp->getReqNodeId() != g_ndb_cluster_connection->node_id()) { - NDBDICT *dict= ndb->getDictionary(); - NdbDictionary::Dictionary::List index_list; - - ndb->setDatabaseName(dbname); - // Invalidating indexes - if (! dict->listIndexes(index_list, tabname)) - { - for (unsigned i = 0; i < index_list.count; i++) { - NdbDictionary::Dictionary::List::Element& index= - index_list.elements[i]; - DBUG_PRINT("info", ("Invalidating index %s.%s", - index.database, index.name)); - dict->invalidateIndex(index.name, tabname); - } - } - // Invalidate table - ha_ndbcluster::invalidate_dictionary_cache(share->table->s, - ndb, - dbname, - tabname, - TRUE); - + TABLE_SHARE *table_share= share->table->s; //share->table_share; + TABLE* table= share->table; + + /* + Invalidate table and all it's indexes + */ + ha_ndbcluster table_handler(table_share); + table_handler.set_dbname(share->key); + table_handler.set_tabname(share->key); + table_handler.open_indexes(ndb, table, TRUE); + table_handler.invalidate_dictionary_cache(TRUE); + if (online_alter_table) { char key[FN_REFLEN]; const void *data= 0, *pack_data= 0; uint length, pack_length; int error; + NDBDICT *dict= ndb->getDictionary(); + const NDBTAB *altered_table= pOp->getTable(); DBUG_PRINT("info", ("Detected frm change of table %s.%s", dbname, tabname)); - const NDBTAB *altered_table= pOp->getEvent()->getTable(); - bool remote_event= - pOp->getReqNodeId() != g_ndb_cluster_connection->node_id(); - strxnmov(key, FN_LEN-1, mysql_data_home, "/", - dbname, "/", tabname, NullS); + build_table_filename(key, FN_LEN-1, dbname, tabname, NullS); /* If the frm of the altered table is different than the one on disk then overwrite it with the new table definition */ - if (remote_event && - readfrm(key, &data, &length) == 0 && + if (readfrm(key, &data, &length) == 0 && packfrm(data, length, &pack_data, &pack_length) == 0 && cmp_frm(altered_table, pack_data, pack_length)) { @@ -1359,6 +1361,12 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, } pthread_mutex_unlock(&LOCK_open); close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); + /* + if ((error= ndbcluster_binlog_open_table(thd, share, + table_share, table))) + sql_print_information("NDB: Failed to re-open table %s.%s", + dbname, tabname); + */ } } remote_drop_table= 1; @@ -1838,6 +1846,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, /* Handle any trailing share */ NDB_SHARE *share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, (byte*) key, key_len); + if (share && share_may_exist) { if (share->flags & NSF_NO_BINLOG || diff --git a/storage/ndb/include/kernel/ndb_limits.h b/storage/ndb/include/kernel/ndb_limits.h index ef6b8370888..6bf9256bf95 100644 --- a/storage/ndb/include/kernel/ndb_limits.h +++ b/storage/ndb/include/kernel/ndb_limits.h @@ -66,6 +66,7 @@ #define MAX_FRAGMENT_DATA_BYTES (4+(2 * 8 * MAX_REPLICAS * MAX_NDB_NODES)) #define MAX_NDB_PARTITIONS 1024 #define MAX_RANGE_DATA (131072+MAX_NDB_PARTITIONS) //0.5 MByte of list data +#define MAX_WORDS_META_FILE 16382 #define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1) /* diff --git a/storage/ndb/include/kernel/signaldata/AlterTable.hpp b/storage/ndb/include/kernel/signaldata/AlterTable.hpp index 427179a389f..1cdc7c00fcb 100644 --- a/storage/ndb/include/kernel/signaldata/AlterTable.hpp +++ b/storage/ndb/include/kernel/signaldata/AlterTable.hpp @@ -39,6 +39,7 @@ class AlterTableReq { friend class NdbEventOperationImpl; friend class NdbDictInterface; friend class Dbdict; + friend class Suma; /** * For printing diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.hpp b/storage/ndb/src/kernel/blocks/backup/Backup.hpp index 9ad244ed3e4..a7d73801665 100644 --- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp +++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp @@ -530,7 +530,7 @@ public: Config c_defaults; Uint32 m_diskless; - STATIC_CONST(NO_OF_PAGES_META_FILE = 2); + STATIC_CONST(NO_OF_PAGES_META_FILE = MAX_WORDS_META_FILE/BACKUP_WORDS_PER_PAGE); /** * Pools diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index a3859012139..8e7a7a091af 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -3440,7 +3441,7 @@ Suma::execDROP_TAB_CONF(Signal *signal) DBUG_VOID_RETURN; } -static Uint32 b_dti_buf[10000]; +static Uint32 b_dti_buf[MAX_WORDS_META_FILE]; void Suma::execALTER_TAB_REQ(Signal *signal) @@ -3462,7 +3463,7 @@ Suma::execALTER_TAB_REQ(Signal *signal) } DBUG_PRINT("info",("alter table id: %d[i=%u]", tableId, tabPtr.i)); - + Table::State old_state = tabPtr.p->m_state; tabPtr.p->m_state = Table::ALTERED; // triggers must be removed, waiting for sub stop req for that @@ -3520,6 +3521,11 @@ Suma::execALTER_TAB_REQ(Signal *signal) DBUG_PRINT("info",("sent to subscriber %d", subbPtr.i)); } } + if (AlterTableReq::getFrmFlag(changeMask)) + { + // Frm changes only are handled on-line + tabPtr.p->m_state = old_state; + } DBUG_VOID_RETURN; } diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 5a458c24aa2..60186837b09 100644 --- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1320,6 +1320,8 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl) m_localHash.put(impl->m_internalName.c_str(), info); + addBlobTables(*impl); + m_ndb.theFirstTupleId[impl->getTableId()] = ~0; m_ndb.theLastTupleId[impl->getTableId()] = ~0; } From e1c8d9c9b4f4d7592f088e38a8374ab844cd51ee Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2006 16:19:24 +0300 Subject: [PATCH 08/26] Fix for bug #16593 "Deadlock or crash in stress test for case where trigger starts trigger". In short, the deadlock/crash happened when execution of statement, which used stored functions or activated triggers, coincided with alteration of the tables used by these functions or triggers (in highly concurrent environment). Bug was caused by the incorrect handling of tables from prelocked set in open_tables() functions in situations when refresh happened. This fix replaces old smart but not very robust way of handling tables after refresh (which was closing only old tables), with new one which simply closes all tables opened so far and restarts open_tables(). Also fixed handling of temporary tables in close_tables_for_reopen(). No test case present since bug manifests itself only in concurrent environment. sql/mysql_priv.h: In order to handle correctly case when table list completely consists from tables from prelocked set close_tables_for_reopen() have to accept table list as in/out parameter. sql/sql_base.cc: open_tables(): Removed part of comment which was out of date. Changed handling of case when refresh happens during opening of tables, now instead of having code which decides for each table if it should be closed we simply close all tables. Old code also incorrectly handled tables from prelocked set in this situation which resulted in bug #16593 "Deadlock or crash in stress test for case where triggers starting trigger". close_tables_for_reopen(): Now we correctly handle the case when table list completely consists from tables from prelocked set. Also now we simply close all tables instead leaving temporary tables non-closed (such approach allows easily handle correctly tables from prelocked set). sql/sql_prepare.cc: In order to handle correctly case when table list completely consists from tables from prelocked set close_tables_for_reopen() have to accept table list as in/out parameter. sql/sql_update.cc: In order to handle correctly case when table list completely consists from tables from prelocked set close_tables_for_reopen() have to accept table list as in/out parameter. --- sql/mysql_priv.h | 2 +- sql/sql_base.cc | 84 +++++++++++++++------------------------------- sql/sql_prepare.cc | 2 +- sql/sql_update.cc | 4 +-- 4 files changed, 31 insertions(+), 61 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index ca2cda0f7c6..6908f2b9049 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -981,7 +981,7 @@ void free_io_cache(TABLE *entry); void intern_close_table(TABLE *entry); bool close_thread_table(THD *thd, TABLE **table_ptr); void close_temporary_tables(THD *thd); -void close_tables_for_reopen(THD *thd, TABLE_LIST *tables); +void close_tables_for_reopen(THD *thd, TABLE_LIST **tables); TABLE_LIST *find_table_in_list(TABLE_LIST *table, uint offset_to_list, const char *db_name, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9d1720cc527..37d4c80a0d0 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1982,22 +1982,11 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) statement for which table list for prelocking is already built, let us cache routines and try to build such table list. - NOTE: We can't delay prelocking until we will met some sub-statement - which really uses tables, since this will imply that we have to restore - its table list to be able execute it in some other context. - And current views implementation assumes that view tables are added to - global table list only once during PS preparing/first SP execution. - Also locking at earlier stage is probably faster altough may decrease - concurrency a bit. - NOTE: We will mark statement as requiring prelocking only if we will have non empty table list. But this does not guarantee that in prelocked mode we will have some locked tables, because queries which use only derived/information schema tables and views possible. Thus "counter" may be still zero for prelocked statement... - - NOTE: The above notes may be out of date. Please wait for psergey to - document new prelocked behavior. */ if (!thd->prelocked_mode && !thd->lex->requires_prelocking() && @@ -2083,48 +2072,23 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) if (refresh) // Refresh in progress { - /* close all 'old' tables used by this thread */ - pthread_mutex_lock(&LOCK_open); - // if query_id is not reset, we will get an error - // re-opening a temp table - thd->version=refresh_version; - TABLE **prev_table= &thd->open_tables; - bool found=0; - for (TABLE_LIST *tmp= *start; tmp; tmp= tmp->next_global) - { - /* Close normal (not temporary) changed tables */ - if (tmp->table && ! tmp->table->s->tmp_table) - { - if (tmp->table->s->version != refresh_version || - ! tmp->table->db_stat) - { - VOID(hash_delete(&open_cache,(byte*) tmp->table)); - tmp->table=0; - found=1; - } - else - { - *prev_table= tmp->table; // Relink open list - prev_table= &tmp->table->next; - } - } - } - *prev_table=0; - pthread_mutex_unlock(&LOCK_open); - if (found) - VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh /* - Let us prepare for recalculation of set of prelocked tables. - First we pretend that we have finished calculation which we - were doing currently. Then we restore list of tables to be - opened and set of used routines to the state in which they were - before first open_tables() call for this statement (i.e. before - we have calculated current set of tables for prelocking). + We have met name-locked or old version of table. Now we have + to close all tables which are not up to date. We also have to + throw away set of prelocked tables (and thus close tables from + this set that were open by now) since it possible that one of + tables which determined its content was changed. + + Instead of implementing complex/non-robust logic mentioned + above we simply close and then reopen all tables. + + In order to prepare for recalculation of set of prelocked tables + we pretend that we have finished calculation which we were doing + currently. */ if (query_tables_last_own) thd->lex->mark_as_requiring_prelocking(query_tables_last_own); - thd->lex->chop_off_not_own_tables(); - sp_remove_not_own_routines(thd->lex); + close_tables_for_reopen(thd, start); goto restart; } result= -1; // Fatal error @@ -2335,7 +2299,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables) break; if (!need_reopen) DBUG_RETURN(-1); - close_tables_for_reopen(thd, tables); + close_tables_for_reopen(thd, &tables); } DBUG_RETURN(0); } @@ -2372,7 +2336,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables) break; if (!need_reopen) DBUG_RETURN(-1); - close_tables_for_reopen(thd, tables); + close_tables_for_reopen(thd, &tables); } if (mysql_handle_derived(thd->lex, &mysql_derived_prepare) || (thd->fill_derived_tables() && @@ -2600,18 +2564,24 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) SYNOPSIS close_tables_for_reopen() - thd Thread context - tables List of tables which we were trying to open and lock + thd in Thread context + tables in/out List of tables which we were trying to open and lock */ -void close_tables_for_reopen(THD *thd, TABLE_LIST *tables) +void close_tables_for_reopen(THD *thd, TABLE_LIST **tables) { + /* + If table list consists only from tables from prelocking set, table list + for new attempt should be empty, so we have to update list's root pointer. + */ + if (thd->lex->first_not_own_table() == *tables) + *tables= 0; thd->lex->chop_off_not_own_tables(); sp_remove_not_own_routines(thd->lex); - for (TABLE_LIST *tmp= tables; tmp; tmp= tmp->next_global) - if (tmp->table && !tmp->table->s->tmp_table) - tmp->table= 0; + for (TABLE_LIST *tmp= *tables; tmp; tmp= tmp->next_global) + tmp->table= 0; + mark_used_tables_as_free_for_reuse(thd, thd->temporary_tables); close_thread_tables(thd); } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 68f033f78fe..b0c4cef6e87 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1135,7 +1135,7 @@ static int mysql_test_update(Prepared_statement *stmt, break; if (!need_reopen) goto error; - close_tables_for_reopen(thd, table_list); + close_tables_for_reopen(thd, &table_list); } /* diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 2ff8a4bc244..324623a61ca 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -158,7 +158,7 @@ int mysql_update(THD *thd, break; if (!need_reopen) DBUG_RETURN(1); - close_tables_for_reopen(thd, table_list); + close_tables_for_reopen(thd, &table_list); } if (mysql_handle_derived(thd->lex, &mysql_derived_prepare) || @@ -813,7 +813,7 @@ reopen_tables: for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global) tbl->cleanup_items(); - close_tables_for_reopen(thd, table_list); + close_tables_for_reopen(thd, &table_list); goto reopen_tables; } From c86dcfd9e34fed19d1d4f72e131c0c0e882c71bb Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Feb 2006 09:44:12 +0100 Subject: [PATCH 09/26] Invalidate table including all it's indexes from binlog thread --- sql/ha_ndbcluster.cc | 12 ++++++++---- sql/ha_ndbcluster.h | 6 +++++- sql/ha_ndbcluster_binlog.cc | 20 +++++++++++++------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index cd37e830952..790877b4838 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -519,6 +519,7 @@ void ha_ndbcluster::invalidate_dictionary_cache(bool global) { NDBINDEX *index = (NDBINDEX *) m_index[i].index; NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index; + if (!index && !unique_index) continue; NDB_INDEX_TYPE idx_type= m_index[i].type; switch (idx_type) { @@ -1076,7 +1077,7 @@ int ha_ndbcluster::get_metadata(const char *path) m_table= (void *)tab; m_table_info= NULL; // Set in external lock - DBUG_RETURN(open_indexes(ndb, table)); + DBUG_RETURN(open_indexes(ndb, table, FALSE)); } static int fix_unique_index_attr_order(NDB_INDEX_DATA &data, @@ -1249,7 +1250,7 @@ int ha_ndbcluster::add_index_handle(THD *thd, NDBDICT *dict, KEY *key_info, /* Associate index handles for each index of a table */ -int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab) +int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error) { uint i; int error= 0; @@ -1263,7 +1264,10 @@ int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab) for (i= 0; i < tab->s->keys; i++, key_info++, key_name++) { if ((error= add_index_handle(thd, dict, key_info, *key_name, i))) - break; + if (ignore_error) + m_index[i].index= m_index[i].unique_index= NULL; + else + break; } DBUG_RETURN(error); @@ -3739,7 +3743,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) { m_table= (void *)tab; m_table_version = tab->getObjectVersion(); - if (!(my_errno= open_indexes(ndb, table))) + if (!(my_errno= open_indexes(ndb, table, FALSE))) DBUG_RETURN(my_errno); } m_table_info= tab_info; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 1eb8ac1ea70..5a65dcc0531 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -691,6 +691,10 @@ static void set_tabname(const char *pathname, char *tabname); private: friend int ndbcluster_drop_database_impl(const char *path); + friend int ndb_handle_schema_change(THD *thd, + Ndb *ndb, NdbEventOperation *pOp, + NDB_SHARE *share); + int alter_table_name(const char *to); static int delete_table(ha_ndbcluster *h, Ndb *ndb, const char *path, @@ -708,7 +712,7 @@ private: int create_indexes(Ndb *ndb, TABLE *tab); void clear_index(int i); void clear_indexes(); - int open_indexes(Ndb *ndb, TABLE *tab); + int open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error); void renumber_indexes(Ndb *ndb, TABLE *tab); int drop_indexes(Ndb *ndb, TABLE *tab); int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict, diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 06f946b013c..ceebb45928b 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1285,7 +1285,7 @@ end: /* Handle _non_ data events from the storage nodes */ -static int +int ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, NDB_SHARE *share) { @@ -1294,12 +1294,18 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, if (pOp->getEventType() != NDBEVENT::TE_CLUSTER_FAILURE && pOp->getReqNodeId() != g_ndb_cluster_connection->node_id()) { - ndb->setDatabaseName(share->table->s->db.str); - ha_ndbcluster::invalidate_dictionary_cache(share->table->s, - ndb, - share->table->s->db.str, - share->table->s->table_name.str, - TRUE); + TABLE_SHARE *table_share= share->table->s; + TABLE* table= share->table; + + /* + Invalidate table and all it's indexes + */ + ha_ndbcluster table_handler(table_share); + table_handler.set_dbname(share->key); + table_handler.set_tabname(share->key); + table_handler.open_indexes(ndb, table, TRUE); + table_handler.invalidate_dictionary_cache(TRUE); + remote_drop_table= 1; } From 452923b63bcfd277410a233a0568d88148d543a2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Feb 2006 20:29:46 +0100 Subject: [PATCH 10/26] Test updates to use with a default engine of ndb mysql-test/t/rpl_row_sp010.test: Updated mysql-test/t/rpl_row_drop.test: Updated mysql-test/r/rpl_row_drop.result: Updated mysql-test/r/rpl_row_sp010.result: Updated --- mysql-test/r/rpl_row_drop.result | 6 ------ mysql-test/r/rpl_row_sp010.result | 6 +++--- mysql-test/t/rpl_row_drop.test | 4 ++-- mysql-test/t/rpl_row_sp010.test | 6 +++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/rpl_row_drop.result b/mysql-test/r/rpl_row_drop.result index 4ef21884fda..a5abc2837e3 100644 --- a/mysql-test/r/rpl_row_drop.result +++ b/mysql-test/r/rpl_row_drop.result @@ -41,12 +41,6 @@ t1 t2 **** On Master **** DROP TABLE t1,t2; -SHOW BINLOG EVENTS; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a int) -master-bin.000001 188 Query 1 274 use `test`; CREATE TABLE t2 (a int) -master-bin.000001 274 Query 1 378 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/r/rpl_row_sp010.result b/mysql-test/r/rpl_row_sp010.result index ba97f83b86a..02567465428 100644 --- a/mysql-test/r/rpl_row_sp010.result +++ b/mysql-test/r/rpl_row_sp010.result @@ -22,7 +22,7 @@ INSERT INTO test.t1 VALUES(1); CALL test.p1(); END| CALL test.p2(); -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY a; a 1 2 @@ -40,11 +40,11 @@ INSERT INTO test.t2 VALUES(6); CALL test.p3(); END| CALL test.p4(); -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a 6 7 -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a 6 7 diff --git a/mysql-test/t/rpl_row_drop.test b/mysql-test/t/rpl_row_drop.test index 816bd108b88..dd6ef331508 100644 --- a/mysql-test/t/rpl_row_drop.test +++ b/mysql-test/t/rpl_row_drop.test @@ -31,8 +31,8 @@ connection master; # Should drop the non-temporary table t1 and the temporary table t2 DROP TABLE t1,t2; let $VERSION=`select version()`; ---replace_result $VERSION VERSION -SHOW BINLOG EVENTS; +#--replace_result $VERSION VERSION +#SHOW BINLOG EVENTS; SHOW TABLES; sync_slave_with_master; --echo **** On Slave **** diff --git a/mysql-test/t/rpl_row_sp010.test b/mysql-test/t/rpl_row_sp010.test index 10940e1e030..28b82217517 100644 --- a/mysql-test/t/rpl_row_sp010.test +++ b/mysql-test/t/rpl_row_sp010.test @@ -37,7 +37,7 @@ BEGIN END| delimiter ;| CALL test.p2(); -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY a; save_master_pos; connection slave; @@ -59,12 +59,12 @@ BEGIN END| delimiter ;| CALL test.p4(); -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; # Cleanup connection master; From be3df0dbaffb407031d1688e19c45f3a6c58e8d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Feb 2006 20:34:47 +0100 Subject: [PATCH 11/26] Updated mysql-test/t/disabled.def: Cleaned up and try to keep in order --- mysql-test/t/disabled.def | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index b9f1e36349c..aa3d5a00f4b 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -28,11 +28,13 @@ rpl_bit_npk : Bug#13418 rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ndb_auto_inc : Bug#17086 rpl_ndb_basic : Bug#16228 [IN REVIEW] +rpl_ndb_blob : Bug #17505 +rpl_ndb_blob2 : Bug #17505 rpl_ndb_charset : Bug#17246 rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296 -#rpl_ndb_log : result not deterministic +rpl_ndb_log : result not deterministic rpl_ndb_relay_space : Bug#16993 rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_sp007 : Bug #17290 @@ -43,6 +45,3 @@ rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future subselect : Bug#15706 (ps mode) [PATCH PENDING] -rpl_ndb_blob : Bug #17505 -rpl_ndb_blob2 : Bug #17505 -rpl_ndb_log : results are not deterministic From 517250a6d3ec40079a3c26211a78f8f24dccf71e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Feb 2006 18:24:28 +0100 Subject: [PATCH 12/26] configure.in (in the new clone): This is a re-clone after tagging, so the version must be set back to 5.1.7-beta. configure.in: This is a re-clone after tagging, so the version must be set back to 5.1.7-beta. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 2f287ac2fce..2d914d8f90c 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.1.8-beta) +AM_INIT_AUTOMAKE(mysql, 5.1.7-beta) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From 71ffac7e60fad22364e62588408c4456227f33d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Feb 2006 15:39:43 -0500 Subject: [PATCH 13/26] Fix the changelog entry header, format was wrong --- support-files/mysql.spec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 2697236949b..7bea933654a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -709,7 +709,7 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog -* Mon Feb 20 03:04:32 CET 2006 +* Mon Feb 20 2006 Kent Boortz - Reintroduced a max build - Limited testing of 'debug' and 'max' servers From a71fb6407f0e767251df0b81de8561f25ea2263f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 10:07:54 +0100 Subject: [PATCH 14/26] Fix test cases to work with non-standard --vardir. Rename mix_innodb_myisam_binlog-master.opt; when the test was moved to separate stm/row test cases, the .opt were not moved along with it, causing a 60-second test duration because of default lock timeout :-( mysql-test/t/binlog_row_mix_innodb_myisam-master.opt: bk cp mysql-test/t/mix_innodb_myisam_binlog-master.opt mysql-test/t/binlog_row_mix_innodb_myisam-master.opt mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt: Rename: mysql-test/t/mix_innodb_myisam_binlog-master.opt -> mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt mysql-test/r/mysqlbinlog_base64.result: Fix test cases to work with non-standard --vardir. mysql-test/r/ndb_load.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_LD_INFILE.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_loaddata2.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_loaddata_m.result: Fix test cases to work with non-standard --vardir. mysql-test/t/loaddata.test: Fix test cases to work with non-standard --vardir. mysql-test/t/mysqlbinlog_base64.test: Fix test cases to work with non-standard --vardir. mysql-test/t/ndb_dd_dump.test: Fix test cases to work with non-standard --vardir. mysql-test/t/ndb_load.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_LD_INFILE.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_loaddata2.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_loaddata_m.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_loadfile.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_001.test: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_load_table_from_master.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_loadfile.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_ndb_row_001.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_row_001.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_row_loaddata_m.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_row_stop_middle_update.result: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_drop_db.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_load_table_from_master.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_stop_middle_update.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_UUID.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_blob.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_charset.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_func003.test: Fix test cases to work with non-standard --vardir. mysql-test/extra/rpl_tests/rpl_row_sp006.test: Fix test cases to work with non-standard --vardir. mysql-test/include/ndb_backup.inc: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_ndb_bank.result: Fix test cases to work with non-standard --vardir. mysql-test/r/rpl_ndb_sync.result: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_ndb_bank.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_ndb_sync.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_NOW.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_func002.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_sp001.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_sp011.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_trig001.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_row_trig003.test: Fix test cases to work with non-standard --vardir. mysql-test/t/rpl_sp004.test: Fix test cases to work with non-standard --vardir. mysql-test/t/show_check.test: Fix test cases to work with non-standard --vardir. mysql-test/include/partition_1.inc: Fix test cases to work with non-standard --vardir. mysql-test/include/partition_layout.inc: Fix test cases to work with non-standard --vardir. mysql-test/r/ndb_dd_backuprestore.result: Fix test cases to work with non-standard --vardir. --- mysql-test/extra/rpl_tests/rpl_row_001.test | 2 +- mysql-test/extra/rpl_tests/rpl_row_UUID.test | 6 +++--- mysql-test/extra/rpl_tests/rpl_row_blob.test | 6 +++--- mysql-test/extra/rpl_tests/rpl_row_charset.test | 4 ++-- mysql-test/extra/rpl_tests/rpl_row_func003.test | 8 ++++---- mysql-test/extra/rpl_tests/rpl_row_sp006.test | 8 ++++---- mysql-test/include/ndb_backup.inc | 4 ++-- mysql-test/include/partition_1.inc | 2 +- mysql-test/include/partition_layout.inc | 2 +- mysql-test/r/mysqlbinlog_base64.result | 2 +- mysql-test/r/ndb_dd_backuprestore.result | 6 +++--- mysql-test/r/ndb_load.result | 4 ++-- mysql-test/r/rpl_LD_INFILE.result | 4 ++-- mysql-test/r/rpl_load_table_from_master.result | 4 ++-- mysql-test/r/rpl_loaddata2.result | 2 +- mysql-test/r/rpl_loaddata_m.result | 4 ++-- mysql-test/r/rpl_loadfile.result | 4 ++-- mysql-test/r/rpl_ndb_bank.result | 2 +- mysql-test/r/rpl_ndb_row_001.result | 2 +- mysql-test/r/rpl_ndb_sync.result | 2 +- mysql-test/r/rpl_row_001.result | 2 +- mysql-test/r/rpl_row_loaddata_m.result | 2 +- mysql-test/r/rpl_row_stop_middle_update.result | 2 +- ...r.opt => binlog_row_mix_innodb_myisam-master.opt} | 0 mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt | 1 + mysql-test/t/loaddata.test | 2 +- mysql-test/t/mysqlbinlog_base64.test | 8 ++++---- mysql-test/t/ndb_dd_dump.test | 4 ++-- mysql-test/t/ndb_load.test | 4 ++-- mysql-test/t/rpl_LD_INFILE.test | 4 ++-- mysql-test/t/rpl_drop_db.test | 2 +- mysql-test/t/rpl_load_table_from_master.test | 4 ++-- mysql-test/t/rpl_loaddata2.test | 2 +- mysql-test/t/rpl_loaddata_m.test | 4 ++-- mysql-test/t/rpl_loadfile.test | 4 ++-- mysql-test/t/rpl_ndb_bank.test | 10 +++++----- mysql-test/t/rpl_ndb_sync.test | 4 ++-- mysql-test/t/rpl_row_NOW.test | 12 ++++++------ mysql-test/t/rpl_row_func002.test | 6 +++--- mysql-test/t/rpl_row_sp001.test | 12 ++++++------ mysql-test/t/rpl_row_sp011.test | 12 ++++++------ mysql-test/t/rpl_row_stop_middle_update.test | 2 +- mysql-test/t/rpl_row_trig001.test | 8 ++++---- mysql-test/t/rpl_row_trig003.test | 6 +++--- mysql-test/t/rpl_sp004.test | 6 +++--- mysql-test/t/show_check.test | 2 +- 46 files changed, 102 insertions(+), 101 deletions(-) rename mysql-test/t/{mix_innodb_myisam_binlog-master.opt => binlog_row_mix_innodb_myisam-master.opt} (100%) create mode 100644 mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test index 44638bdac96..9bdfae81093 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_001.test +++ b/mysql-test/extra/rpl_tests/rpl_row_001.test @@ -2,7 +2,7 @@ -- source include/have_binlog_format_row.inc CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test index 2f203eb8963..d1d6178773b 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_UUID.test +++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test @@ -56,8 +56,8 @@ SHOW CREATE TABLE test.t1; # then LOAD DATA INFILE in slave, and use a query to compare. # This would have the advantage that it would not assume # the system has a 'diff' ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql connection master; # Let's cleanup @@ -72,7 +72,7 @@ DROP TABLE test.t2; # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) ---exec diff ./var/tmp/rpl_row_UUID_master.sql ./var/tmp/rpl_row_UUID_slave.sql; +--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql; # Cleanup dump files. # Long-term "system rm" is not portable; we could live without diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index 7f41118387f..14449e0a018 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -176,10 +176,10 @@ connection master; --echo # Post test clean up section ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql ---exec diff ./var/tmp/rpl_row_blob_master.sql ./var/tmp/rpl_row_blob_slave.sql +--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test index c2a7cda4333..d0fea6f9580 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test @@ -162,8 +162,8 @@ select hex(c1), hex(c2) from t1; connection master; # Let's have a look at generated SETs. ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 +--replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var +#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 drop table t1; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-test/extra/rpl_tests/rpl_row_func003.test index f07c8a65265..153a03da2e7 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_func003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test @@ -77,8 +77,8 @@ SET AUTOCOMMIT=1; # time to dump the databases and so we can see if they match ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql # First lets cleanupi DROP FUNCTION test.f1; @@ -88,9 +88,9 @@ DROP TABLE test.t1; # the test will show that the diff statement failed and no reject file # will be created. You will need to go to the mysql-test dir and diff # the files yourself to see what is not matching :-) File are located -# in mysql-test/var/tmp +# in $MYSQLTEST_VARDIR/tmp -exec diff ./var/tmp/func003_master.sql ./var/tmp/func003_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql; # End of 5.0 test case diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp006.test b/mysql-test/extra/rpl_tests/rpl_row_sp006.test index 272a7caf9ac..f40b3cbb078 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp006.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test @@ -68,8 +68,8 @@ sync_slave_with_master; connection master; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql DROP PROCEDURE IF EXISTS mysqltest1.p1; @@ -81,9 +81,9 @@ DROP TABLE IF EXISTS mysqltest1.t2; # the test will show that the diff statement failed and not reject file # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) Failed test -# Dump files will be located in mysql-test/var/tmp. +# Dump files will be located in $MYSQLTEST_VARDIR/tmp. -exec diff ./var/tmp/sp006_master.sql ./var/tmp/sp006_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql; sync_slave_with_master; diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index 2163b479ed6..f0a883d4e11 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -6,13 +6,13 @@ # there is no neat way to find the backupid, this is a hack to find it... ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; --replace_column 1 diff --git a/mysql-test/include/partition_1.inc b/mysql-test/include/partition_1.inc index 9b829494a73..b0094db2efe 100644 --- a/mysql-test/include/partition_1.inc +++ b/mysql-test/include/partition_1.inc @@ -36,7 +36,7 @@ let $fixed_bug16370= 0; ##### Option, for displaying files ##### # -# Attention: Displaying the directory content via "ls var/master-data/test/t*" +# Attention: Displaying the directory content via "ls $MYSQLTEST_VARDIR/master-data/test/t*" # is probably not portable. # let $ls= 0; disables the execution of "ls ....." let $ls= 0; diff --git a/mysql-test/include/partition_layout.inc b/mysql-test/include/partition_layout.inc index 0a59c23fafd..95f6cac37d7 100644 --- a/mysql-test/include/partition_layout.inc +++ b/mysql-test/include/partition_layout.inc @@ -9,5 +9,5 @@ eval SHOW CREATE TABLE t1; # listing of files belonging to the table t1 if ($ls) { - --exec ls var/master-data/test/t1* + --exec ls $MYSQLTEST_VARDIR/master-data/test/t1* } diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result index 499587cb465..c31dbee56c6 100644 --- a/mysql-test/r/mysqlbinlog_base64.result +++ b/mysql-test/r/mysqlbinlog_base64.result @@ -5,7 +5,7 @@ insert into t1 values (3); update t1 set a=a+2 where a=2; update t1 set a=a+2 where a=3; create table t2 (word varchar(20)); -load data infile '../../std_data/words.dat' into table t2; +load data infile '../std_data_ln/words.dat' into table t2; drop table t1; drop table t2; select * from t1; diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result index 9508ff0c594..0410589e93a 100644 --- a/mysql-test/r/ndb_dd_backuprestore.result +++ b/mysql-test/r/ndb_dd_backuprestore.result @@ -29,7 +29,7 @@ pk1 c2 c3 hex(c4) 5 Sweden 496 1 CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -97,7 +97,7 @@ LENGTH(data) 16384 CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -310,7 +310,7 @@ pk1 c2 c3 hex(c4) 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/ndb_load.result b/mysql-test/r/ndb_load.result index 76da5b2a215..416a350066b 100644 --- a/mysql-test/r/ndb_load.result +++ b/mysql-test/r/ndb_load.result @@ -1,10 +1,10 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; ERROR 23000: Can't write; duplicate key in table 't1' DROP TABLE t1; CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; word Aarhus diff --git a/mysql-test/r/rpl_LD_INFILE.result b/mysql-test/r/rpl_LD_INFILE.result index b092dd9e088..70013f95d85 100644 --- a/mysql-test/r/rpl_LD_INFILE.result +++ b/mysql-test/r/rpl_LD_INFILE.result @@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; DELETE FROM test.t1 WHERE a = 'abashed'; DELETE FROM test.t1; -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; SELECT * FROM test.t1 ORDER BY a DESC; a aberration diff --git a/mysql-test/r/rpl_load_table_from_master.result b/mysql-test/r/rpl_load_table_from_master.result index 9d9a1d7d6cb..c24f857d829 100644 --- a/mysql-test/r/rpl_load_table_from_master.result +++ b/mysql-test/r/rpl_load_table_from_master.result @@ -29,9 +29,9 @@ drop table t1; drop table t1; set SQL_LOG_BIN=0; create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t1; +load data infile '../std_data_ln/words.dat' into table t1; create table t2 (word char(20) not null)ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t2; +load data infile '../std_data_ln/words.dat' into table t2; create table t3 (word char(20) not null primary key)ENGINE=MyISAM; load table t1 from master; load table t2 from master; diff --git a/mysql-test/r/rpl_loaddata2.result b/mysql-test/r/rpl_loaddata2.result index 5e3923616ed..196093211b6 100644 --- a/mysql-test/r/rpl_loaddata2.result +++ b/mysql-test/r/rpl_loaddata2.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; word Aarhus diff --git a/mysql-test/r/rpl_loaddata_m.result b/mysql-test/r/rpl_loaddata_m.result index 54348df9aaa..8b3de87f910 100644 --- a/mysql-test/r/rpl_loaddata_m.result +++ b/mysql-test/r/rpl_loaddata_m.result @@ -7,14 +7,14 @@ start slave; drop database if exists mysqltest; USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1; SELECT COUNT(*) FROM test.t1; COUNT(*) 2 CREATE DATABASE mysqltest; USE mysqltest; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; +LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1; COUNT(*) 2 diff --git a/mysql-test/r/rpl_loadfile.result b/mysql-test/r/rpl_loadfile.result index 7a5a7bc50c9..7487693a9f7 100644 --- a/mysql-test/r/rpl_loadfile.result +++ b/mysql-test/r/rpl_loadfile.result @@ -8,11 +8,11 @@ DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES(1,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; +UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1; create procedure test.p1() begin INSERT INTO test.t1 VALUES(2,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; +UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2; end| CALL test.p1(); SELECT * FROM test.t1 ORDER BY blob_column; diff --git a/mysql-test/r/rpl_ndb_bank.result b/mysql-test/r/rpl_ndb_bank.result index 2d2d54c9170..9baefc9e6b1 100644 --- a/mysql-test/r/rpl_ndb_bank.result +++ b/mysql-test/r/rpl_ndb_bank.result @@ -49,7 +49,7 @@ CREATE DATABASE BANK; RESET MASTER; CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM cluster_replication.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/rpl_ndb_row_001.result b/mysql-test/r/rpl_ndb_row_001.result index 20e98dab00d..56bb31e329d 100644 --- a/mysql-test/r/rpl_ndb_row_001.result +++ b/mysql-test/r/rpl_ndb_row_001.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; word diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result index 5f465dc427c..352d10f3cc2 100644 --- a/mysql-test/r/rpl_ndb_sync.result +++ b/mysql-test/r/rpl_ndb_sync.result @@ -27,7 +27,7 @@ hex(c2) hex(c3) c1 0 0 DEFGHIJKL CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP; DELETE FROM cluster_replication.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/rpl_row_001.result b/mysql-test/r/rpl_row_001.result index b07a99644fc..fad60af664f 100644 --- a/mysql-test/r/rpl_row_001.result +++ b/mysql-test/r/rpl_row_001.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; word diff --git a/mysql-test/r/rpl_row_loaddata_m.result b/mysql-test/r/rpl_row_loaddata_m.result index 198e55c71d0..149efddaf8d 100644 --- a/mysql-test/r/rpl_row_loaddata_m.result +++ b/mysql-test/r/rpl_row_loaddata_m.result @@ -9,7 +9,7 @@ stop slave; create database mysqltest; use mysqltest; create table t1(a int, b int, unique(b)); -load data infile '../../std_data/rpl_loaddata.dat' into table t1; +load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # # diff --git a/mysql-test/r/rpl_row_stop_middle_update.result b/mysql-test/r/rpl_row_stop_middle_update.result index 584a3af4543..0fd4ff86893 100644 --- a/mysql-test/r/rpl_row_stop_middle_update.result +++ b/mysql-test/r/rpl_row_stop_middle_update.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1 (words varchar(20)) engine=myisam; -load data infile '../../std_data/words.dat' into table t1 (words); +load data infile '../std_data_ln/words.dat' into table t1 (words); select count(*) from t1; count(*) 70 diff --git a/mysql-test/t/mix_innodb_myisam_binlog-master.opt b/mysql-test/t/binlog_row_mix_innodb_myisam-master.opt similarity index 100% rename from mysql-test/t/mix_innodb_myisam_binlog-master.opt rename to mysql-test/t/binlog_row_mix_innodb_myisam-master.opt diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt b/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt new file mode 100644 index 00000000000..cb48f1aaf60 --- /dev/null +++ b/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt @@ -0,0 +1 @@ +--loose-innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 34d2e7dbd54..fcd127e3e98 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -135,6 +135,6 @@ select @@character_set_filesystem; LOAD DATA INFILE 't@002d1' INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; ---exec rm $MYSQL_TEST_DIR/var/master-data/test/t@002d1 +--exec rm $MYSQLTEST_VARDIR/master-data/test/t@002d1 SET character_set_filesystem=default; select @@character_set_filesystem; diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test index 3aab767f9fa..66aaff83254 100644 --- a/mysql-test/t/mysqlbinlog_base64.test +++ b/mysql-test/t/mysqlbinlog_base64.test @@ -10,19 +10,19 @@ update t1 set a=a+2 where a=2; update t1 set a=a+2 where a=3; create table t2 (word varchar(20)); -load data infile '../../std_data/words.dat' into table t2; +load data infile '../std_data_ln/words.dat' into table t2; # # Save binlog # ---exec $MYSQL_BINLOG --hexdump $MYSQL_TEST_DIR/var/log/master-bin.000001 > $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql +--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql # # Clear database and restore from binlog # drop table t1; drop table t2; ---exec $MYSQL test < $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql # # Verify that all binlog events have been executed @@ -33,6 +33,6 @@ select * from t2; # # Test cleanup # ---exec rm $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql +--exec rm $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql drop table t1; drop table t2; diff --git a/mysql-test/t/ndb_dd_dump.test b/mysql-test/t/ndb_dd_dump.test index e44822e83c4..13d4fd86396 100644 --- a/mysql-test/t/ndb_dd_dump.test +++ b/mysql-test/t/ndb_dd_dump.test @@ -177,7 +177,7 @@ INSERT INTO t2 VALUES INSERT INTO t3 VALUES (1,1,1); ---exec $MYSQL_DUMP --skip-comments --compact -Y test > var/tmp/ndb_dd_dump.sql +--exec $MYSQL_DUMP --skip-comments --compact -Y test > $MYSQLTEST_VARDIR/tmp/ndb_dd_dump.sql DROP TABLE t1; DROP TABLE t2; @@ -206,7 +206,7 @@ DROP TABLESPACE ts3 ENGINE = NDB; DROP LOGFILE GROUP lg1 ENGINE = NDB; DROP LOGFILE GROUP lg2 ENGINE = NDB; ---exec $MYSQL test < var/tmp/ndb_dd_dump.sql +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ndb_dd_dump.sql SELECT DISTINCT LOGFILE_GROUP_NAME, diff --git a/mysql-test/t/ndb_load.test b/mysql-test/t/ndb_load.test index 72a5b53eaad..af2df70b74e 100644 --- a/mysql-test/t/ndb_load.test +++ b/mysql-test/t/ndb_load.test @@ -12,12 +12,12 @@ DROP TABLE IF EXISTS t1; # should give duplicate key CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; --error 1022 -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; DROP TABLE t1; # now without a primary key we should be ok CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; DROP TABLE t1; diff --git a/mysql-test/t/rpl_LD_INFILE.test b/mysql-test/t/rpl_LD_INFILE.test index ae647ed6648..bace5d4c1f5 100644 --- a/mysql-test/t/rpl_LD_INFILE.test +++ b/mysql-test/t/rpl_LD_INFILE.test @@ -16,10 +16,10 @@ DROP TABLE IF EXISTS test.t1; # Section 1 test CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; DELETE FROM test.t1 WHERE a = 'abashed'; DELETE FROM test.t1; -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; SELECT * FROM test.t1 ORDER BY a DESC; diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test index df17ec88aaa..38ad07f72f1 100644 --- a/mysql-test/t/rpl_drop_db.test +++ b/mysql-test/t/rpl_drop_db.test @@ -46,7 +46,7 @@ show tables; use test; select * from t1; -system rm var/master-data/mysqltest1/f1.txt; +system rm $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt; connection master; DROP DATABASE mysqltest1; sync_slave_with_master; diff --git a/mysql-test/t/rpl_load_table_from_master.test b/mysql-test/t/rpl_load_table_from_master.test index aad113878d3..b9cec3858a9 100644 --- a/mysql-test/t/rpl_load_table_from_master.test +++ b/mysql-test/t/rpl_load_table_from_master.test @@ -71,9 +71,9 @@ sync_with_master; connection master; set SQL_LOG_BIN=0; create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t1; +load data infile '../std_data_ln/words.dat' into table t1; create table t2 (word char(20) not null)ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t2; +load data infile '../std_data_ln/words.dat' into table t2; create table t3 (word char(20) not null primary key)ENGINE=MyISAM; connection slave; load table t1 from master; diff --git a/mysql-test/t/rpl_loaddata2.test b/mysql-test/t/rpl_loaddata2.test index 439c2b48ca5..9e908cac677 100644 --- a/mysql-test/t/rpl_loaddata2.test +++ b/mysql-test/t/rpl_loaddata2.test @@ -1,7 +1,7 @@ --source include/master-slave.inc CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; sync_slave_with_master; diff --git a/mysql-test/t/rpl_loaddata_m.test b/mysql-test/t/rpl_loaddata_m.test index 42c3ad99f33..537d4c163ef 100644 --- a/mysql-test/t/rpl_loaddata_m.test +++ b/mysql-test/t/rpl_loaddata_m.test @@ -17,14 +17,14 @@ connection master; # 'test' database should be ignored by the slave USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1; SELECT COUNT(*) FROM test.t1; # 'mysqltest' database should NOT be ignored by the slave CREATE DATABASE mysqltest; USE mysqltest; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; +LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1; # Now lets check the slave to see what we have :-) diff --git a/mysql-test/t/rpl_loadfile.test b/mysql-test/t/rpl_loadfile.test index 598e89586b2..a671bab15bb 100644 --- a/mysql-test/t/rpl_loadfile.test +++ b/mysql-test/t/rpl_loadfile.test @@ -24,12 +24,12 @@ DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES(1,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; +UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1; delimiter |; create procedure test.p1() begin INSERT INTO test.t1 VALUES(2,'test'); - UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; + UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2; end| delimiter ;| diff --git a/mysql-test/t/rpl_ndb_bank.test b/mysql-test/t/rpl_ndb_bank.test index 817f40f2fa3..9918f3b6b04 100644 --- a/mysql-test/t/rpl_ndb_bank.test +++ b/mysql-test/t/rpl_ndb_bank.test @@ -117,10 +117,10 @@ RESET MASTER; --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT # there is no neat way to find the backupid, this is a hack to find it... ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM cluster_replication.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; --replace_column 1 SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; let the_backup_id=`select @the_backup_id`; @@ -191,17 +191,17 @@ while ($1) # 1. dump database BANK on both master and slave # 2. compare, there should be no difference # ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > ./var/tmp/master_BANK.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/master_BANK.sql --connection master use test; create table t1 (a int primary key) engine=ndb; insert into t1 values (1); --sync_slave_with_master ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > ./var/tmp/slave_BANK.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/slave_BANK.sql --connection master drop table t1; ---exec diff ./var/tmp/master_BANK.sql ./var/tmp/slave_BANK.sql +--exec diff $MYSQLTEST_VARDIR/tmp/master_BANK.sql $MYSQLTEST_VARDIR/tmp/slave_BANK.sql --dec $2 } diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test index 5c990cd4842..6f8de0abb71 100644 --- a/mysql-test/t/rpl_ndb_sync.test +++ b/mysql-test/t/rpl_ndb_sync.test @@ -26,10 +26,10 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; # take a backup on master --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP; DELETE FROM cluster_replication.backup_info; -LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; --replace_column 1 SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; let the_backup_id=`select @the_backup_id` ; diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test index dba6fb16bb2..24a8774284a 100644 --- a/mysql-test/t/rpl_row_NOW.test +++ b/mysql-test/t/rpl_row_NOW.test @@ -50,8 +50,8 @@ sync_slave_with_master; connection master; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/NOW_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/NOW_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql # lets cleanup DROP TABLE IF EXISTS mysqltest1.t1; @@ -61,13 +61,13 @@ DROP FUNCTION mysqltest1.f1; # the test will show that the diff statement failed and not reject file # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) The failed dump -# files will be located in mysql-test/var/tmp +# files will be located in $MYSQLTEST_VARDIR/tmp -exec diff ./var/tmp/NOW_master.sql ./var/tmp/NOW_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; # If all is good, when can cleanup our dump files. -system rm ./var/tmp/NOW_master.sql; -system rm ./var/tmp/NOW_slave.sql; +system rm $MYSQLTEST_VARDIR/tmp/NOW_master.sql; +system rm $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; sync_slave_with_master; # End of 5.1 test case diff --git a/mysql-test/t/rpl_row_func002.test b/mysql-test/t/rpl_row_func002.test index 966124ce035..46767abd529 100644 --- a/mysql-test/t/rpl_row_func002.test +++ b/mysql-test/t/rpl_row_func002.test @@ -84,8 +84,8 @@ connection master; # time to dump the databases and so we can see if they match ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_slave.sql # Cleanup DROP FUNCTION test.f1; @@ -97,7 +97,7 @@ sync_slave_with_master; # the files your self to see what is not matching :-). The files are located # in mysql-test/var/tmp -exec diff ./var/tmp/func002_master.sql ./var/tmp/func002_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func002_slave.sql; # End of 5.0 test case diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test index 88384b242b0..8e01cbc4f44 100644 --- a/mysql-test/t/rpl_row_sp001.test +++ b/mysql-test/t/rpl_row_sp001.test @@ -119,8 +119,8 @@ SELECT * FROM t2 ORDER BY a; # time to dump the databases and so we can see if they match ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp001_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp001_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql # First lets cleanup @@ -135,12 +135,12 @@ sync_slave_with_master; # the test will show that the diff statement failed and not reject file # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) Failed dump files -# will be located in mysql-test/var/tmp +# will be located in $MYSQLTEST_VARDIR/tmp ---exec diff ./var/tmp/sp001_master.sql ./var/tmp/sp001_slave.sql; +--exec diff $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; # If all is good, when can cleanup our dump files. -system rm ./var/tmp/sp001_master.sql; -system rm ./var/tmp/sp001_slave.sql; +system rm $MYSQLTEST_VARDIR/tmp/sp001_master.sql; +system rm $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; # End of 5.0 test case diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test index 73d2f628dbd..54e708492d1 100644 --- a/mysql-test/t/rpl_row_sp011.test +++ b/mysql-test/t/rpl_row_sp011.test @@ -79,8 +79,8 @@ CALL test.p1(); sync_slave_with_master; #SELECT * FROM test.t2; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql # Cleanup connection master; @@ -100,12 +100,12 @@ sync_slave_with_master; # the test will show that the diff statement failed and not reject file # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) Failed test -# Will leave dump files in mysql-test/var/tmp +# Will leave dump files in $MYSQLTEST_VARDIR/tmp -exec diff ./var/tmp/sp011_master.sql ./var/tmp/sp011_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; # If all is good, when can cleanup our dump files. -system rm ./var/tmp/sp011_master.sql; -system rm ./var/tmp/sp011_slave.sql; +system rm $MYSQLTEST_VARDIR/tmp/sp011_master.sql; +system rm $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; # End of 5.0 test case diff --git a/mysql-test/t/rpl_row_stop_middle_update.test b/mysql-test/t/rpl_row_stop_middle_update.test index 82c4b1a9936..29b3008e822 100644 --- a/mysql-test/t/rpl_row_stop_middle_update.test +++ b/mysql-test/t/rpl_row_stop_middle_update.test @@ -9,7 +9,7 @@ connection master; create table t1 (words varchar(20)) engine=myisam; -load data infile '../../std_data/words.dat' into table t1 (words); +load data infile '../std_data_ln/words.dat' into table t1 (words); select count(*) from t1; save_master_pos; diff --git a/mysql-test/t/rpl_row_trig001.test b/mysql-test/t/rpl_row_trig001.test index b7866069a51..931cab95948 100644 --- a/mysql-test/t/rpl_row_trig001.test +++ b/mysql-test/t/rpl_row_trig001.test @@ -75,8 +75,8 @@ let $message=; # time to dump the databases and so we can see if they match ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql # Cleanup connection master; @@ -93,8 +93,8 @@ sync_slave_with_master; # the test will show that the diff statement failed and not reject file # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching :-) Failed tests -# will leave dump files in mysql-test/var/tmp +# will leave dump files in $MYSQLTEST_VARDIR/tmp -exec diff ./var/tmp/trig001_master.sql ./var/tmp/trig001_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql; # End of 5.0 test case diff --git a/mysql-test/t/rpl_row_trig003.test b/mysql-test/t/rpl_row_trig003.test index 799c2d6c9c7..d4570afd094 100644 --- a/mysql-test/t/rpl_row_trig003.test +++ b/mysql-test/t/rpl_row_trig003.test @@ -125,8 +125,8 @@ connection master; # time to dump the databases and so we can see if they match ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trg003_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trg003_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql # cleanup --disable_warnings @@ -147,6 +147,6 @@ DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; --enable_warnings -exec diff ./var/tmp/trg003_master.sql ./var/tmp/trg003_slave.sql; +exec diff $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql; # End of 5.0 test case diff --git a/mysql-test/t/rpl_sp004.test b/mysql-test/t/rpl_sp004.test index 9156e6f4047..335a17c7af0 100644 --- a/mysql-test/t/rpl_sp004.test +++ b/mysql-test/t/rpl_sp004.test @@ -76,8 +76,8 @@ SELECT * FROM test.t1; SELECT * FROM test.t2; #SELECT * FROM test.t3; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql # Cleanup connection master; @@ -91,7 +91,7 @@ sync_slave_with_master; # If the test fails, you will need to diff the dumps to see why. --- exec diff ./var/tmp/sp004_master.sql ./var/tmp/sp004_slave.sql +-- exec diff $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql # End of 5.0 test case diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 9cfe85d3bd4..a7b24a5e06c 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -393,7 +393,7 @@ SHOW TABLE STATUS like 't1'; --error 1033 show create table t1; drop table if exists t1; -system rm -f var/master-data/test/t1.frm ; +system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm ; # End of 4.1 tests From 85e54a08c4fc468ab89f8df27bc981027cb22e6c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 13:44:04 +0300 Subject: [PATCH 15/26] Fix for BUG#7787: Stored procedures: improper warning for "grant execute" statement. The problem was that error flag was not reset. mysql-test/r/sp-security.result: Results for test case for BUG#7787. mysql-test/t/sp-security.test: A test case for BUG#7787. sql/sp.cc: Reset errors after sp_find_routine(). --- mysql-test/r/sp-security.result | 9 +++++++++ mysql-test/t/sp-security.test | 22 ++++++++++++++++++++++ sql/sp.cc | 11 +++++++---- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index ff729e87f97..d8abc387677 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -314,3 +314,12 @@ select * from db_bug14533.t1; ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' drop user user_bug14533@localhost; drop database db_bug14533; +CREATE DATABASE db_bug7787; +use db_bug7787; +CREATE PROCEDURE p1() +SHOW INNODB STATUS; +Warnings: +Warning 1287 'SHOW INNODB STATUS' is deprecated; use 'SHOW ENGINE INNODB STATUS' instead +GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; +DROP DATABASE db_bug7787; +use test; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 90160780618..19f94a32d9c 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -525,4 +525,26 @@ disconnect user_bug14533; drop user user_bug14533@localhost; drop database db_bug14533; + +# +# BUG#7787: Stored procedures: improper warning for "grant execute" statement +# + +# Prepare. + +CREATE DATABASE db_bug7787; +use db_bug7787; + +# Test. + +CREATE PROCEDURE p1() + SHOW INNODB STATUS; + +GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; + +# Cleanup. + +DROP DATABASE db_bug7787; +use test; + # End of 5.0 bugs. diff --git a/sql/sp.cc b/sql/sp.cc index fe249141fea..ce0282bf810 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1012,6 +1012,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error) { TABLE_LIST *routine; bool result= 0; + bool sp_object_found; DBUG_ENTER("sp_exists_routine"); for (routine= routines; routine; routine= routine->next_global) { @@ -1024,10 +1025,12 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error) lex_name.str= thd->strmake(routine->table_name, lex_name.length); name= new sp_name(lex_db, lex_name); name->init_qname(thd); - if (sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name, - &thd->sp_proc_cache, FALSE) != NULL || - sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, - &thd->sp_func_cache, FALSE) != NULL) + sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name, + &thd->sp_proc_cache, FALSE) != NULL || + sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, + &thd->sp_func_cache, FALSE) != NULL; + mysql_reset_errors(thd, TRUE); + if (sp_object_found) { if (any) DBUG_RETURN(1); From 23070875a5642bb24a0e6ed2b1c5ed1e757e8cb3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 12:15:43 +0100 Subject: [PATCH 16/26] Manual fix of the version number when merging the cloned tree. configure.in: Merge of the cloned tree (for its tag and other fix/es) inclueded the reset of the version number, this must again be undone in the general tree: 5.1.8-beta is the current version! --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 2d914d8f90c..2f287ac2fce 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.1.7-beta) +AM_INIT_AUTOMAKE(mysql, 5.1.8-beta) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From 0caf2a466746b7e0bc66487122aaa9e1afc08106 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 15:19:22 +0100 Subject: [PATCH 17/26] Fixes for push version of discover of on-line altered table --- sql/ha_ndbcluster_binlog.cc | 20 +++++++++++++------- storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp | 6 ++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index fb0f35acdb5..2099e09385f 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1320,11 +1320,16 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, Invalidate table and all it's indexes */ ndb->setDatabaseName(share->table->s->db.str); + Thd_ndb *thd_ndb= get_thd_ndb(thd); + DBUG_ASSERT(thd_ndb != NULL); + Ndb* old_ndb= thd_ndb->ndb; + thd_ndb->ndb= ndb; ha_ndbcluster table_handler(table_share); table_handler.set_dbname(share->key); table_handler.set_tabname(share->key); table_handler.open_indexes(ndb, table, TRUE); table_handler.invalidate_dictionary_cache(TRUE); + thd_ndb->ndb= old_ndb; if (online_alter_table) { @@ -1349,7 +1354,10 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, DBUG_DUMP("frm", (char*)altered_table->getFrmData(), altered_table->getFrmLength()); pthread_mutex_lock(&LOCK_open); - dict->putTable(altered_table); + const NDBTAB *old= dict->getTable(tabname); + if (!old && + old->getObjectVersion() != altered_table->getObjectVersion()) + dict->putTable(altered_table); if ((error= unpackfrm(&data, &length, altered_table->getFrmData())) || (error= writefrm(key, data, length))) @@ -1359,12 +1367,12 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, } pthread_mutex_unlock(&LOCK_open); close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); - /* + pthread_mutex_lock(&LOCK_open); if ((error= ndbcluster_binlog_open_table(thd, share, table_share, table))) sql_print_information("NDB: Failed to re-open table %s.%s", dbname, tabname); - */ + pthread_mutex_unlock(&LOCK_open); } } remote_drop_table= 1; @@ -2172,7 +2180,6 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, op= ndb->createEventOperation(event_name); // reset to catch errors ndb->setDatabaseName(""); - ndb->setDatabaseSchemaName(""); } if (!op) { @@ -2745,8 +2752,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) goto err; } - // empty database and schema - if (!(ndb= new Ndb(g_ndb_cluster_connection, "", "")) || + // empty database + if (!(ndb= new Ndb(g_ndb_cluster_connection, "")) || ndb->init()) { sql_print_error("NDB Binlog: Getting Ndb object failed"); @@ -3010,7 +3017,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ndb_binlog_thread_handle_non_data_event(ndb, pOp, row); // reset to catch errors ndb->setDatabaseName(""); - ndb->setDatabaseSchemaName(""); } pOp= ndb->nextEvent(); diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 497b8af0e8e..e4d41a48e66 100644 --- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1310,8 +1310,10 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl) m_globalHash->lock(); if ((old= m_globalHash->get(impl->m_internalName.c_str()))) { - old->m_status = NdbDictionary::Object::Invalid; - m_globalHash->drop(old); + m_globalHash->alter_table_rep(old->m_internalName.c_str(), + impl->m_id, + impl->m_version, + FALSE); } m_globalHash->put(impl->m_internalName.c_str(), impl); m_globalHash->unlock(); From ee1dc206b5019f564e740c5b455fe03c01af14b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 16:05:57 +0100 Subject: [PATCH 18/26] Removed unnecessary unlock/lock of mutex --- sql/ha_ndbcluster_binlog.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 2099e09385f..6429639d003 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1365,9 +1365,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, sql_print_information("NDB: Failed write frm for %s.%s, error %d", dbname, tabname, error); } - pthread_mutex_unlock(&LOCK_open); - close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); - pthread_mutex_lock(&LOCK_open); + close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, TRUE); if ((error= ndbcluster_binlog_open_table(thd, share, table_share, table))) sql_print_information("NDB: Failed to re-open table %s.%s", From 671d3e1ed560a05f3d1ed9306b321641da129286 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 20:03:25 +0300 Subject: [PATCH 19/26] Post-merge fixes. sql/ha_ndbcluster_binlog.cc: A post-merge fix. sql/log_event.cc: A post-merge fix. --- sql/ha_ndbcluster_binlog.cc | 3 ++- sql/log_event.cc | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 28756c54c7f..a7e9cc4cb74 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1641,7 +1641,8 @@ int ndb_add_binlog_index(THD *thd, void *_row) { if (need_reopen) { - close_tables_for_reopen(thd, &binlog_tables); + TABLE_LIST *p_binlog_tables= &binlog_tables; + close_tables_for_reopen(thd, &p_binlog_tables); binlog_index= 0; continue; } diff --git a/sql/log_event.cc b/sql/log_event.cc index cd16745df90..5b95b87bcd2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5281,6 +5281,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) tested replicate-* rules). */ TABLE_LIST table_list; + TABLE_LIST *tables= &table_list; bool need_reopen; uint count= 1; bzero(&table_list, sizeof(table_list)); @@ -5330,13 +5331,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) */ thd->binlog_flush_pending_rows_event(false); - close_tables_for_reopen(thd, &table_list); + close_tables_for_reopen(thd, &tables); /* open the table again, same as in Table_map_event::exec_event */ table_list.db= const_cast(db); table_list.alias= table_list.table_name= const_cast(table_name); table_list.updating= 1; - TABLE_LIST *tables= &table_list; if ((error= open_tables(thd, &tables, &count, 0)) == 0) { /* reset some variables for the table list*/ From 3150f7ccab05d8df8014614b1dfa6403c2411dc6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 20:34:25 +0100 Subject: [PATCH 20/26] Makefile.am: Change for 'make distcheck' libmysqld.vcproj: Typo VC++Files/libmysqld/libmysqld.vcproj: Typo mysql-test/ndb/Makefile.am: Change for 'make distcheck' storage/archive/Makefile.am: Change for 'make distcheck' plugin/fulltext/Makefile.am: Change for 'make distcheck' storage/csv/Makefile.am: Change for 'make distcheck' storage/heap/Makefile.am: Change for 'make distcheck' --- VC++Files/libmysqld/libmysqld.vcproj | 2 +- mysql-test/ndb/Makefile.am | 2 ++ plugin/fulltext/Makefile.am | 2 +- storage/archive/Makefile.am | 7 ++++--- storage/csv/Makefile.am | 3 ++- storage/heap/Makefile.am | 7 ++++--- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj index 8130a2c95f3..2ca2401826d 100644 --- a/VC++Files/libmysqld/libmysqld.vcproj +++ b/VC++Files/libmysqld/libmysqld.vcproj @@ -157,7 +157,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib" - PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__"/> + PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am index 1ef02bec1f0..2a1c59fd359 100644 --- a/mysql-test/ndb/Makefile.am +++ b/mysql-test/ndb/Makefile.am @@ -1,4 +1,6 @@ +BUILT_SOURCES = ndbcluster + benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test/ndb diff --git a/plugin/fulltext/Makefile.am b/plugin/fulltext/Makefile.am index 0a3186829da..e5a70a23beb 100644 --- a/plugin/fulltext/Makefile.am +++ b/plugin/fulltext/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES= -I$(top_builddir)/include +INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include noinst_LTLIBRARIES= mypluglib.la mypluglib_la_SOURCES= plugin_example.c mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir) diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index fabeca81eda..c2ae9d6b728 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -17,9 +17,10 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ @ZLIB_INCLUDES@ -LDADD = libarchive.a $(top_srcdir)/mysys/libmysys.a \ - $(top_srcdir)/dbug/libdbug.a \ - $(top_srcdir)/strings/libmystrings.a \ +LDADD = libarchive.a \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/strings/libmystrings.a \ @ZLIB_LIBS@ pkglib_LIBRARIES = libarchive.a noinst_PROGRAMS = archive_test diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 509cef954ff..5573df720a3 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -20,7 +20,8 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include \ +INCLUDES = -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql \ -I$(srcdir) diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am index 2890dc6ee23..79e0379f9a4 100644 --- a/storage/heap/Makefile.am +++ b/storage/heap/Makefile.am @@ -15,9 +15,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -LDADD = libheap.a $(top_srcdir)/mysys/libmysys.a \ - $(top_srcdir)/dbug/libdbug.a \ - $(top_srcdir)/strings/libmystrings.a +LDADD = libheap.a \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/strings/libmystrings.a pkglib_LIBRARIES = libheap.a noinst_PROGRAMS = hp_test1 hp_test2 hp_test1_LDFLAGS = @NOINST_LDFLAGS@ From ef5d68f33927d5e4bbb4bac29797601e9c9b6f20 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 14:17:11 -0600 Subject: [PATCH 21/26] BUG# 17393: Partitions: Wrong error message when assigning too many subpartitions We changed the error message to more clearly reflect the fact that we are counting parts and subparts mysql-test/r/partition_mgm_err.result: updated error message sql/share/errmsg.txt: updated error message --- mysql-test/r/partition_mgm_err.result | 2 +- sql/share/errmsg.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result index 7d4af16580c..1b73bfb9f16 100644 --- a/mysql-test/r/partition_mgm_err.result +++ b/mysql-test/r/partition_mgm_err.result @@ -91,7 +91,7 @@ PARTITION BY KEY (a) ALTER TABLE t1 ADD PARTITION PARTITIONS 0; ERROR HY000: At least one partition must be added ALTER TABLE t1 ADD PARTITION PARTITIONS 1024; -ERROR HY000: Too many partitions were defined +ERROR HY000: Too many partitions (including subpartitions) were defined ALTER TABLE t1 DROP PARTITION x0; ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions ALTER TABLE t1 COALESCE PARTITION 1; diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 35ff2e4222b..35a67f85909 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5660,8 +5660,8 @@ ER_PARTITION_NOT_DEFINED_ERROR eng "For the partitioned engine it is necessary to define all %-.64s" swe "För partitioneringsmotorn så är det nödvändigt att definiera alla %-.64s" ER_TOO_MANY_PARTITIONS_ERROR - eng "Too many partitions were defined" - swe "För många partitioner definierades" + eng "Too many partitions (including subpartitions) were defined" + swe "För många partitioner (inkluderande subpartitioner) definierades" ER_SUBPARTITION_ERROR eng "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning" swe "Det är endast möjligt att blanda RANGE/LIST partitionering med HASH/KEY partitionering för subpartitionering" From 89d572549dc8332097c5777c947cdb63dc88b99b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 22:03:55 +0100 Subject: [PATCH 22/26] New test for wl2321 mysql-test/t/rpl_row_mysqlbinlog.test: New mysqlbinlog test for row based binlogs per lars request for WL#2321 mysql-test/t/rpl_row_mysqlbinlog-master.opt: New mysqlbinlog test for row based binlogs per lars request for WL#2321 mysql-test/r/rpl_row_mysqlbinlog.result: New mysqlbinlog result WL#2321 --- mysql-test/r/rpl_row_mysqlbinlog.result | 250 +++++++++++++++++ mysql-test/t/rpl_row_mysqlbinlog-master.opt | 1 + mysql-test/t/rpl_row_mysqlbinlog.test | 287 ++++++++++++++++++++ 3 files changed, 538 insertions(+) create mode 100644 mysql-test/r/rpl_row_mysqlbinlog.result create mode 100644 mysql-test/t/rpl_row_mysqlbinlog-master.opt create mode 100644 mysql-test/t/rpl_row_mysqlbinlog.test diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result new file mode 100644 index 00000000000..6faacf119be --- /dev/null +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -0,0 +1,250 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set timestamp=1000000000; +DROP TABLE IF EXISTS t1,t2,t3; +CREATE TABLE t1(word VARCHAR(20)); +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +SELECT COUNT(*) from t1; +COUNT(*) +351 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +SELECT COUNT(*) from t1; +COUNT(*) +351 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +insert into t1 values ("Alas"); +flush logs; + +--- Dump -- +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +stop slave; +reset master; +reset slave; +start slave; +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 + +--- --position -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Remote -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +ROLLBACK; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +DROP TABLE IF EXISTS t1,t2,t3; +SET TIMESTAMP=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +SET TIMESTAMP=1000000000; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +SET TIMESTAMP=1000000000; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- LOAD DATA -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- reading stdin -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +ROLLBACK; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +DROP TABLE IF EXISTS t1,t2,t3; +SET TIMESTAMP=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +SET TIMESTAMP=1000000000; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +SET TIMESTAMP=1000000000; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +use test; +SET TIMESTAMP=1000000000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; +/*!\C latin1 */; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +stop slave; +reset master; +reset slave; +start slave; +create table t4 (f text character set utf8); +create table t5 (f text character set cp932); +flush logs; +rename table t4 to t04, t5 to t05; +select HEX(f) from t04; +HEX(f) +E382BD +select HEX(f) from t4; +HEX(f) +E382BD +select HEX(f) from t05; +HEX(f) +835C +select HEX(f) from t5; +HEX(f) +835C +select HEX(f) from t04; +HEX(f) +E382BD +select HEX(f) from t4; +HEX(f) +E382BD +select HEX(f) from t05; +HEX(f) +835C +select HEX(f) from t5; +HEX(f) +835C +DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; diff --git a/mysql-test/t/rpl_row_mysqlbinlog-master.opt b/mysql-test/t/rpl_row_mysqlbinlog-master.opt new file mode 100644 index 00000000000..07d12817f5f --- /dev/null +++ b/mysql-test/t/rpl_row_mysqlbinlog-master.opt @@ -0,0 +1 @@ +--max-binlog-size=1040384 diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test new file mode 100644 index 00000000000..1d4ce1706de --- /dev/null +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -0,0 +1,287 @@ +################################################################## +# Author: JBM # +# Date: 2006-02-22 # +# Purpose: To test changes to mysqlbinlog for row based bin logs # +# We are using .opt file since we need small binlog size # +################################################################## +# Include Section +# Make sure that we have row based bin log +-- source include/have_binlog_format_row.inc +# Embedded server doesn't support binlogging +-- source include/not_embedded.inc +-- source include/master-slave.inc + +# Setup Section +# we need this for getting fixed timestamps inside of this test +set timestamp=1000000000; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2,t3; +--enable_warnings + +connection master; +CREATE TABLE t1(word VARCHAR(20)); +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); + + +# Test Section +# Lets start by putting some data into the tables. + +--disable_query_log +INSERT INTO t1 VALUES ("abirvalg"); +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; + +# d1 length 3000 +set @d1 = 'dd1'; +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); + +let $count=500; +while ($count) +{ + INSERT INTO t2 VALUES (NULL); + eval INSERT INTO t3 VALUES ($count,@d1,'20060222000000','Tested in Texas',$count*2.2); + dec $count; +} +--enable_query_log + +# Lets Check the tables on the Master +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +sync_slave_with_master; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Okay time to get busy, back to master + +connection master; + +# simple query to show more in second binlog +insert into t1 values ("Alas"); +flush logs; + +# delimiters are for easier debugging in future +--disable_query_log +select "--- Dump --" as ""; +--enable_query_log + +# +# Prepare local temporary file to recreate what we have currently. + +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql + +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql + +# Now that we have our file, lets get rid of the current database. +# Cleanup the master and the slave and try to recreate. + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +sync_slave_with_master; +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) +--disable_warnings +stop slave; +--enable_warnings +--require r/slave-stopped.result +show status like 'Slave_running'; +connection master; +reset master; +connection slave; +reset slave; +start slave; +--require r/slave-running.result +show status like 'Slave_running'; +connection master; + +# We should be clean at this point, now we will run in the file from above. + +--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql" + +# Lets Check the tables on the Master +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +sync_slave_with_master; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +connection master; + +# We should be gold by the time, so I will get rid of our file. + +--exec rm $MYSQLTEST_VARDIR/tmp/master.sql + + +# this test for position option +# By setting this position to 412, we should only get the create of t3 +--disable_query_log +select "--- --position --" as ""; +--enable_query_log +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001 + +# These are tests for remote binlog. +# They should return the same as previous test. + +--disable_query_log +select "--- Remote --" as ""; +--enable_query_log + +# This is broken now +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 + +# This part is disabled due to bug #17654 +################### Start Bug 17654 ###################### +#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql + +#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql + +# Now that we have our file, lets get rid of the current database. +# Cleanup the master and the slave and try to recreate. + +#DROP TABLE t1; +#DROP TABLE t2; +#DROP TABLE t3; + +#sync_slave_with_master; + +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) + +#--disable_warnings +#stop slave; +#--enable_warnings +#--require r/slave-stopped.result +#show status like 'Slave_running'; +#connection master; +#reset master; +#connection slave; +#reset slave; +#start slave; +#--require r/slave-running.result +#show status like 'Slave_running'; +#connection master; + +# We should be clean at this point, now we will run in the file from above. + +#--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql" + +# Lets Check the tables on the Master + +#SELECT COUNT(*) from t1; +#SELECT COUNT(*) from t2; +#SELECT COUNT(*) from t3; +#SELECT * FROM t1 ORDER BY word LIMIT 5; +#SELECT * FROM t2 ORDER BY id LIMIT 5; +#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; + +# Should have the same on the slave; + +#sync_slave_with_master; +#SELECT COUNT(*) from t1; +#SELECT COUNT(*) from t2; +#SELECT COUNT(*) from t3; +#SELECT * FROM t1 ORDER BY word LIMIT 5; +#SELECT * FROM t2 ORDER BY id LIMIT 5; +#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +#connection master; + +# We should be gold by the time, so I will get rid of our file. + +#--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql +################### End Bug 17654 ###################### + +# LOAD DATA +--disable_query_log +select "--- LOAD DATA --" as ""; +--enable_query_log +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 + +# Bug#7853 (mysqlbinlog does not accept input from stdin) + +--disable_query_log +select "--- reading stdin --" as ""; +--enable_query_log +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001 + +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001 + +# Bug#16217 (mysql client did not know how not switch its internal charset) +sync_slave_with_master; + +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) + +--disable_warnings +stop slave; +--enable_warnings +--require r/slave-stopped.result +show status like 'Slave_running'; +connection master; +reset master; +connection slave; +reset slave; +start slave; +--require r/slave-running.result +show status like 'Slave_running'; +connection master; + +create table t4 (f text character set utf8); +create table t5 (f text character set cp932); +--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')" +--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');" +flush logs; +rename table t4 to t04, t5 to t05; +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8 +# original and recovered data must be equal +select HEX(f) from t04; +select HEX(f) from t4; +select HEX(f) from t05; +select HEX(f) from t5; + +# slave should have same +sync_slave_with_master; +select HEX(f) from t04; +select HEX(f) from t4; +select HEX(f) from t05; +select HEX(f) from t5; + +# clean up +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; +sync_slave_with_master; + +# End of 4.1 tests From 871335f587d7eefb052e9b08b851098f9ca5e9ed Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 22:04:46 +0100 Subject: [PATCH 23/26] ndb - ndb_restore.test: fix backup id in result mysql-test/r/ndb_restore.result: fix backup id using jeb's ndb_backup.inc mysql-test/t/ndb_restore.test: fix backup id using jeb's ndb_backup.inc --- mysql-test/r/ndb_restore.result | 16 +++++++++++++++- mysql-test/t/ndb_restore.test | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result index 85c4e34cc5a..bdd721d9a16 100644 --- a/mysql-test/r/ndb_restore.result +++ b/mysql-test/r/ndb_restore.result @@ -125,6 +125,13 @@ create table t6 engine=myisam as select * from t6_c; create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +DELETE FROM test.backup_info; +LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +SELECT @the_backup_id:=backup_id FROM test.backup_info; +@the_backup_id:=backup_id + +DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; count(*) @@ -241,6 +248,13 @@ PARTITION BY LINEAR HASH (`relatta`) PARTITIONS 4; ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +DELETE FROM test.backup_info; +LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +SELECT @the_backup_id:=backup_id FROM test.backup_info; +@the_backup_id:=backup_id + +DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; count(*) @@ -445,4 +459,4 @@ drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; Create table test/def/t2_c failed: Translate frm error drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; -520093696,2 +520093696, diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test index f340b62adae..dc28a9f5408 100644 --- a/mysql-test/t/ndb_restore.test +++ b/mysql-test/t/ndb_restore.test @@ -143,10 +143,10 @@ create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; ---exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT +--source include/ndb_backup.inc drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # random output order?? #show tables; @@ -230,10 +230,10 @@ PARTITIONS 4; ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); ---exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT +--source include/ndb_backup.inc drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-2 >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-2 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT select count(*) from t1; select count(*) from t1_c; @@ -290,8 +290,8 @@ select count(*) select * from t9_c) a; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-2 >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-2 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT select count(*) from t1; select count(*) from t1_c; @@ -348,7 +348,7 @@ select count(*) select * from t9_c) a; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-2 2>&1 | grep Translate || true +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 | grep Translate || true # # Cleanup @@ -363,6 +363,6 @@ drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; # Test BUG#10287 # ---exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696 +--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696, | sed "s/,$the_backup_id/,/" # End of 4.1 tests From 216bc447fb942cc5e4e4a580a91ec9496a540fe8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Feb 2006 23:11:42 +0100 Subject: [PATCH 24/26] rpl_row_mysqlbinlog.result, rpl_row_mysqlbinlog.test: Updated with echos for the results file requested by lars mysql-test/t/rpl_row_mysqlbinlog.test: Updated with echos for the results file requested by lars mysql-test/r/rpl_row_mysqlbinlog.result: Updated with echos for the results file requested by lars --- mysql-test/r/rpl_row_mysqlbinlog.result | 26 ++++++++++++--- mysql-test/t/rpl_row_mysqlbinlog.test | 42 ++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result index 6faacf119be..374f2d3ee82 100644 --- a/mysql-test/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -4,11 +4,15 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; + +---Setup Section -- set timestamp=1000000000; DROP TABLE IF EXISTS t1,t2,t3; CREATE TABLE t1(word VARCHAR(20)); CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); + +---Test1 check table load -- SELECT COUNT(*) from t1; COUNT(*) 351 @@ -72,7 +76,9 @@ c1 c3 c4 c5 insert into t1 values ("Alas"); flush logs; ---- Dump -- +--- Test 1 Dump binlog to file -- + +--- Test 1 delete tables, clean master and slave -- DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -80,6 +86,10 @@ stop slave; reset master; reset slave; start slave; + +--- Test 1 Load from Dump binlog file -- + +--- Test 1 Check Load Results -- SELECT COUNT(*) from t1; COUNT(*) 352 @@ -141,7 +151,7 @@ c1 c3 c4 c5 4 2006-02-22 00:00:00 Tested in Texas 8.8 5 2006-02-22 00:00:00 Tested in Texas 11 ---- --position -- +--- Test 2 position test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; @@ -155,7 +165,7 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- Remote -- +--- Test 3 First Remote test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; @@ -176,14 +186,14 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- LOAD DATA -- +--- Test 5 LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- reading stdin -- +--- Test 6 reading stdin -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; @@ -203,6 +213,8 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Test 7 reading stdin w/position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; @@ -215,6 +227,8 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; + +--- Test 8 switch internal charset -- stop slave; reset master; reset slave; @@ -247,4 +261,6 @@ HEX(f) select HEX(f) from t5; HEX(f) 835C + +--- Test cleanup -- DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test index 1d4ce1706de..3b4c8db86d8 100644 --- a/mysql-test/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -13,6 +13,11 @@ # Setup Section # we need this for getting fixed timestamps inside of this test + +--disable_query_log +select "---Setup Section --" as ""; +--enable_query_log + set timestamp=1000000000; --disable_warnings @@ -51,6 +56,11 @@ while ($count) } --enable_query_log + +--disable_query_log +select "---Test1 check table load --" as ""; +--enable_query_log + # Lets Check the tables on the Master SELECT COUNT(*) from t1; SELECT COUNT(*) from t2; @@ -79,7 +89,7 @@ flush logs; # delimiters are for easier debugging in future --disable_query_log -select "--- Dump --" as ""; +select "--- Test 1 Dump binlog to file --" as ""; --enable_query_log # @@ -91,6 +101,9 @@ select "--- Dump --" as ""; # Now that we have our file, lets get rid of the current database. # Cleanup the master and the slave and try to recreate. +--disable_query_log +select "--- Test 1 delete tables, clean master and slave --" as ""; +--enable_query_log DROP TABLE t1; DROP TABLE t2; @@ -114,9 +127,16 @@ show status like 'Slave_running'; connection master; # We should be clean at this point, now we will run in the file from above. +--disable_query_log +select "--- Test 1 Load from Dump binlog file --" as ""; +--enable_query_log --exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql" +--disable_query_log +select "--- Test 1 Check Load Results --" as ""; +--enable_query_log + # Lets Check the tables on the Master SELECT COUNT(*) from t1; SELECT COUNT(*) from t2; @@ -144,7 +164,7 @@ connection master; # this test for position option # By setting this position to 412, we should only get the create of t3 --disable_query_log -select "--- --position --" as ""; +select "--- Test 2 position test --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001 @@ -153,7 +173,7 @@ select "--- --position --" as ""; # They should return the same as previous test. --disable_query_log -select "--- Remote --" as ""; +select "--- Test 3 First Remote test --" as ""; --enable_query_log # This is broken now @@ -162,6 +182,9 @@ select "--- Remote --" as ""; # This part is disabled due to bug #17654 ################### Start Bug 17654 ###################### +#--disable_query_log +#select "--- Test 4 Second Remote test --" as ""; +#--enable_query_log #--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql #--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql @@ -223,7 +246,7 @@ select "--- Remote --" as ""; # LOAD DATA --disable_query_log -select "--- LOAD DATA --" as ""; +select "--- Test 5 LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 @@ -231,15 +254,21 @@ select "--- LOAD DATA --" as ""; # Bug#7853 (mysqlbinlog does not accept input from stdin) --disable_query_log -select "--- reading stdin --" as ""; +select "--- Test 6 reading stdin --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--disable_query_log +select "--- Test 7 reading stdin w/position --" as ""; +--enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) +--disable_query_log +select "--- Test 8 switch internal charset --" as ""; +--enable_query_log sync_slave_with_master; #we expect STOP SLAVE to produce a warning as the slave is stopped @@ -279,6 +308,9 @@ select HEX(f) from t4; select HEX(f) from t05; select HEX(f) from t5; +--disable_query_log +select "--- Test cleanup --" as ""; +--enable_query_log # clean up connection master; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; From 50ba49988affe5cea38bb40a66468b062ff81937 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Feb 2006 00:35:32 +0100 Subject: [PATCH 25/26] ndb - enable rpl_ndb_blob* again, disabled by accident mysql-test/t/disabled.def: enable rpl_ndb_blob* again, disabled by accident --- mysql-test/t/disabled.def | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ce05e9a3f25..5f276b8b3bf 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -24,8 +24,6 @@ rpl_bit_npk : Bug#13418 rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ndb_auto_inc : Bug#17086 rpl_ndb_basic : Bug#16228 [IN REVIEW] -rpl_ndb_blob : Bug #17505 -rpl_ndb_blob2 : Bug #17505 rpl_ndb_charset : Bug#17246 rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails From c330dc839bf2cfa45a0616b414d5054980e0e506 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Feb 2006 12:32:54 +0300 Subject: [PATCH 26/26] Fix a bad merge of mine. --- sql/share/errmsg.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index e1bea5009ff..49cfe4c4878 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5813,7 +5813,5 @@ ER_CANT_CHANGE_TX_ISOLATION 25001 ER_WARN_DEPRECATED_STATEMENT eng "The '%s' statement is deprecated and will be removed in MySQL %s. Please use client programs (e.g. %s) instead." -ER_TABLE_NEEDS_UPGRADE - eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!" ER_SP_NO_AGGREGATE 42000 eng "AGGREGATE is not supported for stored functions"