Merge lp:~vlad-lesin/percona-server/5.1-table_cache_speed_up into lp:percona-server/5.1

Proposed by Vlad Lesin on 2012-08-19
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
Reviewer Review Type Date Requested Status
Stewart Smith (community) Needs Fixing on 2012-12-27
Alexey Kopytov (community) 2012-08-19 Approve on 2012-08-23
Review via email: mp+120285@code.launchpad.net

Description of the change

This MP is port of this http://lists.mysql.com/commits/121507 patch to 5.1(see issue #25137). The main idea of this patch is to replace linked list of opened tables with hash-table to improve performance of open table lookup mechanism.

Jenkins build of 5.1 with this patch is:
http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/367/

Jenkins build of 5.1 without this patch is:
http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/369/

There are three tests which failed on patched version and were success on original 5.1:
1) innodb_plugin.percona_changed_page_bmp
(I think the trouble is in that "120813 15:38:22 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead." warning and doesn't concern this patch)
2) rpl.percona_bug860910 'stmt'
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_log_slow_slave_statements-innodb
2) rpl.percona_bug860910 'row'
3) rpl.rpl_row_func003 'row'
4) rpl.rpl_start_stop_slave 'mix'

To post a comment you must log in.
465. By Stewart Smith on 2012-08-20

merge fix for Bug #905334: Intermittent innodb_bug56680 crash

466. By Stewart Smith on 2012-08-20

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 on 2012-08-20

fix percona_server_variables_debug from 5.1.65 merge (MySQl 5.1.65 added SLAVE_MAX_ALLOWED_PACKET)

468. By Stewart Smith on 2012-08-20

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 on 2012-08-21

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 on 2012-08-23

merge HandlerSocket fix (fix is due to BZR having an odd bug checking out the repository)

471. By Stewart Smith on 2012-08-23

merge fix for Bug lp:1040483 UNIV_NONINL build broken

472. By Stewart Smith on 2012-08-23

merge fix for Bug #1036530: Sporadic innodb_plugin.percona_changed_page_bmp failures in Jenkins

Alexey Kopytov (akopytov) wrote :

Approved after fixing revision comments to reference the bug number.

review: Approve
473. By Stewart Smith on 2012-08-24

merge fix for Bug #1039384: innodb_adaptive_flushing_method and innodb_flush_neighbor_pages partially broken

474. By Stewart Smith on 2012-08-27

merge 5.1.63-13.4 release branch

475. By Stewart Smith on 2012-08-27

merge fix for Bug #1023883: libmysqlclient16-dev 'Replaces' libmysqlclient16-dev but doesn't 'Provides' it

476. By Stewart Smith on 2012-08-27

merge fix for Bug #902472: main.subselect_notembedded fails on Ubuntu Oneiric in Jenkins

477. By Hrvoje Matijakovic on 2012-09-03

Merged lp:~hrvojem/percona-server/rn-5.1.65-14.0

478. By Stewart Smith on 2012-09-05

merge fix for Bug #1039931: 64-bit atomic operation Autoconf tests duplicated in regular atomic operation tests

479. By Stewart Smith on 2012-09-05

merge fix for Bug #902471: Lots of ssl tests failures on oneiric hosts

480. By Stewart Smith on 2012-09-05

merge Bug #747032: Flashcache throws an error on startup when flashcache is not used

481. By Stewart Smith on 2012-09-05

merge 5.1.65-14.0 release branch

482. By Hrvoje Matijakovic on 2012-09-25

Merged lp:~hrvojem/percona-server/bug1034305-5.1

483. By Stewart Smith on 2012-10-02

merge fix for: Bug #1046389: UNIV_DEBUG build broken

484. By Hrvoje Matijakovic on 2012-10-05

* bug fix for Bug #1054090

Stewart Smith (stewart) wrote :

This will need 5.5 branch before I can merge.

485. By Stewart Smith on 2012-10-12

merge fix for Bug #978036: Percona server crashes on ALTER TABLE on temporary table

486. By Stewart Smith on 2012-10-12

merge fix for Bug #1053087: incorrect mutex handling during buf_LRU_file_dump

487. By Stewart Smith on 2012-10-12

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 on 2012-10-12

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 on 2012-10-12

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 on 2012-10-12

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 on 2012-10-12

merge documentation updates

492. By Hrvoje Matijakovic on 2012-10-13

Added missing release dates, bugfix for Bug #1057029

493. By Hrvoje Matijakovic on 2012-10-18

Added missing release dates, bugfix for Bug #1057029

494. By Stewart Smith on 2012-10-23

merge 5.1.66-14.1 release notes

495. By Hrvoje Matijakovic on 2012-10-31

Bug fix for Bug#1056658

496. By Hrvoje Matijakovic on 2012-12-10

* bug fix for Bug #1056603
* added missing tables with the description
* fixed already existing I_S tables

497. By <email address hidden> on 2012-12-11

Merge lp:~laurynas-biveinis/percona-server/bug1076215-5.1

498. By <email address hidden> on 2012-12-12

Merge lp:~laurynas-biveinis/percona-server/26611-bug917942-5.1

499. By <email address hidden> on 2012-12-12

Merge lp:~laurynas-biveinis/percona-server/26611-bug1064333-5.1

500. By <email address hidden> on 2012-12-12

Merge lp:~laurynas-biveinis/percona-server/26611-bug1059738-5.1

501. By <email address hidden> on 2012-12-13

Merge lp:~akopytov/percona-server/bugs-1039536-1081003-5.1

502. By <email address hidden> on 2012-12-13

Merge lp:~akopytov/percona-server/bug1070856-5.1

503. By <email address hidden> on 2012-12-13

Merge lp:~akopytov/percona-server/bug830286-5.1

504. By <email address hidden> on 2012-12-14

Merge lp:~laurynas-biveinis/percona-server/bug901060-5.1

505. By <email address hidden> on 2012-12-14

Merge lp:~laurynas-biveinis/percona-server/xtradb-multiple-bmp-files-51

506. By <email address hidden> on 2012-12-18

Merge lp:~vlad-lesin/percona-server/5.1-bug1083377-gca

507. By <email address hidden> on 2012-12-19

Merge lp:~stewart/percona-server/5.1-bug1090596

508. By <email address hidden> on 2012-12-19

Merge lp:~hrvojem/percona-server/bug1057031-5.1

Stewart Smith (stewart) wrote :

needs 5.5 branch before I can merge.

review: Needs Fixing
509. By <email address hidden> on 2012-12-27

Merge lp:~hrvojem/percona-server/rn-5.1.66-14.2

510. By <email address hidden> on 2013-01-03

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://code.launchpad.net/~vlad-lesin/percona-server/5.1-gca-bug-1038940-table_cache_speed_up/+merge/141711 .

511. By <email address hidden> on 2013-01-08

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1087202-1087218-5.1

512. By <email address hidden> on 2013-01-09

Merge lp:~hrvojem/percona-server/rn-5.1.66-14.2-r2

513. By <email address hidden> on 2013-01-17

Merge lp:~hrvojem/percona-server/bug1092106-5.1

514. By <email address hidden> on 2013-01-17

Merge lp:~percona-core/percona-server/release-5.1.66-14.1

515. By Stewart Smith on 2013-01-18

merge 5.1.66-14.2 release branch

516. By <email address hidden> on 2013-01-18

Merge lp:~hrvojem/percona-server/rn-5.1.67-14.3

517. By <email address hidden> on 2013-01-19

Merge lp:~sergei.glushchenko/percona-server/51-ST-27220-bug1042946

518. By <email address hidden> on 2013-01-21

Merge lp:~laurynas-biveinis/percona-server/bug110159-5.1

519. By <email address hidden> on 2013-01-28

Merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.1

520. By <email address hidden> on 2013-02-04

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1082437-5.1

521. By <email address hidden> on 2013-02-05

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1083596-5.1

522. By <email address hidden> on 2013-02-06

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1083669-5.1

523. By <email address hidden> on 2013-02-06

Merge lp:~laurynas-biveinis/percona-server/bug1083058-5.1

524. By <email address hidden> on 2013-02-07

Merge lp:~laurynas-biveinis/percona-server/bug1100178-1100643-5.1

525. By <email address hidden> on 2013-02-07

Merge lp:~hrvojem/percona-server/bug1065771-5.1

526. By <email address hidden> on 2013-02-07

Merge lp:~laurynas-biveinis/percona-server/bug1105709-5.1

527. By <email address hidden> on 2013-02-08

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1111226-5.1

528. By <email address hidden> on 2013-02-09

Merge lp:~laurynas-biveinis/percona-server/bug1114612-5.1

529. By Stewart Smith on 2013-02-11

merge slow query log bugfixes from Laurynas

530. By <email address hidden> on 2013-02-13

Merge lp:~hrvojem/percona-server/bug1092189-5.1

531. By <email address hidden> on 2013-02-13

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1105726-5.1

532. By <email address hidden> on 2013-02-13

Merge lp:~laurynas-biveinis/percona-server/BT-16274-bug1108874-5.1

533. By Vlad Lesin on 2013-02-24

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 on 2013-02-24

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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 myisam_hton->create= myisam_create_handler;
6 myisam_hton->panic= myisam_panic;
7 myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
8+
9+ if (mi_init_open_table_hash(table_cache_size))
10+ return 1;
11+
12 return 0;
13 }
14
15
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 info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
21 }
22 flag= !--share->reopen;
23- myisam_open_list=list_delete(myisam_open_list,&info->open_list);
24+ my_hash_delete(&myisam_open_table_hash, (uchar *) info);
25 pthread_mutex_unlock(&share->intern_lock);
26
27 my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
28
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 my_bool check_table_is_closed(const char *name, const char *where)
34 {
35 char filename[FN_REFLEN];
36- LIST *pos;
37+ uint idx;
38 DBUG_ENTER("check_table_is_closed");
39
40 (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32);
41- for (pos=myisam_open_list ; pos ; pos=pos->next)
42+ for (idx= 0; idx < myisam_open_table_hash.records; ++idx)
43 {
44- MI_INFO *info=(MI_INFO*) pos->data;
45+ MI_INFO *info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx);
46 MYISAM_SHARE *share=info->s;
47 if (!strcmp(share->unique_file_name,filename))
48 {
49
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 void mi_change_key_cache(KEY_CACHE *old_key_cache,
55 KEY_CACHE *new_key_cache)
56 {
57- LIST *pos;
58+ uint idx;
59 DBUG_ENTER("mi_change_key_cache");
60
61 /*
62 Lock list to ensure that no one can close the table while we manipulate it
63 */
64 pthread_mutex_lock(&THR_LOCK_myisam);
65- for (pos=myisam_open_list ; pos ; pos=pos->next)
66+ for (idx= 0; idx < myisam_open_table_hash.records; ++idx)
67 {
68- MI_INFO *info= (MI_INFO*) pos->data;
69+ MI_INFO *info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx);
70 MYISAM_SHARE *share= info->s;
71 if (share->key_cache == old_key_cache)
72 mi_assign_to_key_cache(info, (ulonglong) ~0, new_key_cache);
73
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 }
79
80
81-/******************************************************************************
82-** Return the shared struct if the table is already open.
83-** In MySQL the server will handle version issues.
84-******************************************************************************/
85-
86+/*
87+ Get the value used as hash key (helper function for the
88+ open table hash). Function is used as a callback
89+ from the hash table
90+*/
91+static uchar *mi_open_table_hash_key(const uchar *record, size_t *length,
92+ my_bool not_used __attribute__((unused)))
93+{
94+ MI_INFO *info= (MI_INFO *) record;
95+ *length= info->s->unique_name_length;
96+ return (uchar*) info->s->unique_file_name;
97+}
98+
99+/**
100+ Initialize open table hash
101+
102+ Function is normally called from myisam_init
103+ with the system variable table_cache_size used
104+ as hash_size.
105+
106+ @param[in] hash_size Initial has size (elements)
107+ @return inidicates success or failure of initialization
108+ @retval 0 success
109+ @retval 1 failure
110+
111+*/
112+int mi_init_open_table_hash(ulong hash_size)
113+{
114+ if (hash_size == 0)
115+ hash_size= 32; /* default hash size */
116+
117+ if (my_hash_init(&myisam_open_table_hash, &my_charset_filename,
118+ hash_size, 0, 0, mi_open_table_hash_key, 0, 0))
119+ return 1; /* error */
120+
121+ return 0;
122+}
123+
124+
125+/**
126+ Retrieve the shared struct if the table is already
127+ open (i.e in the open table hash)
128+
129+ @param[in] filename table file name
130+ @return shared struct, 0 if not in the cache
131+*/
132 MI_INFO *test_if_reopen(char *filename)
133 {
134- LIST *pos;
135+ HASH_SEARCH_STATE current_record;
136+ int len= strlen(filename);
137
138- for (pos=myisam_open_list ; pos ; pos=pos->next)
139+ MI_INFO *info= (MI_INFO*) my_hash_first(&myisam_open_table_hash,
140+ (uchar *) filename,
141+ len, &current_record);
142+ /*
143+ There might be more than one instance of a table share for
144+ a given table in the hash table. We're interested in the one with
145+ last_version set, so we iterate until we find it
146+ */
147+ while (info)
148 {
149- MI_INFO *info=(MI_INFO*) pos->data;
150 MYISAM_SHARE *share=info->s;
151- if (!strcmp(share->unique_file_name,filename) && share->last_version)
152- return info;
153+ if (share->last_version)
154+ break;
155+
156+ info= (MI_INFO*) my_hash_next(&myisam_open_table_hash,
157+ (uchar *) filename,
158+ len, &current_record);
159 }
160- return 0;
161+ return info;
162 }
163
164
165@@ -650,8 +703,9 @@
166 #ifdef THREAD
167 thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info);
168 #endif
169- m_info->open_list.data=(void*) m_info;
170- myisam_open_list=list_add(myisam_open_list,&m_info->open_list);
171+
172+ if (my_hash_insert(&myisam_open_table_hash, (uchar *) m_info))
173+ goto err;
174
175 pthread_mutex_unlock(&THR_LOCK_myisam);
176
177
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 int mi_panic(enum ha_panic_function flag)
183 {
184 int error=0;
185- LIST *list_element,*next_open;
186 MI_INFO *info;
187+ uint idx;
188 DBUG_ENTER("mi_panic");
189
190 pthread_mutex_lock(&THR_LOCK_myisam);
191- for (list_element=myisam_open_list ; list_element ; list_element=next_open)
192+
193+ if (!my_hash_inited(&myisam_open_table_hash))
194+ goto finish;
195+
196+ if (flag == HA_PANIC_CLOSE)
197 {
198- next_open=list_element->next; /* Save if close */
199- info=(MI_INFO*) list_element->data;
200- switch (flag) {
201- case HA_PANIC_CLOSE:
202- pthread_mutex_unlock(&THR_LOCK_myisam); /* Not exactly right... */
203+ while (myisam_open_table_hash.records)
204+ {
205+ /*
206+ As long as there are records in the hash, fetch the
207+ first, and close it.
208+ */
209+ info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, 0);
210+ pthread_mutex_unlock(&THR_LOCK_myisam); /* Not exactly right... */
211 if (mi_close(info))
212- error=my_errno;
213+ error= my_errno;
214 pthread_mutex_lock(&THR_LOCK_myisam);
215- break;
216+ }
217+ }
218+
219+ for (idx= 0; idx < myisam_open_table_hash.records; ++idx)
220+ {
221+ info=(MI_INFO*) my_hash_element(&myisam_open_table_hash, idx);
222+ switch (flag) {
223+ case HA_PANIC_CLOSE: break;
224 case HA_PANIC_WRITE: /* Do this to free databases */
225 #ifdef CANT_OPEN_FILES_TWICE
226 if (info->s->options & HA_OPTION_READ_ONLY_DATA)
227@@ -106,6 +120,8 @@
228 VOID(mi_log(0)); /* Close log if neaded */
229 ft_free_stopwords();
230 }
231+
232+finish:
233 pthread_mutex_unlock(&THR_LOCK_myisam);
234 if (!error)
235 DBUG_RETURN(0);
236
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 #include "myisamdef.h"
242 #endif
243
244-LIST *myisam_open_list=0;
245+HASH myisam_open_table_hash;
246 uchar NEAR myisam_file_magic[]=
247 { (uchar) 254, (uchar) 254,'\007', '\001', };
248 uchar NEAR myisam_pack_file_magic[]=
249
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 get_options(&argc,(char***) &argv);
255 myisam_quick_table_bits=decode_bits;
256 error=0;
257+ if (mi_init_open_table_hash(0))
258+ {
259+ fprintf(stderr, "Can't initialize MyISAM storage engine\n");
260+ exit(-1);
261+ }
262+
263 while (--argc >= 0)
264 {
265 int new_error=myisamchk(&check_param, *(argv++));
266
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 #else
272 #include <my_no_pthread.h>
273 #endif
274+#include "hash.h"
275
276 #if defined(my_write) && !defined(MAP_TO_USE_RAID)
277 #undef my_write /* undef map from my_nosys; We need test-if-disk full */
278@@ -286,7 +287,6 @@
279 uint data_changed; /* Somebody has changed data */
280 uint save_update; /* When using KEY_READ */
281 int save_lastinx;
282- LIST open_list;
283 IO_CACHE rec_cache; /* When cacheing records */
284 uint preload_buff_size; /* When preloading indexes */
285 myf lock_wait; /* is 0 or MY_DONT_WAIT */
286@@ -472,8 +472,7 @@
287 #endif
288
289 /* Some extern variables */
290-
291-extern LIST *myisam_open_list;
292+extern HASH myisam_open_table_hash;
293 extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[];
294 extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[];
295 extern uint myisam_quick_table_bits;
296@@ -759,6 +758,7 @@
297 void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
298
299 extern MI_INFO *test_if_reopen(char *filename);
300+extern int mi_init_open_table_hash(ulong size);
301 my_bool check_table_is_closed(const char *name, const char *where);
302 int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name,
303 File file_to_dup);
304
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 MY_INIT(argv[0]);
310
311 load_defaults("my",load_default_groups,&argc,&argv);
312+ if (mi_init_open_table_hash(0))
313+ {
314+ fputs("Can't initialize MyISAM storage engine", stderr);
315+ exit(1);
316+ }
317 default_argv= argv;
318 get_options(&argc,&argv);
319

Subscribers

People subscribed via source and target branches