summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-11-23 16:09:39 +0300
committerKonstantin Osipov <kostja@sun.com>2009-11-23 16:09:39 +0300
commit9f49582531b7a3a9b74973f0534f9430f7fee75c (patch)
tree5cc2ddb21e4fef0b2576a1f92415cbf6282446e4 /sql
parentf238113decc10e345a6e2b26d83eefeb53f188f0 (diff)
downloadmariadb-git-9f49582531b7a3a9b74973f0534f9430f7fee75c.tar.gz
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).
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc21
-rw-r--r--sql/handler.h2
-rw-r--r--sql/log.cc3
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sql_class.cc4
-rw-r--r--sql/sql_class.h10
-rw-r--r--sql/sql_parse.cc2
8 files changed, 11 insertions, 36 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index ad7e1ecfa80..9d1fc723208 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -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 @@ end:
/* 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);
}
diff --git a/sql/handler.h b/sql/handler.h
index 05a9e13653c..5f028796cf3 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -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
diff --git a/sql/log.cc b/sql/log.cc
index e7deebad196..0abcdb59551 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -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()));
/*
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 3a54717a45f..87af8911fb9 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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()
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 36597658077..1028e5441ae 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -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
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 441a3037317..b7d88eca89a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -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
diff --git a/sql/sql_class.h b/sql/sql_class.h
index a968258dd1b..03a92c1a685 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1434,19 +1434,13 @@ public:
*/
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 @@ public:
}
inline bool active_transaction()
{
-#ifdef USING_TRANSACTIONS
return server_status & SERVER_STATUS_IN_TRANS;
-#else
- return 0;
-#endif
}
inline bool fill_derived_tables()
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c2021710d6c..cabfaf14c24 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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;