~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/srv/srv0srv.c

  • Committer: Monty Taylor
  • Date: 2009-01-09 07:02:24 UTC
  • mto: (779.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 784.
  • Revision ID: mordred@inaugust.com-20090109070224-prwl5p52mfql3zfw
Split out readline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
 
Copyright (c) 2008, Google Inc.
5
 
 
6
 
Portions of this file contain modifications contributed and copyrighted by
7
 
Google, Inc. Those modifications are gratefully acknowledged and are described
8
 
briefly in the InnoDB documentation. The contributions by Google are
9
 
incorporated with their permission, and subject to the conditions contained in
10
 
the file COPYING.Google.
11
 
 
12
 
This program is free software; you can redistribute it and/or modify it under
13
 
the terms of the GNU General Public License as published by the Free Software
14
 
Foundation; version 2 of the License.
15
 
 
16
 
This program is distributed in the hope that it will be useful, but WITHOUT
17
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
 
 
20
 
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22
 
Place, Suite 330, Boston, MA 02111-1307 USA
23
 
 
24
 
*****************************************************************************/
25
 
 
26
1
/******************************************************
27
2
The database server main program
28
3
 
45
20
Another possibility could be to use some very fast user space
46
21
thread library. This might confuse NT though.
47
22
 
 
23
(c) 1995 Innobase Oy
 
24
 
48
25
Created 10/8/1995 Heikki Tuuri
49
26
*******************************************************/
50
 
 
51
27
/* Dummy comment */
52
28
#include "srv0srv.h"
53
29
 
197
173
};
198
174
 
199
175
 
200
 
/* use os/external memory allocator */
201
 
UNIV_INTERN my_bool     srv_use_sys_malloc      = TRUE;
202
176
/* requested size in kilobytes */
203
 
UNIV_INTERN ulint       srv_buf_pool_size       = ULINT_MAX;
 
177
UNIV_INTERN ulong       srv_buf_pool_size       = ULINT_MAX;
204
178
/* previously requested size */
205
 
UNIV_INTERN ulint       srv_buf_pool_old_size;
 
179
UNIV_INTERN ulong       srv_buf_pool_old_size;
206
180
/* current size in kilobytes */
207
 
UNIV_INTERN ulint       srv_buf_pool_curr_size  = 0;
 
181
UNIV_INTERN ulong       srv_buf_pool_curr_size  = 0;
208
182
/* size in bytes */
209
183
UNIV_INTERN ulint       srv_mem_pool_size       = ULINT_MAX;
210
184
UNIV_INTERN ulint       srv_lock_table_size     = ULINT_MAX;
319
293
 
320
294
/* this mutex protects srv_conc data structures */
321
295
UNIV_INTERN os_fast_mutex_t     srv_conc_mutex;
322
 
/* number of transactions that have declared_to_be_inside_innodb set.
323
 
It used to be a non-error for this value to drop below zero temporarily.
324
 
This is no longer true. We'll, however, keep the lint datatype to add
325
 
assertions to catch any corner cases that we may have missed. */
 
296
/* number of OS threads currently inside InnoDB; it is not an error if
 
297
this drops temporarily below zero because we do not demand that every
 
298
thread increments this, but a thread waiting for a lock decrements
 
299
this temporarily */
326
300
UNIV_INTERN lint        srv_conc_n_threads      = 0;
327
301
/* number of OS threads waiting in the FIFO for a permission to enter
328
302
InnoDB */
1004
978
srv_general_init(void)
1005
979
/*==================*/
1006
980
{
1007
 
        ut_mem_init();
1008
981
        os_sync_init();
1009
982
        sync_init();
1010
983
        mem_init(srv_mem_pool_size);
1063
1036
                return;
1064
1037
        }
1065
1038
 
1066
 
        ut_ad(srv_conc_n_threads >= 0);
1067
 
 
1068
1039
        if (srv_conc_n_threads < (lint)srv_thread_concurrency) {
1069
1040
 
1070
1041
                srv_conc_n_threads++;
1191
1162
                return;
1192
1163
        }
1193
1164
 
1194
 
        ut_ad(srv_conc_n_threads >= 0);
1195
 
 
1196
1165
        os_fast_mutex_lock(&srv_conc_mutex);
1197
1166
 
1198
1167
        srv_conc_n_threads++;
1214
1183
{
1215
1184
        srv_conc_slot_t*        slot    = NULL;
1216
1185
 
 
1186
        if (UNIV_LIKELY(!srv_thread_concurrency)) {
 
1187
 
 
1188
                return;
 
1189
        }
 
1190
 
1217
1191
        if (trx->mysql_thd != NULL
1218
1192
            && thd_is_replication_slave_thread(trx->mysql_thd)) {
1219
1193
 
1227
1201
 
1228
1202
        os_fast_mutex_lock(&srv_conc_mutex);
1229
1203
 
1230
 
        ut_ad(srv_conc_n_threads > 0);
1231
1204
        srv_conc_n_threads--;
1232
1205
        trx->declared_to_be_inside_innodb = FALSE;
1233
1206
        trx->n_tickets_to_enter_innodb = 0;
1521
1494
 
1522
1495
        ut_a(trx->dict_operation_lock_mode == 0);
1523
1496
 
1524
 
        /* Suspend this thread and wait for the event. */
 
1497
        /* Wait for the release */
1525
1498
 
1526
1499
        os_event_wait(event);
1527
1500
 
1528
 
        /* After resuming, reacquire the data dictionary latch if
1529
 
        necessary. */
1530
 
 
1531
1501
        switch (had_dict_lock) {
1532
1502
        case RW_S_LATCH:
1533
1503
                row_mysql_freeze_data_dictionary(trx);
1884
1854
        export_vars.innodb_buffer_pool_pages_misc = buf_pool->curr_size
1885
1855
                - UT_LIST_GET_LEN(buf_pool->LRU)
1886
1856
                - UT_LIST_GET_LEN(buf_pool->free);
1887
 
#ifdef HAVE_GCC_ATOMIC_BUILTINS
1888
 
        export_vars.innodb_have_atomic_builtins = 1;
1889
 
#else
1890
 
        export_vars.innodb_have_atomic_builtins = 0;
1891
 
#endif
1892
1857
        export_vars.innodb_page_size = UNIV_PAGE_SIZE;
1893
1858
        export_vars.innodb_log_waits = srv_log_waits;
1894
1859
        export_vars.innodb_os_log_written = srv_os_log_written;
2691
2656
 
2692
2657
        goto loop;
2693
2658
 
2694
 
 
2695
 
#ifndef UNIV_SOLARIS
2696
2659
        OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */
2697
 
#endif
2698
2660
}
2699
2661
#endif /* !UNIV_HOTBACKUP */