summaryrefslogtreecommitdiff
path: root/innobase/trx
diff options
context:
space:
mode:
authorheikki@donna.mysql.fi <>2002-02-04 23:55:41 +0200
committerheikki@donna.mysql.fi <>2002-02-04 23:55:41 +0200
commitaea3c07139ca98294ee847f11310963e9c16f861 (patch)
tree8afb00e0a5c01501d06fda6b055c26e219075b91 /innobase/trx
parent9c86441ef63023be60427f57184d466468994f73 (diff)
downloadmariadb-git-aea3c07139ca98294ee847f11310963e9c16f861.tar.gz
Many files:
Small improvements row0mysql.c: Small improvements + fix the ALTER TABLE problem by introducing a lazy drop table it can use ha_innobase.cc: Some fine-tuning of optimization
Diffstat (limited to 'innobase/trx')
-rw-r--r--innobase/trx/trx0purge.c4
-rw-r--r--innobase/trx/trx0trx.c52
2 files changed, 52 insertions, 4 deletions
diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c
index a91ac135f81..b73629c9fa4 100644
--- a/innobase/trx/trx0purge.c
+++ b/innobase/trx/trx0purge.c
@@ -226,9 +226,9 @@ trx_purge_sys_create(void)
value */
purge_sys->sess = sess_open(com_endpoint, (byte*)"purge_system", 13);
- purge_sys->trx = (purge_sys->sess)->trx;
+ purge_sys->trx = purge_sys->sess->trx;
- (purge_sys->trx)->type = TRX_PURGE;
+ purge_sys->trx->type = TRX_PURGE;
ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED));
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index 43cca5b62b3..6cbf97104b3 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -26,9 +26,9 @@ Created 3/26/1996 Heikki Tuuri
/* Copy of the prototype for innobase_mysql_print_thd: this
- copy must be equal to the one in mysql/sql/ha_innobase.cc ! */
-void innobase_mysql_print_thd(void* thd);
+copy must be equal to the one in mysql/sql/ha_innobase.cc ! */
+void innobase_mysql_print_thd(void* thd);
/* Dummy session used currently in MySQL interface */
sess_t* trx_dummy_sess = NULL;
@@ -64,6 +64,8 @@ trx_create(
trx = mem_alloc(sizeof(trx_t));
+ trx->magic_n = TRX_MAGIC_N;
+
trx->op_info = "";
trx->type = TRX_USER;
@@ -158,6 +160,32 @@ trx_allocate_for_mysql(void)
}
/************************************************************************
+Creates a transaction object for background operations by the master thread. */
+
+trx_t*
+trx_allocate_for_background(void)
+/*=============================*/
+ /* out, own: transaction object */
+{
+ trx_t* trx;
+
+ mutex_enter(&kernel_mutex);
+
+ /* Open a dummy session */
+
+ if (!trx_dummy_sess) {
+ trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess",
+ ut_strlen("Dummy sess"));
+ }
+
+ trx = trx_create(trx_dummy_sess);
+
+ mutex_exit(&kernel_mutex);
+
+ return(trx);
+}
+
+/************************************************************************
Releases the search latch if trx has reserved it. */
void
@@ -181,6 +209,11 @@ trx_free(
trx_t* trx) /* in, own: trx object */
{
ut_ad(mutex_own(&kernel_mutex));
+
+ ut_a(trx->magic_n == TRX_MAGIC_N);
+
+ trx->magic_n = 11112222;
+
ut_a(trx->conc_state == TRX_NOT_STARTED);
mutex_free(&(trx->undo_mutex));
@@ -242,6 +275,21 @@ trx_free_for_mysql(
mutex_exit(&kernel_mutex);
}
+/************************************************************************
+Frees a transaction object of a background operation of the master thread. */
+
+void
+trx_free_for_background(
+/*====================*/
+ trx_t* trx) /* in, own: trx object */
+{
+ mutex_enter(&kernel_mutex);
+
+ trx_free(trx);
+
+ mutex_exit(&kernel_mutex);
+}
+
/********************************************************************
Inserts the trx handle in the trx system trx list in the right position.
The list is sorted on the trx id so that the biggest id is at the list