From: Pekka Nousiainen Date: December 22 2011 9:44am Subject: bzr push into mysql-5.1-telco-7.0 branch (pekka.nousiainen:4756 to 4760) Bug#13524696 WL#4124 List-Archive: http://lists.mysql.com/commits/142233 X-Bug: 13524696 Message-Id: <20111222094449.9E24357842@cuda.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4760 Pekka Nousiainen 2011-12-22 wl#4124 x44_fix.diff bug#13524696 - try to detect event to self modified: sql/ha_ndb_index_stat.cc 4759 magnus.blaudd@stripped 2011-12-20 ndb - add ndb_rpl_ddl_open_trans also to 7.0 added: mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result mysql-test/suite/ndb_rpl/t/ndb_rpl_ddl_open_trans.test 4758 jonas oreland 2011-12-20 ndb - adopt some testSystemRestart tests to slower machines modified: storage/ndb/test/ndbapi/testSystemRestart.cpp 4757 Jonas Oreland 2011-12-19 ndb - remove c_ssIdSeq as concept use position in array instead (which removes theoretical possibility of duplicate ssId's) modified: storage/ndb/src/kernel/blocks/LocalProxy.cpp storage/ndb/src/kernel/blocks/LocalProxy.hpp 4756 Pekka Nousiainen 2011-12-19 [merge] merge 7.0 into wl#4124 modified: mysql-test/suite/ndb/r/ndb_alter_table_online2.result mysql-test/suite/ndb/t/ndb_alter_table_online2.test storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp storage/ndb/src/mgmsrv/MgmtSrvr.cpp storage/ndb/test/include/NDBT_Test.hpp storage/ndb/test/include/NdbRestarts.hpp storage/ndb/test/ndbapi/testDict.cpp storage/ndb/test/ndbapi/testNodeRestart.cpp storage/ndb/test/run-test/atrt.hpp storage/ndb/test/run-test/daily-basic-tests.txt storage/ndb/test/run-test/daily-perf-tests.txt storage/ndb/test/run-test/db.cpp storage/ndb/test/run-test/main.cpp storage/ndb/test/run-test/test-tests.txt storage/ndb/test/src/NDBT_Test.cpp storage/ndb/test/src/NdbRestarts.cpp === added file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result' --- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result 2011-12-20 12:04:03 +0000 @@ -0,0 +1,53 @@ +include/master-slave.inc +[connection master] +create table t1 ( a int ) engine = ndb; +begin; +insert into t1 values(1); +alter table t1 rename t2; +commit; +drop table t2; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +create table t1 ( a int primary key) engine = ndb; +begin; +insert into t1 values(1); +alter online table t1 add column b int column_format dynamic; +commit; +drop table t1; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +create table t1 ( a int primary key) engine = ndb; +begin; +insert into t1 values(1); +alter offline table t1 add column b int column_format dynamic; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +drop table t1; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +create table t1 ( a int primary key, b int) engine = ndb; +begin; +insert into t1 values(1, 1); +create online index ind_b on t1(b); +commit; +drop table t1; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +create table t1 ( a int primary key, b int, index ind_b (b)) engine = ndb; +begin; +insert into t1 values(1, 1); +drop index ind_b on t1; +commit; +drop table t1; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +create database testdb; +create table testdb.t1 (a int) engine = ndb; +begin; +insert into testdb.t1 values(1); +alter database testdb charset = latin1; +commit; +drop database testdb; +set global ndb_check_shares=1; +set global ndb_check_shares=1; +include/rpl_end.inc === added file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_ddl_open_trans.test' --- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_ddl_open_trans.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_ddl_open_trans.test 2011-12-20 12:04:03 +0000 @@ -0,0 +1,7 @@ +--source include/have_ndb.inc +#--source include/ndb_have_online_alter.inc +--source suite/ndb_rpl/ndb_master-slave.inc + +--source suite/ndb/t/ndb_ddl_open_trans.test + +--source include/rpl_end.inc === modified file 'sql/ha_ndb_index_stat.cc' --- a/sql/ha_ndb_index_stat.cc 2011-12-18 12:21:39 +0000 +++ b/sql/ha_ndb_index_stat.cc 2011-12-22 09:36:58 +0000 @@ -89,6 +89,7 @@ struct Ndb_index_stat { char id[32]; #endif time_t access_time; /* by any table handler */ + time_t update_time; /* latest successful update by us */ time_t load_time; /* when stats were created by kernel */ time_t read_time; /* when stats were read by us (>= load_time) */ uint sample_version; /* goes with read_time */ @@ -563,7 +564,8 @@ struct Ndb_index_stat_glob { uint query_count; uint query_no_stats; uint query_error; - uint event_ok; /* Events received for known index */ + uint event_act; /* Events acted on */ + uint event_skip; /* Events skipped (likely event-to-self) */ uint event_miss; /* Events received for unknown index */ uint refresh_count; /* Successful cache refreshes */ uint clean_count; /* Times old caches (1 or more) cleaned */ @@ -576,7 +578,7 @@ struct Ndb_index_stat_glob { uint cache_high_bytes; /* Max ever of above */ uint cache_drop_bytes; /* Part of above waiting to be evicted */ uint cache_evict_bytes; /* Part of above waiting to be evicted */ - char status[2][512]; + char status[2][1024]; uint status_i; Ndb_index_stat_glob(); @@ -599,7 +601,8 @@ Ndb_index_stat_glob::Ndb_index_stat_glob query_count= 0; query_no_stats= 0; query_error= 0; - event_ok= 0; + event_act= 0; + event_skip= 0; event_miss= 0; refresh_count= 0; clean_count= 0; @@ -658,7 +661,8 @@ Ndb_index_stat_glob::set_status() sprintf(p, ",query:(all:%u,nostats:%u,error:%u)", query_count, query_no_stats, query_error); p+= strlen(p); - sprintf(p, ",event:(ok:%u,miss:%u)", event_ok, event_miss); + sprintf(p, ",event:(act:%u,skip:%u,miss:%u)", + event_act, event_skip, event_miss); p+= strlen(p); sprintf(p, ",cache:(refresh:%u,clean:%u,pinned:%u,drop:%u,evict:%u)", refresh_count, clean_count, pinned_count, drop_count, evict_count); @@ -702,7 +706,8 @@ Ndb_index_stat_glob::zero_total() query_count= 0; query_no_stats= 0; query_error= 0; - event_ok= 0; + event_act= 0; + event_skip= 0; event_miss= 0; refresh_count= 0; clean_count= 0; @@ -726,6 +731,7 @@ Ndb_index_stat::Ndb_index_stat() memset(id, 0, sizeof(id)); #endif access_time= 0; + update_time= 0; load_time= 0; read_time= 0; sample_version= 0; @@ -1331,6 +1337,7 @@ ndb_index_stat_cache_evict(Ndb_index_sta struct Ndb_index_stat_proc { NdbIndexStat* is_util; // For metadata and polling Ndb *ndb; + time_t start; // start of current processing slice time_t now; int lt; bool busy; @@ -1401,6 +1408,9 @@ ndb_index_stat_proc_update(Ndb_index_sta pr.lt= Ndb_index_stat::LT_Error; return; } + + pr.now= ndb_index_stat_time(); + st->update_time= pr.now; pr.lt= Ndb_index_stat::LT_Read; } @@ -1950,11 +1960,30 @@ ndb_index_stat_proc_event(Ndb_index_stat /* Put on Check list if idle. We get event also for our own analyze but this should not matter. + + bug#13524696 + The useless event-to-self makes an immediate second analyze wait + for loop_idle time since the entry moves to LT_Check temporarily. + Ignore the event if an update was done near this processing slice. */ pr.lt= st->lt; if (st->lt == Ndb_index_stat::LT_Idle || st->lt == Ndb_index_stat::LT_Error) - pr.lt= Ndb_index_stat::LT_Check; + { + if (st->update_time < pr.start) + { + DBUG_PRINT("index_stat", ("st %s accept event for check", st->id)); + pr.lt= Ndb_index_stat::LT_Check; + } + else + { + DBUG_PRINT("index_stat", ("st %s ignore likely event to self", st->id)); + } + } + else + { + DBUG_PRINT("index_stat", ("st %s ignore event on lt=%d", st->id, st->lt)); + } } void @@ -2002,11 +2031,15 @@ ndb_index_stat_proc_event(Ndb_index_stat */ if (st != 0) { - DBUG_PRINT("index_stat", ("st %s proc %s", st->id, "Event")); + DBUG_PRINT("index_stat", ("st %s proc %s", st->id, "event")); ndb_index_stat_proc_event(pr, st); if (pr.lt != st->lt) + { ndb_index_stat_list_move(st, pr.lt); - glob.event_ok++; + glob.event_act++; + } + else + glob.event_skip++; } else { @@ -2171,6 +2204,8 @@ ndb_index_stat_proc(Ndb_index_stat_proc Ndb_index_stat_glob old_glob= ndb_index_stat_glob; #endif + pr.start= pr.now= ndb_index_stat_time(); + ndb_index_stat_proc_new(pr); ndb_index_stat_proc_update(pr); ndb_index_stat_proc_read(pr); === modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp' --- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2011-10-07 08:07:21 +0000 +++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2011-12-19 13:58:28 +0000 @@ -27,8 +27,6 @@ LocalProxy::LocalProxy(BlockNumber block for (i = 0; i < MaxWorkers; i++) c_worker[i] = 0; - c_ssIdSeq = 0; - c_typeOfStart = NodeState::ST_ILLEGAL_TYPE; c_masterNodeId = ZNIL; === modified file 'storage/ndb/src/kernel/blocks/LocalProxy.hpp' --- a/storage/ndb/src/kernel/blocks/LocalProxy.hpp 2011-10-07 08:07:21 +0000 +++ b/storage/ndb/src/kernel/blocks/LocalProxy.hpp 2011-12-19 13:58:28 +0000 @@ -192,11 +192,17 @@ protected: template Ss& ssSeize() { - const Uint32 base = SsIdBase; - const Uint32 mask = ~base; - const Uint32 ssId = base | c_ssIdSeq; - c_ssIdSeq = (c_ssIdSeq + 1) & mask; - return ssSeize(ssId); + SsPool& sp = Ss::pool(this); + Ss* ssptr = ssSearch(0); + ndbrequire(ssptr != 0); + // Use position in array as ssId + UintPtr pos = ssptr - sp.m_pool; + Uint32 ssId = Uint32(pos) + 1; + new (ssptr) Ss; + ssptr->m_ssId = ssId; + sp.m_usage++; + D("ssSeize()" << V(sp.m_usage) << hex << V(ssId) << " " << Ss::name()); + return *ssptr; } template === modified file 'storage/ndb/test/ndbapi/testSystemRestart.cpp' --- a/storage/ndb/test/ndbapi/testSystemRestart.cpp 2011-07-04 13:37:56 +0000 +++ b/storage/ndb/test/ndbapi/testSystemRestart.cpp 2011-12-20 08:42:46 +0000 @@ -1405,6 +1405,8 @@ int runSR_DD_1(NDBT_Context* ctx, NDBT_S HugoTransactions hugoTrans(*ctx->getTab()); while(i<=loops && result != NDBT_FAILED) { + if (i > 0 && ctx->closeToTimeout(15)) + break; if (lcploop) { @@ -1508,6 +1510,8 @@ int runSR_DD_2(NDBT_Context* ctx, NDBT_S HugoTransactions hugoTrans(*ctx->getTab()); while(i<=loops && result != NDBT_FAILED) { + if (i > 0 && ctx->closeToTimeout(15)) + break; if (lcploop) { @@ -1612,6 +1616,8 @@ int runSR_DD_3(NDBT_Context* ctx, NDBT_S HugoTransactions hugoTrans(*ctx->getTab()); while(i<=loops && result != NDBT_FAILED) { + if (i > 0 && ctx->closeToTimeout(15)) + break; if (lcploop) { @@ -1853,6 +1859,9 @@ runTO(NDBT_Context* ctx, NDBT_Step* step Uint32 i = 0; while(i<=loops && result != NDBT_FAILED) { + if (i > 0 && ctx->closeToTimeout(35)) + break; + CHECK(res.dumpStateAllNodes(val, 1) == 0); int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT, 0 }; No bundle (reason: useless for push emails).