1 : /* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
2 :
3 : This program is free software; you can redistribute it and/or modify
4 : it under the terms of the GNU General Public License as published by
5 : the Free Software Foundation; version 2 of the License.
6 :
7 : This program is distributed in the hope that it will be useful,
8 : but WITHOUT ANY WARRANTY; without even the implied warranty of
9 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 : GNU General Public License for more details.
11 :
12 : You should have received a copy of the GNU General Public License
13 : along with this program; if not, write to the Free Software
14 : Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15 :
16 :
17 : /*
18 : Static variables for MARIA library. All definied here for easy making of
19 : a shared library
20 : */
21 :
22 : #ifndef _global_h
23 : #include "maria_def.h"
24 : #include "trnman.h"
25 : #endif
26 :
27 : LIST *maria_open_list=0;
28 : uchar maria_file_magic[]=
29 : { (uchar) 254, (uchar) 254, (uchar) 9, '\003', };
30 : uchar maria_pack_file_magic[]=
31 : { (uchar) 254, (uchar) 254, (uchar) 10, '\001', };
32 : /* Unique number for this maria instance */
33 : uchar maria_uuid[MY_UUID_SIZE];
34 : uint maria_quick_table_bits=9;
35 : ulong maria_block_size= MARIA_KEY_BLOCK_LENGTH;
36 : my_bool maria_flush= 0, maria_single_user= 0;
37 : my_bool maria_delay_key_write= 0, maria_page_checksums= 1;
38 : my_bool maria_inited= FALSE;
39 : my_bool maria_in_ha_maria= FALSE; /* If used from ha_maria or not */
40 : pthread_mutex_t THR_LOCK_maria;
41 : #if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
42 : ulong maria_concurrent_insert= 2;
43 : #else
44 : ulong maria_concurrent_insert= 0;
45 : #endif
46 : my_off_t maria_max_temp_length= MAX_FILE_SIZE;
47 : ulong maria_bulk_insert_tree_size=8192*1024;
48 : ulong maria_data_pointer_size= 4;
49 :
50 : PAGECACHE maria_pagecache_var;
51 : PAGECACHE *maria_pagecache= &maria_pagecache_var;
52 :
53 : PAGECACHE maria_log_pagecache_var;
54 : PAGECACHE *maria_log_pagecache= &maria_log_pagecache_var;
55 : MY_TMPDIR *maria_tmpdir; /* Tempdir for redo */
56 : char *maria_data_root;
57 : HASH maria_stored_state;
58 :
59 : /**
60 : @brief when transactionality does not matter we can use this transaction
61 :
62 : Used in external programs like ma_test*, and also internally inside
63 : libmaria when there is no transaction around and the operation isn't
64 : transactional (CREATE/DROP/RENAME/OPTIMIZE/REPAIR).
65 : */
66 : TRN dummy_transaction_object;
67 :
68 : /* a WT_RESOURCE_TYPE for transactions waiting on a unique key conflict */
69 : WT_RESOURCE_TYPE ma_rc_dup_unique={ wt_resource_id_memcmp, 0};
70 :
71 : /* Enough for comparing if number is zero */
72 : uchar maria_zero_string[]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
73 :
74 : /*
75 : read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
76 : Position is , == , >= , <= , > , <
77 : */
78 :
79 : uint32 maria_read_vec[]=
80 : {
81 : SEARCH_FIND, /* HA_READ_KEY_EXACT */
82 : SEARCH_FIND | SEARCH_BIGGER, /* HA_READ_KEY_OR_NEXT */
83 : SEARCH_FIND | SEARCH_SMALLER, /* HA_READ_KEY_OR_PREV */
84 : SEARCH_NO_FIND | SEARCH_BIGGER, /* HA_READ_AFTER_KEY */
85 : SEARCH_NO_FIND | SEARCH_SMALLER, /* HA_READ_BEFORE_KEY */
86 : SEARCH_FIND | SEARCH_PART_KEY, /* HA_READ_PREFIX */
87 : SEARCH_LAST, /* HA_READ_PREFIX_LAST */
88 : SEARCH_LAST | SEARCH_SMALLER, /* HA_READ_PREFIX_LAST_OR_PREV */
89 : MBR_CONTAIN, /* HA_READ_MBR_CONTAIN */
90 : MBR_INTERSECT, /* HA_READ_MBR_INTERSECT */
91 : MBR_WITHIN, /* HA_READ_MBR_WITHIN */
92 : MBR_DISJOINT, /* HA_READ_MBR_DISJOINT */
93 : MBR_EQUAL /* HA_READ_MBR_EQUAL */
94 : };
95 :
96 : uint32 maria_readnext_vec[]=
97 : {
98 : SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
99 : SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
100 : };
101 :
102 : static int always_valid(const char *filename __attribute__((unused)))
103 0 : {
104 0 : return 0;
105 : }
106 :
107 : int (*maria_test_invalid_symlink)(const char *filename)= always_valid;
|