diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-03-27 02:29:31 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-03-27 02:29:31 +0400 |
commit | 67e4f431d6787cdc4f634b3a73d0b8cab0a06a90 (patch) | |
tree | 1c5e253563e466214850e1257016a6fabab0a821 /sql/ha_berkeley.cc | |
parent | e320ade2efe0d91749dc3ebb812c8c1ded799499 (diff) | |
download | mariadb-git-67e4f431d6787cdc4f634b3a73d0b8cab0a06a90.tar.gz |
fixed bug #2342
"Running ANALYZE TABLE on bdb table inside a transaction hangs server thread"
mysql-test/r/bdb-crash.result:
added test for bug #2342
"Running ANALYZE TABLE on bdb table inside a transaction hangs server thread"
mysql-test/t/bdb-crash.test:
added test for bug #2342
"Running ANALYZE TABLE on bdb table inside a transaction hangs server thread"
sql/handler.h:
added constant HA_ADMIN_REJECT
sql/sql_table.cc:
added processing of HA_ADMIN_REJECT in ha_berkley::analyze
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r-- | sql/ha_berkeley.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 70ecc61bfb8..4a1ce43cf70 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -2125,6 +2125,35 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) { DB_BTREE_STAT *stat=0; uint i; + DB_TXN_STAT *txn_stat_ptr= 0; + + if (!db_env->txn_stat(db_env, &txn_stat_ptr, 0) && + txn_stat_ptr && txn_stat_ptr->st_nactive>=2) + { + DB_TXN_ACTIVE *atxn_stmt= 0, *atxn_all= 0; + + DB_TXN *txn_all= (DB_TXN*) thd->transaction.all.bdb_tid; + u_int32_t all_id= txn_all->id(txn_all); + + DB_TXN *txn_stmt= (DB_TXN*) thd->transaction.stmt.bdb_tid; + u_int32_t stmt_id= txn_stmt->id(txn_stmt); + + DB_TXN_ACTIVE *cur= txn_stat_ptr->st_txnarray; + DB_TXN_ACTIVE *end= cur + txn_stat_ptr->st_nactive; + for (; cur!=end && (!atxn_stmt || !atxn_all); cur++) + { + if (cur->txnid==all_id) atxn_all= cur; + if (cur->txnid==stmt_id) atxn_stmt= cur; + } + + if (atxn_stmt && atxn_all && + log_compare(&atxn_stmt->lsn,&atxn_all->lsn)) + { + free(txn_stat_ptr); + return HA_ADMIN_REJECT; + } + free(txn_stat_ptr); + } for (i=0 ; i < table->keys ; i++) { |