Commit 777c3034 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

------------------------------------------------------------
revno: 2630.13.2
committer: Davi Arnaut <davi@sun.com>
branch nick: WL4284-6.0
timestamp: Thu 2008-07-03 18:26:51 -0300
message:
Remove unused USING_TRANSACTIONS macro which unnecessarily
cumbers the code. This macro is a historical leftover and
has no practical use since its unconditionally defined.
parent 7e532b13
......@@ -992,7 +992,7 @@ int ha_prepare(THD *thd)
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_prepare");
#ifdef USING_TRANSACTIONS
if (ha_info)
{
for (; ha_info; ha_info= ha_info->next())
......@@ -1018,7 +1018,7 @@ int ha_prepare(THD *thd)
}
}
}
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
......@@ -1146,7 +1146,7 @@ int ha_commit_trans(THD *thd, bool all)
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(2);
}
#ifdef USING_TRANSACTIONS
if (ha_info)
{
uint rw_ha_count;
......@@ -1227,7 +1227,6 @@ int ha_commit_trans(THD *thd, bool all)
/* Free resources and perform other cleanup even for 'empty' transactions. */
else if (is_real_trans)
thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
......@@ -1249,7 +1248,7 @@ int ha_commit_one_phase(THD *thd, bool all)
bool is_real_trans=all || thd->transaction.all.ha_list == 0;
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
DBUG_ENTER("ha_commit_one_phase");
#ifdef USING_TRANSACTIONS
if (ha_info)
{
for (; ha_info; ha_info= ha_info_next)
......@@ -1279,7 +1278,7 @@ int ha_commit_one_phase(THD *thd, bool all)
/* Free resources and perform other cleanup even for 'empty' transactions. */
if (is_real_trans)
thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
......@@ -1319,7 +1318,7 @@ int ha_rollback_trans(THD *thd, bool all)
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
}
#ifdef USING_TRANSACTIONS
if (ha_info)
{
/* Close all cursors that can not survive ROLLBACK */
......@@ -1350,7 +1349,6 @@ int ha_rollback_trans(THD *thd, bool all)
/* Always cleanup. Even if there nht==0. There may be savepoints. */
if (is_real_trans)
thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
if (all)
thd->transaction_rollback_request= FALSE;
......@@ -1386,7 +1384,7 @@ int ha_rollback_trans(THD *thd, bool all)
int ha_autocommit_or_rollback(THD *thd, int error)
{
DBUG_ENTER("ha_autocommit_or_rollback");
#ifdef USING_TRANSACTIONS
if (thd->transaction.stmt.ha_list)
{
if (!error)
......@@ -1404,7 +1402,6 @@ int ha_autocommit_or_rollback(THD *thd, int error)
thd->variables.tx_isolation=thd->session_tx_isolation;
}
else
#endif
{
if (!error)
RUN_HOOK(transaction, after_commit, (thd, FALSE));
......@@ -1812,7 +1809,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
&thd->transaction.all);
Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_savepoint");
#ifdef USING_TRANSACTIONS
for (; ha_info; ha_info= ha_info->next())
{
int err;
......@@ -1836,7 +1833,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
engines are prepended to the beginning of the list.
*/
sv->ha_list= trans->ha_list;
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
......
......@@ -31,8 +31,6 @@
#define NO_HASH /* Not yet implemented */
#endif
#define USING_TRANSACTIONS
// the following is for checking tables
#define HA_ADMIN_ALREADY_DONE 1
......
......@@ -4089,7 +4089,6 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
}
#endif /* HAVE_REPLICATION */
#if defined(USING_TRANSACTIONS)
/*
Should we write to the binlog cache or to the binlog on disk?
Write to the binlog cache if:
......@@ -4124,7 +4123,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
LOCK_log.
*/
}
#endif /* USING_TRANSACTIONS */
DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
/*
......
......@@ -3895,7 +3895,6 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
int ret= 0;
DBUG_ENTER("Format_description_log_event::do_apply_event");
#ifdef USING_TRANSACTIONS
/*
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died
......@@ -3917,7 +3916,7 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
"its binary log, thus rolled back too.");
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 1);
}
#endif
/*
If this event comes from ourselves, there is no cleaning task to
perform, we don't call Start_log_event_v3::do_apply_event()
......
......@@ -1395,12 +1395,10 @@ static void fix_thd_mem_root(THD *thd, enum_var_type type)
static void fix_trans_mem_root(THD *thd, enum_var_type type)
{
#ifdef USING_TRANSACTIONS
if (type != OPT_GLOBAL)
reset_root_defaults(&thd->transaction.mem_root,
thd->variables.trans_alloc_block_size,
thd->variables.trans_prealloc_size);
#endif
}
......
......@@ -936,11 +936,9 @@ void THD::init_for_queries()
reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size);
#ifdef USING_TRANSACTIONS
reset_root_defaults(&transaction.mem_root,
variables.trans_alloc_block_size,
variables.trans_prealloc_size);
#endif
transaction.xid_state.xid.null();
transaction.xid_state.in_thd=1;
}
......@@ -1059,9 +1057,7 @@ THD::~THD()
DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy();
safeFree(db);
#ifdef USING_TRANSACTIONS
free_root(&transaction.mem_root,MYF(0));
#endif
mysys_var=0; // Safety (shouldn't be needed)
pthread_mutex_destroy(&LOCK_thd_data);
#ifndef DBUG_OFF
......
......@@ -1434,19 +1434,13 @@ class THD :public Statement,
*/
if (!xid_state.rm_error)
xid_state.xid.null();
#ifdef USING_TRANSACTIONS
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
#endif
}
st_transactions()
{
#ifdef USING_TRANSACTIONS
bzero((char*)this, sizeof(*this));
xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
#else
xid_state.xa_state= XA_NOTR;
#endif
}
} transaction;
Field *dup_field;
......@@ -1932,11 +1926,7 @@ class THD :public Statement,
}
inline bool active_transaction()
{
#ifdef USING_TRANSACTIONS
return server_status & SERVER_STATUS_IN_TRANS;
#else
return 0;
#endif
}
inline bool fill_derived_tables()
{
......
......@@ -511,9 +511,7 @@ static void handle_bootstrap_impl(THD *thd)
break;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
#ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
#endif
}
DBUG_VOID_RETURN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment