summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-01-27 22:38:56 +0100
committerunknown <serg@serg.mylan>2005-01-27 22:38:56 +0100
commit042448aa3364a65ed41ceeff10edbd170ee85a2c (patch)
tree6715c798eca742afb2f6f41acc10e122a8d50aa0 /sql/ha_berkeley.cc
parenta7401bf7cc1646f76710992cd77c54b97df8d860 (diff)
downloadmariadb-git-042448aa3364a65ed41ceeff10edbd170ee85a2c.tar.gz
query_id and my_xid -> ulonglong
fix for binlog+autocommit+tclog comments, style fixes libmysqld/libmysqld.rc: Change mode to -rw-rw-r-- libmysqld/resource.h: Change mode to -rw-rw-r-- configure.in: check for getpagesize include/my_global.h: typo ? include/my_pthread.h: bug in thread_safe_decrement_and_test() mysql-test/r/bdb.result: results updated mysql-test/r/innodb.result: results updated mysql-test/r/mix_innodb_myisam_binlog.result: results updated mysql-test/r/rpl_relayrotate.result: results updated sql/ha_berkeley.cc: style fixes sql/ha_innodb.cc: fixes to follow innodb coding style sql/handler.cc: more comments. XA COMMIT ONE PHASE fix. sql/handler.h: my_xid -> ulonglong. comments sql/item_func.cc: DO RELEASE_LOCK("...") is no cache_stmt sql/log.cc: comments, better error messages sql/log_event.cc: even in autocommit mode we may need to cache_stmt xid is ulonglong sql/log_event.h: more comments. sql/mysql_priv.h: query_id is ulonglong sql/mysqld.cc: default value for --log-tc changed sql/share/errmsg.txt: better error messages sql/sql_class.h: cleanup, comments sql/sql_delete.cc: deleting from temporary tables is not always transactional sql/sql_insert.cc: insert into temporary table is not always transactional sql/sql_load.cc: load data into temp table is not always transactional sql/sql_parse.cc: comments. bad merge fixed. xa_state_names[] sql/sql_table.cc: create/drop temp table is not always transactional sql/sql_update.cc: update temp table is not always transactional
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 160adf13e40..ed7fcce197d 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -238,15 +238,13 @@ static int berkeley_commit(THD *thd, bool all)
DBUG_ENTER("berkeley_commit");
DBUG_PRINT("trans",("ending transaction %s", all ? "all" : "stmt"));
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
- int error=txn_commit(all ? trx->all : trx->stmt,0);
+ DB_TXN **txn= all ? &trx->all : &trx->stmt;
+ int error=txn_commit(*txn,0);
+ *txn=0;
#ifndef DBUG_OFF
if (error)
DBUG_PRINT("error",("error: %d",error));
#endif
- if (all)
- trx->all=0;
- else
- trx->stmt=0;
DBUG_RETURN(error);
}
@@ -255,11 +253,9 @@ static int berkeley_rollback(THD *thd, bool all)
DBUG_ENTER("berkeley_rollback");
DBUG_PRINT("trans",("aborting transaction %s", all ? "all" : "stmt"));
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
- int error=txn_abort(all ? trx->all : trx->stmt);
- if (all)
- trx->all=0;
- else
- trx->stmt=0;
+ DB_TXN **txn= all ? &trx->all : &trx->stmt;
+ int error=txn_abort(*txn);
+ *txn=0;
DBUG_RETURN(error);
}
@@ -1904,7 +1900,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
if (trx->stmt)
{
/*
- F_UNLOCK is done without a transaction commit / rollback.
+ F_UNLCK is done without a transaction commit / rollback.
This happens if the thread didn't update any rows
We must in this case commit the work to keep the row locks
*/
@@ -1929,6 +1925,7 @@ int ha_berkeley::start_stmt(THD *thd)
int error=0;
DBUG_ENTER("ha_berkeley::start_stmt");
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
+ DBUG_ASSERT(trx);
/*
note that trx->stmt may have been already initialized as start_stmt()
is called for *each table* not for each storage engine,
@@ -2277,6 +2274,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
DB_BTREE_STAT *stat=0;
DB_TXN_STAT *txn_stat_ptr= 0;
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
+ DBUG_ASSERT(trx);
/*
Original bdb documentation says:
@@ -2291,10 +2289,10 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
txn_stat_ptr && txn_stat_ptr->st_nactive>=2)
{
DB_TXN_ACTIVE *atxn_stmt= 0, *atxn_all= 0;
-
+
u_int32_t all_id= trx->all->id(trx->all);
u_int32_t stmt_id= trx->stmt->id(trx->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++)
@@ -2302,7 +2300,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
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))
{