# At a local mysql-6.0 repository of davi
2673 Davi Arnaut 2008-07-03
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.
modified:
sql/handler.cc
sql/handler.h
sql/log.cc
sql/log_event.cc
sql/set_var.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_parse.cc
per-file messages:
sql/handler.cc
Remove unused USING_TRANSACTIONS that is always present.
sql/handler.h
Remove unused USING_TRANSACTIONS that is always present.
sql/log.cc
Remove unused USING_TRANSACTIONS that is always present.
sql/log_event.cc
Remove unused USING_TRANSACTIONS that is always present.
sql/set_var.cc
Remove unused USING_TRANSACTIONS that is always present.
sql/sql_class.cc
Remove unused USING_TRANSACTIONS that is always present.
sql/sql_class.h
Remove unused USING_TRANSACTIONS that is always present.
sql/sql_parse.cc
Remove unused USING_TRANSACTIONS that is always present.
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-06-30 09:59:59 +0000
+++ b/sql/handler.cc 2008-07-03 21:26:51 +0000
@@ -922,7 +922,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())
@@ -948,7 +948,7 @@ int ha_prepare(THD *thd)
}
}
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -1069,7 +1069,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;
@@ -1152,7 +1152,7 @@ end:
if (rw_trans)
start_waiting_global_read_lock(thd);
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -1167,7 +1167,7 @@ int ha_commit_one_phase(THD *thd, bool a
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)
@@ -1197,7 +1197,7 @@ int ha_commit_one_phase(THD *thd, bool a
thd->transaction.cleanup();
}
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_RETURN(error);
}
@@ -1230,7 +1230,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 */
@@ -1260,7 +1260,7 @@ int ha_rollback_trans(THD *thd, bool all
thd->transaction.cleanup();
}
}
-#endif /* USING_TRANSACTIONS */
+
if (all)
thd->transaction_rollback_request= FALSE;
@@ -1295,7 +1295,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)
@@ -1312,7 +1312,7 @@ int ha_autocommit_or_rollback(THD *thd,
thd->variables.tx_isolation=thd->session_tx_isolation;
}
-#endif
+
DBUG_RETURN(error);
}
@@ -1718,7 +1718,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;
@@ -1742,7 +1742,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);
}
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2008-06-30 09:59:59 +0000
+++ b/sql/handler.h 2008-07-03 21:26:51 +0000
@@ -30,8 +30,6 @@
#define NO_HASH /* Not yet implemented */
#endif
-#define USING_TRANSACTIONS
-
// the following is for checking tables
#define HA_ADMIN_ALREADY_DONE 1
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2008-06-28 11:00:59 +0000
+++ b/sql/log.cc 2008-07-03 21:26:51 +0000
@@ -3885,7 +3885,6 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
}
#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:
@@ -3920,7 +3919,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
LOCK_log.
*/
}
-#endif /* USING_TRANSACTIONS */
+
DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
/*
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2008-06-28 11:00:59 +0000
+++ b/sql/log_event.cc 2008-07-03 21:26:51 +0000
@@ -3094,7 +3094,6 @@ int Format_description_log_event::do_app
{
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
@@ -3116,7 +3115,7 @@ int Format_description_log_event::do_app
"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()
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2008-06-28 11:00:59 +0000
+++ b/sql/set_var.cc 2008-07-03 21:26:51 +0000
@@ -1273,12 +1273,10 @@ static void fix_thd_mem_root(THD *thd, e
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
}
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2008-06-28 11:00:59 +0000
+++ b/sql/sql_class.cc 2008-07-03 21:26:51 +0000
@@ -785,11 +785,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;
}
@@ -925,9 +923,7 @@ THD::~THD()
main_security_ctx.destroy();
safeFree(db);
free_root(&warn_root,MYF(0));
-#ifdef USING_TRANSACTIONS
free_root(&transaction.mem_root,MYF(0));
-#endif
mysys_var=0; // Safety (shouldn't be needed)
pthread_mutex_destroy(&LOCK_delete);
#ifndef DBUG_OFF
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2008-06-28 11:00:59 +0000
+++ b/sql/sql_class.h 2008-07-03 21:26:51 +0000
@@ -1549,19 +1549,13 @@ public:
{
changed_tables= 0;
savepoints= 0;
-#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;
@@ -2078,11 +2072,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()
{
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2008-06-28 11:00:59 +0000
+++ b/sql/sql_parse.cc 2008-07-03 21:26:51 +0000
@@ -460,9 +460,7 @@ pthread_handler_t handle_bootstrap(void
break;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
-#ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
-#endif
}
end:
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (davi:2673) | Davi Arnaut | 3 Jul |