Commit 74ea7333 authored by unknown's avatar unknown

Fixed bug in MAX() optimizing for BDB tables


Docs/manual.texi:
  Updated changelog
mysql-test/README:
  Added reference to manual
mysql-test/r/bdb.result:
  Added test for MAX() bug
mysql-test/r/innobase.result:
  Added test for MAX() bug
mysql-test/t/bdb.test:
  Added test for MAX() bug
mysql-test/t/innobase.test:
  Added test for MAX() bug
sql-bench/server-cfg.sh:
  Don't create big blobs with innobase
sql/ha_berkeley.cc:
  Fixed bug in MAX() optimizing
BitKeeper/etc/ignore:
  Added sql/.gdbinit to the ignore list
sql/ha_innobase.h:
  Fixed bug in MAX() optimizing
sql/handler.h:
  Fixed bug in MAX() optimizing
sql/opt_sum.cc:
  Fixed bug in MAX() optimizing
parent 7957ec7e
......@@ -197,3 +197,4 @@ bdb/build_win32/db.h
bdb/dist/configure
bdb/dist/tags
bdb/build_unix/*
sql/.gdbinit
......@@ -5679,7 +5679,7 @@ To install the HP-UX tar.gz distribution, you must have a copy of GNU
@cindex installing, source distribution
@cindex source distribtuion, installing
@cindex source distribution, installing
@cindex installation overview
@node Installing source, Installing source tree, Installing binary, Installing
@section Installing a MySQL Source Distribution
......@@ -40246,6 +40246,12 @@ If a test fails totally, you should check the logs file in the
@item
If you have compiled @strong{MySQL} with debugging you can try to debug this
with the @code{--gdb} and @code{--debug} options to @code{mysql-test-run}.
@xref{Making trace files}.
If you have not compiled @strong{MySQL} for debugging you should probably
do that. Just specify the @code{--with-debug} options to @code{configure}!
@xref{Installing source}.
@end itemize
@page
......@@ -42125,6 +42131,8 @@ Fixed bug in bi-directonal replication.
Fixed bug in @code{BDB} tables when using index on multi-part key where a
key part may be @code{NULL}.
@item
Fixed @code{MAX()} optimization on sub-key for @code{BDB} tables.
@item
Fixed problem with 'garbage results' when using @code{BDB} tables and
@code{BLOB} or @code{TEXT} fields when joining many tables.
@item
......@@ -47038,6 +47046,12 @@ in some cases the @code{PROCEDURE} will not transform the columns.
@item
Creation of a table of type @code{MERGE} doesn't check if the underlying
tables are of compatible types.
@item
@strong{MySQL} can't yet handle @code{NaN}, @code{-Inf} and @code{Inf}
values in double. Using these will cause problems when trying to export
and import data. We should as a intermediate solution change @code{NaN} to
@code{NULL} (if possible) and @code{-Inf} and @code{Inf} to the
Minimum respective maximum possible @code{double} value.
@end itemize
The following are known bugs in earlier versions of @strong{MySQL}:
......@@ -47669,7 +47683,7 @@ send mail to @email{mysql@@lists.mysql.com} and ask for help. Please use the
If you can cause the @code{mysqld} server to crash quickly, you can try to
create a trace file of this:
Start the @code{mysqld} server with a trace log in @file{/tmp/mysql.trace}.
Start the @code{mysqld} server with a trace log in @file{/tmp/mysqld.trace}.
The log file will get very @emph{BIG}.
@code{mysqld --debug --log}
......@@ -6,7 +6,10 @@ actually have a co-existing MySQL installation - the tests will not
conflict with it.
All tests must pass. If one or more of them fail on your system, please
report the details to bugs@lists.mysql.com
read the following manual section of how to report the problem:
http://www.mysql.com/doc/M/y/MySQL_test_suite.html
You can create your own test cases. To create a test case:
......
......@@ -490,3 +490,5 @@ a 2
a b
a 1
a 2
MIN(B) MAX(b)
1 1
......@@ -443,3 +443,5 @@ i j
1 2
i j
1 2
MIN(B) MAX(b)
1 1
......@@ -664,3 +664,17 @@ SELECT * FROM t1 WHERE a='a' AND b=2;
SELECT * FROM t1 WHERE a='a' AND b in (2);
SELECT * FROM t1 WHERE a='a' AND b in (1,2);
drop table t1;
#
# Test min-max optimization
#
CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
) TYPE = BDB;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
drop table t1;
......@@ -394,3 +394,17 @@ select * from t1 where i=1 and j=2;
create index ax1 on t1 (i,j);
select * from t1 where i=1 and j=2;
drop table t1;
#
# Test min-max optimization
#
CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
) TYPE = innobase;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
drop table t1;
......@@ -194,6 +194,11 @@ sub new
{
$limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's
}
if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=innobase/i)
{
$limits{'max_text_size'} = 8000; # Limit in Innobase
}
return $self;
}
......
......@@ -1429,7 +1429,12 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
pack_key(&last_key, active_index, key_buff, key, key_len);
/* Store for compare */
memcpy(key_buff2, key_buff, (key_len=last_key.size));
key_info->handler.bdb_return_if_eq= -1;
/*
If HA_READ_AFTER_KEY is set, return next key, else return first
matching key.
*/
key_info->handler.bdb_return_if_eq= (find_flag == HA_READ_AFTER_KEY ?
1 : -1);
error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
(char*) buf, active_index, &row, (DBT*) 0, 0);
key_info->handler.bdb_return_if_eq= 0;
......
......@@ -72,16 +72,18 @@ class ha_innobase: public handler
/* Init values for the class: */
public:
ha_innobase(TABLE *table): handler(table),
int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY |
HA_NOT_EXACT_COUNT |
HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE),
last_dup_key((uint) -1),
start_of_scan(0)
int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY |
HA_NOT_EXACT_COUNT |
HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_DROP_BEFORE_CREATE |
HA_NOT_READ_AFTER_KEY),
last_dup_key((uint) -1),
start_of_scan(0)
{
}
~ha_innobase() {}
......
......@@ -70,6 +70,7 @@
#define HA_NO_WRITE_DELAYED (HA_NOT_EXACT_COUNT*2)
#define HA_PRIMARY_KEY_IN_READ_INDEX (HA_NO_WRITE_DELAYED*2)
#define HA_DROP_BEFORE_CREATE (HA_PRIMARY_KEY_IN_READ_INDEX*2)
#define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2)
/* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */
......
......@@ -141,6 +141,11 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
break;
}
TABLE *table=((Item_field*) expr)->field->table;
if ((table->file->option_flag() & HA_NOT_READ_AFTER_KEY))
{
const_result=0;
break;
}
bool error=table->file->index_init((uint) ref.key);
if (!ref.key_length)
......
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