Loading mysql-test/r/ndb_autodiscover3.result 0 → 100644 +45 −0 Original line number Diff line number Diff line drop table if exists t1, t2; create table t1 (a int key) engine=ndbcluster; begin; insert into t1 values (1); insert into t1 values (2); ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster commit; ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster drop table t1; create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster; insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1); select * from t2 order by a limit 3; a b 1 1 2 1 3 1 create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; a 1 2 3 select * from t2 order by a limit 3; ERROR HY000: Can't lock file (errno: 241) select * from t2 order by a limit 3; a 1 2 3 show tables; Tables_in_test create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; a 1 2 3 select * from t2 order by a limit 3; a 1 2 3 drop table t2; mysql-test/t/ndb_autodiscover3.test 0 → 100644 +65 −0 Original line number Diff line number Diff line -- source include/have_ndb.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc --disable_warnings drop table if exists t1, t2; --enable_warnings # # Transaction ongoing while cluster is restarted # --connection server1 create table t1 (a int key) engine=ndbcluster; begin; insert into t1 values (1); --exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --error 1297 insert into t1 values (2); --error 1296 commit; drop table t1; # # Stale cache after restart -i # --connection server1 create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster; insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1); select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --connection server2 create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; # server 1 should have a stale cache, and in this case wrong frm, transaction must be retried --connection server1 --error 1015 select * from t2 order by a limit 3; select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --connection server1 show tables; create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; # server 2 should have a stale cache, but with right frm, transaction need not be retried --connection server2 select * from t2 order by a limit 3; drop table t2; # End of 4.1 tests ndb/include/ndbapi/ndb_cluster_connection.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public: unsigned no_db_nodes(); unsigned node_id(); unsigned get_connect_count() const; #endif private: Loading ndb/src/ndbapi/ClusterMgr.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): noOfAliveNodes= 0; noOfConnectedNodes= 0; theClusterMgrThread= 0; m_connect_count = 0; DBUG_VOID_RETURN; } Loading Loading @@ -469,6 +470,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ theNode.nfCompleteRep = false; if(noOfAliveNodes == 0) { theFacade.m_globalDictCache.lock(); theFacade.m_globalDictCache.invalidate_all(); theFacade.m_globalDictCache.unlock(); m_connect_count ++; NFCompleteRep rep; for(Uint32 i = 1; i<MAX_NODES; i++){ if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ Loading ndb/src/ndbapi/ClusterMgr.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public: Uint32 getNoOfConnectedNodes() const; void hb_received(NodeId); Uint32 m_connect_count; private: Uint32 noOfAliveNodes; Uint32 noOfConnectedNodes; Loading Loading
mysql-test/r/ndb_autodiscover3.result 0 → 100644 +45 −0 Original line number Diff line number Diff line drop table if exists t1, t2; create table t1 (a int key) engine=ndbcluster; begin; insert into t1 values (1); insert into t1 values (2); ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster commit; ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster drop table t1; create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster; insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1); select * from t2 order by a limit 3; a b 1 1 2 1 3 1 create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; a 1 2 3 select * from t2 order by a limit 3; ERROR HY000: Can't lock file (errno: 241) select * from t2 order by a limit 3; a 1 2 3 show tables; Tables_in_test create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; a 1 2 3 select * from t2 order by a limit 3; a 1 2 3 drop table t2;
mysql-test/t/ndb_autodiscover3.test 0 → 100644 +65 −0 Original line number Diff line number Diff line -- source include/have_ndb.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc --disable_warnings drop table if exists t1, t2; --enable_warnings # # Transaction ongoing while cluster is restarted # --connection server1 create table t1 (a int key) engine=ndbcluster; begin; insert into t1 values (1); --exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --error 1297 insert into t1 values (2); --error 1296 commit; drop table t1; # # Stale cache after restart -i # --connection server1 create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster; insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1); select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --connection server2 create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; # server 1 should have a stale cache, and in this case wrong frm, transaction must be retried --connection server1 --error 1015 select * from t2 order by a limit 3; select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --connection server1 show tables; create table t2 (a int key) engine=ndbcluster; insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); select * from t2 order by a limit 3; # server 2 should have a stale cache, but with right frm, transaction need not be retried --connection server2 select * from t2 order by a limit 3; drop table t2; # End of 4.1 tests
ndb/include/ndbapi/ndb_cluster_connection.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public: unsigned no_db_nodes(); unsigned node_id(); unsigned get_connect_count() const; #endif private: Loading
ndb/src/ndbapi/ClusterMgr.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): noOfAliveNodes= 0; noOfConnectedNodes= 0; theClusterMgrThread= 0; m_connect_count = 0; DBUG_VOID_RETURN; } Loading Loading @@ -469,6 +470,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ theNode.nfCompleteRep = false; if(noOfAliveNodes == 0) { theFacade.m_globalDictCache.lock(); theFacade.m_globalDictCache.invalidate_all(); theFacade.m_globalDictCache.unlock(); m_connect_count ++; NFCompleteRep rep; for(Uint32 i = 1; i<MAX_NODES; i++){ if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ Loading
ndb/src/ndbapi/ClusterMgr.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public: Uint32 getNoOfConnectedNodes() const; void hb_received(NodeId); Uint32 m_connect_count; private: Uint32 noOfAliveNodes; Uint32 noOfConnectedNodes; Loading