diff options
author | unknown <monty@hundin.mysql.fi> | 2001-12-06 01:16:28 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-12-06 01:16:28 +0200 |
commit | b5cfb7ac01dd00715060470805859a51d6f2caf5 (patch) | |
tree | 72b6ce45de206772ff694d62b41d9fc5a16edbe8 | |
parent | ff8c7348648b2a2e1ce14d8332c065a38a43ca0c (diff) | |
parent | 6f8f45e9592aa7f2ca48168d51e1624cce158797 (diff) | |
download | mariadb-git-b5cfb7ac01dd00715060470805859a51d6f2caf5.tar.gz |
merge with 3.23.47
Docs/manual.texi:
Auto merged
Build-tools/Do-compile:
Auto merged
innobase/include/buf0buf.ic:
Auto merged
myisam/mi_locking.c:
Auto merged
mysql-test/t/join_outer.test:
Auto merged
mysys/my_init.c:
Auto merged
scripts/mysql_config.sh:
Auto merged
mysql-test/t/myisam.test:
Auto merged
sql/ha_innobase.h:
Auto merged
sql/handler.h:
Auto merged
configure.in:
merge
mysql-test/r/innodb.result:
merge
mysql-test/r/join_outer.result:
merge
mysql-test/r/myisam.result:
merge
mysql-test/t/innodb.test:
merge
mysys/mf_iocache2.c:
Skip changes in 3.23
sql/sql_select.cc:
merge
-rw-r--r-- | Docs/manual.texi | 15 | ||||
-rwxr-xr-x | build-tags | 11 | ||||
-rw-r--r-- | innobase/include/buf0buf.ic | 10 | ||||
-rw-r--r-- | innobase/include/mtr0log.ic | 7 | ||||
-rw-r--r-- | innobase/log/log0recv.c | 4 | ||||
-rw-r--r-- | mysql-test/r/gcc296.result | 5 | ||||
-rw-r--r-- | mysql-test/t/gcc296.test | 17 | ||||
-rw-r--r-- | mysql-test/t/innodb.test | 16 | ||||
-rw-r--r-- | mysql-test/t/join_outer.test | 12 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 16 | ||||
-rw-r--r-- | scripts/mysql_config.sh | 51 | ||||
-rw-r--r-- | scripts/mysqlhotcopy.sh | 96 | ||||
-rw-r--r-- | sql/ha_berkeley.h | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 27 |
14 files changed, 257 insertions, 31 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 485665e0c84..9e906c000f0 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46442,6 +46442,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.47:: Changes in release 3.23.47 * News-3.23.46:: Changes in release 3.23.46 * News-3.23.45:: Changes in release 3.23.45 * News-3.23.44:: Changes in release 3.23.44 @@ -46492,10 +46493,22 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.46, News-3.23.45, News-3.23.x, News-3.23.x +@node News-3.23.47, News-3.23.46, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.47 +@itemize @bullet +@item +Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}. +@item +@code{mysqlconfig} now also work with binary (relocated) distributions. +@end itemize + +@node News-3.23.46, News-3.23.45, News-3.23.47, News-3.23.x @appendixsubsec Changes in release 3.23.46 @itemize @bullet @item +InnoDB and BDB tables will now use index when doing an @code{ORDER BY} +on the whole table. +@item Fixed bug where one got an empty set instead of a DEADLOCK error when using BDB tables. @item diff --git a/build-tags b/build-tags new file mode 100755 index 00000000000..90b957eb3bc --- /dev/null +++ b/build-tags @@ -0,0 +1,11 @@ +#! /bin/sh + +if [ ! -f configure.in ] ; then + echo "$0 must be run from MySQL source root" + exit 1 +fi + +rm -f TAGS +find -not -path \*SCCS\* -and \ + \( -name \*.cc -or -name \*.h -or -name \*.yy -or -name \*.c \) \ + -print -exec etags -o TAGS --append {} \; diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index 49f6dc59503..52bee0eb282 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -211,6 +211,9 @@ buf_block_align( block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero) >> UNIV_PAGE_SIZE_SHIFT); + ut_a(block >= buf_pool->blocks); + ut_a(block < buf_pool->blocks + buf_pool->max_size); + return(block); } @@ -235,6 +238,9 @@ buf_block_align_low( block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero) >> UNIV_PAGE_SIZE_SHIFT); + ut_a(block >= buf_pool->blocks); + ut_a(block < buf_pool->blocks + buf_pool->max_size); + return(block); } @@ -253,9 +259,9 @@ buf_frame_align( frame = ut_align_down(ptr, UNIV_PAGE_SIZE); - ut_ad((ulint)frame + ut_a((ulint)frame >= (ulint)(buf_pool_get_nth_block(buf_pool, 0)->frame)); - ut_ad((ulint)frame <= (ulint)(buf_pool_get_nth_block(buf_pool, + ut_a((ulint)frame <= (ulint)(buf_pool_get_nth_block(buf_pool, buf_pool->max_size - 1)->frame)); return(frame); } diff --git a/innobase/include/mtr0log.ic b/innobase/include/mtr0log.ic index c2150660794..0598f1a9536 100644 --- a/innobase/include/mtr0log.ic +++ b/innobase/include/mtr0log.ic @@ -163,6 +163,13 @@ mlog_write_initial_log_record_fast( space = buf_block_get_space(block); offset = buf_block_get_page_no(block); + if (space != 0 || offset > 0x8FFFFFFF) { + fprintf(stderr, + "InnoDB: error: buffer page pointer %lx has nonsensical space id %lu\n" + "InnoDB: or page no %lu\n", (ulint)ptr, space, offset); + ut_a(0); + } + mach_write_to_1(log_ptr, type); log_ptr++; log_ptr += mach_write_compressed(log_ptr, space); diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 999429cbfcd..1734cfadfff 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -1316,7 +1316,9 @@ recv_parse_log_rec( new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, page_no); - if (!new_ptr) { + /* Check that space id and page_no are sensible */ + + if (!new_ptr || *space != 0 || *page_no > 0x8FFFFFFF) { return(0); } diff --git a/mysql-test/r/gcc296.result b/mysql-test/r/gcc296.result new file mode 100644 index 00000000000..7184bfb9cdc --- /dev/null +++ b/mysql-test/r/gcc296.result @@ -0,0 +1,5 @@ +kodoboru obor aobor +0101000000 aaa AAA +0102000000 bbb BBB +0103000000 ccc CCC +0104000000 xxx XXX diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test new file mode 100644 index 00000000000..7c72b57ca54 --- /dev/null +++ b/mysql-test/t/gcc296.test @@ -0,0 +1,17 @@ +#try to crash gcc 2.96 +drop table if exists obory; +CREATE TABLE obory ( + kodoboru varchar(10) default NULL, + obor tinytext, + aobor tinytext, + UNIQUE INDEX kodoboru (kodoboru), + FULLTEXT KEY obor (obor), + FULLTEXT KEY aobor (aobor) +); +INSERT INTO obory VALUES ('0101000000','aaa','AAA'); +INSERT INTO obory VALUES ('0102000000','bbb','BBB'); +INSERT INTO obory VALUES ('0103000000','ccc','CCC'); +INSERT INTO obory VALUES ('0104000000','xxx','XXX'); + +select * from obory; +drop table obory; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 6bac7bb8059..4d0930c50c6 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -547,3 +547,19 @@ delete from t1; select * from t1; commit; drop table t1; + +# +# Test of how ORDER BY works when doing it on the whole table +# + +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb; +insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); +explain select * from t1 order by a; +explain select * from t1 order by b; +explain select * from t1 order by c; +explain select a from t1 order by a; +explain select b from t1 order by b; +explain select a,b from t1 order by b; +explain select a,b from t1; +explain select a,b,c from t1; +drop table t1; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 774f35ae38e..af5f377afb5 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -404,3 +404,15 @@ insert into t2 values (1,1),(1,2); insert into t1 values (1,1),(2,1); SELECT * FROM t1 LEFT JOIN t2 ON (t1.bug_id = t2.bug_id AND t2.who = 2) WHERE (t1.reporter = 2 OR t2.who = 2); drop table t1,t2; + +# +# Test problem with LEFT JOIN + +create table t1 (fooID smallint unsigned auto_increment, primary key (fooID)); +create table t2 (fooID smallint unsigned not null, barID smallint unsigned not null, primary key (fooID,barID)); +insert into t1 (fooID) values (10),(20),(30); +insert into t2 values (10,1),(20,2),(30,3); +explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; +select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; +select * from t2 left join t1 ignore index(primary) on t1.fooID = t2.fooID and t1.fooID = 30; +drop table t1,t2; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 93462534b43..861bc807323 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -50,3 +50,19 @@ show index from t1; optimize table t1; show index from t1; drop table t1; + +# +# Test of how ORDER BY works when doing it on the whole table +# + +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam; +insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); +explain select * from t1 order by a; +explain select * from t1 order by b; +explain select * from t1 order by c; +explain select a from t1 order by a; +explain select b from t1 order by b; +explain select a,b from t1 order by b; +explain select a,b from t1; +explain select a,b,c from t1; +drop table t1; diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index b2a09173760..31e3ed42e0a 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -18,11 +18,62 @@ # This script reports various configuration settings that may be needed # when using the MySQL client library. +which () +{ + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + for file + do + for dir in $PATH + do + if test -f $dir/$file + then + echo "$dir/$file" + continue 2 + fi + done + echo "which: no $file in ($PATH)" + exit 1 + done + IFS="$save_ifs" +} + +# +# If we can find the given directory relatively to where mysql_config is +# we should use this instead of the incompiled one. +# This is to ensure that this script also works with the binary MySQL +# version + +fix_path () +{ + var=$1 + shift + for filename + do + path=$basedir/$filename + if [ -d "$path" ] ; + then + eval "$var"=$path + return + fi + done +} + +abs_path=`expr \( substr $0 1 1 \) = '/'` +if [ "x$abs_path" = "x1" ] ; then + me=$0 +else + me=`which $0` +fi + +basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` + ldata='@localstatedir@' execdir='@libexecdir@' bindir='@bindir@' pkglibdir='@pkglibdir@' +fix_path pkglibdir lib/mysql lib pkgincludedir='@pkgincludedir@' +fix_path pkgincludedir include/mysql include version='@VERSION@' socket='@MYSQL_UNIX_ADDR@' port='@MYSQL_TCP_PORT@' diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 655e5a2a52b..caf2615fe7a 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.13"; +my $VERSION = "1.14"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -120,6 +120,7 @@ GetOptions( \%opt, # 'target' - destination directory of the copy # 'tables' - array-ref to list of tables in the db # 'files' - array-ref to list of files to be copied +# (RAID files look like 'nn/name.MYD') # 'index' - array-ref to list of indexes to be copied # @@ -265,11 +266,23 @@ foreach my $rdb ( @db_desc ) { or die "Cannot open dir '$db_dir': $!"; my %db_files; - map { ( /(.+)\.\w+$/ ? ( $db_files{$_} = $1 ) : () ) } readdir(DBDIR); + my @raid_dir = (); + + while ( defined( my $name = readdir DBDIR ) ) { + if ( $name =~ /^\d\d$/ && -d "$db_dir/$name" ) { + push @raid_dir, $name; + } + else { + $db_files{$name} = $1 if ( $name =~ /(.+)\.\w+$/ ); + } + } + closedir( DBDIR ); + + scan_raid_dir( \%db_files, $db_dir, @raid_dir ); + unless( keys %db_files ) { warn "'$db' is an empty database\n"; } - closedir( DBDIR ); ## filter (out) files specified in t_regex my @db_files; @@ -297,6 +310,8 @@ foreach my $rdb ( @db_desc ) { my @hc_tables = map { "$db.$_" } @dbh_tables; $rdb->{tables} = [ @hc_tables ]; + $rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ]; + $hc_locks .= ", " if ( length $hc_locks && @hc_tables ); $hc_locks .= join ", ", map { "$_ READ" } @hc_tables; $hc_tables .= ", " if ( length $hc_tables && @hc_tables ); @@ -370,17 +385,20 @@ if ($opt{method} =~ /^cp\b/) retire_directory( @existing ) if ( @existing ); foreach my $rdb ( @db_desc ) { - my $tgt_dirpath = $rdb->{target}; - if ( $opt{dryrun} ) { - print "mkdir $tgt_dirpath, 0750\n"; - } - elsif ($opt{method} =~ /^scp\b/) { - ## assume it's there? - ## ... - } - else { - mkdir($tgt_dirpath, 0750) - or die "Can't create '$tgt_dirpath': $!\n"; + foreach my $td ( '', @{$rdb->{raid_dirs}} ) { + + my $tgt_dirpath = "$rdb->{target}/$td"; + if ( $opt{dryrun} ) { + print "mkdir $tgt_dirpath, 0750\n"; + } + elsif ($opt{method} =~ /^scp\b/) { + ## assume it's there? + ## ... + } + else { + mkdir($tgt_dirpath, 0750) + or die "Can't create '$tgt_dirpath': $!\n"; + } } } @@ -438,7 +456,7 @@ foreach my $rdb ( @db_desc ) my @files = map { "$datadir/$rdb->{src}/$_" } @{$rdb->{files}}; next unless @files; - eval { copy_files($opt{method}, \@files, $rdb->{target} ); }; + eval { copy_files($opt{method}, \@files, $rdb->{target}, $rdb->{raid_dirs} ); }; push @failed, "$rdb->{src} -> $rdb->{target} failed: $@" if ( $@ ); @@ -531,27 +549,33 @@ exit 0; # --- sub copy_files { - my ($method, $files, $target) = @_; + my ($method, $files, $target, $raid_dirs) = @_; my @cmd; print "Copying ".@$files." files...\n" unless $opt{quiet}; if ($method =~ /^s?cp\b/) { # cp or scp with optional flags - @cmd = ($method); + my @cp = ($method); # add option to preserve mod time etc of copied files # not critical, but nice to have - push @cmd, "-p" if $^O =~ m/^(solaris|linux|freebsd)$/; + push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd)$/; # add recursive option for scp - push @cmd, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; + push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; + + my @non_raid = grep { $_ !~ m:\d\d/: } @$files; # add files to copy and the destination directory - push @cmd, @$files, $target; + safe_system( @cp, @non_raid, $target ); + + foreach my $rd ( @$raid_dirs ) { + my @raid = grep { m:$rd/: } @$files; + safe_system( @cp, @raid, "$target/$rd" ) if ( @raid ); + } } else { die "Can't use unsupported method '$method'\n"; } - safe_system (@cmd); } # @@ -682,6 +706,35 @@ sub get_row { return $sth->fetchrow_array(); } +sub scan_raid_dir { + my ( $r_db_files, $data_dir, @raid_dir ) = @_; + + local(*RAID_DIR); + + foreach my $rd ( @raid_dir ) { + + opendir(RAID_DIR, "$data_dir/$rd" ) + or die "Cannot open dir '$data_dir/$rd': $!"; + + while ( defined( my $name = readdir RAID_DIR ) ) { + $r_db_files->{"$rd/$name"} = $1 if ( $name =~ /(.+)\.\w+$/ ); + } + closedir( RAID_DIR ); + } +} + +sub get_raid_dirs { + my ( $r_files ) = @_; + + my %dirs = (); + foreach my $f ( @$r_files ) { + if ( $f =~ m:^(\d\d)/: ) { + $dirs{$1} = 1; + } + } + return sort keys %dirs; +} + __END__ =head1 DESCRIPTION @@ -905,6 +958,7 @@ Tim Bunce Martin Waite - added checkpoint, flushlog, regexp and dryrun options Fixed cleanup of targets when hotcopy fails. Added --record_log_pos. + RAID tables are now copied (don't know if this works over scp). Ralph Corderoy - added synonyms for commands diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 561e06229fa..ab1ead5a3e9 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -107,6 +107,7 @@ class ha_berkeley: public handler uint extra_rec_buf_length() { return BDB_HIDDEN_PRIMARY_KEY_LENGTH; } ha_rows estimate_number_of_rows(); bool fast_key_read() { return 1;} + key_map keys_to_use_for_scanning() { return ~(key_map) 0; } bool has_transactions() { return 1;} int open(const char *name, int mode, uint test_if_locked); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5789e537a6a..cfc40bdfdc3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2191,10 +2191,17 @@ get_best_combination(JOIN *join) j->type=JT_REF; /* Must read with repeat */ else if (ref_key == j->ref.key_copy) { /* Should never be reached */ - j->type=JT_CONST; /* purecov: deadcode */ + /* + This happen if we are using a constant expression in the ON part + of an LEFT JOIN. + SELECT * FROM a LEFT JOIN b ON b.key=30 + Here we should not mark the table as a 'const' as a field may + have a 'normal' value or a NULL value. + */ + j->type=JT_CONST; if (join->const_tables == tablenr) { - join->const_tables++; /* purecov: deadcode */ + join->const_tables++; join->const_table_map|=form->map; } } @@ -2777,8 +2784,8 @@ static void update_depend_map(JOIN *join, ORDER *order) /* -** simple_order is set to 1 if sort_order only uses fields from head table -** and the head table is not a LEFT JOIN table + simple_order is set to 1 if sort_order only uses fields from head table + and the head table is not a LEFT JOIN table */ static ORDER * @@ -4424,8 +4431,11 @@ join_read_const(JOIN_TAB *tab) } store_record(table,1); } - else if (!table->status) // Only happens with left join + else if (!(table->status & ~STATUS_NULL_ROW)) // Only happens with left join + { + table->status=0; restore_record(table,1); // restore old record + } table->null_row=0; return table->status ? -1 : 0; } @@ -5263,7 +5273,7 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) /***************************************************************************** -** If not selecting by given key, create a index how records should be read +** If not selecting by given key, create an index how records should be read ** return: 0 ok ** -1 some fatal error ** 1 no records @@ -5367,6 +5377,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, join_init_read_last_with_key); table->file->index_init(nr); tab->type=JT_NEXT; // Read with index_first(), index_next() + if (table->used_keys & ((key_map) 1 << nr)) + { + table->key_read=1; + table->file->extra(HA_EXTRA_KEYREAD); + } } DBUG_RETURN(1); } |