Commit 4eacb83d authored by unknown's avatar unknown
Browse files

Merge bk-internal:/home/bk/mysql-5.0

into quadxeon.mysql.com:/users/vtkachenko/bk/mysql-5.0-tmp


sql/ha_innodb.cc:
  Auto merged
parents fd9c0a92 8158bb03
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ extern ulint srv_max_dirty_pages_pct;

extern ulint	srv_force_recovery;
extern ulong	srv_thread_concurrency;
extern ulong	srv_commit_concurrency;

extern ulint	srv_max_n_threads;

+1 −0
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ Value 10 should be good if there are less than 4 processors + 4 disks in the
computer. Bigger computers need bigger values. */

ulong	srv_thread_concurrency	= SRV_CONCURRENCY_THRESHOLD;
ulong   srv_commit_concurrency  = 0;

os_fast_mutex_t	srv_conc_mutex;		/* this mutex protects srv_conc data
					structures */
+44 −3
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@ have disables the InnoDB inlining in this file. */
pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */
                prepare_commit_mutex; /* to force correct commit order in
				      binlog */
ulong commit_threads= 0;
pthread_mutex_t commit_threads_m;
pthread_cond_t commit_cond;
pthread_mutex_t commit_cond_m;
bool innodb_inited= 0;

/*-----------------------------------------------------------------*/
@@ -1363,6 +1367,9 @@ innobase_init(void)
			 		(hash_get_key) innobase_get_key, 0, 0);
        pthread_mutex_init(&innobase_share_mutex, MY_MUTEX_INIT_FAST);
        pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
        pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
        pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
        pthread_cond_init(&commit_cond, NULL);
	innodb_inited= 1;

	/* If this is a replication slave and we needed to do a crash recovery,
@@ -1412,6 +1419,9 @@ innobase_end(void)
						MYF(MY_ALLOW_ZERO_PTR));
                pthread_mutex_destroy(&innobase_share_mutex);
                pthread_mutex_destroy(&prepare_commit_mutex);
                pthread_mutex_destroy(&commit_threads_m);
                pthread_mutex_destroy(&commit_cond_m);
                pthread_cond_destroy(&commit_cond);
	}

  	DBUG_RETURN(err);
@@ -1538,7 +1548,9 @@ innobase_commit(
	reserve the kernel mutex, we have to release the search system latch
	first to obey the latching order. */

	innobase_release_stat_resources(trx);
        if (trx->has_search_latch) {
                          trx_search_latch_release_if_reserved(trx);
        }
        
        /* The flag trx->active_trans is set to 1 in

@@ -1568,16 +1580,41 @@ innobase_commit(

                /* We need current binlog position for ibbackup to work.
                Note, the position is current because of prepare_commit_mutex */
retry:
                if (srv_commit_concurrency > 0)
                {
                  pthread_mutex_lock(&commit_cond_m);
                  commit_threads++;
                  if (commit_threads > srv_commit_concurrency)
                  {
                    commit_threads--;
                    pthread_cond_wait(&commit_cond, &commit_cond_m);
                    pthread_mutex_unlock(&commit_cond_m);
                    goto retry;
                  }
                  else
                    pthread_mutex_unlock(&commit_cond_m);
                }
                
                trx->mysql_log_file_name = mysql_bin_log.get_log_fname();
                trx->mysql_log_offset =
                        (ib_longlong)mysql_bin_log.get_log_file()->pos_in_file;

		innobase_commit_low(trx);

                if (srv_commit_concurrency > 0)
                {
                  pthread_mutex_lock(&commit_cond_m);
                  commit_threads--;
                  pthread_cond_signal(&commit_cond);
                  pthread_mutex_unlock(&commit_cond_m);
                }
                
                if (trx->active_trans == 2) {

                        pthread_mutex_unlock(&prepare_commit_mutex);
                }
               
                trx->active_trans = 0;
               
	} else {
@@ -1599,7 +1636,11 @@ innobase_commit(

	/* Tell the InnoDB server that there might be work for utility
	threads: */
        if (trx->declared_to_be_inside_innodb) {
                          /* Release our possible ticket in the FIFO */

                          srv_conc_force_exit_innodb(trx);
        }
	srv_active_wake_master_thread();

	DBUG_RETURN(0);
+1 −0
Original line number Diff line number Diff line
@@ -232,6 +232,7 @@ extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay;
extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
}

extern TYPELIB innobase_lock_typelib;
+4 −0
Original line number Diff line number Diff line
@@ -5314,6 +5314,10 @@ log and this option does nothing anymore.",
   "Helps in performance tuning in heavily concurrent environments.",
   (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
   0, GET_LONG, REQUIRED_ARG, 20, 1, 1000, 0, 1, 0},
  {"innodb_commit_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
   "Helps in performance tuning in heavily concurrent environments.",
   (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
   0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
  {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
   "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
    " disable a sleep",
Loading