1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-04 01:23:45 +03:00

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.


sql/handler.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/handler.h:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/log.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/log_event.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/set_var.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/sql_class.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/sql_class.h:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
sql/sql_parse.cc:
  Remove an always defined #ifdef (USING_TRNASACTIONS).
This commit is contained in:
Konstantin Osipov
2009-11-23 16:09:39 +03:00
parent f238113dec
commit 9f49582531
8 changed files with 11 additions and 36 deletions

View File

@ -992,7 +992,7 @@ int ha_prepare(THD *thd)
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
Ha_trx_info *ha_info= trans->ha_list; Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_prepare"); DBUG_ENTER("ha_prepare");
#ifdef USING_TRANSACTIONS
if (ha_info) if (ha_info)
{ {
for (; ha_info; ha_info= ha_info->next()) for (; ha_info; ha_info= ha_info->next())
@ -1018,7 +1018,7 @@ int ha_prepare(THD *thd)
} }
} }
} }
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); 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)); my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(2); DBUG_RETURN(2);
} }
#ifdef USING_TRANSACTIONS
if (ha_info) if (ha_info)
{ {
uint rw_ha_count; uint rw_ha_count;
@ -1227,7 +1227,6 @@ end:
/* Free resources and perform other cleanup even for 'empty' transactions. */ /* Free resources and perform other cleanup even for 'empty' transactions. */
else if (is_real_trans) else if (is_real_trans)
thd->transaction.cleanup(); thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); 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; bool is_real_trans=all || thd->transaction.all.ha_list == 0;
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
DBUG_ENTER("ha_commit_one_phase"); DBUG_ENTER("ha_commit_one_phase");
#ifdef USING_TRANSACTIONS
if (ha_info) if (ha_info)
{ {
for (; ha_info; ha_info= ha_info_next) 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. */ /* Free resources and perform other cleanup even for 'empty' transactions. */
if (is_real_trans) if (is_real_trans)
thd->transaction.cleanup(); thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); 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)); my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
#ifdef USING_TRANSACTIONS
if (ha_info) if (ha_info)
{ {
/* Close all cursors that can not survive ROLLBACK */ /* 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. */ /* Always cleanup. Even if there nht==0. There may be savepoints. */
if (is_real_trans) if (is_real_trans)
thd->transaction.cleanup(); thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
if (all) if (all)
thd->transaction_rollback_request= FALSE; 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) int ha_autocommit_or_rollback(THD *thd, int error)
{ {
DBUG_ENTER("ha_autocommit_or_rollback"); DBUG_ENTER("ha_autocommit_or_rollback");
#ifdef USING_TRANSACTIONS
if (thd->transaction.stmt.ha_list) if (thd->transaction.stmt.ha_list)
{ {
if (!error) if (!error)
@ -1404,7 +1402,6 @@ int ha_autocommit_or_rollback(THD *thd, int error)
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
} }
else else
#endif
{ {
if (!error) if (!error)
RUN_HOOK(transaction, after_commit, (thd, FALSE)); RUN_HOOK(transaction, after_commit, (thd, FALSE));
@ -1812,7 +1809,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
&thd->transaction.all); &thd->transaction.all);
Ha_trx_info *ha_info= trans->ha_list; Ha_trx_info *ha_info= trans->ha_list;
DBUG_ENTER("ha_savepoint"); DBUG_ENTER("ha_savepoint");
#ifdef USING_TRANSACTIONS
for (; ha_info; ha_info= ha_info->next()) for (; ha_info; ha_info= ha_info->next())
{ {
int err; int err;
@ -1836,7 +1833,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
engines are prepended to the beginning of the list. engines are prepended to the beginning of the list.
*/ */
sv->ha_list= trans->ha_list; sv->ha_list= trans->ha_list;
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@ -31,8 +31,6 @@
#define NO_HASH /* Not yet implemented */ #define NO_HASH /* Not yet implemented */
#endif #endif
#define USING_TRANSACTIONS
// the following is for checking tables // the following is for checking tables
#define HA_ADMIN_ALREADY_DONE 1 #define HA_ADMIN_ALREADY_DONE 1

View File

@ -4089,7 +4089,6 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
} }
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
#if defined(USING_TRANSACTIONS)
/* /*
Should we write to the binlog cache or to the binlog on disk? Should we write to the binlog cache or to the binlog on disk?
Write to the binlog cache if: Write to the binlog cache if:
@ -4124,7 +4123,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
LOCK_log. LOCK_log.
*/ */
} }
#endif /* USING_TRANSACTIONS */
DBUG_PRINT("info",("event type: %d",event_info->get_type_code())); DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
/* /*

View File

@ -3895,7 +3895,6 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
int ret= 0; int ret= 0;
DBUG_ENTER("Format_description_log_event::do_apply_event"); DBUG_ENTER("Format_description_log_event::do_apply_event");
#ifdef USING_TRANSACTIONS
/* /*
As a transaction NEVER spans on 2 or more binlogs: As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died 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."); "its binary log, thus rolled back too.");
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 1); const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 1);
} }
#endif
/* /*
If this event comes from ourselves, there is no cleaning task to If this event comes from ourselves, there is no cleaning task to
perform, we don't call Start_log_event_v3::do_apply_event() perform, we don't call Start_log_event_v3::do_apply_event()

View File

@ -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) static void fix_trans_mem_root(THD *thd, enum_var_type type)
{ {
#ifdef USING_TRANSACTIONS
if (type != OPT_GLOBAL) if (type != OPT_GLOBAL)
reset_root_defaults(&thd->transaction.mem_root, reset_root_defaults(&thd->transaction.mem_root,
thd->variables.trans_alloc_block_size, thd->variables.trans_alloc_block_size,
thd->variables.trans_prealloc_size); thd->variables.trans_prealloc_size);
#endif
} }

View File

@ -936,11 +936,9 @@ void THD::init_for_queries()
reset_root_defaults(mem_root, variables.query_alloc_block_size, reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size); variables.query_prealloc_size);
#ifdef USING_TRANSACTIONS
reset_root_defaults(&transaction.mem_root, reset_root_defaults(&transaction.mem_root,
variables.trans_alloc_block_size, variables.trans_alloc_block_size,
variables.trans_prealloc_size); variables.trans_prealloc_size);
#endif
transaction.xid_state.xid.null(); transaction.xid_state.xid.null();
transaction.xid_state.in_thd=1; transaction.xid_state.in_thd=1;
} }
@ -1059,9 +1057,7 @@ THD::~THD()
DBUG_PRINT("info", ("freeing security context")); DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy(); main_security_ctx.destroy();
safeFree(db); safeFree(db);
#ifdef USING_TRANSACTIONS
free_root(&transaction.mem_root,MYF(0)); free_root(&transaction.mem_root,MYF(0));
#endif
mysys_var=0; // Safety (shouldn't be needed) mysys_var=0; // Safety (shouldn't be needed)
pthread_mutex_destroy(&LOCK_thd_data); pthread_mutex_destroy(&LOCK_thd_data);
#ifndef DBUG_OFF #ifndef DBUG_OFF

View File

@ -1434,19 +1434,13 @@ public:
*/ */
if (!xid_state.rm_error) if (!xid_state.rm_error)
xid_state.xid.null(); xid_state.xid.null();
#ifdef USING_TRANSACTIONS
free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
#endif
} }
st_transactions() st_transactions()
{ {
#ifdef USING_TRANSACTIONS
bzero((char*)this, sizeof(*this)); bzero((char*)this, sizeof(*this));
xid_state.xid.null(); xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
#else
xid_state.xa_state= XA_NOTR;
#endif
} }
} transaction; } transaction;
Field *dup_field; Field *dup_field;
@ -1932,11 +1926,7 @@ public:
} }
inline bool active_transaction() inline bool active_transaction()
{ {
#ifdef USING_TRANSACTIONS
return server_status & SERVER_STATUS_IN_TRANS; return server_status & SERVER_STATUS_IN_TRANS;
#else
return 0;
#endif
} }
inline bool fill_derived_tables() inline bool fill_derived_tables()
{ {

View File

@ -511,9 +511,7 @@ static void handle_bootstrap_impl(THD *thd)
break; break;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
#ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
#endif
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;