1 /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23 /*
24 Static variables for MyISAM library. All definied here for easy making of
25 a shared library
26 */
27
28 #ifndef MY_GLOBAL_INCLUDED
29 #include "myisamdef.h"
30 #endif
31
32 LIST *myisam_open_list=0;
33 uchar myisam_file_magic[]=
34 { (uchar) 254, (uchar) 254,'\007', '\001', };
35 uchar myisam_pack_file_magic[]=
36 { (uchar) 254, (uchar) 254,'\010', '\002', };
37 char * myisam_log_filename=(char*) "myisam.log";
38 File myisam_log_file= -1;
39 uint myisam_quick_table_bits=9;
40 ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
41 my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
42 #if !defined(DONT_USE_RW_LOCKS)
43 ulong myisam_concurrent_insert= 2;
44 #else
45 ulong myisam_concurrent_insert= 0;
46 #endif
47 ulonglong myisam_max_temp_length= MAX_FILE_SIZE;
48 ulong myisam_data_pointer_size=4;
49 ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
50
always_valid(const char * filename MY_ATTRIBUTE ((unused)))51 static int always_valid(const char *filename MY_ATTRIBUTE((unused)))
52 {
53 return 0;
54 }
55
56 int (*myisam_test_invalid_symlink)(const char *filename)= always_valid;
57
58
59 /*
60 read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
61 Position is , == , >= , <= , > , <
62 */
63
64 uint myisam_read_vec[]=
65 {
66 SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER,
67 SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER,
68 SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, SEARCH_LAST | SEARCH_SMALLER,
69 MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL
70 };
71
72 uint myisam_readnext_vec[]=
73 {
74 SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
75 SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
76 };
77
78 #ifdef HAVE_PSI_INTERFACE
79 PSI_mutex_key mi_key_mutex_MYISAM_SHARE_intern_lock,
80 mi_key_mutex_MI_SORT_INFO_mutex, mi_key_mutex_MI_CHECK_print_msg;
81
82 static PSI_mutex_info all_myisam_mutexes[]=
83 {
84 { &mi_key_mutex_MI_SORT_INFO_mutex, "MI_SORT_INFO::mutex", 0},
85 { &mi_key_mutex_MYISAM_SHARE_intern_lock, "MYISAM_SHARE::intern_lock", 0},
86 { &mi_key_mutex_MI_CHECK_print_msg, "MI_CHECK::print_msg", 0}
87 };
88
89 PSI_rwlock_key mi_key_rwlock_MYISAM_SHARE_key_root_lock,
90 mi_key_rwlock_MYISAM_SHARE_mmap_lock;
91
92 static PSI_rwlock_info all_myisam_rwlocks[]=
93 {
94 { &mi_key_rwlock_MYISAM_SHARE_key_root_lock, "MYISAM_SHARE::key_root_lock", 0},
95 { &mi_key_rwlock_MYISAM_SHARE_mmap_lock, "MYISAM_SHARE::mmap_lock", 0}
96 };
97
98 PSI_cond_key mi_key_cond_MI_SORT_INFO_cond;
99
100 static PSI_cond_info all_myisam_conds[]=
101 {
102 { &mi_key_cond_MI_SORT_INFO_cond, "MI_SORT_INFO::cond", 0}
103 };
104
105 PSI_file_key mi_key_file_datatmp, mi_key_file_dfile, mi_key_file_kfile,
106 mi_key_file_log;
107
108 static PSI_file_info all_myisam_files[]=
109 {
110 { & mi_key_file_datatmp, "data_tmp", 0},
111 { & mi_key_file_dfile, "dfile", 0},
112 { & mi_key_file_kfile, "kfile", 0},
113 { & mi_key_file_log, "log", 0}
114 };
115
116 PSI_thread_key mi_key_thread_find_all_keys;
117
118 static PSI_thread_info all_myisam_threads[]=
119 {
120 { &mi_key_thread_find_all_keys, "find_all_keys", 0},
121 };
122
init_myisam_psi_keys()123 void init_myisam_psi_keys()
124 {
125 const char* category= "myisam";
126 int count;
127
128 count= array_elements(all_myisam_mutexes);
129 mysql_mutex_register(category, all_myisam_mutexes, count);
130
131 count= array_elements(all_myisam_rwlocks);
132 mysql_rwlock_register(category, all_myisam_rwlocks, count);
133
134 count= array_elements(all_myisam_conds);
135 mysql_cond_register(category, all_myisam_conds, count);
136
137 count= array_elements(all_myisam_files);
138 mysql_file_register(category, all_myisam_files, count);
139
140 count= array_elements(all_myisam_threads);
141 mysql_thread_register(category, all_myisam_threads, count);
142 }
143 #endif /* HAVE_PSI_INTERFACE */
144
145