Skip to content

Commit ce7a0a0

Browse files
author
monty@hundin.mysql.fi
committed
Fix not critical MyISAM bug in locking.
Free character sets properly (for embedded). Add missing mutex in HANDLER CLOSE
1 parent 7c3f844 commit ce7a0a0

File tree

9 files changed

+97
-14
lines changed

9 files changed

+97
-14
lines changed

Build-tools/Do-compile

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if ($opt_innodb || $opt_bdb)
1919

2020
chomp($host=`hostname`);
2121
$full_host_name=$host;
22-
info("Compiling MySQL$version_suffix at $host, stage: $opt_stage\n");
22+
info("Compiling MySQL$version_suffix at $host$suffix, stage: $opt_stage\n");
2323
$connect_option= ($opt_tcpip ? "--host=$host" : "");
2424
$host =~ /^([^.-]*)/;
2525
$host=$1 . $opt_suffix;
@@ -36,6 +36,10 @@ if (defined($gcc_version) && ! $opt_config_env)
3636
{
3737
$opt_config_env= 'CC=gcc CFLAGS="-O2 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fno-omit-frame-pointer"';
3838
}
39+
elsif ($tmp =~ /version 3\.0\./)
40+
{
41+
$opt_config_env= 'CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"';
42+
}
3943
else
4044
{
4145
$opt_config_env= 'CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"';
@@ -107,7 +111,6 @@ $|=1;
107111
safe_cd("$host");
108112
if ($opt_stage == 0 && ! $opt_use_old_distribution)
109113
{
110-
my ($name);
111114
safe_system("gunzip < $opt_distribution | $tar xf -");
112115

113116
# Fix file times; This is needed because the time for files may be

Docs/manual.texi

+6-1
Original file line numberDiff line numberDiff line change
@@ -7704,6 +7704,11 @@ also work. There have been some problems with the @code{glibc} RPMs from
77047704
RedHat, so if you have problems, check whether or not there are any updates!
77057705
The @code{glibc} 2.0.7-19 and 2.0.7-29 RPMs are known to work.
77067706

7707+
If you are using gcc 3.0 and above to compile MySQL, you must install
7708+
the @code{libstdc++v3} library before compiling MySQL; If you don't do
7709+
this you will get an error about a missing @code{__cxa_pure_virtual}
7710+
symbol during linking!
7711+
77077712
On some older Linux distributions, @code{configure} may produce an error
77087713
like this:
77097714

@@ -7757,7 +7762,7 @@ shell> CXX=gcc ./configure
77577762
@end example
77587763

77597764
If you are running gcc 3.0 and above, you can't use the above trick with
7760-
CXX=gcc, but you have to install libstd++.
7765+
setting to CXX=gcc.
77617766

77627767
@node Linux-SPARC, Linux-Alpha, Linux-x86, Linux
77637768
@subsubsection Linux SPARC Notes

myisam/mi_locking.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
305305
MYISAM_SHARE *share=info->s;
306306
if (!share->tot_locks)
307307
{
308-
if ((info->tmp_lock_type=lock_type) != F_RDLCK)
309-
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
310-
info->lock_wait | MY_SEEK_NOT_DONE))
311-
DBUG_RETURN(1);
308+
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
309+
info->lock_wait | MY_SEEK_NOT_DONE))
310+
DBUG_RETURN(1);
312311
if (mi_state_info_read_dsk(share->kfile, &share->state, 1))
313312
{
314313
int error=my_errno ? my_errno : -1;

myisam/myisamdef.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ enum myisam_log_commands {
589589
#define myisam_log_record(a,b,c,d,e) if (myisam_log_file >= 0) _myisam_log_record(a,b,c,d,e)
590590

591591
#define fast_mi_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _mi_writeinfo((INFO),0)
592-
#define fast_mi_readinfo(INFO) (!(INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
592+
#define fast_mi_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
593593

594594
#ifdef __cplusplus
595595
extern "C" {

mysys/my_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void my_end(int infoflag)
125125
DBUG_PRINT("error",("%s",errbuff[0]));
126126
}
127127
}
128+
free_charsets();
128129
if (infoflag & MY_GIVE_INFO || info_file != stderr)
129130
{
130131
#ifdef HAVE_GETRUSAGE
@@ -149,7 +150,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
149150
#if defined(MSDOS) && !defined(__WIN__)
150151
fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
151152
#endif
152-
free_charsets();
153153
#if defined(SAFEMALLOC)
154154
TERMINATE(stderr); /* Give statistic on screen */
155155
#elif defined(__WIN__) && defined(_MSC_VER)

mysys/my_seek.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
3535
DBUG_PRINT("error",("lseek: %lu, errno: %d",newpos,errno));
3636
DBUG_RETURN(MY_FILEPOS_ERROR);
3737
}
38-
if (newpos != pos)
38+
if ((my_off_t) newpos != pos)
3939
{
4040
DBUG_PRINT("exit",("pos: %lu", (ulong) newpos));
4141
}

sql-bench/server-cfg.sh

+74-2
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ sub reconnect_on_errors
335335
return 0;
336336
}
337337

338+
sub fix_for_insert
339+
{
340+
my ($self,$cmd) = @_;
341+
return $cmd;
342+
}
343+
338344
#
339345
# Optimize tables for better performance
340346
#
@@ -354,7 +360,6 @@ sub vacuum
354360
}
355361
}
356362

357-
358363
#############################################################################
359364
# Definitions for mSQL
360365
#############################################################################
@@ -548,6 +553,12 @@ sub reconnect_on_errors
548553
return 0;
549554
}
550555

556+
sub fix_for_insert
557+
{
558+
my ($self,$cmd) = @_;
559+
return $cmd;
560+
}
561+
551562
#############################################################################
552563
# Definitions for PostgreSQL #
553564
#############################################################################
@@ -806,6 +817,12 @@ sub reconnect_on_errors
806817
return 0;
807818
}
808819

820+
sub fix_for_insert
821+
{
822+
my ($self,$cmd) = @_;
823+
return $cmd;
824+
}
825+
809826
sub vacuum
810827
{
811828
my ($self,$full_vacuum,$dbh_ref,@tables)=@_;
@@ -1072,6 +1089,12 @@ sub small_rollback_segment
10721089
return 0;
10731090
}
10741091

1092+
sub fix_for_insert
1093+
{
1094+
my ($self,$cmd) = @_;
1095+
return $cmd;
1096+
}
1097+
10751098
sub reconnect_on_errors
10761099
{
10771100
return 0;
@@ -1811,7 +1834,7 @@ sub query {
18111834
sub fix_for_insert
18121835
{
18131836
my ($self,$cmd) = @_;
1814-
$cmd =~ s/\\'//g;
1837+
$cmd =~ s/\\\'//g;
18151838
return $cmd;
18161839
}
18171840

@@ -1844,6 +1867,7 @@ sub reconnect_on_errors
18441867
return 0;
18451868
}
18461869

1870+
18471871
#############################################################################
18481872
# Configuration for Access
18491873
#############################################################################
@@ -2021,6 +2045,12 @@ sub reconnect_on_errors
20212045
return 1;
20222046
}
20232047

2048+
sub fix_for_insert
2049+
{
2050+
my ($self,$cmd) = @_;
2051+
return $cmd;
2052+
}
2053+
20242054
#############################################################################
20252055
# Configuration for Microsoft SQL server
20262056
#############################################################################
@@ -2209,6 +2239,12 @@ sub reconnect_on_errors
22092239
return 0;
22102240
}
22112241

2242+
sub fix_for_insert
2243+
{
2244+
my ($self,$cmd) = @_;
2245+
return $cmd;
2246+
}
2247+
22122248
#############################################################################
22132249
# Configuration for Sybase
22142250
#############################################################################
@@ -2384,6 +2420,12 @@ sub reconnect_on_errors
23842420
return 0;
23852421
}
23862422

2423+
sub fix_for_insert
2424+
{
2425+
my ($self,$cmd) = @_;
2426+
return $cmd;
2427+
}
2428+
23872429
#
23882430
# optimize the tables ....
23892431
#
@@ -2617,6 +2659,12 @@ sub reconnect_on_errors
26172659
return 0;
26182660
}
26192661

2662+
sub fix_for_insert
2663+
{
2664+
my ($self,$cmd) = @_;
2665+
return $cmd;
2666+
}
2667+
26202668
#############################################################################
26212669
# Configuration for IBM DB2
26222670
#############################################################################
@@ -2791,6 +2839,12 @@ sub reconnect_on_errors
27912839
return 0;
27922840
}
27932841

2842+
sub fix_for_insert
2843+
{
2844+
my ($self,$cmd) = @_;
2845+
return $cmd;
2846+
}
2847+
27942848
#############################################################################
27952849
# Configuration for MIMER
27962850
#############################################################################
@@ -2992,6 +3046,12 @@ sub reconnect_on_errors
29923046
return 0;
29933047
}
29943048

3049+
sub fix_for_insert
3050+
{
3051+
my ($self,$cmd) = @_;
3052+
return $cmd;
3053+
}
3054+
29953055
#############################################################################
29963056
# Configuration for InterBase
29973057
#############################################################################
@@ -3205,6 +3265,12 @@ sub reconnect_on_errors
32053265
return 1;
32063266
}
32073267

3268+
sub fix_for_insert
3269+
{
3270+
my ($self,$cmd) = @_;
3271+
return $cmd;
3272+
}
3273+
32083274
#############################################################################
32093275
# Configuration for FrontBase
32103276
#############################################################################
@@ -3410,4 +3476,10 @@ sub reconnect_on_errors
34103476
return 1;
34113477
}
34123478

3479+
sub fix_for_insert
3480+
{
3481+
my ($self,$cmd) = @_;
3482+
return $cmd;
3483+
}
3484+
34133485
1;

sql/sql_handler.cc

+4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
6363
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->name);
6464

6565
if (*ptr)
66+
{
67+
VOID(pthread_mutex_lock(&LOCK_open));
6668
close_thread_table(thd, ptr);
69+
VOID(pthread_mutex_unlock(&LOCK_open));
70+
}
6771

6872
send_ok(&thd->net);
6973
return 0;

sql/sql_update.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int mysql_update(THD *thd,
199199
}
200200

201201
init_read_record(&info,thd,table,select,0,1);
202-
thd->proc_info="searching";
202+
thd->proc_info="Searching rows for update";
203203

204204
while (!(error=info.read_record(&info)) && !thd->killed)
205205
{
@@ -261,7 +261,7 @@ int mysql_update(THD *thd,
261261
ha_rows updated=0L,found=0L;
262262
thd->count_cuted_fields=1; /* calc cuted fields */
263263
thd->cuted_fields=0L;
264-
thd->proc_info="updating";
264+
thd->proc_info="Updating";
265265
query_id=thd->query_id;
266266

267267
while (!(error=info.read_record(&info)) && !thd->killed)

0 commit comments

Comments
 (0)