List:Internals« Previous MessageNext Message »
From:Marko Mäkelä Date:June 8 2005 2:46pm
Subject:bk commit into 5.0 tree (marko:1.1868)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1868 05/06/08 15:45:56 marko@stripped +7 -0
  InnoDB: Do not distinguish explicitly requested table locks.
  Since UNLOCK TABLES will commit the transaction (and thus release
  all InnoDB locks held by it), it is unnecessary to release the
  user-requested table locks separately.

  sql/ha_innodb.cc
    1.200 05/06/08 15:45:47 marko@stripped +3 -7
    Remove references to LOCK_TABLE_EXP and LOCK_TABLE_TRANSACTIONAL
    and row_unlock_tables_for_mysql().

  innobase/trx/trx0trx.c
    1.55 05/06/08 15:45:47 marko@stripped +0 -10
    Remove n_lock_table_exp and n_lock_table_transactional.

  innobase/row/row0mysql.c
    1.108 05/06/08 15:45:47 marko@stripped +5 -29
    Remove row_unlock_tables_for_mysql().
    Remove references to LOCK_TABLE_TRANSACTIONAL and LOCK_TABLE_EXP.

  innobase/lock/lock0lock.c
    1.59 05/06/08 15:45:47 marko@stripped +5 -113
    Remove references to LOCK_TABLE_EXP and LOCK_TABLE_TRANSACTIONAL.
    Remove lock_release_tables_off_kernel().
    Remove references to trx->n_lock_table_exp
    and trx->n_lock_table_transactional.

  innobase/include/trx0trx.h
    1.47 05/06/08 15:45:47 marko@stripped +0 -7
    Remove n_lock_table_exp and n_lock_table_transactional.

  innobase/include/row0mysql.h
    1.42 05/06/08 15:45:47 marko@stripped +3 -10
    Remove row_unlock_tables_for_mysql().

  innobase/include/lock0lock.h
    1.23 05/06/08 15:45:47 marko@stripped +1 -15
    Remove references to LOCK_TABLE_EXP and LOCK_TABLE_TRANSACTIONAL.
    Remove lock_release_tables_off_kernel().

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	marko
# Host:	hundin.mysql.fi
# Root:	/home/marko/mysql-5.0

--- 1.22/innobase/include/lock0lock.h	Mon Apr 25 10:14:25 2005
+++ 1.23/innobase/include/lock0lock.h	Wed Jun  8 15:45:47 2005
@@ -413,9 +413,7 @@
 				/* out: DB_SUCCESS, DB_LOCK_WAIT,
 				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
 	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,
-				does nothing;
-				if LOCK_TABLE_EXP bits are set,
-				creates an explicit table lock */
+				does nothing */
 	dict_table_t*	table,	/* in: database table in dictionary cache */
 	ulint		mode,	/* in: lock mode */
 	que_thr_t*	thr);	/* in: query thread */
@@ -452,15 +450,6 @@
 /*====================*/
 	trx_t*	trx);	/* in: transaction */
 /*************************************************************************
-Releases table locks explicitly requested with LOCK TABLES (indicated by
-lock type LOCK_TABLE_EXP), and releases possible other transactions waiting
-because of these locks. */
-
-void
-lock_release_tables_off_kernel(
-/*===========================*/
-	trx_t*	trx);	/* in: transaction */
-/*************************************************************************
 Cancels a waiting lock request and releases possible other transactions
 waiting behind it. */
 
@@ -612,9 +601,6 @@
 /* Lock types */
 #define LOCK_TABLE	16	/* these type values should be so high that */
 #define	LOCK_REC	32	/* they can be ORed to the lock mode */
-#define LOCK_TABLE_EXP	80	/* explicit table lock (80 = 16 + 64) */
-#define	LOCK_TABLE_TRANSACTIONAL	144
-				/* transactional table lock (144 = 16 + 128)*/
 #define LOCK_TYPE_MASK	0xF0UL	/* mask used to extract lock type from the
 				type_mode field in a lock */
 /* Waiting lock flag */

--- 1.41/innobase/include/row0mysql.h	Mon Apr 25 10:14:26 2005
+++ 1.42/innobase/include/row0mysql.h	Wed Jun  8 15:45:47 2005
@@ -172,14 +172,6 @@
 	row_prebuilt_t*	prebuilt);	/* in: prebuilt struct in the MySQL
 					table handle */
 /*************************************************************************
-Unlocks all table locks explicitly requested by trx (with LOCK TABLES,
-lock type LOCK_TABLE_EXP). */
-
-void		  	
-row_unlock_tables_for_mysql(
-/*========================*/
-	trx_t*	trx);	/* in: transaction */
-/*************************************************************************
 Sets a table lock on the table mentioned in prebuilt. */
 
 int
@@ -190,9 +182,10 @@
 					table handle */
 	dict_table_t*	table,		/* in: table to lock, or NULL
 					if prebuilt->table should be
-					locked as LOCK_TABLE_EXP |
+					locked as
 					prebuilt->select_lock_type */
-	ulint		mode);		/* in: lock mode of table */
+	ulint		mode);		/* in: lock mode of table
+					(ignored if table==NULL) */
 					   
 /*************************************************************************
 Does an insert for MySQL. */

--- 1.46/innobase/include/trx0trx.h	Wed Apr 20 17:38:56 2005
+++ 1.47/innobase/include/trx0trx.h	Wed Jun  8 15:45:47 2005
@@ -497,13 +497,6 @@
 					in the lock list trx_locks */
 	ibool		trx_create_lock;/* this is TRUE if we have created a
 					new lock for a record accessed */
-	ulint		n_lock_table_exp;/* number of explicit table locks
-					(LOCK TABLES) reserved by the
-					transaction, stored in trx_locks */
-	ulint		n_lock_table_transactional;
-					/* number of transactional table locks
-					(LOCK TABLES..WHERE ENGINE) reserved by
-					the transaction, stored in trx_locks */
 	UT_LIST_NODE_T(trx_t)
 			trx_list;	/* list of transactions */
 	UT_LIST_NODE_T(trx_t)

--- 1.58/innobase/lock/lock0lock.c	Mon Apr 25 10:14:26 2005
+++ 1.59/innobase/lock/lock0lock.c	Wed Jun  8 15:45:47 2005
@@ -2208,11 +2208,7 @@
                 release it at the end of the SQL statement */
 
                 lock->trx->auto_inc_lock = lock;
-        } else if (lock_get_type(lock) == LOCK_TABLE_EXP ||
-			lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
-		ut_a(lock_get_mode(lock) == LOCK_S
-			|| lock_get_mode(lock) == LOCK_X);
-	}
+        }
 
 	if (lock_print_waits) {
 		fprintf(stderr, "Lock wait for trx %lu ends\n",
@@ -3415,14 +3411,6 @@
 	lock->type_mode = type_mode | LOCK_TABLE;
 	lock->trx = trx;
 
-	if (lock_get_type(lock) == LOCK_TABLE_EXP) {
-		lock->trx->n_lock_table_exp++;
-	}
-
-	if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
-		lock->trx->n_lock_table_transactional++;
-	}
-
 	lock->un_member.tab_lock.table = table;
 
 	UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
@@ -3459,14 +3447,6 @@
 		trx->auto_inc_lock = NULL;
 	}
 
-	if (lock_get_type(lock) == LOCK_TABLE_EXP) {
-		trx->n_lock_table_exp--;
-	}
-
-        if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
-		trx->n_lock_table_transactional--;
-	}
-
 	UT_LIST_REMOVE(trx_locks, trx->trx_locks, lock);
 	UT_LIST_REMOVE(un_member.tab_lock.locks, table->locks, lock);
 }	
@@ -3597,10 +3577,7 @@
 				/* out: DB_SUCCESS, DB_LOCK_WAIT,
 				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
 	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,
-				does nothing;
-				if LOCK_TABLE_EXP|LOCK_TABLE_TRANSACTIONAL
-				bits are set,
-				creates an explicit table lock */
+				does nothing */
 	dict_table_t*	table,	/* in: database table in dictionary cache */
 	ulint		mode,	/* in: lock mode */
 	que_thr_t*	thr)	/* in: query thread */
@@ -3615,8 +3592,7 @@
 		return(DB_SUCCESS);
 	}
 
-	ut_a(flags == 0 || flags == LOCK_TABLE_EXP || 
-					flags == LOCK_TABLE_TRANSACTIONAL);
+	ut_a(flags == 0);
 
 	trx = thr_get_trx(thr);
 
@@ -3729,9 +3705,7 @@
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(mutex_own(&kernel_mutex));
 #endif /* UNIV_SYNC_DEBUG */
-	ut_a(lock_get_type(in_lock) == LOCK_TABLE ||
-		lock_get_type(in_lock) == LOCK_TABLE_EXP ||
-		lock_get_type(in_lock) == LOCK_TABLE_TRANSACTIONAL);
+	ut_a(lock_get_type(in_lock) == LOCK_TABLE);
 
 	lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
 
@@ -3835,12 +3809,6 @@
 			}
 
 			lock_table_dequeue(lock);
-
-			if (lock_get_type(lock) == LOCK_TABLE_EXP ||
-			    lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
-				ut_a(lock_get_mode(lock) == LOCK_S
-					|| lock_get_mode(lock) == LOCK_X);
-			}
 		}
 
 		if (count == LOCK_RELEASE_KERNEL_INTERVAL) {
@@ -3860,74 +3828,6 @@
 	mem_heap_empty(trx->lock_heap);
 
 	ut_a(trx->auto_inc_lock == NULL);
-	ut_a(trx->n_lock_table_exp == 0);
-	ut_a(trx->n_lock_table_transactional == 0);
-}
-
-/*************************************************************************
-Releases table locks explicitly requested with LOCK TABLES (indicated by
-lock type LOCK_TABLE_EXP), and releases possible other transactions waiting
-because of these locks. */
-
-void
-lock_release_tables_off_kernel(
-/*===========================*/
-	trx_t*	trx)	/* in: transaction */
-{
-	dict_table_t*	table;
-	ulint		count;
-	lock_t*		lock;
-
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
-
-	lock = UT_LIST_GET_LAST(trx->trx_locks);
-
-	count = 0;
-
-	while (lock != NULL) {
-
-		count++;
-
-		if (lock_get_type(lock) == LOCK_TABLE_EXP) {
-			ut_a(lock_get_mode(lock) == LOCK_S
-				|| lock_get_mode(lock) == LOCK_X);
-			if (trx->insert_undo || trx->update_undo) {
-
-				/* The trx may have modified the table.
-				We block the use of the MySQL query
-				cache for all currently active
-				transactions. */
-
-				table = lock->un_member.tab_lock.table;
-
-				table->query_cache_inv_trx_id =
-							trx_sys->max_trx_id;
-			}
-
-			lock_table_dequeue(lock);
-
-			lock = UT_LIST_GET_LAST(trx->trx_locks);
-			continue;
-		}
-
-		if (count == LOCK_RELEASE_KERNEL_INTERVAL) {
-			/* Release the kernel mutex for a while, so that we
-			do not monopolize it */
-
-			lock_mutex_exit_kernel();
-
-			lock_mutex_enter_kernel();
-
-			count = 0;
-		}
-
-		lock = UT_LIST_GET_PREV(trx_locks, lock);
-	}
-
-	ut_a(trx->n_lock_table_exp == 0);
-	ut_a(trx->n_lock_table_transactional == 0);
 }
 
 /*************************************************************************
@@ -4040,15 +3940,7 @@
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(mutex_own(&kernel_mutex));
 #endif /* UNIV_SYNC_DEBUG */
-	ut_a(lock_get_type(lock) == LOCK_TABLE ||
-		lock_get_type(lock) == LOCK_TABLE_EXP ||
-		lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL);
-
-	if (lock_get_type(lock) == LOCK_TABLE_EXP) {
-		fputs("EXPLICIT ", file);
-	} else if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
-		fputs("TRANSACTIONAL ", file);
-	}
+	ut_a(lock_get_type(lock) == LOCK_TABLE);
 
 	fputs("TABLE LOCK table ", file);
 	ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name);

--- 1.107/innobase/row/row0mysql.c	Mon Apr 25 10:14:26 2005
+++ 1.108/innobase/row/row0mysql.c	Wed Jun  8 15:45:47 2005
@@ -971,25 +971,6 @@
 }
 
 /*************************************************************************
-Unlocks all table locks explicitly requested by trx (with LOCK TABLES,
-lock type LOCK_TABLE_EXP). */
-
-void		  	
-row_unlock_tables_for_mysql(
-/*========================*/
-	trx_t*	trx)	/* in: transaction */
-{
-	if (!trx->n_lock_table_exp) {
-
-		return;
-	}
-
-	mutex_enter(&kernel_mutex);
-	lock_release_tables_off_kernel(trx);
-	mutex_exit(&kernel_mutex);
-}
-
-/*************************************************************************
 Sets a table lock on the table mentioned in prebuilt. */
 
 int
@@ -1000,9 +981,10 @@
 					table handle */
 	dict_table_t*	table,		/* in: table to lock, or NULL
 					if prebuilt->table should be
-					locked or a
+					locked as
 					prebuilt->select_lock_type */
-	ulint		mode)		/* in: lock mode of table */
+	ulint		mode)		/* in: lock mode of table
+					(ignored if table==NULL) */
 {
 	trx_t*		trx 		= prebuilt->trx;
 	que_thr_t*	thr;
@@ -1038,14 +1020,8 @@
 	if (table) {
 		err = lock_table(0, table, mode, thr);
 	} else {
-		if (mode == LOCK_TABLE_TRANSACTIONAL) {
-			err = lock_table(LOCK_TABLE_TRANSACTIONAL, 
-					prebuilt->table,
-					prebuilt->select_lock_type, thr);
-		} else {
-			err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
-					prebuilt->select_lock_type, thr);
-		}
+		err = lock_table(0, prebuilt->table,
+				prebuilt->select_lock_type, thr);
 	}
 
 	trx->error_state = err;

--- 1.54/innobase/trx/trx0trx.c	Mon Mar 21 22:28:50 2005
+++ 1.55/innobase/trx/trx0trx.c	Wed Jun  8 15:45:47 2005
@@ -158,8 +158,6 @@
 	trx->n_tickets_to_enter_innodb = 0;
 
 	trx->auto_inc_lock = NULL;
-	trx->n_lock_table_exp = 0;
-	trx->n_lock_table_transactional = 0;
 	
 	trx->read_view_heap = mem_heap_create(256);
 	trx->read_view = NULL;
@@ -309,8 +307,6 @@
 
 	ut_a(!trx->has_search_latch);
 	ut_a(!trx->auto_inc_lock);
-	ut_a(!trx->n_lock_table_exp);
-	ut_a(!trx->n_lock_table_transactional);
 
 	ut_a(trx->dict_operation_lock_mode == 0);
 
@@ -1710,12 +1706,6 @@
 					(ulong) trx->n_mysql_tables_in_use,
 					(ulong) trx->mysql_n_tables_locked);
 	}
-
-	if (trx->n_lock_table_transactional > 0 || trx->n_lock_table_exp > 0) {
-fprintf(f, "mysql explicit table locks %lu, transactional table locks %lu\n",
-				(ulong) trx->n_lock_table_exp,
-				(ulong) trx->n_lock_table_transactional);
-        }
 
 	newline = TRUE;
 

--- 1.199/sql/ha_innodb.cc	Tue May  3 15:55:43 2005
+++ 1.200/sql/ha_innodb.cc	Wed Jun  8 15:45:47 2005
@@ -5719,7 +5719,7 @@
 
 				ulint	error;
 				error = row_lock_table_for_mysql(prebuilt,
-							NULL, LOCK_TABLE_EXP);
+							NULL, 0);
 
 				if (error != DB_SUCCESS) {
 					error = convert_error_code_to_mysql(
@@ -5739,9 +5739,6 @@
 	trx->n_mysql_tables_in_use--;
 	prebuilt->mysql_has_locked = FALSE;
 	auto_inc_counter_for_this_stat = 0;
-	if (trx->n_lock_table_exp) {
-		row_unlock_tables_for_mysql(trx);
-	}
 
 	/* If the MySQL lock count drops to zero we know that the current SQL
 	statement has ended */
@@ -5783,7 +5780,7 @@
 int
 ha_innobase::transactional_table_lock(
 /*==================================*/
-			        /* out: 0 */
+			        /* out: error code */
 	THD*	thd,		/* in: handle to the user thread */
 	int 	lock_type)	/* in: lock type */
 {
@@ -5847,8 +5844,7 @@
 	if (thd->in_lock_tables && thd->variables.innodb_table_locks) {
 		ulint	error = DB_SUCCESS;
 
-		error = row_lock_table_for_mysql(prebuilt,NULL,
-						LOCK_TABLE_TRANSACTIONAL);
+		error = row_lock_table_for_mysql(prebuilt, NULL, 0);
 
 		if (error != DB_SUCCESS) {
 			error = convert_error_code_to_mysql(error, user_thd);
Thread
bk commit into 5.0 tree (marko:1.1868)Marko Mäkelä8 Jun