Commit b5cfb7ac authored by unknown's avatar unknown

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
parents ff8c7348 6f8f45e9
...@@ -46442,6 +46442,7 @@ users use this code as the rest of the code and because of this we are ...@@ -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. not yet 100% confident in this code.
@menu @menu
* News-3.23.47:: Changes in release 3.23.47
* News-3.23.46:: Changes in release 3.23.46 * News-3.23.46:: Changes in release 3.23.46
* News-3.23.45:: Changes in release 3.23.45 * News-3.23.45:: Changes in release 3.23.45
* News-3.23.44:: Changes in release 3.23.44 * News-3.23.44:: Changes in release 3.23.44
...@@ -46492,10 +46493,22 @@ not yet 100% confident in this code. ...@@ -46492,10 +46493,22 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @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 @appendixsubsec Changes in release 3.23.46
@itemize @bullet @itemize @bullet
@item @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 Fixed bug where one got an empty set instead of a DEADLOCK error when using
BDB tables. BDB tables.
@item @item
#! /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 {} \;
...@@ -211,6 +211,9 @@ buf_block_align( ...@@ -211,6 +211,9 @@ buf_block_align(
block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero) block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero)
>> UNIV_PAGE_SIZE_SHIFT); >> UNIV_PAGE_SIZE_SHIFT);
ut_a(block >= buf_pool->blocks);
ut_a(block < buf_pool->blocks + buf_pool->max_size);
return(block); return(block);
} }
...@@ -235,6 +238,9 @@ buf_block_align_low( ...@@ -235,6 +238,9 @@ buf_block_align_low(
block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero) block = buf_pool_get_nth_block(buf_pool, (ptr - frame_zero)
>> UNIV_PAGE_SIZE_SHIFT); >> UNIV_PAGE_SIZE_SHIFT);
ut_a(block >= buf_pool->blocks);
ut_a(block < buf_pool->blocks + buf_pool->max_size);
return(block); return(block);
} }
...@@ -253,9 +259,9 @@ buf_frame_align( ...@@ -253,9 +259,9 @@ buf_frame_align(
frame = ut_align_down(ptr, UNIV_PAGE_SIZE); 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)); >= (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)); buf_pool->max_size - 1)->frame));
return(frame); return(frame);
} }
......
...@@ -163,6 +163,13 @@ mlog_write_initial_log_record_fast( ...@@ -163,6 +163,13 @@ mlog_write_initial_log_record_fast(
space = buf_block_get_space(block); space = buf_block_get_space(block);
offset = buf_block_get_page_no(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); mach_write_to_1(log_ptr, type);
log_ptr++; log_ptr++;
log_ptr += mach_write_compressed(log_ptr, space); log_ptr += mach_write_compressed(log_ptr, space);
......
...@@ -1316,7 +1316,9 @@ recv_parse_log_rec( ...@@ -1316,7 +1316,9 @@ recv_parse_log_rec(
new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
page_no); page_no);
if (!new_ptr) { /* Check that space id and page_no are sensible */
if (!new_ptr || *space != 0 || *page_no > 0x8FFFFFFF) {
return(0); return(0);
} }
......
kodoboru obor aobor
0101000000 aaa AAA
0102000000 bbb BBB
0103000000 ccc CCC
0104000000 xxx XXX
#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;
...@@ -547,3 +547,19 @@ delete from t1; ...@@ -547,3 +547,19 @@ delete from t1;
select * from t1; select * from t1;
commit; commit;
drop table 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=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;
...@@ -404,3 +404,15 @@ insert into t2 values (1,1),(1,2); ...@@ -404,3 +404,15 @@ insert into t2 values (1,1),(1,2);
insert into t1 values (1,1),(2,1); 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); 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; 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;
...@@ -50,3 +50,19 @@ show index from t1; ...@@ -50,3 +50,19 @@ show index from t1;
optimize table t1; optimize table t1;
show index from t1; show index from t1;
drop table 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;
...@@ -18,11 +18,62 @@ ...@@ -18,11 +18,62 @@
# This script reports various configuration settings that may be needed # This script reports various configuration settings that may be needed
# when using the MySQL client library. # 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@' ldata='@localstatedir@'
execdir='@libexecdir@' execdir='@libexecdir@'
bindir='@bindir@' bindir='@bindir@'
pkglibdir='@pkglibdir@' pkglibdir='@pkglibdir@'
fix_path pkglibdir lib/mysql lib
pkgincludedir='@pkgincludedir@' pkgincludedir='@pkgincludedir@'
fix_path pkgincludedir include/mysql include
version='@VERSION@' version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@' socket='@MYSQL_UNIX_ADDR@'
port='@MYSQL_TCP_PORT@' port='@MYSQL_TCP_PORT@'
......
...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. ...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file # Documentation continued at end of file
my $VERSION = "1.13"; my $VERSION = "1.14";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
...@@ -120,6 +120,7 @@ GetOptions( \%opt, ...@@ -120,6 +120,7 @@ GetOptions( \%opt,
# 'target' - destination directory of the copy # 'target' - destination directory of the copy
# 'tables' - array-ref to list of tables in the db # 'tables' - array-ref to list of tables in the db
# 'files' - array-ref to list of files to be copied # '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 # 'index' - array-ref to list of indexes to be copied
# #
...@@ -265,11 +266,23 @@ foreach my $rdb ( @db_desc ) { ...@@ -265,11 +266,23 @@ foreach my $rdb ( @db_desc ) {
or die "Cannot open dir '$db_dir': $!"; or die "Cannot open dir '$db_dir': $!";
my %db_files; 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 ) { unless( keys %db_files ) {
warn "'$db' is an empty database\n"; warn "'$db' is an empty database\n";
} }
closedir( DBDIR );
## filter (out) files specified in t_regex ## filter (out) files specified in t_regex
my @db_files; my @db_files;
...@@ -297,6 +310,8 @@ foreach my $rdb ( @db_desc ) { ...@@ -297,6 +310,8 @@ foreach my $rdb ( @db_desc ) {
my @hc_tables = map { "$db.$_" } @dbh_tables; my @hc_tables = map { "$db.$_" } @dbh_tables;
$rdb->{tables} = [ @hc_tables ]; $rdb->{tables} = [ @hc_tables ];
$rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ];
$hc_locks .= ", " if ( length $hc_locks && @hc_tables ); $hc_locks .= ", " if ( length $hc_locks && @hc_tables );
$hc_locks .= join ", ", map { "$_ READ" } @hc_tables; $hc_locks .= join ", ", map { "$_ READ" } @hc_tables;
$hc_tables .= ", " if ( length $hc_tables && @hc_tables ); $hc_tables .= ", " if ( length $hc_tables && @hc_tables );
...@@ -370,17 +385,20 @@ if ($opt{method} =~ /^cp\b/) ...@@ -370,17 +385,20 @@ if ($opt{method} =~ /^cp\b/)
retire_directory( @existing ) if ( @existing ); retire_directory( @existing ) if ( @existing );
foreach my $rdb ( @db_desc ) { foreach my $rdb ( @db_desc ) {
my $tgt_dirpath = $rdb->{target}; foreach my $td ( '', @{$rdb->{raid_dirs}} ) {
if ( $opt{dryrun} ) {
print "mkdir $tgt_dirpath, 0750\n"; my $tgt_dirpath = "$rdb->{target}/$td";
} if ( $opt{dryrun} ) {
elsif ($opt{method} =~ /^scp\b/) { print "mkdir $tgt_dirpath, 0750\n";
## assume it's there? }
## ... elsif ($opt{method} =~ /^scp\b/) {
} ## assume it's there?
else { ## ...
mkdir($tgt_dirpath, 0750) }
or die "Can't create '$tgt_dirpath': $!\n"; else {
mkdir($tgt_dirpath, 0750)
or die "Can't create '$tgt_dirpath': $!\n";
}
} }
} }
...@@ -438,7 +456,7 @@ foreach my $rdb ( @db_desc ) ...@@ -438,7 +456,7 @@ foreach my $rdb ( @db_desc )
my @files = map { "$datadir/$rdb->{src}/$_" } @{$rdb->{files}}; my @files = map { "$datadir/$rdb->{src}/$_" } @{$rdb->{files}};
next unless @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: $@" push @failed, "$rdb->{src} -> $rdb->{target} failed: $@"
if ( $@ ); if ( $@ );
...@@ -531,27 +549,33 @@ exit 0; ...@@ -531,27 +549,33 @@ exit 0;
# --- # ---
sub copy_files { sub copy_files {
my ($method, $files, $target) = @_; my ($method, $files, $target, $raid_dirs) = @_;
my @cmd; my @cmd;
print "Copying ".@$files." files...\n" unless $opt{quiet}; print "Copying ".@$files." files...\n" unless $opt{quiet};
if ($method =~ /^s?cp\b/) { # cp or scp with optional flags 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 # add option to preserve mod time etc of copied files
# not critical, but nice to have # 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 # 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 # 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 else
{ {
die "Can't use unsupported method '$method'\n"; die "Can't use unsupported method '$method'\n";
} }
safe_system (@cmd);
} }
# #
...@@ -682,6 +706,35 @@ sub get_row { ...@@ -682,6 +706,35 @@ sub get_row {
return $sth->fetchrow_array(); 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__ __END__
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -905,6 +958,7 @@ Tim Bunce ...@@ -905,6 +958,7 @@ Tim Bunce
Martin Waite - added checkpoint, flushlog, regexp and dryrun options Martin Waite - added checkpoint, flushlog, regexp and dryrun options
Fixed cleanup of targets when hotcopy fails. Fixed cleanup of targets when hotcopy fails.
Added --record_log_pos. Added --record_log_pos.
RAID tables are now copied (don't know if this works over scp).
Ralph Corderoy - added synonyms for commands Ralph Corderoy - added synonyms for commands
......
...@@ -107,6 +107,7 @@ class ha_berkeley: public handler ...@@ -107,6 +107,7 @@ class ha_berkeley: public handler
uint extra_rec_buf_length() { return BDB_HIDDEN_PRIMARY_KEY_LENGTH; } uint extra_rec_buf_length() { return BDB_HIDDEN_PRIMARY_KEY_LENGTH; }
ha_rows estimate_number_of_rows(); ha_rows estimate_number_of_rows();
bool fast_key_read() { return 1;} bool fast_key_read() { return 1;}
key_map keys_to_use_for_scanning() { return ~(key_map) 0; }
bool has_transactions() { return 1;} bool has_transactions() { return 1;}
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
......
...@@ -2191,10 +2191,17 @@ get_best_combination(JOIN *join) ...@@ -2191,10 +2191,17 @@ get_best_combination(JOIN *join)
j->type=JT_REF; /* Must read with repeat */ j->type=JT_REF; /* Must read with repeat */
else if (ref_key == j->ref.key_copy) else if (ref_key == j->ref.key_copy)
{ /* Should never be reached */ { /* 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) if (join->const_tables == tablenr)
{ {
join->const_tables++; /* purecov: deadcode */ join->const_tables++;
join->const_table_map|=form->map; join->const_table_map|=form->map;
} }
} }
...@@ -2777,8 +2784,8 @@ static void update_depend_map(JOIN *join, ORDER *order) ...@@ -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 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 and the head table is not a LEFT JOIN table
*/ */
static ORDER * static ORDER *
...@@ -4424,8 +4431,11 @@ join_read_const(JOIN_TAB *tab) ...@@ -4424,8 +4431,11 @@ join_read_const(JOIN_TAB *tab)
} }
store_record(table,1); 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 restore_record(table,1); // restore old record
}
table->null_row=0; table->null_row=0;
return table->status ? -1 : 0; return table->status ? -1 : 0;
} }
...@@ -5263,7 +5273,7 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) ...@@ -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 ** return: 0 ok
** -1 some fatal error ** -1 some fatal error
** 1 no records ** 1 no records
...@@ -5367,6 +5377,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, ...@@ -5367,6 +5377,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
join_init_read_last_with_key); join_init_read_last_with_key);
table->file->index_init(nr); table->file->index_init(nr);
tab->type=JT_NEXT; // Read with index_first(), index_next() 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); DBUG_RETURN(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment