~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

Removed dead variable, sorted authors file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
 
21
 
/**
22
 
 * @file
23
 
 *
24
 
 * Mostly constants and some macros/functions used by the server  
25
 
 */
26
 
 
27
 
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
28
 
#define DRIZZLE_SERVER_DEFINITIONS_H
29
 
 
30
 
#ifndef NO_ALARM_LOOP
31
 
#define NO_ALARM_LOOP           /* lib5 and popen can't use alarm */
32
 
#endif
33
 
 
34
 
/* These paths are converted to other systems (WIN95) before use */
35
 
 
36
 
#define LANGUAGE        "english/"
37
 
#define ERRMSG_FILE     "errmsg.sys"
38
 
#define TEMP_PREFIX     "MY"
39
 
#define LOG_PREFIX      "ML"
40
 
#define PROGDIR         "bin/"
41
 
#ifndef DATADIR
42
 
#define DATADIR         "data/"
43
 
#endif
44
 
#ifndef SHAREDIR
45
 
#define SHAREDIR        "share/"
46
 
#endif
47
 
#ifndef PLUGINDIR
48
 
#define PLUGINDIR       "lib/plugin"
49
 
#endif
50
 
 
51
 
#define ER(X) _(drizzled_error_messages[(X) - ER_ERROR_FIRST])
52
 
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : _("Invalid error code"))
53
 
 
54
 
#define ERRMAPP 1                               /* Errormap f|r my_error */
55
 
#define LIBLEN FN_REFLEN-FN_LEN                 /* Max l{ngd p} dev */
56
 
/* extra 4+4 bytes for slave tmp tables */
57
 
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
58
 
#define MAX_ALIAS_NAME 256
59
 
#define MAX_FIELD_NAME 34                       /* Max colum name length +2 */
60
 
#define MAX_SYS_VAR_LENGTH 32
61
 
#define MAX_KEY MAX_INDEXES                     /* Max used keys */
62
 
#define MAX_REF_PARTS 16                        /* Max parts used as ref */
63
 
#define MAX_KEY_LENGTH 4096                     /* max possible key */
64
 
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4          /* strlen("4096") */
65
 
#if SIZEOF_OFF_T > 4
66
 
#define MAX_REFLENGTH 8                         /* Max length for record ref */
67
 
#else
68
 
#define MAX_REFLENGTH 4                         /* Max length for record ref */
69
 
#endif
70
 
#define MAX_HOSTNAME  61                        /* len+1 in mysql.user */
71
 
 
72
 
#define MAX_MBWIDTH             4               /* Max multibyte sequence */
73
 
#define MAX_FIELD_CHARLENGTH    255
74
 
#define MAX_FIELD_VARCHARLENGTH 65535
75
 
#define CONVERT_IF_BIGGER_TO_BLOB 512           /* Used for CREATE ... SELECT */
76
 
 
77
 
/* Max column width +1 */
78
 
#define MAX_FIELD_WIDTH         (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
79
 
 
80
 
#define MAX_BIT_FIELD_LENGTH    64      /* Max length in bits for bit fields */
81
 
 
82
 
#define MAX_DATE_WIDTH          10      /* YYYY-MM-DD */
83
 
#define MAX_TIME_WIDTH          23      /* -DDDDDD HH:MM:SS.###### */
84
 
#define MAX_DATETIME_FULL_WIDTH 29      /* YYYY-MM-DD HH:MM:SS.###### AM */
85
 
#define MAX_DATETIME_WIDTH      19      /* YYYY-MM-DD HH:MM:SS */
86
 
#define MAX_DATETIME_COMPRESSED_WIDTH 14  /* YYYYMMDDHHMMSS */
87
 
 
88
 
#define MAX_TABLES      (sizeof(table_map)*8-3) /* Max tables in join */
89
 
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
90
 
#define OUTER_REF_TABLE_BIT     (((table_map) 1) << (sizeof(table_map)*8-2))
91
 
#define RAND_TABLE_BIT  (((table_map) 1) << (sizeof(table_map)*8-1))
92
 
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
93
 
                           RAND_TABLE_BIT)
94
 
#define MAX_FIELDS      4096                    /* Limit in the .frm file */
95
 
 
96
 
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
97
 
 
98
 
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
99
 
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
100
 
 
101
 
/* Memory allocated when parsing a statement / saving a statement */
102
 
#define MEM_ROOT_BLOCK_SIZE       8192
103
 
#define MEM_ROOT_PREALLOC         8192
104
 
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
105
 
#define TRANS_MEM_ROOT_PREALLOC   4096
106
 
 
107
 
#define DEFAULT_ERROR_COUNT     64
108
 
#define EXTRA_RECORDS   10                      /* Extra records in sort */
109
 
#define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
110
 
#define FIELD_NAME_USED ((uint) 32768)          /* Bit set if fieldname used */
111
 
#define FORM_NAME_USED  ((uint) 16384)          /* Bit set if formname used */
112
 
#define FIELD_NR_MASK   16383                   /* To get fieldnumber */
113
 
#define FERR            -1                      /* Error from my_functions */
114
 
#define CREATE_MODE     0                       /* Default mode on new files */
115
 
#define NAMES_SEP_CHAR  '\377'                  /* Char to sep. names */
116
 
 
117
 
#define READ_RECORD_BUFFER      (uint) (IO_SIZE*8) /* Pointer_buffer_size */
118
 
#define DISK_BUFFER_SIZE        (uint) (IO_SIZE*16) /* Size of diskbuffer */
119
 
 
120
 
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
121
 
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
122
 
#define MYF_RW MYF(MY_WME+MY_NABP)              /* Vid my_read & my_write */
123
 
 
124
 
        /* Extern defines */
125
 
#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
126
 
#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
127
 
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
128
 
#define empty_record(A)                                 \
129
 
  do {                                                  \
130
 
    restore_record((A),s->default_values);              \
131
 
    memset((A)->null_flags, 255, (A)->s->null_bytes);   \
132
 
  } while (0)
133
 
 
134
 
        /* Defines for use with openfrm, openprt and openfrd */
135
 
 
136
 
#define READ_ALL                1       /* openfrm: Read all parameters */
137
 
#define CHANGE_FRM              2       /* openfrm: open .frm as O_RDWR */
138
 
#define EXTRA_RECORD            8       /* Reservera plats f|r extra record */
139
 
#define DONT_GIVE_ERROR         256     /* Don't do frm_error on openfrm  */
140
 
#define DELAYED_OPEN            4096    /* Open table later */
141
 
/**
142
 
  This flag is used in function get_all_tables() which fills
143
 
  I_S tables with data which are retrieved from frm files and storage engine
144
 
  The flag means that we need to open FRM file only to get necessary data.
145
 
*/
146
 
#define OPEN_FRM_FILE_ONLY     32768
147
 
/**
148
 
  This flag is used in function get_all_tables() which fills
149
 
  I_S tables with data which are retrieved from frm files and storage engine
150
 
  The flag means that we need to process tables only to get necessary data.
151
 
  Views are not processed.
152
 
*/
153
 
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
154
 
/**
155
 
  This flag is used in function get_all_tables() which fills
156
 
  I_S tables with data which are retrieved from frm files and storage engine.
157
 
  The flag means that I_S table uses optimization algorithm.
158
 
*/
159
 
#define OPTIMIZE_I_S_TABLE     OPEN_TABLE_ONLY*2
160
 
 
161
 
#define SC_INFO_LENGTH 4                /* Form format constant */
162
 
#define TE_INFO_LENGTH 3
163
 
#define MTYP_NOEMPTY_BIT 128
164
 
 
165
 
#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
166
 
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM_CGE 50120
167
 
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM 50205
168
 
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM_STR "50205"
169
 
 
170
 
/*
171
 
  Minimum length pattern before Turbo Boyer-Moore is used
172
 
  for SELECT "text" LIKE "%pattern%", excluding the two
173
 
  wildcards in class Item_func_like.
174
 
*/
175
 
#define MIN_TURBOBM_PATTERN_LEN 3
176
 
 
177
 
/* 
178
 
   Defines for binary logging.
179
 
   Do not decrease the value of BIN_LOG_HEADER_SIZE.
180
 
   Do not even increase it before checking code.
181
 
*/
182
 
 
183
 
#define BIN_LOG_HEADER_SIZE    4 
184
 
 
185
 
#define DEFAULT_KEY_CACHE_NAME "default"
186
 
 
187
 
#define STORAGE_TYPE_MASK 7
188
 
#define COLUMN_FORMAT_MASK 7
189
 
#define COLUMN_FORMAT_SHIFT 3
190
 
 
191
 
/* Below are #defines that used to be in mysql_priv.h */
192
 
/***************************************************************************
193
 
  Configuration parameters
194
 
****************************************************************************/
195
 
#define ACL_CACHE_SIZE          256
196
 
#define MAX_PASSWORD_LENGTH     32
197
 
#define HOST_CACHE_SIZE         128
198
 
#define MAX_ACCEPT_RETRY        10      // Test accept this many times
199
 
#define MAX_FIELDS_BEFORE_HASH  32
200
 
#define USER_VARS_HASH_SIZE     16
201
 
#define TABLE_OPEN_CACHE_MIN    64
202
 
#define TABLE_OPEN_CACHE_DEFAULT 64
203
 
 
204
 
/* 
205
 
 Value of 9236 discovered through binary search 2006-09-26 on Ubuntu Dapper
206
 
 Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86.  (Added 
207
 
 100 bytes as reasonable buffer against growth and other environments'
208
 
 requirements.)
209
 
 
210
 
 Feel free to raise this by the smallest amount you can to get the
211
 
 "execution_constants" test to pass.
212
 
 */
213
 
#define STACK_MIN_SIZE          12000   ///< Abort if less stack during eval.
214
 
 
215
 
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
216
 
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
217
 
 
218
 
/** 
219
 
 * @TODO Move into a drizzled.h since it's only used in drizzled.cc
220
 
 *
221
 
 * @TODO Rename to DRIZZLED_NET_RETRY_COUNT
222
 
 */
223
 
#ifndef MYSQLD_NET_RETRY_COUNT
224
 
#define MYSQLD_NET_RETRY_COUNT  10      ///< Abort read after this many int.
225
 
#endif
226
 
#define TEMP_POOL_SIZE          128
227
 
 
228
 
#define QUERY_ALLOC_BLOCK_SIZE          8192
229
 
#define QUERY_ALLOC_PREALLOC_SIZE       8192
230
 
#define TRANS_ALLOC_BLOCK_SIZE          4096
231
 
#define TRANS_ALLOC_PREALLOC_SIZE       4096
232
 
#define RANGE_ALLOC_BLOCK_SIZE          4096
233
 
#define ACL_ALLOC_BLOCK_SIZE            1024
234
 
#define UDF_ALLOC_BLOCK_SIZE            1024
235
 
#define TABLE_ALLOC_BLOCK_SIZE          1024
236
 
#define BDB_LOG_ALLOC_BLOCK_SIZE        1024
237
 
#define WARN_ALLOC_BLOCK_SIZE           2048
238
 
#define WARN_ALLOC_PREALLOC_SIZE        1024
239
 
#define PROFILE_ALLOC_BLOCK_SIZE  2048
240
 
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
241
 
 
242
 
/*
243
 
  The following parameters is to decide when to use an extra cache to
244
 
  optimise seeks when reading a big table in sorted order
245
 
*/
246
 
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
247
 
#define MIN_ROWS_TO_USE_TABLE_CACHE      100
248
 
#define MIN_ROWS_TO_USE_BULK_INSERT      100
249
 
 
250
 
/**
251
 
  The following is used to decide if MySQL should use table scanning
252
 
  instead of reading with keys.  The number says how many evaluation of the
253
 
  WHERE clause is comparable to reading one extra row from a table.
254
 
*/
255
 
#define TIME_FOR_COMPARE   5    // 5 compares == one read
256
 
 
257
 
/**
258
 
  Number of comparisons of table rowids equivalent to reading one row from a 
259
 
  table.
260
 
*/
261
 
#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2)
262
 
 
263
 
/*
264
 
  For sequential disk seeks the cost formula is:
265
 
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip  
266
 
  
267
 
  The cost of average seek 
268
 
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
269
 
*/
270
 
#define DISK_SEEK_BASE_COST ((double)0.9)
271
 
 
272
 
#define BLOCKS_IN_AVG_SEEK  128
273
 
 
274
 
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
275
 
 
276
 
 
277
 
/**
278
 
  Number of rows in a reference table when refereed through a not unique key.
279
 
  This value is only used when we don't know anything about the key
280
 
  distribution.
281
 
*/
282
 
#define MATCHING_ROWS_IN_OTHER_TABLE 10
283
 
 
284
 
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
285
 
#define KEY_DEFAULT_PACK_LENGTH 8
286
 
 
287
 
/** Characters shown for the command in 'show processlist'. */
288
 
#define PROCESS_LIST_WIDTH 100
289
 
/* Characters shown for the command in 'information_schema.processlist' */
290
 
#define PROCESS_LIST_INFO_WIDTH 65535
291
 
 
292
 
#define PRECISION_FOR_DOUBLE 53
293
 
#define PRECISION_FOR_FLOAT  24
294
 
 
295
 
/*
296
 
  Default time to wait before aborting a new client connection
297
 
  that does not respond to "initial server greeting" timely
298
 
*/
299
 
#define CONNECT_TIMEOUT         10
300
 
 
301
 
/* The following can also be changed from the command line */
302
 
#define DEFAULT_CONCURRENCY     10
303
 
#define FLUSH_TIME              0               /**< Don't flush tables */
304
 
#define MAX_CONNECT_ERRORS      10              ///< errors before disabling host
305
 
 
306
 
#define INTERRUPT_PRIOR 10
307
 
#define CONNECT_PRIOR   9
308
 
#define WAIT_PRIOR      8
309
 
#define QUERY_PRIOR     6
310
 
 
311
 
        /* Bits from testflag */
312
 
#define TEST_PRINT_CACHED_TABLES 1
313
 
#define TEST_NO_KEY_GROUP        2
314
 
#define TEST_MIT_THREAD         4
315
 
#define TEST_BLOCKING           8
316
 
#define TEST_KEEP_TMP_TABLES    16
317
 
#define TEST_READCHECK          64      /**< Force use of readcheck */
318
 
#define TEST_NO_EXTRA           128
319
 
#define TEST_CORE_ON_SIGNAL     256     /**< Give core if signal */
320
 
#define TEST_NO_STACKTRACE      512
321
 
#define TEST_SIGINT             1024    /**< Allow sigint on threads */
322
 
#define TEST_SYNCHRONIZATION    2048    /**< get server to do sleep in some places */
323
 
 
324
 
/* Bits for different SQL modes modes (including ANSI mode) */
325
 
#define MODE_NO_ZERO_DATE               (2)
326
 
#define MODE_INVALID_DATES              (MODE_NO_ZERO_DATE*2)
327
 
 
328
 
/* @@optimizer_switch flags */
329
 
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
330
 
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
331
 
 
332
 
#define MY_CHARSET_BIN_MB_MAXLEN 1
333
 
 
334
 
// uncachable cause
335
 
#define UNCACHEABLE_DEPENDENT   1
336
 
#define UNCACHEABLE_RAND        2
337
 
#define UNCACHEABLE_SIDEEFFECT  4
338
 
/// forcing to save JOIN for explain
339
 
#define UNCACHEABLE_EXPLAIN     8
340
 
/** Don't evaluate subqueries in prepare even if they're not correlated */
341
 
#define UNCACHEABLE_PREPARE    16
342
 
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
343
 
#define UNCACHEABLE_UNITED     32
344
 
 
345
 
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
346
 
#define UNDEF_POS (-1)
347
 
 
348
 
/* BINLOG_DUMP options */
349
 
 
350
 
#define BINLOG_DUMP_NON_BLOCK   1
351
 
 
352
 
/* sql_show.cc:show_log_files() */
353
 
#define SHOW_LOG_STATUS_FREE "FREE"
354
 
#define SHOW_LOG_STATUS_INUSE "IN USE"
355
 
 
356
 
/* Options to add_table_to_list() */
357
 
#define TL_OPTION_UPDATING      1
358
 
#define TL_OPTION_FORCE_INDEX   2
359
 
#define TL_OPTION_IGNORE_LEAVES 4
360
 
#define TL_OPTION_ALIAS         8
361
 
 
362
 
/* Some portable defines */
363
 
 
364
 
#define portable_sizeof_char_ptr 8
365
 
 
366
 
#define tmp_file_prefix "#sql"                  /**< Prefix for tmp tables */
367
 
#define tmp_file_prefix_length 4
368
 
 
369
 
/* Flags for calc_week() function.  */
370
 
#define WEEK_MONDAY_FIRST    1
371
 
#define WEEK_YEAR            2
372
 
#define WEEK_FIRST_WEEKDAY   4
373
 
 
374
 
#define STRING_BUFFER_USUAL_SIZE 80
375
 
 
376
 
/*
377
 
  Some defines for exit codes for ::is_equal class functions.
378
 
*/
379
 
#define IS_EQUAL_NO 0
380
 
#define IS_EQUAL_YES 1
381
 
#define IS_EQUAL_PACK_LENGTH 2
382
 
 
383
 
 
384
 
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */