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
25LIST *myisam_open_list=0;
26uchar myisam_file_magic[]=
27{ (uchar) 254, (uchar) 254,'\007', '\001', };
28uchar myisam_pack_file_magic[]=
29{ (uchar) 254, (uchar) 254,'\010', '\002', };
30char * myisam_log_filename=(char*) "myisam.log";
31File myisam_log_file= -1;
32uint myisam_quick_table_bits=9;
33ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
34my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
35#if !defined(DONT_USE_RW_LOCKS)
36ulong myisam_concurrent_insert= 2;
37#else
38ulong myisam_concurrent_insert= 0;
39#endif
40ulonglong myisam_max_temp_length= MAX_FILE_SIZE;
41ulong myisam_data_pointer_size=4;
42ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
43my_bool (*mi_killed)(MI_INFO *)= mi_killed_standalone;
44
45/*
46 read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
47 Position is , == , >= , <= , > , <
48*/
49
50uint myisam_read_vec[]=
51{
52 SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER,
53 SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER,
54 SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, SEARCH_LAST | SEARCH_SMALLER,
55 MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL
56};
57
58uint myisam_readnext_vec[]=
59{
60 SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
61 SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
62};
63
64#ifdef HAVE_PSI_INTERFACE
65PSI_mutex_key mi_key_mutex_MYISAM_SHARE_intern_lock,
66 mi_key_mutex_MI_SORT_INFO_mutex, mi_key_mutex_MI_CHECK_print_msg;
67
68static PSI_mutex_info all_myisam_mutexes[]=
69{
70 { &mi_key_mutex_MI_SORT_INFO_mutex, "MI_SORT_INFO::mutex", 0},
71 { &mi_key_mutex_MYISAM_SHARE_intern_lock, "MYISAM_SHARE::intern_lock", 0},
72 { &mi_key_mutex_MI_CHECK_print_msg, "MI_CHECK::print_msg", 0}
73};
74
75PSI_rwlock_key mi_key_rwlock_MYISAM_SHARE_key_root_lock,
76 mi_key_rwlock_MYISAM_SHARE_mmap_lock;
77
78static PSI_rwlock_info all_myisam_rwlocks[]=
79{
80 { &mi_key_rwlock_MYISAM_SHARE_key_root_lock, "MYISAM_SHARE::key_root_lock", 0},
81 { &mi_key_rwlock_MYISAM_SHARE_mmap_lock, "MYISAM_SHARE::mmap_lock", 0}
82};
83
84PSI_cond_key mi_key_cond_MI_SORT_INFO_cond;
85
86static PSI_cond_info all_myisam_conds[]=
87{
88 { &mi_key_cond_MI_SORT_INFO_cond, "MI_SORT_INFO::cond", 0}
89};
90
91PSI_file_key mi_key_file_datatmp, mi_key_file_dfile, mi_key_file_kfile,
92 mi_key_file_log;
93
94static PSI_file_info all_myisam_files[]=
95{
96 { & mi_key_file_datatmp, "data_tmp", 0},
97 { & mi_key_file_dfile, "dfile", 0},
98 { & mi_key_file_kfile, "kfile", 0},
99 { & mi_key_file_log, "log", 0}
100};
101
102PSI_thread_key mi_key_thread_find_all_keys;
103
104static PSI_thread_info all_myisam_threads[]=
105{
106 { &mi_key_thread_find_all_keys, "find_all_keys", 0},
107};
108
109void init_myisam_psi_keys()
110{
111 const char* category= "myisam";
112 int count;
113
114 count= array_elements(all_myisam_mutexes);
115 mysql_mutex_register(category, all_myisam_mutexes, count);
116
117 count= array_elements(all_myisam_rwlocks);
118 mysql_rwlock_register(category, all_myisam_rwlocks, count);
119
120 count= array_elements(all_myisam_conds);
121 mysql_cond_register(category, all_myisam_conds, count);
122
123 count= array_elements(all_myisam_files);
124 mysql_file_register(category, all_myisam_files, count);
125
126 count= array_elements(all_myisam_threads);
127 mysql_thread_register(category, all_myisam_threads, count);
128}
129#endif /* HAVE_PSI_INTERFACE */
130
131