From 9871a6d080f507f58afa91bfd7624c27b27963cd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2002 23:55:41 +0200 Subject: 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 sql/ha_innobase.cc: Some fine-tuning of optimization innobase/include/log0recv.h: Small improvements innobase/include/mem0mem.h: Small improvements innobase/include/mem0pool.h: Small improvements innobase/include/row0mysql.h: Small improvements innobase/include/srv0srv.h: Small improvements innobase/include/trx0trx.h: Small improvements innobase/buf/buf0lru.c: Small improvements innobase/fil/fil0fil.c: Small improvements innobase/log/log0recv.c: Small improvements innobase/mem/mem0mem.c: Small improvements innobase/mem/mem0pool.c: Small improvements innobase/row/row0mysql.c: Small improvements + fix the ALTER TABLE problem by introducing a lazy drop table it can use innobase/srv/srv0srv.c: Small improvements innobase/srv/srv0start.c: Small improvements innobase/trx/trx0purge.c: Small improvements innobase/trx/trx0trx.c: Small improvements --- innobase/trx/trx0trx.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'innobase/trx/trx0trx.c') 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; @@ -157,6 +159,32 @@ trx_allocate_for_mysql(void) return(trx); } +/************************************************************************ +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. */ @@ -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 -- cgit v1.2.1