~stewart/haildb/trunk

« back to all changes in this revision

Viewing changes to api/api0cfg.c

  • Committer: Stewart Smith
  • Date: 2010-04-09 07:57:43 UTC
  • Revision ID: stewart@flamingspork.com-20100409075743-jfh1oml3el1uouvh
Embedded InnoDB 1.0.0 released

2009-04-21      The InnoDB Team

        Embedded InnoDB 1.0.0 released

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************
 
2
Copyright (c) 2008 Innobase Oy. All rights reserved.
 
3
Copyright (c) 2008 Oracle. All rights reserved.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify
 
6
it under the terms of the GNU General Public License as published by
 
7
the Free Software Foundation; version 2 of the License.
 
8
 
 
9
This program is distributed in the hope that it will be useful,
 
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
GNU General Public License for more details.
 
13
 
 
14
You should have received a copy of the GNU General Public License
 
15
along with this program; if not, write to the Free Software
 
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
17
 
 
18
************************************************************************/
 
19
#include <stdarg.h>
 
20
 
 
21
#ifdef HAVE_STRINGS_H
 
22
#include <strings.h>
 
23
#endif
 
24
 
 
25
#include "univ.i"
 
26
#include "api0api.h"
 
27
#include "btr0sea.h"
 
28
#include "db0err.h"
 
29
#include "log0recv.h"
 
30
#include "srv0srv.h"
 
31
#include "srv0start.h"
 
32
#include "trx0sys.h" /* for trx_sys_file_format_name_to_id() */
 
33
#include "ut0mem.h" /* for ut_malloc() */
 
34
 
 
35
/* If set then we rollback the transaction on DB_LOCK_WAIT_TIMEOUT error. */
 
36
extern ibool    ses_rollback_on_timeout;
 
37
 
 
38
typedef enum ib_cfg_flag {
 
39
        IB_CFG_FLAG_NONE,
 
40
        IB_CFG_FLAG_READONLY_AFTER_STARTUP,     /* can be modified only before
 
41
                                                innodb is started */
 
42
        IB_CFG_FLAG_READONLY                    /* cannot be modified */
 
43
} ib_cfg_flag_t;
 
44
 
 
45
typedef struct ib_cfg_var {
 
46
        const char*     name;   /* config var name */
 
47
        ib_cfg_type_t   type;   /* config var type */
 
48
        ib_cfg_flag_t   flag;   /* config var flag */
 
49
        ib_uint64_t     min_val;/* minimum allowed value for numeric types,
 
50
                                ignored for other types */
 
51
        ib_int64_t      max_val;/* maximum allowed value for numeric types,
 
52
                                ignored for other types */
 
53
        ib_bool_t       (*validate)(const struct ib_cfg_var*, const void*); /*
 
54
                                function used to validate a new variable's
 
55
                                value when setting it */
 
56
        ib_bool_t       (*set)(struct ib_cfg_var*, const void*); /* function
 
57
                                used to set the variable's value */
 
58
        ib_bool_t       (*get)(const struct ib_cfg_var*, void*); /* function
 
59
                                used to get the variable's value */
 
60
        void*           tank;   /* opaque storage that may be used by the
 
61
                                set() and get() functions */
 
62
} ib_cfg_var_t;
 
63
 
 
64
/***********************************************************************
 
65
Assign src to dst according to type. */
 
66
static
 
67
ib_bool_t
 
68
ib_cfg_assign(
 
69
/*==========*/
 
70
                                /* out: IB_TRUE if assigned (type is known) */
 
71
        ib_cfg_type_t   type,   /* in: type of src and dst */
 
72
        void*           dst,    /* out: destination */
 
73
        const void*     src)    /* in: source */
 
74
{
 
75
        switch (type) {
 
76
        case IB_CFG_IBOOL: {
 
77
 
 
78
                *(ib_bool_t*) dst = *(const ib_bool_t*) src;
 
79
                return(IB_TRUE);
 
80
        }
 
81
 
 
82
        case IB_CFG_ULINT: {
 
83
 
 
84
                *(ulint*) dst = *(const ulint*) src;
 
85
                return(IB_TRUE);
 
86
        }
 
87
 
 
88
        case IB_CFG_ULONG: {
 
89
 
 
90
                *(ulong*) dst = *(const ulong*) src;
 
91
                return(IB_TRUE);
 
92
        }
 
93
 
 
94
        case IB_CFG_TEXT: {
 
95
                const char*     str;
 
96
                ulint           len;
 
97
 
 
98
                str = *(const char**) src;
 
99
 
 
100
                /* Release any previously allocated value. */
 
101
                if (*(char**) dst != NULL) {
 
102
                        ut_free(*(char**) dst);
 
103
                }
 
104
 
 
105
                len = ut_strlen(str) + 1;
 
106
 
 
107
                /* Since we are using ut_malloc(), it's guaranteed
 
108
                to be freed during shutdown. */
 
109
                *(char**) dst = ut_malloc(len);
 
110
                ut_strcpy(*(char**) dst, str);
 
111
                return(IB_TRUE);
 
112
        }
 
113
 
 
114
        case IB_CFG_CB: {
 
115
 
 
116
                *(ib_cb_t*) dst = *(ib_cb_t*) src;
 
117
                return(IB_TRUE);
 
118
        }
 
119
 
 
120
        default:
 
121
                return(IB_FALSE);
 
122
        }
 
123
}
 
124
 
 
125
/***********************************************************************
 
126
A generic function used for ib_cfg_var_t::validate() to check a numeric
 
127
type for min/max allowed value overflow. */
 
128
static
 
129
ib_bool_t
 
130
ib_cfg_var_validate_numeric(
 
131
/*========================*/
 
132
                                        /* out: IB_TRUE if value is in range */
 
133
        const struct ib_cfg_var* cfg_var,/* in/out: configuration variable to
 
134
                                        check */
 
135
        const void*             value)  /* in: value to check */
 
136
{
 
137
        switch (cfg_var->type) {
 
138
 
 
139
        case IB_CFG_ULINT: {
 
140
                ulint   v;
 
141
 
 
142
                v = *(ulint*) value;
 
143
 
 
144
                if ((ulint) cfg_var->min_val <= v
 
145
                    && v <= (ulint) cfg_var->max_val) {
 
146
 
 
147
                        return(IB_TRUE);
 
148
                } else {
 
149
 
 
150
                        return(IB_FALSE);
 
151
                }
 
152
        }
 
153
 
 
154
        case IB_CFG_ULONG: {
 
155
                ulong   v;
 
156
 
 
157
                v = *(ulong*) value;
 
158
 
 
159
                if ((ulong) cfg_var->min_val <= v
 
160
                    && v <= (ulong) cfg_var->max_val) {
 
161
 
 
162
                        return(IB_TRUE);
 
163
                } else {
 
164
 
 
165
                        return(IB_FALSE);
 
166
                }
 
167
        }
 
168
 
 
169
        default:
 
170
                ut_error;
 
171
        }
 
172
 
 
173
        return(IB_FALSE);
 
174
}
 
175
 
 
176
/***********************************************************************
 
177
A generic function used for ib_cfg_var_t::set() that stores the value
 
178
of the configuration parameter in the location pointed by
 
179
ib_cfg_var_t::tank. */
 
180
static
 
181
ib_bool_t
 
182
ib_cfg_var_set_generic(
 
183
/*===================*/
 
184
                                        /* out: IB_TRUE if set successfully */
 
185
        struct ib_cfg_var*      cfg_var,/* in/out: configuration variable to
 
186
                                        manipulate */
 
187
        const void*             value)  /* in: value to set */
 
188
{
 
189
        if (cfg_var->validate != NULL) {
 
190
                if (!cfg_var->validate(cfg_var, value)) {
 
191
                        return(IB_FALSE);
 
192
                }
 
193
        }
 
194
 
 
195
        return(ib_cfg_assign(cfg_var->type, cfg_var->tank, value));
 
196
}
 
197
 
 
198
/***********************************************************************
 
199
A generic function used for ib_cfg_var_t::get() that retrieves the value
 
200
of the configuration parameter from the location pointed by
 
201
ib_cfg_var_t::tank. */
 
202
static
 
203
ib_bool_t
 
204
ib_cfg_var_get_generic(
 
205
/*===================*/
 
206
                                                /* out: IB_TRUE if
 
207
                                                retrieved successfully */
 
208
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
209
                                                variable whose value to
 
210
                                                retrieve */
 
211
        void*                           value)  /* out: place to store
 
212
                                                the retrieved value */
 
213
{
 
214
        return(ib_cfg_assign(cfg_var->type, value, cfg_var->tank));
 
215
}
 
216
 
 
217
/***********************************************************************
 
218
Set the value of the config variable "adaptive_hash_index". */
 
219
static
 
220
ib_bool_t
 
221
ib_cfg_var_set_adaptive_hash_index(
 
222
/*===============================*/
 
223
                                        /* out: IB_TRUE if set successfully */
 
224
        struct ib_cfg_var*      cfg_var,/* in/out: configuration variable to
 
225
                                        manipulate, must be
 
226
                                        "adaptive_hash_index" */
 
227
        const void*             value)  /* in: value to set, must point to
 
228
                                        ib_bool_t variable */
 
229
{
 
230
        ut_a(strcasecmp(cfg_var->name, "adaptive_hash_index") == 0);
 
231
        ut_a(cfg_var->type == IB_CFG_IBOOL);
 
232
 
 
233
        btr_search_enabled = !(*(const ib_bool_t*) value);
 
234
 
 
235
        return(IB_TRUE);
 
236
}
 
237
 
 
238
/***********************************************************************
 
239
Retrieve the value of the config variable "adaptive_hash_index". */
 
240
static
 
241
ib_bool_t
 
242
ib_cfg_var_get_adaptive_hash_index(
 
243
/*===============================*/
 
244
                                                /* out: IB_TRUE if
 
245
                                                retrieved successfully */
 
246
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
247
                                                variable whose value to
 
248
                                                retrieve, must be
 
249
                                                "adaptive_hash_index" */
 
250
        void*                           value)  /* out: place to store
 
251
                                                the retrieved value, must
 
252
                                                point to ib_bool_t variable */
 
253
{
 
254
        ut_a(strcasecmp(cfg_var->name, "adaptive_hash_index") == 0);
 
255
        ut_a(cfg_var->type == IB_CFG_IBOOL);
 
256
 
 
257
        *(ib_bool_t*) value = !btr_search_enabled;
 
258
 
 
259
        return(IB_TRUE);
 
260
}
 
261
 
 
262
/***********************************************************************
 
263
Set the value of the config variable "data_file_path". */
 
264
static
 
265
ib_bool_t
 
266
ib_cfg_var_set_data_file_path(
 
267
/*==========================*/
 
268
                                        /* out: IB_TRUE if set successfully */
 
269
        struct ib_cfg_var*      cfg_var,/* in/out: configuration variable to
 
270
                                        manipulate, must be
 
271
                                        "data_file_path" */
 
272
        const void*             value)  /* in: value to set, must point to
 
273
                                        char* variable */
 
274
{
 
275
        const char*     value_str;
 
276
 
 
277
        ut_a(strcasecmp(cfg_var->name, "data_file_path") == 0);
 
278
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
279
 
 
280
        value_str = *(char**) value;
 
281
 
 
282
        return(srv_parse_data_file_paths_and_sizes(value_str));
 
283
}
 
284
 
 
285
/***********************************************************************
 
286
Retrieve the value of the config variable "data_file_path". */
 
287
static
 
288
ib_bool_t
 
289
ib_cfg_var_get_data_file_path(
 
290
/*==========================*/
 
291
                                                /* out: IB_TRUE if
 
292
                                                retrieved successfully */
 
293
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
294
                                                variable whose value to
 
295
                                                retrieve, must be
 
296
                                                "data_file_path" */
 
297
        void*                           value)  /* out: place to store
 
298
                                                the retrieved value, must
 
299
                                                point to char* variable */
 
300
{
 
301
        ut_a(strcasecmp(cfg_var->name, "data_file_path") == 0);
 
302
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
303
 
 
304
        *(char**) value = srv_data_file_paths_and_sizes;
 
305
 
 
306
        return(IB_TRUE);
 
307
}
 
308
 
 
309
/***********************************************************************
 
310
Set the value of the config variable "file_format". */
 
311
static
 
312
ib_bool_t
 
313
ib_cfg_var_set_file_format(
 
314
/*=======================*/
 
315
                                        /* out: IB_TRUE if set successfully */
 
316
        struct ib_cfg_var*      cfg_var,/* in/out: configuration variable to
 
317
                                        manipulate, must be "file_format" */
 
318
        const void*             value)  /* in: value to set, must point to
 
319
                                        char* variable */
 
320
{
 
321
        ulint           format_id;
 
322
 
 
323
        ut_a(strcasecmp(cfg_var->name, "file_format") == 0);
 
324
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
325
 
 
326
        format_id = trx_sys_file_format_name_to_id(*(char**) value);
 
327
 
 
328
        if (format_id > DICT_TF_FORMAT_MAX) {
 
329
                return(IB_FALSE);
 
330
        }
 
331
 
 
332
        srv_file_format = format_id;
 
333
 
 
334
        return(IB_TRUE);
 
335
}
 
336
 
 
337
/***********************************************************************
 
338
Retrieve the value of the config variable "file_format". */
 
339
static
 
340
ib_bool_t
 
341
ib_cfg_var_get_file_format(
 
342
/*=======================*/
 
343
                                                /* out: IB_TRUE if
 
344
                                                retrieved successfully */
 
345
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
346
                                                variable whose value to
 
347
                                                retrieve, must be
 
348
                                                "file_format" */
 
349
        void*                           value)  /* out: place to store
 
350
                                                the retrieved value, must
 
351
                                                point to char* variable */
 
352
{
 
353
        ut_a(strcasecmp(cfg_var->name, "file_format") == 0);
 
354
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
355
 
 
356
        *(const char**) value = trx_sys_file_format_id_to_name(
 
357
                srv_file_format);
 
358
 
 
359
        return(IB_TRUE);
 
360
}
 
361
 
 
362
/***********************************************************************
 
363
Set the value of the config variable "log_group_home_dir". */
 
364
static
 
365
ib_bool_t
 
366
ib_cfg_var_set_log_group_home_dir(
 
367
/*==============================*/
 
368
                                        /* out: IB_TRUE if set successfully */
 
369
        struct ib_cfg_var*      cfg_var,/* in/out: configuration variable to
 
370
                                        manipulate, must be
 
371
                                        "log_group_home_dir" */
 
372
        const void*             value)  /* in: value to set, must point to
 
373
                                        char* variable */
 
374
{
 
375
        const char*     value_str;
 
376
 
 
377
        ut_a(strcasecmp(cfg_var->name, "log_group_home_dir") == 0);
 
378
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
379
 
 
380
        ut_a(srv_log_group_home_dir == NULL);
 
381
 
 
382
        value_str = *(char**) value;
 
383
 
 
384
        return(srv_parse_log_group_home_dirs(value_str));
 
385
}
 
386
 
 
387
/***********************************************************************
 
388
Retrieve the value of the config variable "log_group_home_dir". */
 
389
static
 
390
ib_bool_t
 
391
ib_cfg_var_get_log_group_home_dir(
 
392
/*==============================*/
 
393
                                                /* out: IB_TRUE if
 
394
                                                retrieved successfully */
 
395
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
396
                                                variable whose value to
 
397
                                                retrieve, must be
 
398
                                                "log_group_home_dir" */
 
399
        void*                           value)  /* out: place to store
 
400
                                                the retrieved value, must
 
401
                                                point to char* variable */
 
402
{
 
403
        ut_a(strcasecmp(cfg_var->name, "log_group_home_dir") == 0);
 
404
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
405
 
 
406
        *(const char**) value = NULL;
 
407
 
 
408
        return(IB_TRUE);
 
409
}
 
410
 
 
411
/* There is no ib_cfg_var_set_version() */
 
412
 
 
413
/***********************************************************************
 
414
Retrieve the value of the config variable "version". */
 
415
static
 
416
ib_bool_t
 
417
ib_cfg_var_get_version(
 
418
/*===================*/
 
419
                                                /* out: IB_TRUE if
 
420
                                                retrieved successfully */
 
421
        const struct ib_cfg_var*        cfg_var,/* in: configuration
 
422
                                                variable whose value to
 
423
                                                retrieve, must be
 
424
                                                "version" */
 
425
        void*                           value)  /* out: place to store
 
426
                                                the retrieved value, must
 
427
                                                point to char* variable */
 
428
{
 
429
        ut_a(strcasecmp(cfg_var->name, "version") == 0);
 
430
        ut_a(cfg_var->type == IB_CFG_TEXT);
 
431
 
 
432
        *(const char**) value = INNODB_VERSION_STR;
 
433
 
 
434
        return(IB_TRUE);
 
435
}
 
436
 
 
437
static ib_cfg_var_t cfg_vars[] = {
 
438
        {STRUCT_FLD(name,       "adaptive_hash_index"),
 
439
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
440
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
441
         STRUCT_FLD(min_val,    0),
 
442
         STRUCT_FLD(max_val,    0),
 
443
         STRUCT_FLD(validate,   NULL),
 
444
         STRUCT_FLD(set,        ib_cfg_var_set_adaptive_hash_index),
 
445
         STRUCT_FLD(get,        ib_cfg_var_get_adaptive_hash_index),
 
446
         STRUCT_FLD(tank,       NULL)},
 
447
 
 
448
        {STRUCT_FLD(name,       "additional_mem_pool_size"),
 
449
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
450
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
451
         STRUCT_FLD(min_val,    512 * 1024),
 
452
         STRUCT_FLD(max_val,    ~0L),
 
453
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
454
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
455
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
456
         STRUCT_FLD(tank,       &srv_mem_pool_size)},
 
457
 
 
458
        {STRUCT_FLD(name,       "autoextend_increment"),
 
459
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
460
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
461
         STRUCT_FLD(min_val,    1),
 
462
         STRUCT_FLD(max_val,    1000),
 
463
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
464
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
465
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
466
         STRUCT_FLD(tank,       &srv_auto_extend_increment)},
 
467
 
 
468
        {STRUCT_FLD(name,       "buffer_pool_size"),
 
469
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
470
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
471
         STRUCT_FLD(min_val,    5 * 1024 * 1024),
 
472
         STRUCT_FLD(max_val,    ULINT_MAX),
 
473
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
474
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
475
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
476
         STRUCT_FLD(tank,       &srv_buf_pool_size)},
 
477
 
 
478
        {STRUCT_FLD(name,       "checksums"),
 
479
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
480
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
481
         STRUCT_FLD(min_val,    0),
 
482
         STRUCT_FLD(max_val,    0),
 
483
         STRUCT_FLD(validate,   NULL),
 
484
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
485
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
486
         STRUCT_FLD(tank,       &srv_use_checksums)},
 
487
 
 
488
        {STRUCT_FLD(name,       "commit_concurrency"),
 
489
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
490
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
491
         STRUCT_FLD(min_val,    0),
 
492
         STRUCT_FLD(max_val,    1000),
 
493
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
494
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
495
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
496
         STRUCT_FLD(tank,       &srv_commit_concurrency)},
 
497
 
 
498
        {STRUCT_FLD(name,       "concurrency_tickets"),
 
499
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
500
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
501
         STRUCT_FLD(min_val,    1),
 
502
         STRUCT_FLD(max_val,    ~0L),
 
503
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
504
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
505
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
506
         STRUCT_FLD(tank,       &srv_n_free_tickets_to_enter)},
 
507
 
 
508
        {STRUCT_FLD(name,       "data_file_path"),
 
509
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
510
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
511
         STRUCT_FLD(min_val,    0),
 
512
         STRUCT_FLD(max_val,    0),
 
513
         STRUCT_FLD(validate,   NULL),
 
514
         STRUCT_FLD(set,        ib_cfg_var_set_data_file_path),
 
515
         STRUCT_FLD(get,        ib_cfg_var_get_data_file_path),
 
516
         STRUCT_FLD(tank,       NULL)},
 
517
 
 
518
        {STRUCT_FLD(name,       "data_home_dir"),
 
519
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
520
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
521
         STRUCT_FLD(min_val,    0),
 
522
         STRUCT_FLD(max_val,    0),
 
523
         STRUCT_FLD(validate,   NULL),
 
524
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
525
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
526
         STRUCT_FLD(tank,       &srv_data_home)},
 
527
 
 
528
        {STRUCT_FLD(name,       "doublewrite"),
 
529
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
530
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
531
         STRUCT_FLD(min_val,    0),
 
532
         STRUCT_FLD(max_val,    0),
 
533
         STRUCT_FLD(validate,   NULL),
 
534
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
535
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
536
         STRUCT_FLD(tank,       &srv_use_doublewrite_buf)},
 
537
 
 
538
        {STRUCT_FLD(name,       "fast_shutdown"),
 
539
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
540
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
541
         STRUCT_FLD(min_val,    0),
 
542
         STRUCT_FLD(max_val,    2),
 
543
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
544
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
545
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
546
         STRUCT_FLD(tank,       &srv_fast_shutdown)},
 
547
 
 
548
        {STRUCT_FLD(name,       "file_format"),
 
549
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
550
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
551
         STRUCT_FLD(min_val,    0),
 
552
         STRUCT_FLD(max_val,    0),
 
553
         STRUCT_FLD(validate,   NULL /* validation is done inside
 
554
                                     ib_cfg_var_set_file_format */),
 
555
         STRUCT_FLD(set,        ib_cfg_var_set_file_format),
 
556
         STRUCT_FLD(get,        ib_cfg_var_get_file_format),
 
557
         STRUCT_FLD(tank,       NULL)},
 
558
 
 
559
        {STRUCT_FLD(name,       "file_io_threads"),
 
560
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
561
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
562
         STRUCT_FLD(min_val,    4),
 
563
         STRUCT_FLD(max_val,    64),
 
564
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
565
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
566
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
567
         STRUCT_FLD(tank,       &srv_n_file_io_threads)},
 
568
 
 
569
        {STRUCT_FLD(name,       "file_per_table"),
 
570
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
571
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
572
         STRUCT_FLD(min_val,    0),
 
573
         STRUCT_FLD(max_val,    0),
 
574
         STRUCT_FLD(validate,   NULL),
 
575
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
576
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
577
         STRUCT_FLD(tank,       &srv_file_per_table)},
 
578
 
 
579
        {STRUCT_FLD(name,       "flush_log_at_trx_commit"),
 
580
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
581
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
582
         STRUCT_FLD(min_val,    0),
 
583
         STRUCT_FLD(max_val,    2),
 
584
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
585
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
586
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
587
         STRUCT_FLD(tank,       &srv_flush_log_at_trx_commit)},
 
588
 
 
589
        {STRUCT_FLD(name,       "flush_method"),
 
590
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
591
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
592
         STRUCT_FLD(min_val,    0),
 
593
         STRUCT_FLD(max_val,    0),
 
594
         STRUCT_FLD(validate,   NULL),
 
595
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
596
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
597
         STRUCT_FLD(tank,       &srv_file_flush_method_str)},
 
598
 
 
599
        {STRUCT_FLD(name,       "force_recovery"),
 
600
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
601
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
602
         STRUCT_FLD(min_val,    0),
 
603
         STRUCT_FLD(max_val,    6),
 
604
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
605
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
606
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
607
         STRUCT_FLD(tank,       &srv_force_recovery)},
 
608
 
 
609
        {STRUCT_FLD(name,       "lock_wait_timeout"),
 
610
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
611
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
612
         STRUCT_FLD(min_val,    1),
 
613
         STRUCT_FLD(max_val,    1024 * 1024 * 1024),
 
614
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
615
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
616
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
617
         STRUCT_FLD(tank,       &ses_lock_wait_timeout)},
 
618
 
 
619
        {STRUCT_FLD(name,       "log_buffer_size"),
 
620
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
621
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
622
         STRUCT_FLD(min_val,    256 * 1024),
 
623
         STRUCT_FLD(max_val,    ~0L),
 
624
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
625
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
626
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
627
         STRUCT_FLD(tank,       &srv_log_buffer_size)},
 
628
 
 
629
        {STRUCT_FLD(name,       "log_file_size"),
 
630
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
631
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
632
         STRUCT_FLD(min_val,    1024 * 1024),
 
633
         STRUCT_FLD(max_val,    ULINT_MAX),
 
634
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
635
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
636
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
637
         STRUCT_FLD(tank,       &srv_log_file_size)},
 
638
 
 
639
        {STRUCT_FLD(name,       "log_files_in_group"),
 
640
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
641
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
642
         STRUCT_FLD(min_val,    2),
 
643
         STRUCT_FLD(max_val,    100),
 
644
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
645
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
646
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
647
         STRUCT_FLD(tank,       &srv_n_log_files)},
 
648
 
 
649
        {STRUCT_FLD(name,       "log_group_home_dir"),
 
650
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
651
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
652
         STRUCT_FLD(min_val,    0),
 
653
         STRUCT_FLD(max_val,    0),
 
654
         STRUCT_FLD(validate,   NULL),
 
655
         STRUCT_FLD(set,        ib_cfg_var_set_log_group_home_dir),
 
656
         STRUCT_FLD(get,        ib_cfg_var_get_log_group_home_dir),
 
657
         STRUCT_FLD(tank,       NULL)},
 
658
 
 
659
        {STRUCT_FLD(name,       "max_dirty_pages_pct"),
 
660
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
661
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
662
         STRUCT_FLD(min_val,    0),
 
663
         STRUCT_FLD(max_val,    100),
 
664
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
665
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
666
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
667
         STRUCT_FLD(tank,       &srv_max_buf_pool_modified_pct)},
 
668
 
 
669
        {STRUCT_FLD(name,       "max_purge_lag"),
 
670
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
671
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
672
         STRUCT_FLD(min_val,    0),
 
673
         STRUCT_FLD(max_val,    ~0L),
 
674
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
675
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
676
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
677
         STRUCT_FLD(tank,       &srv_max_purge_lag)},
 
678
 
 
679
        {STRUCT_FLD(name,       "mirrored_log_groups"),
 
680
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
681
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
682
         STRUCT_FLD(min_val,    1),
 
683
         STRUCT_FLD(max_val,    10),
 
684
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
685
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
686
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
687
         STRUCT_FLD(tank,       &srv_n_log_groups)},
 
688
 
 
689
        {STRUCT_FLD(name,       "open_files"),
 
690
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
691
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY_AFTER_STARTUP),
 
692
         STRUCT_FLD(min_val,    10),
 
693
         STRUCT_FLD(max_val,    ~0L),
 
694
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
695
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
696
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
697
         STRUCT_FLD(tank,       &srv_max_n_open_files)},
 
698
 
 
699
        /* New, not present in InnoDB/MySQL */
 
700
        {STRUCT_FLD(name,       "pre_rollback_hook"),
 
701
         STRUCT_FLD(type,       IB_CFG_CB),
 
702
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
703
         STRUCT_FLD(min_val,    0),
 
704
         STRUCT_FLD(max_val,    0),
 
705
         STRUCT_FLD(validate,   NULL),
 
706
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
707
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
708
         STRUCT_FLD(tank,       &recv_pre_rollback_hook)},
 
709
 
 
710
        /* New, not present in InnoDB/MySQL */
 
711
        {STRUCT_FLD(name,       "print_verbose_log"),
 
712
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
713
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
714
         STRUCT_FLD(min_val,    0),
 
715
         STRUCT_FLD(max_val,    0),
 
716
         STRUCT_FLD(validate,   NULL),
 
717
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
718
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
719
         STRUCT_FLD(tank,       &srv_print_verbose_log)},
 
720
 
 
721
        /* New, not present in InnoDB/MySQL */
 
722
        {STRUCT_FLD(name,       "rollback_on_timeout"),
 
723
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
724
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
725
         STRUCT_FLD(min_val,    0),
 
726
         STRUCT_FLD(max_val,    0),
 
727
         STRUCT_FLD(validate,   NULL),
 
728
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
729
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
730
         STRUCT_FLD(tank,       &ses_rollback_on_timeout)},
 
731
 
 
732
        {STRUCT_FLD(name,       "stats_sample_pages"),
 
733
         STRUCT_FLD(type,       IB_CFG_ULINT),
 
734
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
735
         STRUCT_FLD(min_val,    1),
 
736
         STRUCT_FLD(max_val,    ULINT_MAX),
 
737
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
738
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
739
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
740
         STRUCT_FLD(tank,       &srv_stats_sample_pages)},
 
741
 
 
742
        {STRUCT_FLD(name,       "status_file"),
 
743
         STRUCT_FLD(type,       IB_CFG_IBOOL),
 
744
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
745
         STRUCT_FLD(min_val,    0),
 
746
         STRUCT_FLD(max_val,    0),
 
747
         STRUCT_FLD(validate,   NULL),
 
748
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
749
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
750
         STRUCT_FLD(tank,       &srv_innodb_status)},
 
751
 
 
752
        {STRUCT_FLD(name,       "sync_spin_loops"),
 
753
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
754
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
755
         STRUCT_FLD(min_val,    0),
 
756
         STRUCT_FLD(max_val,    ~0L),
 
757
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
758
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
759
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
760
         STRUCT_FLD(tank,       &srv_n_spin_wait_rounds)},
 
761
 
 
762
        {STRUCT_FLD(name,       "thread_concurrency"),
 
763
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
764
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
765
         STRUCT_FLD(min_val,    0),
 
766
         STRUCT_FLD(max_val,    1000),
 
767
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
768
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
769
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
770
         STRUCT_FLD(tank,       &srv_thread_concurrency)},
 
771
 
 
772
        {STRUCT_FLD(name,       "thread_sleep_delay"),
 
773
         STRUCT_FLD(type,       IB_CFG_ULONG),
 
774
         STRUCT_FLD(flag,       IB_CFG_FLAG_NONE),
 
775
         STRUCT_FLD(min_val,    0),
 
776
         STRUCT_FLD(max_val,    ~0L),
 
777
         STRUCT_FLD(validate,   ib_cfg_var_validate_numeric),
 
778
         STRUCT_FLD(set,        ib_cfg_var_set_generic),
 
779
         STRUCT_FLD(get,        ib_cfg_var_get_generic),
 
780
         STRUCT_FLD(tank,       &srv_thread_sleep_delay)},
 
781
 
 
782
        {STRUCT_FLD(name,       "version"),
 
783
         STRUCT_FLD(type,       IB_CFG_TEXT),
 
784
         STRUCT_FLD(flag,       IB_CFG_FLAG_READONLY),
 
785
         STRUCT_FLD(min_val,    0),
 
786
         STRUCT_FLD(max_val,    0),
 
787
         STRUCT_FLD(validate,   NULL),
 
788
         STRUCT_FLD(set,        NULL /* The ::set() function should never
 
789
                                     be called because this variable is
 
790
                                     flagged as IB_CFG_FLAG_READONLY */),
 
791
         STRUCT_FLD(get,        ib_cfg_var_get_version),
 
792
         STRUCT_FLD(tank,       NULL)},
 
793
};
 
794
 
 
795
/*************************************************************************
 
796
Lookup a variable name. */
 
797
static
 
798
ib_cfg_var_t*
 
799
ib_cfg_lookup_var(
 
800
/*==============*/
 
801
                                        /* out: config variable instance if
 
802
                                        found else NULL */
 
803
        const char*     var)            /* in: variable name */
 
804
{
 
805
        ulint           i;
 
806
 
 
807
        for (i = 0; i < UT_ARR_SIZE(cfg_vars); ++i) {
 
808
                ib_cfg_var_t*   cfg_var;
 
809
 
 
810
                cfg_var = &cfg_vars[i];
 
811
 
 
812
                if (strcasecmp(var, cfg_var->name) == 0) {
 
813
                        return(cfg_var);
 
814
                }
 
815
        }
 
816
 
 
817
        return(NULL);
 
818
}
 
819
 
 
820
/*************************************************************************
 
821
Get the type of a configuration variable. Returns IB_TRUE if "type" was
 
822
set, IB_FALSE if no such variable. */
 
823
UNIV_INTERN
 
824
ib_bool_t
 
825
ib_cfg_var_get_type(
 
826
/*================*/
 
827
                                /* out: IB_TRUE if successful */
 
828
        const char*     name,   /* in: variable name */
 
829
        ib_cfg_type_t*  type)   /* out: variable type */
 
830
{
 
831
        ib_cfg_var_t*   cfg_var;
 
832
 
 
833
        cfg_var = ib_cfg_lookup_var(name);
 
834
 
 
835
        if (cfg_var != NULL) {
 
836
                *type = cfg_var->type;
 
837
                return(IB_TRUE);
 
838
        }
 
839
 
 
840
        return(IB_FALSE);
 
841
}
 
842
 
 
843
/*************************************************************************
 
844
Set a configuration variable. "ap" must contain one argument whose type
 
845
depends on the type of the variable with the given "name". */
 
846
UNIV_INTERN
 
847
ib_bool_t
 
848
ib_cfg_set_ap(
 
849
/*==========*/
 
850
                                        /* out: IB_TRUE if set */
 
851
        const char*     name,           /* in: variable name */
 
852
        va_list         ap)             /* in: variable value */
 
853
{
 
854
        ib_cfg_var_t*   cfg_var;
 
855
 
 
856
        if (!ib_cfg_are_defaults_set) {
 
857
                ib_cfg_set_defaults();
 
858
        }
 
859
 
 
860
        cfg_var = ib_cfg_lookup_var(name);
 
861
 
 
862
        if (cfg_var != NULL) {
 
863
 
 
864
                /* check whether setting the variable is appropriate,
 
865
                according to its flag */
 
866
                switch (cfg_var->flag) {
 
867
                case IB_CFG_FLAG_NONE:
 
868
                        break;
 
869
 
 
870
                case IB_CFG_FLAG_READONLY_AFTER_STARTUP:
 
871
                        if (srv_was_started) {
 
872
                                return(IB_FALSE);
 
873
                        }
 
874
                        break;
 
875
 
 
876
                case IB_CFG_FLAG_READONLY:
 
877
                        return(IB_FALSE);
 
878
                }
 
879
 
 
880
                /* get the parameter according to its type and call ::set() */
 
881
                switch (cfg_var->type) {
 
882
                case IB_CFG_IBOOL: {
 
883
                        int     value;
 
884
 
 
885
                        value = va_arg(ap, int);
 
886
 
 
887
                        return(cfg_var->set(cfg_var, &value));
 
888
                }
 
889
 
 
890
                case IB_CFG_ULINT: {
 
891
                        ulint   value;
 
892
 
 
893
                        value = va_arg(ap, ulint);
 
894
 
 
895
                        return(cfg_var->set(cfg_var, &value));
 
896
                }
 
897
 
 
898
                case IB_CFG_ULONG: {
 
899
                        ulong   value;
 
900
 
 
901
                        value = va_arg(ap, ulong);
 
902
 
 
903
                        return(cfg_var->set(cfg_var, &value));
 
904
                }
 
905
 
 
906
                case IB_CFG_TEXT: {
 
907
                        const char*     value;
 
908
 
 
909
                        value = va_arg(ap, const char*);
 
910
 
 
911
                        return(cfg_var->set(cfg_var, &value));
 
912
                }
 
913
 
 
914
                case IB_CFG_CB: {
 
915
                        ib_cb_t value;
 
916
 
 
917
                        value = va_arg(ap, ib_cb_t);
 
918
 
 
919
                        return(cfg_var->set(cfg_var, &value));
 
920
                }
 
921
 
 
922
                default:
 
923
                        return(IB_FALSE);
 
924
                }
 
925
        }
 
926
 
 
927
        return(IB_FALSE);
 
928
}
 
929
 
 
930
/*************************************************************************
 
931
Set a configuration variable. The second argument's type depends on the
 
932
type of the variable with the given "name". */
 
933
UNIV_INTERN
 
934
ib_bool_t
 
935
ib_cfg_set(
 
936
/*=======*/
 
937
                                /* out: IB_TRUE if set */
 
938
        const char*     name,   /* in: variable name */
 
939
        ...)                    /* in: variable value */
 
940
{
 
941
        va_list         ap;
 
942
        ib_bool_t       ret;
 
943
 
 
944
        va_start(ap, name);
 
945
 
 
946
        ret = ib_cfg_set_ap(name, ap);
 
947
 
 
948
        va_end(ap);
 
949
 
 
950
        return(ret);
 
951
}
 
952
 
 
953
/*************************************************************************
 
954
Get the value of a configuration variable. The type of the returned value
 
955
depends on the type of the configuration variable. IB_FALSE is returned if
 
956
no such variable exists. */
 
957
UNIV_INTERN
 
958
ib_bool_t
 
959
ib_cfg_get(
 
960
/*=======*/
 
961
                                /* out: IB_TRUE if retrieved successfully */
 
962
        const char*     name,   /* in: variable name */
 
963
        void*           value)  /* out: place to store the retrieved
 
964
                                value */
 
965
{
 
966
        ib_cfg_var_t*   cfg_var;
 
967
 
 
968
        cfg_var = ib_cfg_lookup_var(name);
 
969
 
 
970
        if (cfg_var != NULL) {
 
971
                return(cfg_var->get(cfg_var, value));
 
972
        }
 
973
 
 
974
        return(IB_FALSE);
 
975
}
 
976
 
 
977
/* Used to indicate whether the default values of the configuration
 
978
variables have been set or not. This is needed because we want to set
 
979
the defaults in ib_startup(), but we do not want to overwrite settings
 
980
possibly done by the user with ib_cfg_set() before he called ib_startup().
 
981
So if the first function invoked by the user is ib_startup() we call
 
982
ib_cfg_set_defaults() from there. Otherwise, if he calls ib_cfg_set()
 
983
first, then we call ib_cfg_set_defaults() from ib_cfg_set(). */
 
984
ib_bool_t       ib_cfg_are_defaults_set = IB_FALSE;
 
985
 
 
986
/*************************************************************************
 
987
Set the default values of some variables, others get their defaults when
 
988
declared (in srv0srv.c). */
 
989
UNIV_INTERN
 
990
void
 
991
ib_cfg_set_defaults()
 
992
/*=================*/
 
993
{
 
994
        ut_a(ib_cfg_are_defaults_set == FALSE);
 
995
 
 
996
        ib_cfg_are_defaults_set = IB_TRUE;
 
997
#define IB_CFG_SET_DEFAULT(name, var) if (!ib_cfg_set(name, var)) ut_error
 
998
 
 
999
        IB_CFG_SET_DEFAULT("additional_mem_pool_size", 4 * 1024 * 1024);
 
1000
        IB_CFG_SET_DEFAULT("buffer_pool_size", 8 * 1024 * 1024);
 
1001
        IB_CFG_SET_DEFAULT("data_file_path", "ibdata1:32M:autoextend");
 
1002
        IB_CFG_SET_DEFAULT("data_home_dir", ".");
 
1003
        IB_CFG_SET_DEFAULT("file_io_threads", 4);
 
1004
        IB_CFG_SET_DEFAULT("file_per_table", IB_TRUE);
 
1005
        IB_CFG_SET_DEFAULT("flush_method", "fsync");
 
1006
        IB_CFG_SET_DEFAULT("lock_wait_timeout", 60);
 
1007
        IB_CFG_SET_DEFAULT("log_buffer_size", 384 * 1024);
 
1008
        IB_CFG_SET_DEFAULT("log_file_size", 16 * 1024 * 1024);
 
1009
        IB_CFG_SET_DEFAULT("log_files_in_group", 2);
 
1010
        IB_CFG_SET_DEFAULT("log_group_home_dir", "log");
 
1011
        /* XXX ha_innodb.cc says mirrored_log_groups should be set to 1,
 
1012
        why is it set to 2? */
 
1013
        IB_CFG_SET_DEFAULT("mirrored_log_groups", 2);
 
1014
        IB_CFG_SET_DEFAULT("rollback_on_timeout", IB_TRUE);
 
1015
#undef IB_CFG_SET_DEFAULT
 
1016
}