Merge lp:~vlad-lesin/percona-server/5.1-table_cache_speed_up into lp:percona-server/5.1
- 5.1-table_cache_speed_up
- Merge into 5.1
Status: | Work in progress |
---|---|
Proposed branch: | lp:~vlad-lesin/percona-server/5.1-table_cache_speed_up |
Merge into: | lp:percona-server/5.1 |
Diff against target: |
318 lines (+118/-33) 10 files modified
Percona-Server/storage/myisam/ha_myisam.cc (+4/-0) Percona-Server/storage/myisam/mi_close.c (+1/-1) Percona-Server/storage/myisam/mi_dbug.c (+3/-3) Percona-Server/storage/myisam/mi_keycache.c (+3/-3) Percona-Server/storage/myisam/mi_open.c (+67/-13) Percona-Server/storage/myisam/mi_panic.c (+25/-9) Percona-Server/storage/myisam/mi_static.c (+1/-1) Percona-Server/storage/myisam/myisamchk.c (+6/-0) Percona-Server/storage/myisam/myisamdef.h (+3/-3) Percona-Server/storage/myisam/myisampack.c (+5/-0) |
To merge this branch: | bzr merge lp:~vlad-lesin/percona-server/5.1-table_cache_speed_up |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Needs Fixing | ||
Alexey Kopytov (community) | Approve | ||
Review via email: mp+120285@code.launchpad.net |
Commit message
Description of the change
This MP is port of this http://
Jenkins build of 5.1 with this patch is:
http://
Jenkins build of 5.1 without this patch is:
http://
There are three tests which failed on patched version and were success on original 5.1:
1) innodb_
(I think the trouble is in that "120813 15:38:22 [Warning] '--default-
2) rpl.percona_
It doesn't seem to be failed due to the patch. It passed at the second attempt and I can't repeat failure on my local host. I this the success passing of this test depends on host load.
3) rpl.rpl_stop_slave 'stmt'
I don't know how to interpret this failure. Console output shows that the project was not built. But the same log shows that tests were started and this is the only executed test.
There are four tests which failed on original 5.1 and were success on patched version:
1) main.percona_
2) rpl.percona_
3) rpl.rpl_row_func003 'row'
4) rpl.rpl_
- 465. By Stewart Smith
-
merge fix for Bug #905334: Intermittent innodb_bug56680 crash
- 466. By Stewart Smith
-
merge mysql-5.1.65 from lp:percona-server/upstream-5.1. This was a simple merge, 2 conflicts. One in mysqldump.cc (added code near Percona added code, simple fix) and one in sql_class.cc (new mutex added by PS and upstream, simple merge).
- 467. By Stewart Smith
-
fix percona_
server_ variables_ debug from 5.1.65 merge (MySQl 5.1.65 added SLAVE_MAX_ ALLOWED_ PACKET) - 468. By Stewart Smith
-
fix debug assert in kill_idle_trx. After revid:<email address hidden> we need to use LOCK_thd_kill rather than LOCK_THD_data for kill idle trx. This revid fixed a deadlock bug by introducing a new mutex.
- 469. By Stewart Smith
-
post merge fix: new DBUG_ASSERT() assertions in ha_innodb::clone() are incorrect. Confirmed by laurynas, pointing to revid:<email address hidden>
- 470. By Stewart Smith
-
merge HandlerSocket fix (fix is due to BZR having an odd bug checking out the repository)
- 471. By Stewart Smith
-
merge fix for Bug lp:1040483 UNIV_NONINL build broken
- 472. By Stewart Smith
-
merge fix for Bug #1036530: Sporadic innodb_
plugin. percona_ changed_ page_bmp failures in Jenkins
- 473. By Stewart Smith
-
merge fix for Bug #1039384: innodb_
adaptive_ flushing_ method and innodb_ flush_neighbor_ pages partially broken - 474. By Stewart Smith
-
merge 5.1.63-13.4 release branch
- 475. By Stewart Smith
-
merge fix for Bug #1023883: libmysqlclient1
6-dev 'Replaces' libmysqlclient1 6-dev but doesn't 'Provides' it - 476. By Stewart Smith
-
merge fix for Bug #902472: main.subselect_
notembedded fails on Ubuntu Oneiric in Jenkins - 477. By Hrvoje Matijakovic
- 478. By Stewart Smith
-
merge fix for Bug #1039931: 64-bit atomic operation Autoconf tests duplicated in regular atomic operation tests
- 479. By Stewart Smith
-
merge fix for Bug #902471: Lots of ssl tests failures on oneiric hosts
- 480. By Stewart Smith
-
merge Bug #747032: Flashcache throws an error on startup when flashcache is not used
- 481. By Stewart Smith
-
merge 5.1.65-14.0 release branch
- 482. By Hrvoje Matijakovic
- 483. By Stewart Smith
-
merge fix for: Bug #1046389: UNIV_DEBUG build broken
- 484. By Hrvoje Matijakovic
-
* bug fix for Bug #1054090
Stewart Smith (stewart) wrote : | # |
This will need 5.5 branch before I can merge.
- 485. By Stewart Smith
-
merge fix for Bug #978036: Percona server crashes on ALTER TABLE on temporary table
- 486. By Stewart Smith
-
merge fix for Bug #1053087: incorrect mutex handling during buf_LRU_file_dump
- 487. By Stewart Smith
-
merge fix for Bug #1028240: Postfix crashes using shared dependency(
libmysqlclient. so) provided by Percona Server- shared- compat / Percona- Server- shared in CentOS/RHEL 6.x - 488. By Stewart Smith
-
merge fix for Bug #1042517: Custom Percona Server 5.5.27 build crashes when compiled with MAX_INDEXES between 121-128 in config.h.cmake
- 489. By Stewart Smith
-
merge fix for Bug #907499: ubuntu packaging: percona-
server- client- 5.x should conflict (/provides) mysql-client- core-5. x / percona- server- server- 5.x should conflict mysql-server- core-5. x - 490. By Stewart Smith
-
merge fix for Bug #805805: attaching to percona-server with gdb disconnects clients and Bug #1060136: safe_process.
cc/safe_ process. pl should not kill mysqld on SIGSTOP/SIGCONT - 491. By Stewart Smith
-
merge documentation updates
- 492. By Hrvoje Matijakovic
-
Added missing release dates, bugfix for Bug #1057029
- 493. By Hrvoje Matijakovic
-
Added missing release dates, bugfix for Bug #1057029
- 494. By Stewart Smith
-
merge 5.1.66-14.1 release notes
- 495. By Hrvoje Matijakovic
-
Bug fix for Bug#1056658
- 496. By Hrvoje Matijakovic
-
* bug fix for Bug #1056603
* added missing tables with the description
* fixed already existing I_S tables - 497. By <email address hidden>
- 498. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/26611-bug917942-5.1
- 499. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/26611-bug1064333-5.1
- 500. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/26611-bug1059738-5.1
- 501. By <email address hidden>
- 502. By <email address hidden>
- 503. By <email address hidden>
- 504. By <email address hidden>
- 505. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/xtradb-multiple-bmp-files-51
- 506. By <email address hidden>
- 507. By <email address hidden>
- 508. By <email address hidden>
Stewart Smith (stewart) wrote : | # |
needs 5.5 branch before I can merge.
- 509. By <email address hidden>
- 510. By <email address hidden>
-
Merge lp:~vlad-lesin/percona-server/5.1-bug1049871-injections-gca
Vlad Lesin (vlad-lesin) wrote : | # |
> needs 5.5 branch before I can merge.
This branch can be used by customer. I ported the patch to 5.1 gca clone and made new MP here https:/
- 511. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1087202-1087218-5.1
- 512. By <email address hidden>
- 513. By <email address hidden>
- 514. By <email address hidden>
- 515. By Stewart Smith
-
merge 5.1.66-14.2 release branch
- 516. By <email address hidden>
- 517. By <email address hidden>
-
Merge lp:~sergei.glushchenko/percona-server/51-ST-27220-bug1042946
- 518. By <email address hidden>
- 519. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.1
- 520. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1082437-5.1
- 521. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1083596-5.1
- 522. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1083669-5.1
- 523. By <email address hidden>
- 524. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/bug1100178-1100643-5.1
- 525. By <email address hidden>
- 526. By <email address hidden>
- 527. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1111226-5.1
- 528. By <email address hidden>
- 529. By Stewart Smith
-
merge slow query log bugfixes from Laurynas
- 530. By <email address hidden>
- 531. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1105726-5.1
- 532. By <email address hidden>
-
Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1108874-5.1
- 533. By Vlad Lesin
-
As the number of open tables is increased, table lookup
(testing if a table is already open) and (in particular)
the case when a table is not open, became increasingly more
expensive.The problem was caused by the open table lookup mechanism,
which was based on traversing a linked list comparing the
file names.As the list was replaced by a hash table, the lookup
time dropped significantly when used on systems with
a large number of open tables.The original patch can be found here:
http://lists.mysql. com/commits/ 121507
Unmerged revisions
- 533. By Vlad Lesin
-
As the number of open tables is increased, table lookup
(testing if a table is already open) and (in particular)
the case when a table is not open, became increasingly more
expensive.The problem was caused by the open table lookup mechanism,
which was based on traversing a linked list comparing the
file names.As the list was replaced by a hash table, the lookup
time dropped significantly when used on systems with
a large number of open tables.The original patch can be found here:
http://lists.mysql. com/commits/ 121507
Preview Diff
1 | === modified file 'Percona-Server/storage/myisam/ha_myisam.cc' | |||
2 | --- Percona-Server/storage/myisam/ha_myisam.cc 2011-11-24 16:33:30 +0000 | |||
3 | +++ Percona-Server/storage/myisam/ha_myisam.cc 2013-02-24 23:14:22 +0000 | |||
4 | @@ -2201,6 +2201,10 @@ | |||
5 | 2201 | myisam_hton->create= myisam_create_handler; | 2201 | myisam_hton->create= myisam_create_handler; |
6 | 2202 | myisam_hton->panic= myisam_panic; | 2202 | myisam_hton->panic= myisam_panic; |
7 | 2203 | myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES; | 2203 | myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES; |
8 | 2204 | |||
9 | 2205 | if (mi_init_open_table_hash(table_cache_size)) | ||
10 | 2206 | return 1; | ||
11 | 2207 | |||
12 | 2204 | return 0; | 2208 | return 0; |
13 | 2205 | } | 2209 | } |
14 | 2206 | 2210 | ||
15 | 2207 | 2211 | ||
16 | === modified file 'Percona-Server/storage/myisam/mi_close.c' | |||
17 | --- Percona-Server/storage/myisam/mi_close.c 2012-02-15 16:21:38 +0000 | |||
18 | +++ Percona-Server/storage/myisam/mi_close.c 2013-02-24 23:14:22 +0000 | |||
19 | @@ -56,7 +56,7 @@ | |||
20 | 56 | info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); | 56 | info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); |
21 | 57 | } | 57 | } |
22 | 58 | flag= !--share->reopen; | 58 | flag= !--share->reopen; |
24 | 59 | myisam_open_list=list_delete(myisam_open_list,&info->open_list); | 59 | my_hash_delete(&myisam_open_table_hash, (uchar *) info); |
25 | 60 | pthread_mutex_unlock(&share->intern_lock); | 60 | pthread_mutex_unlock(&share->intern_lock); |
26 | 61 | 61 | ||
27 | 62 | my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); | 62 | my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); |
28 | 63 | 63 | ||
29 | === modified file 'Percona-Server/storage/myisam/mi_dbug.c' | |||
30 | --- Percona-Server/storage/myisam/mi_dbug.c 2011-06-30 15:37:13 +0000 | |||
31 | +++ Percona-Server/storage/myisam/mi_dbug.c 2013-02-24 23:14:22 +0000 | |||
32 | @@ -172,13 +172,13 @@ | |||
33 | 172 | my_bool check_table_is_closed(const char *name, const char *where) | 172 | my_bool check_table_is_closed(const char *name, const char *where) |
34 | 173 | { | 173 | { |
35 | 174 | char filename[FN_REFLEN]; | 174 | char filename[FN_REFLEN]; |
37 | 175 | LIST *pos; | 175 | uint idx; |
38 | 176 | DBUG_ENTER("check_table_is_closed"); | 176 | DBUG_ENTER("check_table_is_closed"); |
39 | 177 | 177 | ||
40 | 178 | (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32); | 178 | (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32); |
42 | 179 | for (pos=myisam_open_list ; pos ; pos=pos->next) | 179 | for (idx= 0; idx < myisam_open_table_hash.records; ++idx) |
43 | 180 | { | 180 | { |
45 | 181 | MI_INFO *info=(MI_INFO*) pos->data; | 181 | MI_INFO *info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx); |
46 | 182 | MYISAM_SHARE *share=info->s; | 182 | MYISAM_SHARE *share=info->s; |
47 | 183 | if (!strcmp(share->unique_file_name,filename)) | 183 | if (!strcmp(share->unique_file_name,filename)) |
48 | 184 | { | 184 | { |
49 | 185 | 185 | ||
50 | === modified file 'Percona-Server/storage/myisam/mi_keycache.c' | |||
51 | --- Percona-Server/storage/myisam/mi_keycache.c 2008-03-29 15:56:33 +0000 | |||
52 | +++ Percona-Server/storage/myisam/mi_keycache.c 2013-02-24 23:14:22 +0000 | |||
53 | @@ -137,16 +137,16 @@ | |||
54 | 137 | void mi_change_key_cache(KEY_CACHE *old_key_cache, | 137 | void mi_change_key_cache(KEY_CACHE *old_key_cache, |
55 | 138 | KEY_CACHE *new_key_cache) | 138 | KEY_CACHE *new_key_cache) |
56 | 139 | { | 139 | { |
58 | 140 | LIST *pos; | 140 | uint idx; |
59 | 141 | DBUG_ENTER("mi_change_key_cache"); | 141 | DBUG_ENTER("mi_change_key_cache"); |
60 | 142 | 142 | ||
61 | 143 | /* | 143 | /* |
62 | 144 | Lock list to ensure that no one can close the table while we manipulate it | 144 | Lock list to ensure that no one can close the table while we manipulate it |
63 | 145 | */ | 145 | */ |
64 | 146 | pthread_mutex_lock(&THR_LOCK_myisam); | 146 | pthread_mutex_lock(&THR_LOCK_myisam); |
66 | 147 | for (pos=myisam_open_list ; pos ; pos=pos->next) | 147 | for (idx= 0; idx < myisam_open_table_hash.records; ++idx) |
67 | 148 | { | 148 | { |
69 | 149 | MI_INFO *info= (MI_INFO*) pos->data; | 149 | MI_INFO *info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx); |
70 | 150 | MYISAM_SHARE *share= info->s; | 150 | MYISAM_SHARE *share= info->s; |
71 | 151 | if (share->key_cache == old_key_cache) | 151 | if (share->key_cache == old_key_cache) |
72 | 152 | mi_assign_to_key_cache(info, (ulonglong) ~0, new_key_cache); | 152 | mi_assign_to_key_cache(info, (ulonglong) ~0, new_key_cache); |
73 | 153 | 153 | ||
74 | === modified file 'Percona-Server/storage/myisam/mi_open.c' | |||
75 | --- Percona-Server/storage/myisam/mi_open.c 2011-06-30 15:37:13 +0000 | |||
76 | +++ Percona-Server/storage/myisam/mi_open.c 2013-02-24 23:14:22 +0000 | |||
77 | @@ -46,23 +46,76 @@ | |||
78 | 46 | } | 46 | } |
79 | 47 | 47 | ||
80 | 48 | 48 | ||
86 | 49 | /****************************************************************************** | 49 | /* |
87 | 50 | ** Return the shared struct if the table is already open. | 50 | Get the value used as hash key (helper function for the |
88 | 51 | ** In MySQL the server will handle version issues. | 51 | open table hash). Function is used as a callback |
89 | 52 | ******************************************************************************/ | 52 | from the hash table |
90 | 53 | 53 | */ | |
91 | 54 | static uchar *mi_open_table_hash_key(const uchar *record, size_t *length, | ||
92 | 55 | my_bool not_used __attribute__((unused))) | ||
93 | 56 | { | ||
94 | 57 | MI_INFO *info= (MI_INFO *) record; | ||
95 | 58 | *length= info->s->unique_name_length; | ||
96 | 59 | return (uchar*) info->s->unique_file_name; | ||
97 | 60 | } | ||
98 | 61 | |||
99 | 62 | /** | ||
100 | 63 | Initialize open table hash | ||
101 | 64 | |||
102 | 65 | Function is normally called from myisam_init | ||
103 | 66 | with the system variable table_cache_size used | ||
104 | 67 | as hash_size. | ||
105 | 68 | |||
106 | 69 | @param[in] hash_size Initial has size (elements) | ||
107 | 70 | @return inidicates success or failure of initialization | ||
108 | 71 | @retval 0 success | ||
109 | 72 | @retval 1 failure | ||
110 | 73 | |||
111 | 74 | */ | ||
112 | 75 | int mi_init_open_table_hash(ulong hash_size) | ||
113 | 76 | { | ||
114 | 77 | if (hash_size == 0) | ||
115 | 78 | hash_size= 32; /* default hash size */ | ||
116 | 79 | |||
117 | 80 | if (my_hash_init(&myisam_open_table_hash, &my_charset_filename, | ||
118 | 81 | hash_size, 0, 0, mi_open_table_hash_key, 0, 0)) | ||
119 | 82 | return 1; /* error */ | ||
120 | 83 | |||
121 | 84 | return 0; | ||
122 | 85 | } | ||
123 | 86 | |||
124 | 87 | |||
125 | 88 | /** | ||
126 | 89 | Retrieve the shared struct if the table is already | ||
127 | 90 | open (i.e in the open table hash) | ||
128 | 91 | |||
129 | 92 | @param[in] filename table file name | ||
130 | 93 | @return shared struct, 0 if not in the cache | ||
131 | 94 | */ | ||
132 | 54 | MI_INFO *test_if_reopen(char *filename) | 95 | MI_INFO *test_if_reopen(char *filename) |
133 | 55 | { | 96 | { |
135 | 56 | LIST *pos; | 97 | HASH_SEARCH_STATE current_record; |
136 | 98 | int len= strlen(filename); | ||
137 | 57 | 99 | ||
139 | 58 | for (pos=myisam_open_list ; pos ; pos=pos->next) | 100 | MI_INFO *info= (MI_INFO*) my_hash_first(&myisam_open_table_hash, |
140 | 101 | (uchar *) filename, | ||
141 | 102 | len, ¤t_record); | ||
142 | 103 | /* | ||
143 | 104 | There might be more than one instance of a table share for | ||
144 | 105 | a given table in the hash table. We're interested in the one with | ||
145 | 106 | last_version set, so we iterate until we find it | ||
146 | 107 | */ | ||
147 | 108 | while (info) | ||
148 | 59 | { | 109 | { |
149 | 60 | MI_INFO *info=(MI_INFO*) pos->data; | ||
150 | 61 | MYISAM_SHARE *share=info->s; | 110 | MYISAM_SHARE *share=info->s; |
153 | 62 | if (!strcmp(share->unique_file_name,filename) && share->last_version) | 111 | if (share->last_version) |
154 | 63 | return info; | 112 | break; |
155 | 113 | |||
156 | 114 | info= (MI_INFO*) my_hash_next(&myisam_open_table_hash, | ||
157 | 115 | (uchar *) filename, | ||
158 | 116 | len, ¤t_record); | ||
159 | 64 | } | 117 | } |
161 | 65 | return 0; | 118 | return info; |
162 | 66 | } | 119 | } |
163 | 67 | 120 | ||
164 | 68 | 121 | ||
165 | @@ -650,8 +703,9 @@ | |||
166 | 650 | #ifdef THREAD | 703 | #ifdef THREAD |
167 | 651 | thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info); | 704 | thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info); |
168 | 652 | #endif | 705 | #endif |
171 | 653 | m_info->open_list.data=(void*) m_info; | 706 | |
172 | 654 | myisam_open_list=list_add(myisam_open_list,&m_info->open_list); | 707 | if (my_hash_insert(&myisam_open_table_hash, (uchar *) m_info)) |
173 | 708 | goto err; | ||
174 | 655 | 709 | ||
175 | 656 | pthread_mutex_unlock(&THR_LOCK_myisam); | 710 | pthread_mutex_unlock(&THR_LOCK_myisam); |
176 | 657 | 711 | ||
177 | 658 | 712 | ||
178 | === modified file 'Percona-Server/storage/myisam/mi_panic.c' | |||
179 | --- Percona-Server/storage/myisam/mi_panic.c 2006-12-31 00:32:21 +0000 | |||
180 | +++ Percona-Server/storage/myisam/mi_panic.c 2013-02-24 23:14:22 +0000 | |||
181 | @@ -26,22 +26,36 @@ | |||
182 | 26 | int mi_panic(enum ha_panic_function flag) | 26 | int mi_panic(enum ha_panic_function flag) |
183 | 27 | { | 27 | { |
184 | 28 | int error=0; | 28 | int error=0; |
185 | 29 | LIST *list_element,*next_open; | ||
186 | 30 | MI_INFO *info; | 29 | MI_INFO *info; |
187 | 30 | uint idx; | ||
188 | 31 | DBUG_ENTER("mi_panic"); | 31 | DBUG_ENTER("mi_panic"); |
189 | 32 | 32 | ||
190 | 33 | pthread_mutex_lock(&THR_LOCK_myisam); | 33 | pthread_mutex_lock(&THR_LOCK_myisam); |
192 | 34 | for (list_element=myisam_open_list ; list_element ; list_element=next_open) | 34 | |
193 | 35 | if (!my_hash_inited(&myisam_open_table_hash)) | ||
194 | 36 | goto finish; | ||
195 | 37 | |||
196 | 38 | if (flag == HA_PANIC_CLOSE) | ||
197 | 35 | { | 39 | { |
203 | 36 | next_open=list_element->next; /* Save if close */ | 40 | while (myisam_open_table_hash.records) |
204 | 37 | info=(MI_INFO*) list_element->data; | 41 | { |
205 | 38 | switch (flag) { | 42 | /* |
206 | 39 | case HA_PANIC_CLOSE: | 43 | As long as there are records in the hash, fetch the |
207 | 40 | pthread_mutex_unlock(&THR_LOCK_myisam); /* Not exactly right... */ | 44 | first, and close it. |
208 | 45 | */ | ||
209 | 46 | info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, 0); | ||
210 | 47 | pthread_mutex_unlock(&THR_LOCK_myisam); /* Not exactly right... */ | ||
211 | 41 | if (mi_close(info)) | 48 | if (mi_close(info)) |
213 | 42 | error=my_errno; | 49 | error= my_errno; |
214 | 43 | pthread_mutex_lock(&THR_LOCK_myisam); | 50 | pthread_mutex_lock(&THR_LOCK_myisam); |
216 | 44 | break; | 51 | } |
217 | 52 | } | ||
218 | 53 | |||
219 | 54 | for (idx= 0; idx < myisam_open_table_hash.records; ++idx) | ||
220 | 55 | { | ||
221 | 56 | info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx); | ||
222 | 57 | switch (flag) { | ||
223 | 58 | case HA_PANIC_CLOSE: break; | ||
224 | 45 | case HA_PANIC_WRITE: /* Do this to free databases */ | 59 | case HA_PANIC_WRITE: /* Do this to free databases */ |
225 | 46 | #ifdef CANT_OPEN_FILES_TWICE | 60 | #ifdef CANT_OPEN_FILES_TWICE |
226 | 47 | if (info->s->options & HA_OPTION_READ_ONLY_DATA) | 61 | if (info->s->options & HA_OPTION_READ_ONLY_DATA) |
227 | @@ -106,6 +120,8 @@ | |||
228 | 106 | VOID(mi_log(0)); /* Close log if neaded */ | 120 | VOID(mi_log(0)); /* Close log if neaded */ |
229 | 107 | ft_free_stopwords(); | 121 | ft_free_stopwords(); |
230 | 108 | } | 122 | } |
231 | 123 | |||
232 | 124 | finish: | ||
233 | 109 | pthread_mutex_unlock(&THR_LOCK_myisam); | 125 | pthread_mutex_unlock(&THR_LOCK_myisam); |
234 | 110 | if (!error) | 126 | if (!error) |
235 | 111 | DBUG_RETURN(0); | 127 | DBUG_RETURN(0); |
236 | 112 | 128 | ||
237 | === modified file 'Percona-Server/storage/myisam/mi_static.c' | |||
238 | --- Percona-Server/storage/myisam/mi_static.c 2011-06-30 15:37:13 +0000 | |||
239 | +++ Percona-Server/storage/myisam/mi_static.c 2013-02-24 23:14:22 +0000 | |||
240 | @@ -25,7 +25,7 @@ | |||
241 | 25 | #include "myisamdef.h" | 25 | #include "myisamdef.h" |
242 | 26 | #endif | 26 | #endif |
243 | 27 | 27 | ||
245 | 28 | LIST *myisam_open_list=0; | 28 | HASH myisam_open_table_hash; |
246 | 29 | uchar NEAR myisam_file_magic[]= | 29 | uchar NEAR myisam_file_magic[]= |
247 | 30 | { (uchar) 254, (uchar) 254,'\007', '\001', }; | 30 | { (uchar) 254, (uchar) 254,'\007', '\001', }; |
248 | 31 | uchar NEAR myisam_pack_file_magic[]= | 31 | uchar NEAR myisam_pack_file_magic[]= |
249 | 32 | 32 | ||
250 | === modified file 'Percona-Server/storage/myisam/myisamchk.c' | |||
251 | --- Percona-Server/storage/myisam/myisamchk.c 2011-06-30 15:37:13 +0000 | |||
252 | +++ Percona-Server/storage/myisam/myisamchk.c 2013-02-24 23:14:22 +0000 | |||
253 | @@ -96,6 +96,12 @@ | |||
254 | 96 | get_options(&argc,(char***) &argv); | 96 | get_options(&argc,(char***) &argv); |
255 | 97 | myisam_quick_table_bits=decode_bits; | 97 | myisam_quick_table_bits=decode_bits; |
256 | 98 | error=0; | 98 | error=0; |
257 | 99 | if (mi_init_open_table_hash(0)) | ||
258 | 100 | { | ||
259 | 101 | fprintf(stderr, "Can't initialize MyISAM storage engine\n"); | ||
260 | 102 | exit(-1); | ||
261 | 103 | } | ||
262 | 104 | |||
263 | 99 | while (--argc >= 0) | 105 | while (--argc >= 0) |
264 | 100 | { | 106 | { |
265 | 101 | int new_error=myisamchk(&check_param, *(argv++)); | 107 | int new_error=myisamchk(&check_param, *(argv++)); |
266 | 102 | 108 | ||
267 | === modified file 'Percona-Server/storage/myisam/myisamdef.h' | |||
268 | --- Percona-Server/storage/myisam/myisamdef.h 2011-11-24 02:01:56 +0000 | |||
269 | +++ Percona-Server/storage/myisam/myisamdef.h 2013-02-24 23:14:22 +0000 | |||
270 | @@ -26,6 +26,7 @@ | |||
271 | 26 | #else | 26 | #else |
272 | 27 | #include <my_no_pthread.h> | 27 | #include <my_no_pthread.h> |
273 | 28 | #endif | 28 | #endif |
274 | 29 | #include "hash.h" | ||
275 | 29 | 30 | ||
276 | 30 | #if defined(my_write) && !defined(MAP_TO_USE_RAID) | 31 | #if defined(my_write) && !defined(MAP_TO_USE_RAID) |
277 | 31 | #undef my_write /* undef map from my_nosys; We need test-if-disk full */ | 32 | #undef my_write /* undef map from my_nosys; We need test-if-disk full */ |
278 | @@ -286,7 +287,6 @@ | |||
279 | 286 | uint data_changed; /* Somebody has changed data */ | 287 | uint data_changed; /* Somebody has changed data */ |
280 | 287 | uint save_update; /* When using KEY_READ */ | 288 | uint save_update; /* When using KEY_READ */ |
281 | 288 | int save_lastinx; | 289 | int save_lastinx; |
282 | 289 | LIST open_list; | ||
283 | 290 | IO_CACHE rec_cache; /* When cacheing records */ | 290 | IO_CACHE rec_cache; /* When cacheing records */ |
284 | 291 | uint preload_buff_size; /* When preloading indexes */ | 291 | uint preload_buff_size; /* When preloading indexes */ |
285 | 292 | myf lock_wait; /* is 0 or MY_DONT_WAIT */ | 292 | myf lock_wait; /* is 0 or MY_DONT_WAIT */ |
286 | @@ -472,8 +472,7 @@ | |||
287 | 472 | #endif | 472 | #endif |
288 | 473 | 473 | ||
289 | 474 | /* Some extern variables */ | 474 | /* Some extern variables */ |
292 | 475 | 475 | extern HASH myisam_open_table_hash; | |
291 | 476 | extern LIST *myisam_open_list; | ||
293 | 477 | extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; | 476 | extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; |
294 | 478 | extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; | 477 | extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; |
295 | 479 | extern uint myisam_quick_table_bits; | 478 | extern uint myisam_quick_table_bits; |
296 | @@ -759,6 +758,7 @@ | |||
297 | 759 | void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); | 758 | void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); |
298 | 760 | 759 | ||
299 | 761 | extern MI_INFO *test_if_reopen(char *filename); | 760 | extern MI_INFO *test_if_reopen(char *filename); |
300 | 761 | extern int mi_init_open_table_hash(ulong size); | ||
301 | 762 | my_bool check_table_is_closed(const char *name, const char *where); | 762 | my_bool check_table_is_closed(const char *name, const char *where); |
302 | 763 | int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name, | 763 | int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name, |
303 | 764 | File file_to_dup); | 764 | File file_to_dup); |
304 | 765 | 765 | ||
305 | === modified file 'Percona-Server/storage/myisam/myisampack.c' | |||
306 | --- Percona-Server/storage/myisam/myisampack.c 2011-06-30 15:37:13 +0000 | |||
307 | +++ Percona-Server/storage/myisam/myisampack.c 2013-02-24 23:14:22 +0000 | |||
308 | @@ -210,6 +210,11 @@ | |||
309 | 210 | MY_INIT(argv[0]); | 210 | MY_INIT(argv[0]); |
310 | 211 | 211 | ||
311 | 212 | load_defaults("my",load_default_groups,&argc,&argv); | 212 | load_defaults("my",load_default_groups,&argc,&argv); |
312 | 213 | if (mi_init_open_table_hash(0)) | ||
313 | 214 | { | ||
314 | 215 | fputs("Can't initialize MyISAM storage engine", stderr); | ||
315 | 216 | exit(1); | ||
316 | 217 | } | ||
317 | 213 | default_argv= argv; | 218 | default_argv= argv; |
318 | 214 | get_options(&argc,&argv); | 219 | get_options(&argc,&argv); |
319 | 215 | 220 |
Approved after fixing revision comments to reference the bug number.