List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:May 4 2010 9:12am
Subject:bzr commit into mysql-trunk-innodb branch (Sunny.Bains:3052)
View as plain text  
#At file:///Users/sunny/innodb/bzr/mysql-trunk-innodb/ based on revid:sunny.bains@stripped

 3052 Sunny Bains	2010-05-04 [merge]
      1. Set the thr->slot to NULL on creation
      2. When checking for pending purge in trx_purge() make the
         coordinator thread wait on an event instead of polling.
      3. Wait for history len to get to n_purge_threads * purge_batch_size
         before initiating purge.
      4. Add some debug code in row0purge.c 

    modified:
      storage/innobase/include/srv0srv.h
      storage/innobase/que/que0que.c
      storage/innobase/row/row0purge.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/trx/trx0purge.c
=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	revid:sunny.bains@stripped
+++ b/storage/innobase/include/srv0srv.h	revid:sunny.bains@stripped
@@ -684,6 +684,15 @@ ulint
 srv_get_task_queue_length(void);
 /*===========================*/
 
+/*********************************************************************//**
+Suspends the calling thread to wait for the event in its thread slot.
+NOTE! The server mutex has to be reserved by the caller!
+@return	event for the calling thread to wait */
+UNIV_INTERN
+os_event_t
+srv_suspend_thread(void);
+/*====================*/
+
 /** Status variables to be passed to MySQL */
 struct export_var_struct{
 	ulint innodb_data_pending_reads;	/*!< Pending reads */

=== modified file 'storage/innobase/que/que0que.c'
--- a/storage/innobase/que/que0que.c	revid:sunny.bains@stripped
+++ b/storage/innobase/que/que0que.c	revid:sunny.bains@stripped
@@ -225,6 +225,8 @@ que_thr_create(
 	thr->resource = 0;
 	thr->lock_state = QUE_THR_LOCK_NOLOCK;
 
+	thr->slot = NULL;
+
 	UT_LIST_ADD_LAST(thrs, parent->thrs, thr);
 
 	return(thr);

=== modified file 'storage/innobase/row/row0purge.c'
--- a/storage/innobase/row/row0purge.c	revid:sunny.bains@stripped
+++ b/storage/innobase/row/row0purge.c	revid:sunny.bains@stripped
@@ -796,16 +796,22 @@ row_purge_step(
 	ut_ad(que_node_get_type(node) == QUE_NODE_PURGE);
 
 	if (!(node->undo_recs == NULL || ib_vector_is_empty(node->undo_recs))) {
+		trx_undo_inf_t*	cell;
 		trx_purge_rec_t*purge_rec;
 
 		purge_rec = ib_vector_pop(node->undo_recs);
 
-		node->reservation = &purge_sys->arr->infos[node->thread_id];
+		cell = &purge_sys->arr->infos[node->thread_id];
+
+		node->reservation = cell;
 		node->roll_ptr = purge_rec->roll_ptr;
 
 		row_purge(node, purge_rec->undo_rec, thr);
 
-		trx_purge_rec_release(node->reservation);
+		ut_a(cell == node->reservation);
+		ut_a(cell == &purge_sys->arr->infos[node->thread_id]);
+
+		trx_purge_rec_release(cell);
 
 		if (ib_vector_is_empty(node->undo_recs)) {
 			row_purge_end(thr);

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	revid:sunny.bains@stripped
+++ b/storage/innobase/srv/srv0srv.c	revid:sunny.bains@stripped
@@ -889,7 +889,7 @@ srv_table_reserve_slot(
 Suspends the calling thread to wait for the event in its thread slot.
 NOTE! The server mutex has to be reserved by the caller!
 @return	event for the calling thread to wait */
-static
+UNIV_INTERN
 os_event_t
 srv_suspend_thread(void)
 /*====================*/
@@ -3318,7 +3318,8 @@ srv_purge_coordinator_thread(
 		because in the worst case we will end up waiting for
 		the next purge event. */
 
-		if (trx_sys->rseg_history_len < 200) {
+		if (trx_sys->rseg_history_len
+		    < (srv_n_purge_threads * srv_purge_batch_size)) {
 			os_event_t	event;
 
 			event = srv_suspend_thread();

=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c	revid:sunny.bains@stripped
+++ b/storage/innobase/trx/trx0purge.c	revid:sunny.bains@stripped
@@ -1171,7 +1171,13 @@ trx_purge(
 		n_tasks = srv_get_task_queue_length();
 
 		if (n_tasks > 0) {
+			os_event_t	event;
+
 			srv_wake_worker_threads(n_tasks);
+
+			event = srv_suspend_thread();
+
+			os_event_wait(event);
 		}
 
 		mutex_enter(&purge_sys->mutex);


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20100504090945-04wczqn4137gvwn3.bundle
Thread
bzr commit into mysql-trunk-innodb branch (Sunny.Bains:3052) Sunny Bains4 May