MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mi_static.c
1 /* Copyright (c) 2000, 2011, 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 /*
17  Static variables for MyISAM library. All definied here for easy making of
18  a shared library
19 */
20 
21 #ifndef MY_GLOBAL_INCLUDED
22 #include "myisamdef.h"
23 #endif
24 
25 LIST *myisam_open_list=0;
26 uchar myisam_file_magic[]=
27 { (uchar) 254, (uchar) 254,'\007', '\001', };
28 uchar myisam_pack_file_magic[]=
29 { (uchar) 254, (uchar) 254,'\010', '\002', };
30 char * myisam_log_filename=(char*) "myisam.log";
31 File myisam_log_file= -1;
32 uint myisam_quick_table_bits=9;
33 ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
34 my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
35 #if !defined(DONT_USE_RW_LOCKS)
36 ulong myisam_concurrent_insert= 2;
37 #else
38 ulong myisam_concurrent_insert= 0;
39 #endif
40 ulonglong myisam_max_temp_length= MAX_FILE_SIZE;
41 ulong myisam_data_pointer_size=4;
42 ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
43 
44 static int always_valid(const char *filename __attribute__((unused)))
45 {
46  return 0;
47 }
48 
49 int (*myisam_test_invalid_symlink)(const char *filename)= always_valid;
50 
51 
52 /*
53  read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
54  Position is , == , >= , <= , > , <
55 */
56 
57 uint myisam_read_vec[]=
58 {
59  SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER,
60  SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER,
61  SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, SEARCH_LAST | SEARCH_SMALLER,
62  MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL
63 };
64 
65 uint myisam_readnext_vec[]=
66 {
67  SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
68  SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
69 };
70 
71 #ifdef HAVE_PSI_INTERFACE
72 PSI_mutex_key mi_key_mutex_MYISAM_SHARE_intern_lock,
73  mi_key_mutex_MI_SORT_INFO_mutex, mi_key_mutex_MI_CHECK_print_msg;
74 
75 static PSI_mutex_info all_myisam_mutexes[]=
76 {
77  { &mi_key_mutex_MI_SORT_INFO_mutex, "MI_SORT_INFO::mutex", 0},
78  { &mi_key_mutex_MYISAM_SHARE_intern_lock, "MYISAM_SHARE::intern_lock", 0},
79  { &mi_key_mutex_MI_CHECK_print_msg, "MI_CHECK::print_msg", 0}
80 };
81 
82 PSI_rwlock_key mi_key_rwlock_MYISAM_SHARE_key_root_lock,
83  mi_key_rwlock_MYISAM_SHARE_mmap_lock;
84 
85 static PSI_rwlock_info all_myisam_rwlocks[]=
86 {
87  { &mi_key_rwlock_MYISAM_SHARE_key_root_lock, "MYISAM_SHARE::key_root_lock", 0},
88  { &mi_key_rwlock_MYISAM_SHARE_mmap_lock, "MYISAM_SHARE::mmap_lock", 0}
89 };
90 
91 PSI_cond_key mi_key_cond_MI_SORT_INFO_cond;
92 
93 static PSI_cond_info all_myisam_conds[]=
94 {
95  { &mi_key_cond_MI_SORT_INFO_cond, "MI_SORT_INFO::cond", 0}
96 };
97 
98 PSI_file_key mi_key_file_datatmp, mi_key_file_dfile, mi_key_file_kfile,
99  mi_key_file_log;
100 
101 static PSI_file_info all_myisam_files[]=
102 {
103  { & mi_key_file_datatmp, "data_tmp", 0},
104  { & mi_key_file_dfile, "dfile", 0},
105  { & mi_key_file_kfile, "kfile", 0},
106  { & mi_key_file_log, "log", 0}
107 };
108 
109 PSI_thread_key mi_key_thread_find_all_keys;
110 
111 static PSI_thread_info all_myisam_threads[]=
112 {
113  { &mi_key_thread_find_all_keys, "find_all_keys", 0},
114 };
115 
116 void init_myisam_psi_keys()
117 {
118  const char* category= "myisam";
119  int count;
120 
121  count= array_elements(all_myisam_mutexes);
122  mysql_mutex_register(category, all_myisam_mutexes, count);
123 
124  count= array_elements(all_myisam_rwlocks);
125  mysql_rwlock_register(category, all_myisam_rwlocks, count);
126 
127  count= array_elements(all_myisam_conds);
128  mysql_cond_register(category, all_myisam_conds, count);
129 
130  count= array_elements(all_myisam_files);
131  mysql_file_register(category, all_myisam_files, count);
132 
133  count= array_elements(all_myisam_threads);
134  mysql_thread_register(category, all_myisam_threads, count);
135 }
136 #endif /* HAVE_PSI_INTERFACE */
137