From: Date: March 7 2005 10:21am Subject: bk commit into 4.1 tree (mskold:1.2085) BUG#8753 List-Archive: http://lists.mysql.com/internals/22713 X-Bug: 8753 Message-Id: <200503070921.j279Li8X011553@localhost.localdomain> Below is the list of changes that have just been committed into a local 4.1 repository of marty. When marty does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2085 05/03/07 10:21:38 mskold@stripped +7 -0 Fix for Bug #8753 Invalid schema object version after dropping index sql/ha_ndbcluster.h 1.48 05/03/07 10:21:08 mskold@stripped +1 -0 Fix for Bug #8753 Invalid schema object version after dropping index sql/ha_ndbcluster.cc 1.131 05/03/07 10:21:08 mskold@stripped +32 -6 Fix for Bug #8753 Invalid schema object version after dropping index mysql-test/t/ndb_alter_table.test 1.17 05/03/07 10:21:08 mskold@stripped +16 -0 Fix for Bug #8753 Invalid schema object version after dropping index mysql-test/r/ndb_alter_table.result 1.19 05/03/07 10:21:08 mskold@stripped +14 -0 Fix for Bug #8753 Invalid schema object version after dropping index mysql-test/t/ndb_multi.test 1.1 05/03/07 09:54:53 mskold@stripped +44 -0 mysql-test/r/ndb_multi.result 1.1 05/03/07 09:54:53 mskold@stripped +49 -0 mysql-test/t/ndb_multi.test 1.0 05/03/07 09:54:53 mskold@stripped +0 -0 BitKeeper file /usr/local/home/marty/MySQL/mysql-4.1/mysql-test/t/ndb_multi.test mysql-test/r/ndb_multi.result 1.0 05/03/07 09:54:53 mskold@stripped +0 -0 BitKeeper file /usr/local/home/marty/MySQL/mysql-4.1/mysql-test/r/ndb_multi.result mysql-test/include/have_multi_ndb.inc 1.1 05/03/07 09:54:52 mskold@stripped +28 -0 mysql-test/include/have_multi_ndb.inc 1.0 05/03/07 09:54:52 mskold@stripped +0 -0 BitKeeper file /usr/local/home/marty/MySQL/mysql-4.1/mysql-test/include/have_multi_ndb.inc # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: mskold # Host: blowfish.ndb.mysql.com # Root: /usr/local/home/marty/MySQL/mysql-4.1 --- 1.18/mysql-test/r/ndb_alter_table.result Mon Dec 6 14:49:47 2004 +++ 1.19/mysql-test/r/ndb_alter_table.result Mon Mar 7 10:21:08 2005 @@ -170,3 +170,17 @@ 4 5 drop table t1; +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); +select * from t1 where b = 'two'; +a b c +2 two two +alter table t1 drop index c; +select * from t1 where b = 'two'; +ERROR 42S02: Table 'test.t1' doesn't exist +select * from t1 where b = 'two'; +a b c +2 two two +drop table t1; --- 1.16/mysql-test/t/ndb_alter_table.test Mon Dec 6 14:49:47 2004 +++ 1.17/mysql-test/t/ndb_alter_table.test Mon Mar 7 10:21:08 2005 @@ -1,4 +1,5 @@ -- source include/have_ndb.inc +-- source include/have_multi_ndb.inc --disable_warnings DROP TABLE IF EXISTS t1; @@ -131,6 +132,21 @@ select c from t1 order by c; INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0); select c from t1 order by c; +drop table t1; + +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); +connection server2; +select * from t1 where b = 'two'; +connection server1; +alter table t1 drop index c; +connection server2; +--error 1146 +select * from t1 where b = 'two'; +select * from t1 where b = 'two'; +connection server1; drop table t1; #--disable_warnings --- 1.130/sql/ha_ndbcluster.cc Thu Feb 24 18:59:55 2005 +++ 1.131/sql/ha_ndbcluster.cc Mon Mar 7 10:21:08 2005 @@ -328,6 +328,36 @@ # The mapped error code */ +void ha_ndbcluster::invalidateCache() +{ + NDBDICT *dict= get_ndb()->getDictionary(); + DBUG_PRINT("info", ("invalidating %s", m_tabname)); + dict->invalidateTable(m_tabname); + table->version=0L; /* Free when thread is ready */ + /* Invalidate indexes */ + for (uint i= 0; i < table->keys; i++) + { + NDBINDEX *index = (NDBINDEX *) m_index[i].index; + NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index; + NDB_INDEX_TYPE idx_type= m_index[i].type; + + + switch(m_index[i].type) { + case(PRIMARY_KEY_ORDERED_INDEX): + case(ORDERED_INDEX): + dict->invalidateIndex(index->getName(), m_tabname); + break; + case(UNIQUE_ORDERED_INDEX): + dict->invalidateIndex(index->getName(), m_tabname); + case(UNIQUE_INDEX): + dict->invalidateIndex(unique_index->getName(), m_tabname); + break; + case(PRIMARY_KEY_INDEX): + case(UNDEFINED_INDEX): + break; + } + } +} int ha_ndbcluster::ndb_err(NdbConnection *trans) { @@ -339,11 +369,7 @@ switch (err.classification) { case NdbError::SchemaError: { - Ndb *ndb= get_ndb(); - NDBDICT *dict= ndb->getDictionary(); - DBUG_PRINT("info", ("invalidateTable %s", m_tabname)); - dict->invalidateTable(m_tabname); - table->version=0L; /* Free when thread is ready */ + invalidateCache(); break; } default: @@ -733,7 +759,7 @@ if (!invalidating_ndb_table) { DBUG_PRINT("info", ("Invalidating table")); - dict->invalidateTable(m_tabname); + invalidateCache(); invalidating_ndb_table= TRUE; } else --- 1.47/sql/ha_ndbcluster.h Wed Jan 26 11:31:38 2005 +++ 1.48/sql/ha_ndbcluster.h Mon Mar 7 10:21:08 2005 @@ -201,6 +201,7 @@ void print_results(); longlong get_auto_increment(); + void invalidateCache(); int ndb_err(NdbConnection*); bool uses_blob_value(bool all_fields); --- New file --- +++ mysql-test/include/have_multi_ndb.inc 05/03/07 09:54:52 # Setup connections to both MySQL Servers connected to the cluster connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,); # Check that server1 has NDB support connection server1; disable_query_log; --disable_warnings drop table if exists t1, t2; --enable_warnings flush tables; @r/have_ndb.require show variables like "have_ndbcluster"; # @r/server_id.require show variables like "server_id"; enable_query_log; # Check that server2 has NDB support connection server2; disable_query_log; --disable_warnings drop table if exists t1, t2; --enable_warnings flush tables; @r/have_ndb.require show variables like "have_ndbcluster"; # @r/server_id1.require show variables like "server_id"; enable_query_log; # Set the default connection to 'server1' connection server1; --- New file --- +++ mysql-test/r/ndb_multi.result 05/03/07 09:54:53 drop table if exists t1, t2, t3, t4; flush status; create table t1 (a int) engine=ndbcluster; create table t2 (a int) engine=ndbcluster; insert into t1 value (2); insert into t2 value (3); select * from t1; a 2 select * from t2; a 3 show status like 'handler_discover%'; Variable_name Value Handler_discover 0 flush status; select * from t1; a 2 update t1 set a=3 where a=2; show status like 'handler_discover%'; Variable_name Value Handler_discover 1 create table t3 (a int not null primary key, b varchar(22), c int, last_col text) engine=ndb; insert into t3 values(1, 'Hi!', 89, 'Longtext column'); create table t4 (pk int primary key, b int) engine=ndb; select * from t1; a 3 select * from t3; a b c last_col 1 Hi! 89 Longtext column show status like 'handler_discover%'; Variable_name Value Handler_discover 1 show tables like 't4'; Tables_in_test (t4) t4 show status like 'handler_discover%'; Variable_name Value Handler_discover 2 show tables; Tables_in_test t1 t2 t3 t4 drop table t1, t2, t3, t4; --- New file --- +++ mysql-test/t/ndb_multi.test 05/03/07 09:54:53 -- source include/have_ndb.inc -- source include/have_multi_ndb.inc --disable_warnings drop table if exists t1, t2, t3, t4; --enable_warnings flush status; # Create test tables on server1 create table t1 (a int) engine=ndbcluster; create table t2 (a int) engine=ndbcluster; insert into t1 value (2); insert into t2 value (3); select * from t1; select * from t2; show status like 'handler_discover%'; # Connect to server2 and use the tables from there connection server2; flush status; select * from t1; update t1 set a=3 where a=2; show status like 'handler_discover%'; # Create a new table on server2 create table t3 (a int not null primary key, b varchar(22), c int, last_col text) engine=ndb; insert into t3 values(1, 'Hi!', 89, 'Longtext column'); create table t4 (pk int primary key, b int) engine=ndb; # Check that the tables are accessible from server1 connection server1; select * from t1; select * from t3; show status like 'handler_discover%'; show tables like 't4'; show status like 'handler_discover%'; show tables; drop table t1, t2, t3, t4;